44 , fbDebugMonitorMode(kFALSE)
45 , fvbMaskedComponents()
47 , fvuElinkIdxHodo(kuNbHodos, 0)
48 , fvbHodoSwapXY(kuNbHodos, kFALSE)
49 , fvbHodoInvertX(kuNbHodos, kFALSE)
50 , fvbHodoInvertY(kuNbHodos, kFALSE)
51 , fvuAdcGainHodo(kuNbHodos, 0)
52 , fvuAdcOffsHodo(kuNbHodos, 0)
75 , fdTsStopTimeCore(-1.0)
76 , fvdPrevMsTime(kiMaxNbFlibLinks, -1.0)
80 , fuCurrentEquipmentId(0)
82 , fiRunStartDateTimeSec(-1)
83 , fiBinSizeDatePlots(-1)
86 , fdStartTimeMsSz(-1.0)
87 , ftStartTimeUnix(
std::chrono::steady_clock::now())
89 , fhHodoMessType(nullptr)
90 , fhHodoStatusMessType(nullptr)
91 , fhHodoMsStatusFieldType(nullptr)
92 , fhHodoMessTypePerElink(nullptr)
93 , fhHodoChanCntRaw(kuNbHodos, nullptr)
94 , fhHodoChanAdcRaw(kuNbHodos, nullptr)
95 , fhHodoChanAdcRawProf(kuNbHodos, nullptr)
96 , fhHodoChanAdcCal(kuNbHodos, nullptr)
97 , fhHodoChanAdcCalProf(kuNbHodos, nullptr)
98 , fhHodoChanRawTs(kuNbHodos, nullptr)
99 , fhHodoChanMissEvt(kuNbHodos, nullptr)
100 , fhHodoChanMissEvtEvo(kuNbHodos, nullptr)
101 , fhHodoChanHitRateEvo(kuNbHodos, nullptr)
102 , fhHodoChanHitRateProf(kuNbHodos, nullptr)
103 , fhHodoChanDistT(kuNbHodos, nullptr)
104 , fhHodoFiberCnt(kuNbHodos,
std::vector<TH1*>(kuNbAxis, nullptr))
105 , fhHodoFiberAdc(kuNbHodos,
std::vector<TH2*>(kuNbAxis, nullptr))
106 , fhHodoFiberAdcProf(kuNbHodos,
std::vector<TProfile*>(kuNbAxis, nullptr))
107 , fhHodoFiberHitRateEvo(kuNbHodos,
std::vector<TH2*>(kuNbAxis, nullptr))
108 , fhHodoFiberCoincMapXY(kuNbHodos, nullptr)
109 , fhHodoFiberCoincTimeXY(kuNbHodos, nullptr)
110 , fhHodoFiberCoincWalkXY_X(kuNbHodos, nullptr)
111 , fhHodoFiberCoincWalkXY_Y(kuNbHodos, nullptr)
112 , fhHodoFiberCoincMapSameAB(kuNbAxis, nullptr)
113 , fhHodoFiberCoincTimeSameAB(kuNbAxis, nullptr)
114 , fhHodoFiberCoincMapDiffAB(kuNbAxis, nullptr)
115 , fhHodoFiberCoincTimeDiffAB(kuNbAxis, nullptr)
116 , fhHodoFullCoincPosA(nullptr)
117 , fhHodoFullCoincPosB(nullptr)
118 , fhHodoFullCoincCompX(nullptr)
119 , fhHodoFullCoincCompY(nullptr)
120 , fhHodoFullCoincResidualXY(nullptr)
121 , fhHodoFullCoincTimeDiff(nullptr)
122 , fhHodoFullCoincTimeWalk(kuNbHodos,
std::vector<TH2*>(kuNbAxis, nullptr))
123 , fhHodoFullCoincRateEvo(nullptr)
124 , fhHodoFullCoincPosEvo(kuNbHodos,
std::vector<TH2*>(kuNbAxis, nullptr))
125 , fhPrevHitDtAllAsics(nullptr)
126 , fhPrevHitDtAsicA(nullptr)
127 , fhPrevHitDtAsicB(nullptr)
128 , fhPrevHitDtAsicsAB(nullptr)
129 , fiTimeIntervalRateUpdate(-1)
130 , fviTimeSecLastRateUpdate(kuNbHodos, 0)
131 , fvdChanCountsSinceLastRateUpdate(kuNbHodos,
std::vector<Double_t>(kuNbChanPerAsic, 0.0))
132 , fdHodoChanLastTimeForDist(kuNbHodos,
std::vector<Double_t>(kuNbChanPerAsic, 0.0))
133 , fuPreviousHitAsic(0)
134 , fvdPreviousHitTimePerAsic(2, 0.0)
136 , fcHodoSummaryRaw(kuNbHodos, nullptr)
137 , fcHodoSummaryFiber(kuNbHodos, nullptr)
138 , fcHodoFiberCoinc(nullptr)
139 , fcHodoFiberCoincAB(nullptr)
140 , fcHodoFullCoinc(nullptr)
141 , fcHodoFullCoincPos(nullptr)
142 , fcHodoPrevHitDt(nullptr)
280 fviFebAddress.push_back( fviModAddress[ fviFebModuleIdx[ uDpb ][ uCrobIdx ][ uFebIdx ] ]
281 + ( fviFebModuleSide[ uDpb ][ uCrobIdx ][ uFebIdx ] << 25 ) );
284 } // case 0: // FEB-8-1 with ZIF connector on the right
285 case 1: // FEB-8-1 with ZIF connector on the left
287 // P side (0) has type B (1)
288 // N side (1) has type A (0)
289 fviFebType[ uDpb ][ uCrobIdx ][ uFebIdx ] = !(fviFebModuleSide[ uDpb ][ uCrobIdx ][ uFebIdx ]);
295 fviFebAddress.push_back( fviModAddress[ fviFebModuleIdx[ uDpb ][ uCrobIdx ][ uFebIdx ] ]
296 + ( (!fviFebModuleSide[ uDpb ][ uCrobIdx ][ uFebIdx ]) << 25 ) );
298 } // case 1: // FEB-8-1 with ZIF connector on the left
300 LOG(fatal) << Form( "Bad module type for DPB #%02u CROB #%u FEB %02u: %d",
301 uDpb, uCrobIdx, uFebIdx,
302 fviModuleType[ fviFebModuleIdx[ uDpb ][ uCrobIdx ][ uFebIdx ] ] );
304 } // switch( fviModuleType[ fviFebModuleIdx[ uDpb ][ uCrobIdx ][ uFebIdx ] ] )
305 } // FEB active and module index OK
306 else if( -1 == fviFebModuleIdx[ uDpb ][ uCrobIdx ][ uFebIdx ] ||
307 -1 == fviFebModuleSide[ uDpb ][ uCrobIdx ][ uFebIdx ] )
309 fviFebAddress.push_back( 0 );
310 } // Module index or type is set to inactive
313 LOG(fatal) << Form( "Bad module Index and/or Side for DPB #%02u CROB #%u FEB %02u: %d %d",
314 uDpb, uCrobIdx, uFebIdx,
315 fviFebModuleIdx[ uDpb ][ uCrobIdx ][ uFebIdx ],
316 fviFebModuleSide[ uDpb ][ uCrobIdx ][ uFebIdx ] );
317 } // Bad module index or type for this FEB
318 } // for( UInt_t uFebIdx = 0; uFebIdx < fUnpackPar->GetNbFebsPerCrob(); ++ uFebIdx )
319 } // for( UInt_t uCrobIdx = 0; uCrobIdx < fUnpackPar->GetNbCrobsPerDpb(); ++uCrobIdx )
320 } // for( UInt_t uDpb = 0; uDpb < fuNrOfDpbs; ++uDpb )
322 for( UInt_t uDpb = 0; uDpb < fuNrOfDpbs; ++uDpb )
324 TString sPrintoutLine = Form( "DPB #%02u CROB Active ?: ", uDpb);
325 for( UInt_t uCrobIdx = 0; uCrobIdx < fUnpackPar->GetNbCrobsPerDpb(); ++uCrobIdx )
327 sPrintoutLine += Form( "%1u", ( fvbCrobActiveFlag[ uDpb ][ uCrobIdx ] == kTRUE ) );
328 } // for( UInt_t uCrobIdx = 0; uCrobIdx < fUnpackPar->GetNbCrobsPerDpb(); ++uCrobIdx )
329 LOG(info) << sPrintoutLine;
330 } // for( UInt_t uDpb = 0; uDpb < fuNrOfDpbs; ++uDpb )
332 UInt_t uGlobalFebIdx = 0;
333 for( UInt_t uDpb = 0; uDpb < fuNrOfDpbs; ++uDpb )
335 for( UInt_t uCrobIdx = 0; uCrobIdx < fUnpackPar->GetNbCrobsPerDpb(); ++uCrobIdx )
337 LOG(info) << Form( "DPB #%02u CROB #%u: ", uDpb, uCrobIdx);
338 for( UInt_t uFebIdx = 0; uFebIdx < fUnpackPar->GetNbFebsPerCrob(); ++ uFebIdx )
340 if( 0 <= fviFebModuleIdx[ uDpb ][ uCrobIdx ][ uFebIdx ] )
341 LOG(info) << Form( " FEB #%02u (%02u): Mod. Idx = %03d Side %c (%2d) Type %c (%2d) (Addr. 0x%08x) ADC gain %4.0f e- ADC Offs %5.0f e-",
342 uFebIdx, uGlobalFebIdx,
343 fviFebModuleIdx[ uDpb ][ uCrobIdx ][ uFebIdx ],
344 1 == fviFebModuleSide[ uDpb ][ uCrobIdx ][ uFebIdx ] ? 'N': 'P',
345 fviFebModuleSide[ uDpb ][ uCrobIdx ][ uFebIdx ],
346 1 == fviFebType[ uDpb ][ uCrobIdx ][ uFebIdx ] ? 'B' : 'A',
347 fviFebType[ uDpb ][ uCrobIdx ][ uFebIdx ],
348 fviFebAddress[ uGlobalFebIdx ],
349 fvdFebAdcGain[ uDpb ][ uCrobIdx ][ uFebIdx ],
350 fvdFebAdcOffs[ uDpb ][ uCrobIdx ][ uFebIdx ]
353 } // for( UInt_t uFebIdx = 0; uFebIdx < fUnpackPar->GetNbFebsPerCrob(); ++ uFebIdx )
354 } // for( UInt_t uCrobIdx = 0; uCrobIdx < fUnpackPar->GetNbCrobsPerDpb(); ++uCrobIdx )
355 } // for( UInt_t uDpb = 0; uDpb < fuNrOfDpbs; ++uDpb )
357 // Internal status initialization
358 fvulCurrentTsMsb.resize( fuNrOfDpbs );
359 fvuCurrentTsMsbCycle.resize( fuNrOfDpbs );
360 for( UInt_t uDpb = 0; uDpb < fuNrOfDpbs; ++uDpb )
362 fvulCurrentTsMsb[uDpb] = 0;
363 fvuCurrentTsMsbCycle[uDpb] = 0;
364 } // for( UInt_t uDpb = 0; uDpb < fuNrOfDpbs; ++uDpb )
783 fhHodoMessType =
new TH1I(
"hHodoMessType",
"Nb of message for each type; Type", 6, 0., 6.);
792 new TH2I(
"hHodoStatusMessType",
"Nb of status message of each type for each DPB; ASIC; Status Type",
kuNbHodos, 0,
802 new TH2I(
"hHodoMsStatusFieldType",
"For each flag in the MS header, ON/OFF counts; Flag bit []; ON/OFF; MS []", 16,
803 -0.5, 15.5, 2, -0.5, 1.5);
811 fhHodoMessTypePerElink =
new TH2I(
"hHodoMessTypePerElink",
"Nb of message of each type for each eLink; eLink; Type",
825 for (UInt_t uHodoIdx = 0; uHodoIdx <
kuNbHodos; ++uHodoIdx) {
829 Form(
"Hits Count per channel, Hodo #%u; Channel; Hits []", uHodoIdx),
834 Form(
"Raw Adc distribution per channel, Hodo #%u; Channel []; "
842 new TProfile(Form(
"hHodoChanAdcRawProf_%u", uHodoIdx),
843 Form(
"Raw Adc prodile per channel, Hodo #%u; Channel []; Adc []", uHodoIdx),
kuNbChanPerAsic, -0.5,
847 fhHodoChanAdcCal[ uHodoIdx ] = new TH2I( Form( "hHodoChanAdcCal_%u", uHodoIdx ),
848 Form( "Cal. Adc distribution per channel, Hodo #%u; Channel []; Adc [e-]; Hits []", uHodoIdx ),
849 kuNbChanPerAsic, -0.5, kuNbChanPerAsic - 0.5,
853 fhHodoChanAdcCalProf[ uHodoIdx ] = new TProfile( Form( "hHodoChanAdcCalProf_%u", uHodoIdx ),
854 Form( "Cal. Adc prodile per channel, Hodo #%u; Channel []; Adc [e-]", uHodoIdx ),
855 kuNbChanPerAsic, -0.5, kuNbChanPerAsic - 0.5 );
858 fhHodoChanRawTs[uHodoIdx] =
new TH2I(Form(
"hHodoChanRawTs_%u", uHodoIdx),
859 Form(
"Raw Timestamp distribution per channel, FEB #%03u; "
860 "Channel []; Ts []; Hits []",
867 Form(
"Missed Event flags per channel, Hodo #%u; Channel []; "
868 "Miss Evt []; Hits []",
874 Form(
"Missed Evt flags per second & channel in Hodo #%u; Time "
875 "[s]; Channel []; Missed Evt flags []",
881 new TH2I(Form(
"hHodoChanHitRateEvo_%u", uHodoIdx),
882 Form(
"Hits per second & channel in Hodo #%u; Time [s]; Channel []; Hits []", uHodoIdx), 1800, 0, 1800,
887 new TProfile(Form(
"hHodoChanHitRateProf_%u", uHodoIdx),
888 Form(
"Hits per second for each channel in Hodo #%u; Channel []; Hits/s []", uHodoIdx),
892 fhHodoChanDistT[uHodoIdx] =
new TH2I(Form(
"hHodoChanDistT_%u", uHodoIdx),
893 Form(
"Time distance between hits on same channel in Hodo #%u; "
894 "Time difference [ns]; Channel []; ",
899 for (UInt_t uAxis = 0; uAxis <
kuNbAxis; ++uAxis) {
900 Char_t cAxisName = (uAxis ?
'Y' :
'X');
903 new TH1I(Form(
"hHodoFiberCnt%c_%u", cAxisName, uHodoIdx),
904 Form(
"Hits Count per Fiber, Hodo #%u Axis %c; Fiber; Hits []", uHodoIdx, cAxisName),
908 fhHodoFiberAdc[uHodoIdx][uAxis] =
new TH2I(Form(
"fhHodoFiberAdc%c_%u", cAxisName, uHodoIdx),
909 Form(
"Raw Adc distribution per Fiber, Hodo #%u Axis %c; "
910 "Channel []; Adc []; Hits []",
911 uHodoIdx, cAxisName),
917 new TProfile(Form(
"hHodoFiberAdcProf%c_%u", cAxisName, uHodoIdx),
918 Form(
"Raw Adc prodile per Fiber, Hodo #%u Axis %c; Channel []; Adc []", uHodoIdx, cAxisName),
923 new TH2I(Form(
"hHodoFiberHitRateEvo%c_%u", cAxisName, uHodoIdx),
924 Form(
"Hits per second & Fiber in Hodo #%u Axis %c; Time [s]; "
925 "Channel []; Hits []",
926 uHodoIdx, cAxisName),
941 Form(
"Map of coincident (X, Y) pairs in Hodo #%u; X [Fiber]; Y "
948 Form(
"Time difference of coincident (X, Y) pairs in Hodo #%u; "
949 "t_Y - t_X [ns]; Hits []",
954 Form(
"Walk X of coincident (X, Y) pairs in Hodo #%u; ADC X "
955 "[bin]; t_Y - t_X [ns]; Hits []",
960 Form(
"Walk X of coincident (X, Y) pairs in Hodo #%u; ADC X "
961 "[bin]; t_Y - t_X [ns]; Hits []",
983 for (UInt_t uAxis = 0; uAxis <
kuNbAxis; ++uAxis) {
984 Char_t cAxisName = (uAxis ?
'Y' :
'X');
985 Char_t cOtherAxisName = (uAxis ?
'X' :
'Y');
989 Form(
"Map of coincident (%c, %c) pairs in Hodo A and B; %c_A "
990 "[Fiber]; %c_B [Fiber]; Hits []",
991 cAxisName, cAxisName, cAxisName, cAxisName),
996 Form(
"Time difference of coincident (%c, %c) pairs in Hodo A "
997 "and B; t_%c_B - t_%c_A [ns]; Hits []",
998 cAxisName, cAxisName, cAxisName, cAxisName),
1003 Form(
"Map of coincident (%c, %c) pairs in Hodo A and B; %c_A "
1004 "[Fiber]; %c_B [Fiber]; Hits []",
1005 cAxisName, cOtherAxisName, cOtherAxisName, cAxisName),
1010 Form(
"Time difference of coincident (%c, %c) pairs in Hodo A and B; "
1011 "t_%c_B - t_%c_A [ns]; Hits []",
1012 cAxisName, cOtherAxisName, cOtherAxisName, cAxisName),
1024 "Position on Hodo A for coincident pairs in Hodo A and B; X_A "
1025 "[Fiber]; Y_A [Fiber]; Hits []",
1030 "Position on Hodo B for coincident pairs in Hodo A and B; X_B "
1031 "[Fiber]; Y_B [Fiber]; Hits []",
1036 "Comparison of X pos for coincident pairs in Hodo A and B; X_A "
1037 "[Fiber]; X_B [Fiber]; Hits []",
1042 "Comparison of Y pos for coincident pairs in Hodo A and B; Y_A "
1043 "[Fiber]; Y_B [Fiber]; Hits []",
1049 new TH2I(
"hHodoFullCoincResidualXY",
1050 "X and Y residuals for coincident pairs in Hodo A and B; X_B - "
1051 "X_A [Fiber]; Y_B - Y_A [Fiber]; Hits []",
1056 "Time difference of coincident pairs in Hodo A and B; (t_X_B + "
1057 "t_Y_B)/2 - (t_X_A + t_Y_A)/2 [ns]; Hits []",
1061 "Evolution of the full coincidence rate; "
1062 "Time in run [s]; Full coincidences;",
1063 1800, -0.5, 1800 - 0.5);
1073 for (UInt_t uHodoIdx = 0; uHodoIdx <
kuNbHodos; ++uHodoIdx) {
1074 for (UInt_t uAxis = 0; uAxis <
kuNbAxis; ++uAxis) {
1075 Char_t cAxisName = (uAxis ?
'Y' :
'X');
1077 new TH2I(Form(
"hHodoFullCoincTimeWalk_%u%c", uHodoIdx, cAxisName),
1078 Form(
"Time walk of coincident (A, B) pairs in Hodo #%u Axis "
1079 "%c; ADC %u_%c [bin]; Time Diff <B> - <A> [ns]; Hits []",
1080 uHodoIdx, cAxisName, uHodoIdx, cAxisName),
1086 new TH2I(Form(
"hHodoFullCoincPosEvo_%u%c", uHodoIdx, cAxisName),
1087 Form(
"Time evolution of coincident (A, B) pairs position in Hodo #%u "
1088 "Axis %c; Time in run [s]; Position %u_%c [Fiber]; Hits []",
1089 uHodoIdx, cAxisName, uHodoIdx, cAxisName),
1097 "Time difference between current and previous hits in any ASIC; t "
1098 "- t_prev [ns]; Hit pairs []",
1101 "Time difference between current and previous "
1102 "hits in ASIC A; t - t_prev [ns]; Hit pairs []",
1105 "Time difference between current and previous "
1106 "hits in ASIC B; t - t_prev [ns]; Hit pairs []",
1109 "Time difference between current in ASIC A and previous hit in "
1110 "ASIC B; t - t_prev [ns]; Hit pairs []",
1122 fcSummary =
new TCanvas(
"fcSummary",
"Summary for the Hodo sDPB", w,
h);
1152 for (UInt_t uHodoIdx = 0; uHodoIdx <
kuNbHodos; ++uHodoIdx) {
1155 new TCanvas(Form(
"cHodoSummaryRaw%u", uHodoIdx), Form(
"Raw Summary for Hodo %u", uHodoIdx), w,
h);
1207 new TCanvas(Form(
"cHodoSummaryFiber%u", uHodoIdx), Form(
"Fiber Summary for Hodo %u", uHodoIdx), w,
h);
1210 for (UInt_t uAxis = 0; uAxis <
kuNbAxis; ++uAxis) {
1239 fcHodoFiberCoinc =
new TCanvas(
"fcHodoFiberCoinc",
"X/Y coincidences in same hodoscope", w,
h);
1290 fcHodoFiberCoincAB =
new TCanvas(
"fcHodoFiberCoincAB",
"X/Y coincidences between hodoscopes", w,
h);
1293 for (UInt_t uAxis = 0; uAxis <
kuNbAxis; ++uAxis) {
1319 fcHodoFullCoinc =
new TCanvas(
"fcHodoFullCoinc",
"Full coincidences between hodoscopes", w,
h);
1372 new TCanvas(
"fcHodoFullCoincPos",
"Hit Positions for Full coincidences between hodoscopes", w,
h);
1388 new TCanvas(
"fcHodoFullCoincPosEvo",
"Hit Positions Evo for Full coincidences between hodoscopes", w,
h);
1415 fcHodoPrevHitDt =
new TCanvas(
"fcHodoPrevHitDt",
"Time difference between current and previous hits", w,
h);
1453 std::vector<std::vector<stsxyter::FinalHit>> lastHitHodoAxis;
1454 std::vector<std::vector<Bool_t>> bHitFoundHodoAxis;
1457 for (UInt_t uHodoIdx = 0; uHodoIdx <
kuNbHodos; ++uHodoIdx) {
1458 lastHitHodoAxis[uHodoIdx].resize(
kuNbAxis);
1459 bHitFoundHodoAxis[uHodoIdx].resize(
kuNbAxis, kFALSE);
1464 for (UInt_t uHit = 0; uHit < uTotalNbHits; ++uHit) {
1482 lastHitHodoAxis[uHodo][uAxis] =
fvmHitsInMs[uHit];
1483 bHitFoundHodoAxis[uHodo][uAxis] = kTRUE;
1486 if (bHitFoundHodoAxis[uHodo][0] && bHitFoundHodoAxis[uHodo][1]) {
1491 fhHodoFiberCoincMapXY[uHodo]->Fill(lastHitHodoAxis[uHodo][0].GetChan(), lastHitHodoAxis[uHodo][1].GetChan());
1499 if (bHitFoundHodoAxis[0][uAxis] && bHitFoundHodoAxis[1][uAxis]) {
1505 lastHitHodoAxis[1][uAxis].GetChan());
1510 UInt_t uAxisA = (uHodo ? !uAxis : uAxis);
1511 UInt_t uAxisB = (uHodo ? uAxis : !uAxis);
1512 if (bHitFoundHodoAxis[0][uAxisA] && bHitFoundHodoAxis[1][uAxisB]) {
1518 lastHitHodoAxis[1][uAxisB].GetChan());
1524 if (bHitFoundHodoAxis[0][0] && bHitFoundHodoAxis[0][1] && bHitFoundHodoAxis[1][0] && bHitFoundHodoAxis[1][1]) {
1544 UInt_t uPosXA =
fvbHodoSwapXY[0] ? lastHitHodoAxis[0][1].GetChan() : lastHitHodoAxis[0][0].GetChan();
1545 UInt_t uPosYA =
fvbHodoSwapXY[0] ? lastHitHodoAxis[0][0].GetChan() : lastHitHodoAxis[0][1].GetChan();
1546 UInt_t uPosXB =
fvbHodoSwapXY[1] ? lastHitHodoAxis[1][1].GetChan() : lastHitHodoAxis[1][0].GetChan();
1547 UInt_t uPosYB =
fvbHodoSwapXY[1] ? lastHitHodoAxis[1][0].GetChan() : lastHitHodoAxis[1][1].GetChan();
1554 Double_t dResX = uPosXB;
1555 Double_t dResY = uPosYB;
1573 Double_t dTimeSinceStart = (dTimeHitHodoAB -
fdStartTime) * 1e-9;