CbmRoot
Loading...
Searching...
No Matches
CbmMcbm2018UnpackerAlgoPsd.cxx
Go to the documentation of this file.
1/* Copyright (C) 2019-2021 GSI Helmholtzzentrum fuer Schwerionenforschung, Darmstadt
2 SPDX-License-Identifier: GPL-3.0-only
3 Authors: Nikolay Karpushkin, David Emschermann [committer], Pierre-Alain Loizeau */
4
5// -----------------------------------------------------------------------------
6// ----- -----
7// ----- CbmMcbm2018UnpackerAlgoPsd -----
8// ----- Created 09.10.2019 by N.Karpushkin -----
9// ----- based on CbmMcbm2018UnpackerAlgoTof by P.-A. Loizeau -----
10// ----- -----
11// -----------------------------------------------------------------------------
12
14
16#include "CbmMcbm2018PsdPar.h"
17#include "CbmPsdAddress.h"
18
19#include <Logger.h>
20
21#include "TCanvas.h"
22#include "TH1.h"
23#include "TH2.h"
24#include "TList.h"
25#include "TProfile.h"
26#include "TROOT.h"
27#include "TString.h"
28
29#include <fstream>
30#include <iomanip>
31#include <iostream>
32
33#include <stdint.h>
34
35// -------------------------------------------------------------------------
40
42{
43 if (nullptr != fPsdDigiVector) {
44 fPsdDigiVector->clear();
45 delete fPsdDigiVector;
46 }
47 if (nullptr != fPsdDspVector) {
48 fPsdDspVector->clear();
49 delete fPsdDspVector;
50 }
51}
52
53// -------------------------------------------------------------------------
55{
56 LOG(info) << "Initializing mCBM PSD 2019 unpacker algo";
57
58 return kTRUE;
59}
66
67// -------------------------------------------------------------------------
69{
70 LOG(info) << "Init parameter containers for CbmMcbm2018UnpackerAlgoPsd";
71 Bool_t initOK = ReInitContainers();
72
73 return initOK;
74}
76{
77 LOG(info) << "**********************************************";
78 LOG(info) << "ReInit parameter containers for CbmMcbm2018UnpackerAlgoPsd";
79
80 fUnpackPar = (CbmMcbm2018PsdPar*) fParCList->FindObject("CbmMcbm2018PsdPar");
81 if (nullptr == fUnpackPar) return kFALSE;
82
83 Bool_t initOK = InitParameters();
84
85 return initOK;
86}
88{
89 if (nullptr == fParCList) fParCList = new TList();
90 fUnpackPar = new CbmMcbm2018PsdPar("CbmMcbm2018PsdPar");
92
93 return fParCList;
94}
96{
98 LOG(info) << "Data Version: " << fuRawDataVersion;
99
101 LOG(info) << "Nr. of Tof GDPBs: " << fuNrOfGdpbs;
102
104 LOG(info) << "Nr. of FEEs per Psd GDPB: " << fuNrOfFeePerGdpb;
105
107 LOG(info) << "Nr. of channels per FEE: " << fuNrOfChannelsPerFee;
108
110 LOG(info) << "Nr. of channels per GDPB: " << fuNrOfChannelsPerGdpb;
111
112 fGdpbIdIndexMap.clear();
113 for (UInt_t i = 0; i < fuNrOfGdpbs; ++i) {
115 LOG(info) << "GDPB Id of PSD " << i << " : " << std::hex << fUnpackPar->GetGdpbId(i) << std::dec;
116 } // for( UInt_t i = 0; i < fuNrOfGdpbs; ++i )
117
119 LOG(info) << "Nr. of GBTx: " << fuNrOfGbtx;
120
121 //Temporary until creation of full psd map
122 UInt_t uNrOfModules = 1;
123 UInt_t uNrOfSections = 32;
124 UInt_t uNrOfChannels = uNrOfModules * uNrOfSections;
125 LOG(info) << "Nr. of possible Psd channels: " << uNrOfChannels;
126 fviPsdChUId.resize(uNrOfChannels);
127
128 UInt_t iCh = 0;
129 for (UInt_t iModule = 0; iModule < uNrOfModules; ++iModule) {
130 for (UInt_t iSection = 0; iSection < uNrOfSections; ++iSection) {
131 iCh = iModule * uNrOfSections + iSection;
132 fviPsdChUId[iCh] = CbmPsdAddress::GetAddress(iModule, iSection);
133 }
134 }
135
136 return kTRUE;
137}
138// -------------------------------------------------------------------------
139
140void CbmMcbm2018UnpackerAlgoPsd::AddMsComponentToList(size_t component, UShort_t usDetectorId)
141{
143 for (UInt_t uCompIdx = 0; uCompIdx < fvMsComponentsList.size(); ++uCompIdx)
144 if (component == fvMsComponentsList[uCompIdx]) return;
145
147 fvMsComponentsList.push_back(component);
148
149 LOG(info) << "CbmMcbm2018UnpackerAlgoPsd::AddMsComponentToList => Component " << component << " with detector ID 0x"
150 << std::hex << usDetectorId << std::dec << " added to list";
151}
152// -------------------------------------------------------------------------
153
154Bool_t CbmMcbm2018UnpackerAlgoPsd::ProcessTs(const fles::Timeslice& ts)
155{
156
157 fulCurrentTsIdx = ts.index();
158 fdTsStartTime = static_cast<Double_t>(ts.start_time());
159
161 if (0 == fulCurrentTsIdx) { return kTRUE; } // if( 0 == fulCurrentTsIdx )
162
164 if (-1.0 == fdTsCoreSizeInNs) {
165 fuNbCoreMsPerTs = ts.num_core_microslices();
166 fuNbOverMsPerTs = ts.num_microslices(0) - ts.num_core_microslices();
169 LOG(info) << "Timeslice parameters: each TS has " << fuNbCoreMsPerTs << " Core MS and " << fuNbOverMsPerTs
170 << " Overlap MS, for a core duration of " << fdTsCoreSizeInNs << " ns and a full duration of "
171 << fdTsFullSizeInNs << " ns";
172
176 LOG(info) << "In each TS " << fuNbMsLoop << " MS will be looped over";
177 } // if( -1.0 == fdTsCoreSizeInNs )
178
181 // LOG(info) << Form( "TS %5d Start %12f Stop %12f", fulCurrentTsIdx, fdTsStartTime, fdTsStopTimeCore );
182
183 fDigiVect.clear();
185 for (fuMsIndex = 0; fuMsIndex < fuNbMsLoop; fuMsIndex++) {
187 for (UInt_t uMsCompIdx = 0; uMsCompIdx < fvMsComponentsList.size(); ++uMsCompIdx) {
188 UInt_t uMsComp = fvMsComponentsList[uMsCompIdx];
189 if (kFALSE == ProcessMs(ts, uMsComp, fuMsIndex)) {
190 LOG(error) << "Failed to process ts " << fulCurrentTsIdx << " MS " << fuMsIndex << " for component " << uMsComp;
191 return kFALSE;
192 } // if( kFALSE == ProcessMs( ts, uMsCompIdx, fuMsIndex ) )
193 } // for( UInt_t uMsCompIdx = 0; uMsCompIdx < fvMsComponentsList.size(); ++uMsCompIdx )
194 } // for( fuMsIndex = 0; fuMsIndex < uNbMsLoop; fuMsIndex ++ )
195
197 //std::sort(fDigiVect.begin(), fDigiVect.end(),
198 // [](const CbmPsdDigi& a, const CbmPsdDigi& b) -> bool { return a.GetTime() < b.GetTime(); });
199
200 std::sort(fPsdDigiVector->begin(), fPsdDigiVector->end(),
201 [](const CbmPsdDigi& a, const CbmPsdDigi& b) -> bool { return a.GetTime() < b.GetTime(); });
202
203 if (fbDebugWriteOutput && (fPsdDspVector != nullptr)) {
204 std::sort(fPsdDspVector->begin(), fPsdDspVector->end(),
205 [](const CbmPsdDsp& a, const CbmPsdDsp& b) -> bool { return a.GetTime() < b.GetTime(); });
206 }
207
208 return kTRUE;
209}
210
211
212Bool_t CbmMcbm2018UnpackerAlgoPsd::ProcessMs(const fles::Timeslice& ts, size_t uMsCompIdx, size_t uMsIdx)
213{
214 auto msDescriptor = ts.descriptor(uMsCompIdx, uMsIdx);
215 fuCurrentEquipmentId = msDescriptor.eq_id;
216 const uint8_t* msContent = reinterpret_cast<const uint8_t*>(ts.content(uMsCompIdx, uMsIdx));
217
218 uint32_t uSize = msDescriptor.size;
219 fulCurrentMsIdx = msDescriptor.idx;
220
221 fdMsTime = static_cast<double>(fulCurrentMsIdx);
222
223 LOG(debug) << "Microslice: " << fulCurrentMsIdx << " from EqId " << std::hex << fuCurrentEquipmentId << std::dec
224 << " has size: " << uSize;
225
226 if (0 == fvbMaskedComponents.size()) fvbMaskedComponents.resize(ts.num_components(), kFALSE);
227
228 fuCurrDpbId = static_cast<uint32_t>(fuCurrentEquipmentId & 0xFFFF);
229
231 auto it = fGdpbIdIndexMap.find(fuCurrDpbId);
232 if (it == fGdpbIdIndexMap.end()) {
233 if (kFALSE == fvbMaskedComponents[uMsCompIdx]) {
234 LOG(info) << "---------------------------------------------------------------";
235
236 LOG(info) << FormatMsHeaderPrintout(msDescriptor);
237 LOG(warning) << "Could not find the gDPB index for AFCK id 0x" << std::hex << fuCurrDpbId << std::dec
238 << " in timeslice " << fulCurrentTsIdx << " in microslice " << uMsIdx << " component " << uMsCompIdx
239 << "\n"
240 << "If valid this index has to be added in the PSD "
241 "parameter file in the DbpIdArray field";
242 fvbMaskedComponents[uMsCompIdx] = kTRUE;
243 } // if( kFALSE == fvbMaskedComponents[ uMsComp ] )
244 else
245 return kTRUE;
246
249
250
251 return kFALSE;
252
253 } // if( it == fGdpbIdIndexMap.end() )
254 else
256
257 fuCurrentMsSysId = static_cast<unsigned int>(msDescriptor.sys_id);
258
259 // If not integer number of message in input buffer, print warning/error
260 if (0 != (uSize % kuBytesPerMessage))
261 LOG(error) << "The input microslice buffer does NOT "
262 << "contain only complete nDPB messages!";
263
266 Double_t dMsRelativeTime = fdMsTime - fdTsStartTime;
267
268 // If MS time is less than start time print error and return
269 if (fdMsTime - fdStartTime < 0) {
270 LOG(error) << "CbmMcbm2018UnpackerAlgoPsd:: Negative time! MS time = " << fdMsTime
271 << "; Start time = " << fdStartTime;
272 //return kFALSE;
273 }
274
275 // Compute the number of complete messages in the input microslice buffer
276 uint32_t uNbMessages = (uSize - (uSize % kuBytesPerMessage)) / kuBytesPerMessage;
277
278 // Prepare variables for the loop on contents
279 const uint64_t* pInBuff = reinterpret_cast<const uint64_t*>(msContent);
280
281 /*
282 if (uSize != 0) {
283 printf("%u = %u 64bit messages\n", uSize, uNbMessages);
284 for(uint32_t line_iter = 0; line_iter<uNbMessages; line_iter++){
285 printf("%016lx\n", (pInBuff[line_iter]));
286 }
287 }
288*/
289
290 if ((fair::Logger::Logging(fair::Severity::debug)) && (uNbMessages > 1)) {
291 printf("%u = %u 64bit messages\n", uSize, uNbMessages);
292 for (uint32_t line_iter = 0; line_iter < uNbMessages - 2; line_iter += 2) {
293 printf("%010llx", static_cast<unsigned long long int>(pInBuff[line_iter] & 0xffffffffff));
294 printf("%010llx", static_cast<unsigned long long int>(pInBuff[line_iter + 1] & 0xffffffffff));
295 printf(" %u - %u", line_iter + 1, line_iter + 2);
296 printf("\n");
297 }
298 printf("%020llx %u\n", static_cast<unsigned long long int>(pInBuff[uNbMessages - 1]), uNbMessages);
299 }
300
301 // every 80bit gbt word is decomposed into two 64bit words
302 if (uNbMessages > 1) { //more than one 64 bit word
303
304 switch (fuRawDataVersion) {
305 // --------------------------------------------------------------------------------------------------
306 case 100: {
307
308 PsdDataV100::PsdGbtReader PsdReader(pInBuff);
309 if (fair::Logger::Logging(fair::Severity::debug)) PsdReader.SetPrintOutMode(true);
310
311 while (PsdReader.GetTotalGbtWordsRead() < uNbMessages) {
312 int ReadResult = PsdReader.ReadMs();
313 if (fair::Logger::Logging(fair::Severity::debug)) {
314 printf("\nMicroslice idx: %llu\n", fulCurrentMsIdx);
315 PsdReader.PrintOut(); /*PsdReader.PrintSaveBuff();*/
316 }
317 if (ReadResult == 0) {
318
319 double prev_hit_time =
320 dMsRelativeTime + (double) PsdReader.VectPackHdr.at(0).uAdcTime * 12.5 - fdTimeOffsetNs; //in ns
321
322 //hit loop
323 for (uint64_t hit_iter = 0; hit_iter < PsdReader.VectHitHdr.size(); hit_iter++) {
324 if (PsdReader.VectPackHdr.size() != PsdReader.VectHitHdr.size()) {
325 LOG(error) << "Different vector headers sizes!"
326 << " in VectPackHdr " << PsdReader.VectPackHdr.size() << " in VectHitHdr "
327 << PsdReader.VectHitHdr.size() << "\n";
328 break;
329 }
330
331 uint8_t uHitChannel = PsdReader.VectHitHdr.at(hit_iter).uHitChannel;
332 //uint8_t uLinkIndex = PsdReader.VectPackHdr.at(hit_iter).uLinkIndex;
333 if (uHitChannel >= fviPsdChUId.size()) {
334 LOG(error) << "hit channel number out of range! channel index: " << uHitChannel
335 << " max: " << fviPsdChUId.size();
336 break;
337 }
338 UInt_t uChanUId = fviPsdChUId[uHitChannel]; //unique ID
339
340 UInt_t fuAddress = uChanUId;
341 Double_t fdTime = dMsRelativeTime + (double) PsdReader.VectPackHdr.at(hit_iter).uAdcTime * 12.5
343 Double_t fdTsTime =
345 Double_t fdEdep = (double) PsdReader.VectHitHdr.at(hit_iter).uSignalCharge
346 / fUnpackPar->GetMipCalibration(uHitChannel);
347 UInt_t fuZL = PsdReader.VectHitHdr.at(hit_iter).uZeroLevel;
348 Double_t fdAccum = (double) PsdReader.VectHitHdr.at(hit_iter).uFeeAccum;
349 Double_t fdAdcTime = (double) PsdReader.VectPackHdr.at(hit_iter).uAdcTime;
350
351 Double_t fdEdepWfm = 0.;
352 Double_t fdAmpl = 0.;
353 UInt_t fuMinimum = 0;
354 UInt_t fuTimeMax = 0;
355 std::vector<uint16_t> fuWfm = PsdReader.VectHitData.at(hit_iter).uWfm;
356
357 Double_t fdFitAmpl = 0.;
358 Double_t fdFitZL = 0.;
359 Double_t fdFitEdep = 0.;
360 Double_t fdFitR2 = 999.;
361 Double_t fdFitTimeMax = -1.;
362 std::vector<uint16_t> fuFitWfm;
363
364 if (!fuWfm.empty()) {
365
366 int32_t iHitChargeWfm = std::accumulate(fuWfm.begin(), fuWfm.end(), -fuZL * fuWfm.size());
367 auto const max_iter = std::max_element(fuWfm.begin(), fuWfm.end());
368 assert(max_iter != fuWfm.end());
369 if (max_iter == fuWfm.end()) break;
370 uint8_t uHitTimeMax = std::distance(fuWfm.begin(), max_iter);
371 int32_t iHitAmlpitude = *max_iter - fuZL;
372 auto const min_iter = std::min_element(fuWfm.begin(), fuWfm.end());
373 uint32_t uHitMinimum = *min_iter;
374
375 fdEdepWfm = (double) iHitChargeWfm / fUnpackPar->GetMipCalibration(uHitChannel); // ->now in MeV
376 fdAmpl = (double) iHitAmlpitude / 16.5; // -> now in mV
377 fuTimeMax = uHitTimeMax;
378 fuMinimum = uHitMinimum;
379
380 int gate_beg = 0;
381 int gate_end = (int) fuWfm.size() - 1;
382 PsdSignalFitting::PronyFitter Pfitter(2, 2, gate_beg, gate_end);
383 Pfitter.SetDebugMode(0);
384 //std::vector<int> iWfm(fuWfm.begin(), fuWfm.end());
385 Pfitter.SetWaveform(fuWfm, fuZL);
386 int SignalBeg = 4;
387 //0.6, 0.2 // 0.72 0.38
388 std::complex<float> first_fit_harmonic = {0.72, 0.0};
389 std::complex<float> second_fit_harmonic = {0.38, -0.0};
390 Pfitter.SetExternalHarmonics(first_fit_harmonic, second_fit_harmonic);
391 Int_t best_signal_begin = Pfitter.ChooseBestSignalBegin(SignalBeg - 1, SignalBeg + 1);
392 Pfitter.SetSignalBegin(best_signal_begin);
393 Pfitter.CalculateFitAmplitudes();
394
395 fdFitEdep =
396 Pfitter.GetIntegral(gate_beg, gate_end) / fUnpackPar->GetMipCalibration(uHitChannel); // ->now in MeV
397 fdFitAmpl = (Pfitter.GetMaxAmplitude() - Pfitter.GetZeroLevel()) / 16.5; // ->now in mV
398 fdFitR2 = Pfitter.GetRSquare(gate_beg, gate_end);
399 fdFitZL = Pfitter.GetZeroLevel();
400 fdFitTimeMax = Pfitter.GetSignalMaxTime();
401 fuFitWfm = Pfitter.GetFitWfm();
402 }
403
404 CbmPsdDsp dsp = CbmPsdDsp(fuAddress, fdTime, fdTsTime, fdEdep, fuZL, fdAccum, fdAdcTime,
405
406 fdEdepWfm, fdAmpl, fuMinimum, fuTimeMax, fuWfm,
407
408 fdFitAmpl, fdFitZL, fdFitEdep, fdFitR2, fdFitTimeMax, fuFitWfm);
409
410 std::unique_ptr<CbmPsdDigi> digi = MakeDigi(dsp);
411 if (digi) fPsdDigiVector->emplace_back(*digi);
412
413 if (fbDebugWriteOutput && (fPsdDspVector != nullptr)) { fPsdDspVector->emplace_back(dsp); }
414
415 //DEBUG
416 if (fdTime < prev_hit_time) printf("negative time btw hits! %f after %f \n", fdTime, prev_hit_time);
417 //DEBUG END
418 prev_hit_time = fdTime;
419 //DEBUG
420
421 } // for (uint64_t hit_iter = 0; hit_iter < PsdReader.VectHitHdr.size(); hit_iter++) {
422 }
423 else if (ReadResult == 1) {
424 LOG(error) << "no pack headers in message!";
425 break;
426 }
427 else if (ReadResult == 2) {
428 LOG(error) << "wrong channel! In header: " << PsdReader.HitHdr.uHitChannel;
429 break;
430 }
431 else if (ReadResult == 3) {
432 LOG(error) << "check number of waveform points! In header: " << PsdReader.HitHdr.uWfmWords - 1;
433 break;
434 }
435 else {
436 LOG(error) << "PsdGbtReader.ReadEventFles() didn't return expected values";
437 break;
438 }
439
440
441 } // while(PsdReader.GetTotalGbtWordsRead()<uNbMessages)
442
443 if (uNbMessages != PsdReader.GetTotalGbtWordsRead())
444 LOG(error) << "Wrong amount of messages read!"
445 << " in microslice " << uNbMessages << " by PsdReader " << PsdReader.GetTotalGbtWordsRead()
446 << "\n";
447
448 break;
449 } // case 100
450 // --------------------------------------------------------------------------------------------------
451 // --------------------------------------------------------------------------------------------------
452 case 000: {
453
454 PsdDataV000::PsdGbtReader PsdReader(pInBuff);
455 //PsdReader.SetPrintOutMode(true);
456
457 while (PsdReader.GetTotalGbtWordsRead() < uNbMessages) {
458 int ReadResult = PsdReader.ReadEventFles();
459 if (PsdReader.EvHdrAb.uHitsNumber > fviPsdChUId.size()) {
460 LOG(error) << "too many triggered channels! In header: " << PsdReader.EvHdrAb.uHitsNumber
461 << " in PSD: " << fviPsdChUId.size();
462 break;
463 }
464
465 if (ReadResult == 0) {
466 //hit loop
467 for (int hit_iter = 0; hit_iter < PsdReader.EvHdrAb.uHitsNumber; hit_iter++) {
468 UInt_t uHitChannel = PsdReader.VectHitHdr.at(hit_iter).uHitChannel;
469 UInt_t uSignalCharge = PsdReader.VectHitHdr.at(hit_iter).uSignalCharge;
470 //UInt_t uZeroLevel = PsdReader.VectHitHdr.at(hit_iter).uZeroLevel;
471 Double_t dHitTime =
472 (double) PsdReader.EvHdrAb.ulMicroSlice + (double) PsdReader.EvHdrAc.uAdcTime * 12.5 - fdTimeOffsetNs;
473
474 if (uHitChannel >= fviPsdChUId.size()) {
475 LOG(error) << "hit channel number out of range! channel index: " << uHitChannel
476 << " max: " << fviPsdChUId.size();
477 break;
478 }
479 UInt_t uChanUId = fviPsdChUId[uHitChannel]; //unique ID
480
481 LOG(debug) << Form("Insert 0x%08x digi with charge ", uChanUId) << uSignalCharge
482 << Form(", at %u,", PsdReader.EvHdrAc.uAdcTime)
483 << " epoch: " << PsdReader.EvHdrAb.ulMicroSlice;
484
485 fPsdDigiVector->emplace_back(uChanUId, dHitTime, (double) uSignalCharge);
486
487 } // for(int hit_iter = 0; hit_iter < PsdReader.EvHdrAb.uHitsNumber; hit_iter++)
488 }
489 else if (ReadResult == 1) {
490 LOG(error) << "no event headers in message!";
491 break;
492 }
493 else if (ReadResult == 2) {
494 LOG(error) << "check number of waveform points! In header: " << PsdReader.HitHdr.uWfmPoints
495 << " should be: " << 8;
496 break;
497 }
498 else if (ReadResult == 3) {
499 LOG(error) << "wrong amount of hits read! In header: " << PsdReader.EvHdrAb.uHitsNumber
500 << " in hit vector: " << PsdReader.VectHitHdr.size();
501 break;
502 }
503 else {
504 LOG(error) << "PsdGbtReader.ReadEventFles() didn't return expected values";
505 break;
506 }
507
508 } // while(PsdReader.GetTotalGbtWordsRead()<uNbMessages)
509
510 if (uNbMessages != PsdReader.GetTotalGbtWordsRead())
511 LOG(error) << "Wrong amount of messages read!"
512 << " in microslice " << uNbMessages << " by PsdReader " << PsdReader.GetTotalGbtWordsRead()
513 << "\n";
514
515 if (fulCurrentMsIdx != PsdReader.EvHdrAb.ulMicroSlice)
516 LOG(error) << "Wrong MS index!"
517 << " in microslice " << fulCurrentMsIdx << " by PsdReader " << PsdReader.EvHdrAb.ulMicroSlice
518 << "\n";
519 break;
520 } //case 000
521 // --------------------------------------------------------------------------------------------------
522
523 } // switch
524
525 } //if(uNbMessages > 1)
526
527
528 return kTRUE;
529}
530
531std::pair<std::vector<CbmPsdDigi>*, std::vector<CbmPsdDsp>*>
532CbmMcbm2018UnpackerAlgoPsd::unpack(const fles::Timeslice* ts, std::uint16_t icomp)
533{
534 AddMsComponentToList(icomp, 0x80);
535 Reset();
536 ProcessTs(*ts);
537
538 return std::make_pair(fPsdDigiVector, fPsdDspVector);
539}
540
541Bool_t CbmMcbm2018UnpackerAlgoPsd::SetDigiOutputPointer(std::vector<CbmPsdDigi>* const pVector)
542{
543 if (nullptr == fPsdDigiVector) {
544 fPsdDigiVector = pVector;
545 return kTRUE;
546 }
547 else {
548 return kFALSE;
549 }
550}
551
552Bool_t CbmMcbm2018UnpackerAlgoPsd::SetDspOutputPointer(std::vector<CbmPsdDsp>* const pVector)
553{
554 if (nullptr == fPsdDspVector) {
555 fPsdDspVector = pVector;
556 return kTRUE;
557 }
558 else {
559 return kFALSE;
560 }
561}
562
563std::unique_ptr<CbmPsdDigi> CbmMcbm2018UnpackerAlgoPsd::MakeDigi(CbmPsdDsp dsp)
564{
565 std::unique_ptr<CbmPsdDigi> digi(new CbmPsdDigi(dsp.GetAddress(), dsp.GetTime(), dsp.fdFitEdep));
566
567 return digi;
568}
569
573// -------------------------------------------------------------------------
std::string FormatMsHeaderPrintout(const fles::MicrosliceDescriptor &msDescriptor)
Int_t GetGdpbId(Int_t i)
Double_t GetMipCalibration(UInt_t i)
Bool_t ProcessTs(const fles::Timeslice &ts)
UInt_t fuMsIndex
Start Time in ns of current MS from its index field in header.
UInt_t fuCurrDpbId
Current equipment ID, tells from which DPB the current MS is originating.
Bool_t ProcessMs(const fles::Timeslice &ts, size_t uMsCompIdx, size_t uMsIdx)
Double_t fdTsStopTimeCore
Time in ns of current TS from the index of the first MS first component.
UInt_t fuCurrentEquipmentId
Index of current MS within the TS.
std::map< UInt_t, UInt_t > fGdpbIdIndexMap
Total number of GDPBs in the system.
Double_t fdTimeOffsetNs
User settings: Data correction parameters.
UInt_t fuNrOfGbtx
Number of channels per GDPB.
void AddMsComponentToList(size_t component, UShort_t usDetectorId)
Bool_t SetDigiOutputPointer(std::vector< CbmPsdDigi > *const pVector)
UInt_t fuNrOfChannelsPerFee
Number of FEBs per GDPB.
std::vector< Bool_t > fvbMaskedComponents
Output Dsp vector /* TODO CHECK The exclamation mark signals the transientness *‍/.
UInt_t fuNrOfChannelsPerGdpb
Number of channels in each FEE.
Double_t fdMsTime
End Time in ns of current TS Core from the index of the first MS first component.
UInt_t fuCurrDpbIdx
Temp holder until Current equipment ID is properly filled in MS.
Double_t fdTsStartTime
SysId of the current MS in TS (0 to fuTotalMsNb)
std::unique_ptr< CbmPsdDigi > MakeDigi(CbmPsdDsp dsp)
UInt_t fuNrOfFeePerGdpb
gDPB ID to index map
Bool_t fbDebugWriteOutput
Switch ON the filling of a additional set of histograms.
std::vector< CbmPsdDigi > * fPsdDigiVector
If ON the output vector of dsp debug information is written to disk.
ULong64_t fulCurrentMsIdx
Idx of the current TS.
Double_t fdStartTime
Index of the DPB from which the MS currently unpacked is coming.
size_t fuCurrentMsSysId
Idx of the current MS in TS (0 to fuTotalMsNb)
CbmMcbm2018PsdPar * fUnpackPar
Settings from parameter file.
std::pair< std::vector< CbmPsdDigi > *, std::vector< CbmPsdDsp > * > unpack(const fles::Timeslice *ts, std::uint16_t icomp)
Bool_t SetDspOutputPointer(std::vector< CbmPsdDsp > *const pVector)
std::vector< CbmPsdDsp > * fPsdDspVector
Output Digi vector /* TODO CHECK The exclamation mark signals the transientness *‍/.
static uint32_t GetAddress(int32_t moduleId, int32_t sectionId)
Return address from system ID, module, Section.
Data class for PSD digital information.
Definition CbmPsdDigi.h:36
Data class for PSD digital signal processing (DSP)
Definition CbmPsdDsp.h:30
double GetTime() const
Time.
Definition CbmPsdDsp.h:81
uint32_t GetAddress() const
Address.
Definition CbmPsdDsp.h:75
double fdFitEdep
ZeroLevel from fit of waveform [adc counts].
Definition CbmPsdDsp.h:136
std::vector< size_t > fvMsComponentsList
std::vector< CbmPsdDigi > fDigiVect
std::vector< PsdHitHeader > VectHitHdr
std::vector< struct PsdPackHeader > VectPackHdr
std::vector< struct PsdHitData > VectHitData
std::vector< struct PsdHitHeader > VectHitHdr
void SetSignalBegin(int SignalBeg)
void SetExternalHarmonics(std::complex< float > z1, std::complex< float > z2)
std::vector< uint16_t > GetFitWfm()
Definition PronyFitter.h:74
float GetRSquare(int gate_beg, int gate_end)
void SetDebugMode(bool IsDebug)
Definition PronyFitter.h:50
void SetWaveform(std::vector< uint16_t > &uWfm, uint16_t uZeroLevel)
int ChooseBestSignalBegin(int first_sample, int last_sample)
float GetIntegral(int gate_beg, int gate_end)
uint64_t ulMicroSlice
Total number of hits.