CbmRoot
Loading...
Searching...
No Matches
CbmMcbm2018MonitorSts.cxx
Go to the documentation of this file.
1/* Copyright (C) 2018-2020 Facility for Antiproton and Ion Research in Europe, Darmstadt
2 SPDX-License-Identifier: GPL-3.0-only
3 Authors: Pierre-Alain Loizeau [committer] */
4
5// -----------------------------------------------------------------------------
6// ----- -----
7// ----- CbmMcbm2018MonitorSts -----
8// ----- Created 11/05/18 by P.-A. Loizeau -----
9// ----- -----
10// -----------------------------------------------------------------------------
11
13
15
16// Data
17
18// CbmRoot
19#include "CbmHistManager.h"
20#include "CbmMcbm2018StsPar.h"
21
22// FairRoot
23#include "FairRootManager.h"
24#include "FairRun.h"
25#include "FairRunOnline.h"
26#include "FairRuntimeDb.h"
27#include <Logger.h>
28
29// Root
30#include "TClonesArray.h"
31#include "THttpServer.h"
32#include "TMath.h"
33#include "TROOT.h"
34#include "TRandom.h"
35#include "TString.h"
36#include "TStyle.h"
37#include <TFile.h>
38
39// C++11
40#include <bitset>
41
42// C/C++
43#include <iomanip>
44#include <iostream>
45
46#include <stdint.h>
47
48Bool_t bMcbm2018ResetSts = kFALSE;
49Bool_t bMcbm2018WriteSts = kFALSE;
50Bool_t bMcbm2018ScanNoisySts = kFALSE;
51
54 , fvbMaskedComponents()
55 , fvMsComponentsList()
56 , fuNbCoreMsPerTs(0)
57 , fuNbOverMsPerTs(0)
58 , fbIgnoreOverlapMs(kFALSE)
59 , fUnpackParSts(NULL)
60 , fuNbModules(0)
61 , fviModuleType()
62 , fviModAddress()
63 , fuNrOfDpbs(0)
64 , fDpbIdIndexMap()
65 , fvbCrobActiveFlag()
66 , fuNbFebs(0)
67 , fuNbStsXyters(0)
68 , fviFebModuleIdx()
69 , fviFebModuleSide()
70 , fviFebType()
71 , fvdFebAdcGain()
72 , fvdFebAdcOffs()
73 ,
74 /*
75 fuNrOfDpbs(0),
76 fDpbIdIndexMap(),
77 fuNbStsXyters(0),
78 fUnpackParSts->GetNbChanPerAsic()(0),
79 fuNbFebs(0),
80*/
81 fsHistoFileFullname("data/SetupHistos.root")
82 , fbPrintMessages(kFALSE)
83 , fPrintMessCtrl(stsxyter::MessagePrintMask::msg_print_Human)
84 ,
85 // fbEnableCoincidenceMaps( kFALSE ),
86 fbEnableCheckBugSmx20(kFALSE)
87 , fulCurrentTsIdx(0)
88 , fulCurrentMsIdx(0)
89 , fmMsgCounter()
90 , fuCurrentEquipmentId(0)
91 , fuCurrDpbId(0)
92 , fuCurrDpbIdx(0)
93 , fiRunStartDateTimeSec(-1)
94 , fiBinSizeDatePlots(-1)
95 , fvulCurrentTsMsb()
96 , fvuCurrentTsMsbCycle()
97 , fvuInitialHeaderDone()
98 , fvuInitialTsMsbCycleHeader()
99 , fvuElinkLastTsHit()
100 , fvulChanLastHitTime()
101 , fvdChanLastHitTime()
102 , fvdPrevMsTime()
103 , fvdMsTime()
104 , fvuChanNbHitsInMs()
105 , fvdChanLastHitTimeInMs()
106 , fvusChanLastHitAdcInMs()
107 ,
108 // fvmChanHitsInTs(),
109 fdStartTime(-1.0)
110 , fdStartTimeMsSz(-1.0)
111 , ftStartTimeUnix(std::chrono::steady_clock::now())
112 , fvmHitsInMs()
113 , fvmAsicHitsInMs()
114 , fvmFebHitsInMs()
115 , fuMaxNbMicroslices(100)
116 , fiTimeIntervalRateUpdate(10)
117 , fvdFebTimeSecLastRateUpdate()
118 , fviFebCountsSinceLastRateUpdate()
119 , fvdFebChanCountsSinceLastRateUpdate()
120 , fbLongHistoEnable(kFALSE)
121 , fuLongHistoNbSeconds(0)
122 , fuLongHistoBinSizeSec(0)
123 , fuLongHistoBinNb(0)
124 , fdCoincCenter(0.0)
125 , fdCoincBorder(50.0)
126 , fdCoincMin(fdCoincCenter - fdCoincBorder)
127 , fdCoincMax(fdCoincCenter + fdCoincBorder)
128 , fHM(new CbmHistManager())
129 , fhStsMessType(NULL)
130 , fhStsSysMessType(NULL)
131 , fhStsMessTypePerDpb(NULL)
132 , fhStsSysMessTypePerDpb(NULL)
133 , fhStsStatusMessType(NULL)
134 , fhStsMsStatusFieldType(NULL)
135 , fhStsMessTypePerElink(NULL)
136 , fhStsHitsElinkPerDpb(NULL)
137 , fhStsAllFebsHitRateEvo(nullptr)
138 , fhStsAllAsicsHitRateEvo(nullptr)
139 , fhStsFebAsicHitCounts(nullptr)
140 , fdFebChanCoincidenceLimit(100.0)
141 , fhStsFebChanCntRaw()
142 , fhStsFebChanCntRawGood()
143 , fhStsFebChanAdcRaw()
144 , fhStsFebChanAdcRawProf()
145 ,
146 // fhStsFebChanAdcCal(),
147 // fhStsFebChanAdcCalProf(),
148 fhStsFebChanRawTs()
149 , fhStsFebChanMissEvt()
150 , fhStsFebChanMissEvtEvo()
151 , fhStsFebAsicMissEvtEvo()
152 , fhStsFebMissEvtEvo()
153 , fhStsFebChanHitRateEvo()
154 , fhStsFebChanHitRateProf()
155 , fhStsFebAsicHitRateEvo()
156 , fhStsFebHitRateEvo()
157 , fhStsFebChanHitRateEvoLong()
158 , fhStsFebAsicHitRateEvoLong()
159 , fhStsFebHitRateEvoLong()
160 , fdStsFebChanLastTimeForDist()
161 , fhStsFebChanDistT()
162 , fhStsFebChanCloseHitsCounts()
163 , fhStsFebChanCloseHitsRatio()
164 ,
165 /*
166 fhStsFebChanDtCoinc(),
167 fhStsFebChanCoinc(),
168 fhStsModulePNCoincDt(),
169 fhStsModulePNCoincDtAsicP(),
170 fhStsModulePNCoincDtAsicN(),
171 fhStsModulePNCoincChan(),
172 fhStsModulePNCoincAdc(),
173 fhStsModuleCoincAdcChanP(),
174 fhStsModuleCoincAdcChanN(),
175 fhStsModuleCoincMap(),
176*/
177 fbSmx2ErrorUseNoiseLevels(kFALSE)
178 , fdSmxErrCoincWinM07(kdSmxErrCoincWinMainM07)
179 , fdSmxErrCoincWinM08(kdSmxErrCoincWinMainM08)
180 , fdSmxErrCoincWinM09(kdSmxErrCoincWinMainM09)
181 , fdSmxErrCoincWinM10(kdSmxErrCoincWinMainM10)
182 , fdSmxErrCoincWinM11(kdSmxErrCoincWinMainM11)
183 , fvdSmxErrTimeLastHits()
184 , fvuSmxErrIdxFirstHitM07()
185 , fvuSmxErrIdxFirstHitM08()
186 , fvuSmxErrIdxFirstHitM09()
187 , fvuSmxErrIdxFirstHitM10()
188 , fvuSmxErrIdxFirstHitM11()
189 , fvuSmxErrIdxLastHit()
190 , fhStsFebSmxErrRatioEvo()
191 , fhStsFebSmxErrRatioEvoAsic()
192 , fhStsFebSmxErrRatioCopyEvo()
193 , fhStsFebSmxErrRatioCopyEvoAsic()
194 , fhStsFebSmxErrRatioCopySameAdcEvo()
195 , fhStsFebSmxErrRatioCopySameAdcEvoAsic()
196 , fcMsSizeAll(NULL)
197{
198}
199
201
203{
204 LOG(info) << "Initializing flib StsXyter unpacker for STS";
205
206 FairRootManager* ioman = FairRootManager::Instance();
207 if (ioman == NULL) { LOG(fatal) << "No FairRootManager instance"; }
208
209 return kTRUE;
210}
211
213{
214 LOG(info) << "Setting parameter containers for " << GetName();
215 fUnpackParSts = (CbmMcbm2018StsPar*) (FairRun::Instance()->GetRuntimeDb()->getContainer("CbmMcbm2018StsPar"));
216}
217
218
220{
221 LOG(info) << "Init parameter containers for " << GetName();
222
223 Bool_t bInit = InitStsParameters();
224 if (kTRUE == bInit) CreateHistograms();
225
226 return bInit;
227}
228
230{
231 LOG(info) << "ReInit parameter containers for " << GetName();
232
233 return InitStsParameters();
234}
235
237{
238
239
241 LOG(info) << "Nr. of STS Modules: " << fuNbModules;
242
245 for (UInt_t uModIdx = 0; uModIdx < fuNbModules; ++uModIdx) {
246 fviModuleType[uModIdx] = fUnpackParSts->GetModuleType(uModIdx);
247 fviModAddress[uModIdx] = fUnpackParSts->GetModuleAddress(uModIdx);
248 LOG(info) << "Module #" << std::setw(2) << uModIdx << " Type " << std::setw(4) << fviModuleType[uModIdx]
249 << " Address 0x" << std::setw(8) << std::hex << fviModAddress[uModIdx] << std::dec;
250 } // for( UInt_t uModIdx = 0; uModIdx < fuNbModules; ++uModIdx)
251
253 LOG(info) << "Nr. of STS DPBs: " << fuNrOfDpbs;
254
255 fDpbIdIndexMap.clear();
256 for (UInt_t uDpb = 0; uDpb < fuNrOfDpbs; ++uDpb) {
258 LOG(info) << "Eq. ID for DPB #" << std::setw(2) << uDpb << " = 0x" << std::setw(4) << std::hex
259 << fUnpackParSts->GetDpbId(uDpb) << std::dec << " => " << fDpbIdIndexMap[fUnpackParSts->GetDpbId(uDpb)];
260 } // for( UInt_t uDpb = 0; uDpb < fuNrOfDpbs; ++uDpb )
261
263 LOG(info) << "Nr. of FEBs: " << fuNbFebs;
264
266 LOG(info) << "Nr. of StsXyter ASICs: " << fuNbStsXyters;
267
271 fviFebType.resize(fuNrOfDpbs);
274 for (UInt_t uDpb = 0; uDpb < fuNrOfDpbs; ++uDpb) {
281 for (UInt_t uCrobIdx = 0; uCrobIdx < fUnpackParSts->GetNbCrobsPerDpb(); ++uCrobIdx) {
282 fvbCrobActiveFlag[uDpb][uCrobIdx] = fUnpackParSts->IsCrobActive(uDpb, uCrobIdx);
283
284 fviFebModuleIdx[uDpb][uCrobIdx].resize(fUnpackParSts->GetNbFebsPerCrob());
285 fviFebModuleSide[uDpb][uCrobIdx].resize(fUnpackParSts->GetNbFebsPerCrob());
286 fviFebType[uDpb][uCrobIdx].resize(fUnpackParSts->GetNbFebsPerCrob(), -1);
287 fvdFebAdcGain[uDpb][uCrobIdx].resize(fUnpackParSts->GetNbFebsPerCrob(), 0.0);
288 fvdFebAdcOffs[uDpb][uCrobIdx].resize(fUnpackParSts->GetNbFebsPerCrob(), 0.0);
289 for (UInt_t uFebIdx = 0; uFebIdx < fUnpackParSts->GetNbFebsPerCrob(); ++uFebIdx) {
290 fviFebModuleIdx[uDpb][uCrobIdx][uFebIdx] = fUnpackParSts->GetFebModuleIdx(uDpb, uCrobIdx, uFebIdx);
291 fviFebModuleSide[uDpb][uCrobIdx][uFebIdx] = fUnpackParSts->GetFebModuleSide(uDpb, uCrobIdx, uFebIdx);
292 fvdFebAdcGain[uDpb][uCrobIdx][uFebIdx] = fUnpackParSts->GetFebAdcGain(uDpb, uCrobIdx, uFebIdx);
293 fvdFebAdcOffs[uDpb][uCrobIdx][uFebIdx] = fUnpackParSts->GetFebAdcOffset(uDpb, uCrobIdx, uFebIdx);
294
295 if (0 <= fviFebModuleSide[uDpb][uCrobIdx][uFebIdx]
296 && static_cast<UInt_t>(fviFebModuleIdx[uDpb][uCrobIdx][uFebIdx]) < fuNbModules) {
297 switch (fviModuleType[fviFebModuleIdx[uDpb][uCrobIdx][uFebIdx]]) {
298 case 0: // FEB-8-1 with ZIF connector on the right
299 {
300 // P side (0) has type A (0)
301 // N side (1) has type B (1)
302 fviFebType[uDpb][uCrobIdx][uFebIdx] = fviFebModuleSide[uDpb][uCrobIdx][uFebIdx];
303 break;
304 } // case 0: // FEB-8-1 with ZIF connector on the right
305 case 1: // FEB-8-1 with ZIF connector on the left
306 {
307 // P side (0) has type B (1)
308 // N side (1) has type A (0)
309 fviFebType[uDpb][uCrobIdx][uFebIdx] = !(fviFebModuleSide[uDpb][uCrobIdx][uFebIdx]);
310 break;
311 } // case 1: // FEB-8-1 with ZIF connector on the left
312 default: break;
313 } // switch( fviModuleType[ fviFebModuleIdx[ uDpb ][ uCrobIdx ][ uFebIdx ] ] )
314 } // FEB active and module index OK
315 } // for( UInt_t uFebIdx = 0; uFebIdx < fUnpackParSts->GetNbFebsPerCrob(); ++ uFebIdx )
316 } // for( UInt_t uCrobIdx = 0; uCrobIdx < fUnpackParSts->GetNbCrobsPerDpb(); ++uCrobIdx )
317 } // for( UInt_t uDpb = 0; uDpb < fuNrOfDpbs; ++uDpb )
318
319 for (UInt_t uDpb = 0; uDpb < fuNrOfDpbs; ++uDpb) {
320 for (UInt_t uCrobIdx = 0; uCrobIdx < fUnpackParSts->GetNbCrobsPerDpb(); ++uCrobIdx) {
321 LOG(info) << Form("DPB #%02u CROB #%02u Active: ", uDpb, uCrobIdx) << fvbCrobActiveFlag[uDpb][uCrobIdx];
322 } // for( UInt_t uCrobIdx = 0; uCrobIdx < fUnpackParSts->GetNbCrobsPerDpb(); ++uCrobIdx )
323 } // for( UInt_t uDpb = 0; uDpb < fuNrOfDpbs; ++uDpb )
324
325 for (UInt_t uDpb = 0; uDpb < fuNrOfDpbs; ++uDpb) {
326 for (UInt_t uCrobIdx = 0; uCrobIdx < fUnpackParSts->GetNbCrobsPerDpb(); ++uCrobIdx) {
327 LOG(info) << Form("DPB #%02u CROB #%u: ", uDpb, uCrobIdx);
328 for (UInt_t uFebIdx = 0; uFebIdx < fUnpackParSts->GetNbFebsPerCrob(); ++uFebIdx)
329 if (0 <= fviFebModuleIdx[uDpb][uCrobIdx][uFebIdx]) {
330 LOG(info) << Form(" FEB #%02u: Mod. Idx = %03d Side %c (%2d) Type %c (%2d) ADC "
331 "gain %4.0f e- ADC Offs %5.0f e-",
332 uFebIdx, fviFebModuleIdx[uDpb][uCrobIdx][uFebIdx],
333 1 == fviFebModuleSide[uDpb][uCrobIdx][uFebIdx] ? 'N' : 'P',
334 fviFebModuleSide[uDpb][uCrobIdx][uFebIdx],
335 1 == fviFebType[uDpb][uCrobIdx][uFebIdx] ? 'B' : 'A', fviFebType[uDpb][uCrobIdx][uFebIdx],
336 fvdFebAdcGain[uDpb][uCrobIdx][uFebIdx], fvdFebAdcOffs[uDpb][uCrobIdx][uFebIdx]);
337 } // for( UInt_t uFebIdx = 0; uFebIdx < fUnpackParSts->GetNbFebsPerCrob(); ++ uFebIdx )
338 } // for( UInt_t uCrobIdx = 0; uCrobIdx < fUnpackParSts->GetNbCrobsPerDpb(); ++uCrobIdx )
339 } // for( UInt_t uDpb = 0; uDpb < fuNrOfDpbs; ++uDpb )
340
341 if (fbBinningFw) LOG(info) << "Unpacking data in bin sorter FW mode";
342 else
343 LOG(info) << "Unpacking data in full time sorter FW mode (legacy)";
344
345 // Internal status initialization
351 for (UInt_t uDpb = 0; uDpb < fuNrOfDpbs; ++uDpb) {
352 fvulCurrentTsMsb[uDpb] = 0;
353 fvuCurrentTsMsbCycle[uDpb] = 0;
354 fvuInitialHeaderDone[uDpb] = kFALSE;
356 } // for( UInt_t uDpb = 0; uDpb < fuNrOfDpbs; ++uDpb )
357
359
367
368 for (UInt_t uXyterIdx = 0; uXyterIdx < fuNbStsXyters; ++uXyterIdx) {
374 fvmAsicHitsInMs[uXyterIdx].clear();
375
376 for (UInt_t uChan = 0; uChan < fUnpackParSts->GetNbChanPerAsic(); ++uChan) {
377 fvulChanLastHitTime[uXyterIdx][uChan] = 0;
378 fvdChanLastHitTime[uXyterIdx][uChan] = -1.0;
379
380 fvuChanNbHitsInMs[uXyterIdx][uChan].resize(fuMaxNbMicroslices);
381 fvdChanLastHitTimeInMs[uXyterIdx][uChan].resize(fuMaxNbMicroslices);
382 fvusChanLastHitAdcInMs[uXyterIdx][uChan].resize(fuMaxNbMicroslices);
383 for (UInt_t uMsIdx = 0; uMsIdx < fuMaxNbMicroslices; ++uMsIdx) {
384 fvuChanNbHitsInMs[uXyterIdx][uChan][uMsIdx] = 0;
385 fvdChanLastHitTimeInMs[uXyterIdx][uChan][uMsIdx] = -1.0;
386 fvusChanLastHitAdcInMs[uXyterIdx][uChan][uMsIdx] = 0;
387 } // for( UInt_t uMsIdx = 0; uMsIdx < fuMaxNbMicroslices; ++uMsIdx )
388 } // for( UInt_t uChan = 0; uChan < fUnpackParSts->GetNbChanPerAsic(); ++uChan )
389 } // for( UInt_t uXyterIdx = 0; uXyterIdx < fuNbStsXyters; ++uXyterIdx )
390
391 LOG(info) << "CbmMcbm2018MonitorSts::ReInitContainers => Changed "
392 "fvuChanNbHitsInMs size "
393 << fvuChanNbHitsInMs.size() << " VS " << fuNbStsXyters;
394 LOG(info) << "CbmMcbm2018MonitorSts::ReInitContainers => Changed "
395 "fvuChanNbHitsInMs size "
396 << fvuChanNbHitsInMs[0].size() << " VS " << fUnpackParSts->GetNbChanPerAsic();
397 LOG(info) << "CbmMcbm2018MonitorSts::ReInitContainers => Changed "
398 "fvuChanNbHitsInMs size "
399 << fvuChanNbHitsInMs[0][0].size() << " VS " << fuMaxNbMicroslices;
400
401 fvmFebHitsInMs.resize(fuNbFebs);
406 for (UInt_t uFebIdx = 0; uFebIdx < fuNbFebs; ++uFebIdx) {
407 fvmFebHitsInMs[uFebIdx].clear();
410 } // for( UInt_t uFebIdx = 0; uFebIdx < fuNbFebs; ++uFebIdx )
411
415
416 return kTRUE;
417}
418
419void CbmMcbm2018MonitorSts::AddMsComponentToList(size_t component, UShort_t /*usDetectorId*/)
420{
422 for (UInt_t uCompIdx = 0; uCompIdx < fvMsComponentsList.size(); ++uCompIdx)
423 if (component == fvMsComponentsList[uCompIdx]) return;
424
426 if (kiMaxNbFlibLinks <= component) {
427 LOG(error) << "CbmMcbm2018MonitorSts::AddMsComponentToList => "
428 << "Ignored the addition of component " << component << " as it is above the hadcoded limit of "
429 << static_cast<Int_t>(kiMaxNbFlibLinks) << " !!!!!!!!! "
430 << "\n"
431 << " To change this behavior check kiMaxNbFlibLinks in "
432 "CbmMcbm2018MonitorSts.cxx";
433 return;
434 } // if( kiMaxNbFlibLinks <= component )
435
436
438 fvMsComponentsList.push_back(component);
439 LOG(info) << "CbmMcbm2018MonitorSts::AddMsComponentToList => Added component: " << component;
440
442 if (NULL == fhMsSz[component]) {
443 TString sMsSzName = Form("MsSz_link_%02lu", component);
444 TString sMsSzTitle = Form("Size of MS for nDPB of link %02lu; Ms Size [bytes]", component);
445 fhMsSz[component] = new TH1F(sMsSzName.Data(), sMsSzTitle.Data(), 30000, 0., 30000.);
446 fHM->Add(sMsSzName.Data(), fhMsSz[component]);
447
448 sMsSzName = Form("MsSzTime_link_%02lu", component);
449 sMsSzTitle = Form("Size of MS vs time for gDPB of link %02lu; Time[s] ; Ms Size [bytes]", component);
450 fhMsSzTime[component] = new TProfile(sMsSzName.Data(), sMsSzTitle.Data(), 15000, 0., 300.);
451 fHM->Add(sMsSzName.Data(), fhMsSzTime[component]);
452
453 if (NULL != fcMsSizeAll) {
454 fcMsSizeAll->cd(1 + component);
455 gPad->SetLogy();
456 fhMsSzTime[component]->Draw("hist le0");
457 } // if( NULL != fcMsSizeAll )
458 LOG(info) << "Added MS size histo for component: " << component << " (DPB)";
459
460 THttpServer* server = FairRunOnline::Instance()->GetHttpServer();
461 if (server) {
462 server->Register("/FlibRaw", fhMsSz[component]);
463 server->Register("/FlibRaw", fhMsSzTime[component]);
464 } // if( server )
465 } // if( NULL == fhMsSz[ component ] )
466}
467void CbmMcbm2018MonitorSts::SetNbMsInTs(size_t uCoreMsNb, size_t uOverlapMsNb)
468{
469 fuNbCoreMsPerTs = uCoreMsNb;
470 fuNbOverMsPerTs = uOverlapMsNb;
471
472 UInt_t uNbMsTotal = fuNbCoreMsPerTs + fuNbOverMsPerTs;
473
474 if (fuMaxNbMicroslices < uNbMsTotal) {
475 fuMaxNbMicroslices = uNbMsTotal;
476
481 for (UInt_t uXyterIdx = 0; uXyterIdx < fuNbStsXyters; ++uXyterIdx) {
485 for (UInt_t uChan = 0; uChan < fUnpackParSts->GetNbChanPerAsic(); ++uChan) {
486 fvuChanNbHitsInMs[uXyterIdx][uChan].resize(fuMaxNbMicroslices);
487 fvdChanLastHitTimeInMs[uXyterIdx][uChan].resize(fuMaxNbMicroslices);
488 fvusChanLastHitAdcInMs[uXyterIdx][uChan].resize(fuMaxNbMicroslices);
489 for (UInt_t uMsIdx = 0; uMsIdx < fuMaxNbMicroslices; ++uMsIdx) {
490 fvuChanNbHitsInMs[uXyterIdx][uChan][uMsIdx] = 0;
491 fvdChanLastHitTimeInMs[uXyterIdx][uChan][uMsIdx] = -1.0;
492 fvusChanLastHitAdcInMs[uXyterIdx][uChan][uMsIdx] = 0;
493 } // for( UInt_t uMsIdx = 0; uMsIdx < fuMaxNbMicroslices; ++uMsIdx )
494 } // for( UInt_t uChan = 0; uChan < fUnpackParSts->GetNbChanPerAsic(); ++uChan )
495 } // for( UInt_t uXyterIdx = 0; uXyterIdx < fuNbStsXyters; ++uXyterIdx )
496 LOG(info) << "CbmMcbm2018MonitorSts::DoUnpack => Changed fvuChanNbHitsInMs size " << fvuChanNbHitsInMs.size()
497 << " VS " << fuNbStsXyters;
498 LOG(info) << "CbmMcbm2018MonitorSts::DoUnpack => Changed fvuChanNbHitsInMs size " << fvuChanNbHitsInMs[0].size()
499 << " VS " << fUnpackParSts->GetNbChanPerAsic();
500 LOG(info) << "CbmMcbm2018MonitorSts::DoUnpack => Changed fvuChanNbHitsInMs size " << fvuChanNbHitsInMs[0][0].size()
501 << " VS " << fuMaxNbMicroslices;
502 } // if( fuMaxNbMicroslices < uNbMsTotal )
503}
504/*
505void CbmMcbm2018MonitorSts::SetCoincidenceBorder( Double_t dCenterPos, Double_t dBorderVal )
506{
507 fdCoincCenter = dCenterPos;
508 fdCoincBorder = dBorderVal;
509 fdCoincMin = dCenterPos - dBorderVal;
510 fdCoincMax = dCenterPos + dBorderVal;
511}
512*/
514{
515 TString sHistName {""};
516 TString title {""};
517
518 sHistName = "hPulserMessageType";
519 title = "Nb of message for each type; Type";
520 fhStsMessType = new TH1I(sHistName, title, 6, 0., 6.);
521 fhStsMessType->GetXaxis()->SetBinLabel(1, "Dummy");
522 fhStsMessType->GetXaxis()->SetBinLabel(2, "Hit");
523 fhStsMessType->GetXaxis()->SetBinLabel(3, "TsMsb");
524 fhStsMessType->GetXaxis()->SetBinLabel(4, "Epoch");
525 fhStsMessType->GetXaxis()->SetBinLabel(5, "Status");
526 fhStsMessType->GetXaxis()->SetBinLabel(6, "Empty");
527
528 /* *** Missing int + MessType OP!!!! ****
529 fhStsMessType->GetXaxis()->SetBinLabel(1 + stsxyter::MessType::Dummy, "Dummy");
530 fhStsMessType->GetXaxis()->SetBinLabel(1 + stsxyter::MessType::Hit, "Hit");
531 fhStsMessType->GetXaxis()->SetBinLabel(1 + stsxyter::MessType::TsMsb, "TsMsb");
532 fhStsMessType->GetXaxis()->SetBinLabel(1 + stsxyter::MessType::ReadDataAck, "ReadDataAck");
533 fhStsMessType->GetXaxis()->SetBinLabel(1 + stsxyter::MessType::Ack, "Ack");
534*/
535
536 sHistName = "hPulserSysMessType";
537 title = "Nb of system message for each type; System Type";
538 fhStsSysMessType = new TH1I(sHistName, title, 17, 0., 17.);
539 /*
540 hSysMessType->GetXaxis()->SetBinLabel(1 + ngdpb::SYSMSG_DAQ_START, "DAQ START");
541 hSysMessType->GetXaxis()->SetBinLabel(1 + ngdpb::SYSMSG_DAQ_FINISH, "DAQ FINISH");
542 hSysMessType->GetXaxis()->SetBinLabel(1 + 16, "GET4 Hack 32B");
543*/
544
545 sHistName = "hPulserMessageTypePerDpb";
546 title = "Nb of message of each type for each DPB; DPB; Type";
547 fhStsMessTypePerDpb = new TH2I(sHistName, title, fuNrOfDpbs, 0, fuNrOfDpbs, 6, 0., 6.);
548 fhStsMessTypePerDpb->GetYaxis()->SetBinLabel(1, "Dummy");
549 fhStsMessTypePerDpb->GetYaxis()->SetBinLabel(2, "Hit");
550 fhStsMessTypePerDpb->GetYaxis()->SetBinLabel(3, "TsMsb");
551 fhStsMessTypePerDpb->GetYaxis()->SetBinLabel(4, "Epoch");
552 fhStsMessTypePerDpb->GetYaxis()->SetBinLabel(5, "Status");
553 fhStsMessTypePerDpb->GetYaxis()->SetBinLabel(6, "Empty");
554 /* *** Missing int + MessType OP!!!! ****
555 fhStsMessType->GetYaxis()->SetBinLabel(1 + stsxyter::MessType::Dummy, "Dummy");
556 fhStsMessType->GetYaxis()->SetBinLabel(1 + stsxyter::MessType::Hit, "Hit");
557 fhStsMessType->GetYaxis()->SetBinLabel(1 + stsxyter::MessType::TsMsb, "TsMsb");
558 fhStsMessType->GetYaxis()->SetBinLabel(1 + stsxyter::MessType::ReadDataAck, "ReadDataAck");
559 fhStsMessType->GetYaxis()->SetBinLabel(1 + stsxyter::MessType::Ack, "Ack");
560*/
561
562 sHistName = "hPulserSysMessTypePerDpb";
563 title = "Nb of system message of each type for each DPB; DPB; System Type";
564 fhStsSysMessTypePerDpb = new TH2I(sHistName, title, fuNrOfDpbs, 0, fuNrOfDpbs, 17, 0., 17.);
565 /*
566 hSysMessType->GetYaxis()->SetBinLabel(1 + ngdpb::SYSMSG_DAQ_START, "DAQ START");
567 hSysMessType->GetYaxis()->SetBinLabel(1 + ngdpb::SYSMSG_DAQ_FINISH, "DAQ FINISH");
568 hSysMessType->GetYaxis()->SetBinLabel(1 + 16, "GET4 Hack 32B");
569*/
570
571 sHistName = "hStsStatusMessType";
572 title = "Nb of status message of each type for each DPB; ASIC; Status Type";
573 fhStsStatusMessType = new TH2I(sHistName, title, fuNbStsXyters, 0, fuNbStsXyters, 16, 0., 16.);
574 /*
575 fhStsStatusMessType->GetYaxis()->SetBinLabel( 1, "Dummy");
576 fhStsStatusMessType->GetYaxis()->SetBinLabel( 2, "Hit");
577 fhStsStatusMessType->GetYaxis()->SetBinLabel( 3, "TsMsb");
578 fhStsStatusMessType->GetYaxis()->SetBinLabel( 4, "Epoch");
579*/
580
581 sHistName = "hStsMsStatusFieldType";
582 title = "For each flag in the MS header, ON/OFF counts; Flag bit []; ON/OFF; MS []";
583 fhStsMsStatusFieldType = new TH2I(sHistName, title, 16, -0.5, 15.5, 2, -0.5, 1.5);
584 /*
585 fhStsMsStatusFieldType->GetYaxis()->SetBinLabel( 1, "Dummy");
586 fhStsMsStatusFieldType->GetYaxis()->SetBinLabel( 2, "Hit");
587 fhStsMsStatusFieldType->GetYaxis()->SetBinLabel( 3, "TsMsb");
588 fhStsMsStatusFieldType->GetYaxis()->SetBinLabel( 4, "Epoch");
589*/
590
591 sHistName = "hStsMessTypePerElink";
592 title = "Nb of message of each type for each DPB; DPB; Type";
593 fhStsMessTypePerElink = new TH2I(sHistName, title, fuNrOfDpbs * fUnpackParSts->GetNbElinkPerDpb(), 0,
595 fhStsMessTypePerElink->GetYaxis()->SetBinLabel(1, "Dummy");
596 fhStsMessTypePerElink->GetYaxis()->SetBinLabel(2, "Hit");
597 fhStsMessTypePerElink->GetYaxis()->SetBinLabel(3, "TsMsb");
598 fhStsMessTypePerElink->GetYaxis()->SetBinLabel(4, "Epoch");
599 fhStsMessTypePerElink->GetYaxis()->SetBinLabel(5, "Status");
600 fhStsMessTypePerElink->GetYaxis()->SetBinLabel(6, "Empty");
601
602 sHistName = "hStsHitsElinkPerDpb";
603 title = "Nb of hit messages per eLink for each DPB; DPB; eLink; Hits nb []";
604 fhStsHitsElinkPerDpb = new TH2I(sHistName, title, fuNrOfDpbs, 0, fuNrOfDpbs, 42, 0., 42.);
605
607 sHistName = "hStsAllFebsHitRateEvo";
608 title = "Hits per second & FEB; Time [s]; FEB []; Hits []";
609 fhStsAllFebsHitRateEvo = new TH2I(sHistName, title, 1800, 0, 1800, fuNbFebs, -0.5, fuNbFebs - 0.5);
610
612 sHistName = "hStsAllAsicsHitRateEvo";
613 title = "Hits per second & ASIC; Time [s]; ASIC []; Hits []";
614 fhStsAllAsicsHitRateEvo = new TH2I(sHistName, title, 1800, 0, 1800, fuNbStsXyters, -0.5, fuNbStsXyters - 0.5);
615
617 sHistName = "hStsFebAsicHitCounts";
618 title = "Hits per FEB & ASIC; FEB []; ASIC in FEB[]; Hits []";
619 fhStsFebAsicHitCounts = new TH2I(sHistName, title, fuNbFebs, -0.5, fuNbFebs - 0.5, fUnpackParSts->GetNbAsicsPerFeb(),
620 -0.5, fUnpackParSts->GetNbAsicsPerFeb() - 0.5);
621 /*
622 // Number of rate bins =
623 // 9 for the sub-unit decade
624 // + 9 for each unit of each decade * 10 for the subdecade range
625 // + 1 for the closing bin top edge
626 const Int_t iNbDecadesRate = 9;
627 const Int_t iNbStepsDecade = 9;
628 const Int_t iNbSubStepsInStep = 10;
629 const Int_t iNbBinsRate = iNbStepsDecade
630 + iNbStepsDecade * iNbSubStepsInStep * iNbDecadesRate
631 + 1;
632 Double_t dBinsRate[iNbBinsRate];
633 // First fill sub-unit decade
634 for( Int_t iSubU = 0; iSubU < iNbStepsDecade; iSubU ++ )
635 dBinsRate[ iSubU ] = 0.1 * ( 1 + iSubU );
636 std::cout << std::endl;
637 // Then fill the main decades
638 Double_t dSubstepSize = 1.0 / iNbSubStepsInStep;
639 for( Int_t iDecade = 0; iDecade < iNbDecadesRate; iDecade ++)
640 {
641 Double_t dBase = std::pow( 10, iDecade );
642 Int_t iDecadeIdx = iNbStepsDecade
643 + iDecade * iNbStepsDecade * iNbSubStepsInStep;
644 for( Int_t iStep = 0; iStep < iNbStepsDecade; iStep++ )
645 {
646 Int_t iStepIdx = iDecadeIdx + iStep * iNbSubStepsInStep;
647 for( Int_t iSubStep = 0; iSubStep < iNbSubStepsInStep; iSubStep++ )
648 {
649 dBinsRate[ iStepIdx + iSubStep ] = dBase * (1 + iStep)
650 + dBase * dSubstepSize * iSubStep;
651 } // for( Int_t iSubStep = 0; iSubStep < iNbSubStepsInStep; iSubStep++ )
652 } // for( Int_t iStep = 0; iStep < iNbStepsDecade; iStep++ )
653 } // for( Int_t iDecade = 0; iDecade < iNbDecadesRate; iDecade ++)
654 dBinsRate[ iNbBinsRate - 1 ] = std::pow( 10, iNbDecadesRate );
655*/
658 fuLongHistoBinNb = uAlignedLimit / fuLongHistoBinSizeSec;
659
660 // UInt_t uNbBinEvo = (32768 + 1) * 2;
661 // Double_t dMaxEdgeEvo = stsxyter::kdClockCycleNs
662 // * static_cast< Double_t >( uNbBinEvo ) / 2.0;
663 // Double_t dMinEdgeEvo = dMaxEdgeEvo * -1.0;
664
665 // UInt_t uNbBinDt = static_cast<UInt_t>( (fdCoincMax - fdCoincMin )/stsxyter::kdClockCycleNs );
666
670 // fhStsFebChanDtCoinc.resize( fuNbFebs );
671 // fhStsFebChanCoinc.resize( fuNbFebs );
672 for (UInt_t uFebIdx = 0; uFebIdx < fuNbFebs; ++uFebIdx) {
674 sHistName = Form("hStsFebChanCntRaw_%03u", uFebIdx);
675 title = Form("Hits Count per channel, FEB #%03u; Channel; Hits []", uFebIdx);
676 fhStsFebChanCntRaw.push_back(
677 new TH1I(sHistName, title, fUnpackParSts->GetNbChanPerFeb(), -0.5, fUnpackParSts->GetNbChanPerFeb() - 0.5));
678
679 sHistName = Form("hStsFebChanCntRawGood_%03u", uFebIdx);
680 title = Form("Hits Count per channel in good MS (SX2 bug flag off), FEB "
681 "#%03u; Channel; Hits []",
682 uFebIdx);
683 fhStsFebChanCntRawGood.push_back(
684 new TH1I(sHistName, title, fUnpackParSts->GetNbChanPerFeb(), -0.5, fUnpackParSts->GetNbChanPerFeb() - 0.5));
685
687 sHistName = Form("hStsFebChanAdcRaw_%03u", uFebIdx);
688 title = Form("Raw Adc distribution per channel, FEB #%03u; Channel []; Adc "
689 "[]; Hits []",
690 uFebIdx);
691 fhStsFebChanAdcRaw.push_back(new TH2I(sHistName, title, fUnpackParSts->GetNbChanPerFeb(), -0.5,
694
696 sHistName = Form("hStsFebChanAdcRawProfc_%03u", uFebIdx);
697 title = Form("Raw Adc prodile per channel, FEB #%03u; Channel []; Adc []", uFebIdx);
698 fhStsFebChanAdcRawProf.push_back(
699 new TProfile(sHistName, title, fUnpackParSts->GetNbChanPerFeb(), -0.5, fUnpackParSts->GetNbChanPerFeb() - 0.5));
700 /*
702 sHistName = Form( "hStsFebChanAdcCal_%03u", uFebIdx );
703 title = Form( "Cal. Adc distribution per channel, FEB #%03u; Channel []; Adc [e-]; Hits []", uFebIdx );
704 fhStsFebChanAdcCal.push_back( new TH2I(sHistName, title,
705 fUnpackParSts->GetNbChanPerFeb(), -0.5, fUnpackParSts->GetNbChanPerFeb() - 0.5,
706 50, 0., 100000. ) );
707
709 sHistName = Form( "hStsFebChanAdcCalProfc_%03u", uFebIdx );
710 title = Form( "Cal. Adc prodile per channel, FEB #%03u; Channel []; Adc [e-]", uFebIdx );
711 fhStsFebChanAdcCalProf.push_back( new TProfile(sHistName, title,
712 fUnpackParSts->GetNbChanPerFeb(), -0.5, fUnpackParSts->GetNbChanPerFeb() - 0.5 ) );
713*/
715 sHistName = Form("hStsFebChanRawTs_%03u", uFebIdx);
716 title = Form("Raw Timestamp distribution per channel, FEB #%03u; Channel "
717 "[]; Ts []; Hits []",
718 uFebIdx);
719 fhStsFebChanRawTs.push_back(new TH2I(sHistName, title, fUnpackParSts->GetNbChanPerFeb(), -0.5,
722
724 sHistName = Form("hStsFebChanMissEvt_%03u", uFebIdx);
725 title = Form("Missed Event flags per channel, FEB #%03u; Channel []; Miss "
726 "Evt []; Hits []",
727 uFebIdx);
728 fhStsFebChanMissEvt.push_back(new TH2I(sHistName, title, fUnpackParSts->GetNbChanPerFeb(), -0.5,
729 fUnpackParSts->GetNbChanPerFeb() - 0.5, 2, -0.5, 1.5));
730
732 sHistName = Form("hStsFebChanMissEvtEvo_%03u", uFebIdx);
733 title = Form("Missed Evt flags per second & channel in FEB #%03u; Time "
734 "[s]; Channel []; Missed Evt flags []",
735 uFebIdx);
736 fhStsFebChanMissEvtEvo.push_back(new TH2I(sHistName, title, 1800, 0, 1800, fUnpackParSts->GetNbChanPerFeb(), -0.5,
738
740 sHistName = Form("hStsFebAsicMissEvtEvo_%03u", uFebIdx);
741 title = Form("Missed Evt flags per second & StsXyter in FEB #%03u; Time "
742 "[s]; Asic []; Missed Evt flags []",
743 uFebIdx);
744 fhStsFebAsicMissEvtEvo.push_back(new TH2I(sHistName, title, 1800, 0, 1800, fUnpackParSts->GetNbAsicsPerFeb(), -0.5,
746
748 sHistName = Form("hStsFebMissEvtEvo_%03u", uFebIdx);
749 title = Form("Missed Evt flags per second & channel in FEB #%03u; Time "
750 "[s]; Missed Evt flags []",
751 uFebIdx);
752 fhStsFebMissEvtEvo.push_back(new TH1I(sHistName, title, 1800, 0, 1800));
753
755 sHistName = Form("hStsFebChanRateEvo_%03u", uFebIdx);
756 title = Form("Hits per second & channel in FEB #%03u; Time [s]; Channel []; Hits []", uFebIdx);
757 fhStsFebChanHitRateEvo.push_back(new TH2I(sHistName, title, 1800, 0, 1800, fUnpackParSts->GetNbChanPerFeb(), -0.5,
759
761 sHistName = Form("hStsFebChanRateProf_%03u", uFebIdx);
762 title = Form("Hits per second for each channel in FEB #%03u; Channel []; Hits/s []", uFebIdx);
763 fhStsFebChanHitRateProf.push_back(
764 new TProfile(sHistName, title, fUnpackParSts->GetNbChanPerFeb(), -0.5, fUnpackParSts->GetNbChanPerFeb() - 0.5));
765
767 sHistName = Form("hStsFebAsicRateEvo_%03u", uFebIdx);
768 title = Form("Hits per second & StsXyter in FEB #%03u; Time [s]; Asic []; Hits []", uFebIdx);
769 fhStsFebAsicHitRateEvo.push_back(new TH2I(sHistName, title, 1800, 0, 1800, fUnpackParSts->GetNbAsicsPerFeb(), -0.5,
771
773 sHistName = Form("hStsFebRateEvo_%03u", uFebIdx);
774 title = Form("Hits per second in FEB #%03u; Time [s]; Hits []", uFebIdx);
775 fhStsFebHitRateEvo.push_back(new TH1I(sHistName, title, 1800, 0, 1800));
776
778 sHistName = Form("hStsFebChanRateEvoLong_%03u", uFebIdx);
779 title = Form("Hits per second & channel in FEB #%03u; Time [min]; Channel []; Hits []", uFebIdx);
780 fhStsFebChanHitRateEvoLong.push_back(new TH2D(sHistName, title, fuLongHistoBinNb, -0.5, uAlignedLimit - 0.5,
783
785 sHistName = Form("hStsFebAsicRateEvoLong_%03u", uFebIdx);
786 title = Form("Hits per second & StsXyter in FEB #%03u; Time [min]; Asic []; Hits []", uFebIdx);
787 fhStsFebAsicHitRateEvoLong.push_back(new TH2D(sHistName, title, fuLongHistoBinNb, -0.5, uAlignedLimit - 0.5,
790
792 sHistName = Form("hStsFebRateEvoLong_%03u", uFebIdx);
793 title = Form("Hits per second in FEB #%03u; Time [min]; Hits []", uFebIdx);
794 fhStsFebHitRateEvoLong.push_back(new TH1D(sHistName, title, fuLongHistoBinNb, -0.5, uAlignedLimit - 0.5));
795
797 sHistName = Form("hStsFebChanDistT_%03u", uFebIdx);
798 title = Form("Time distance between hits on same channel in FEB #%03u; "
799 "Time difference [ns]; Channel []; ",
800 uFebIdx);
801 fhStsFebChanDistT.push_back(new TH2I(sHistName, title, 1000, -0.5, 6250.0 - 0.5, fUnpackParSts->GetNbChanPerFeb(),
802 -0.5, fUnpackParSts->GetNbChanPerFeb() - 0.5));
803
805 sHistName = Form("hStsFebChanCloseHitsCounts_%03u", uFebIdx);
806 title = Form("Hits with too small dt on same channel in FEB #%03u; Channel "
807 "counts []; ",
808 uFebIdx);
809 fhStsFebChanCloseHitsCounts.push_back(new TH2I(sHistName, title, fUnpackParSts->GetNbChanPerFeb(), -0.5,
810 fUnpackParSts->GetNbChanPerFeb() - 0.5, 2, -0.5, 1.5));
811 sHistName = Form("hStsFebChanCloseHitsRatio_%03u", uFebIdx);
812 title = Form("Ratio of Hits with too small dt on same channel in FEB "
813 "#%03u; Ratio []; ",
814 uFebIdx);
816 new TProfile(sHistName, title, fUnpackParSts->GetNbChanPerFeb(), -0.5, fUnpackParSts->GetNbChanPerFeb() - 0.5));
817
818 /*
820 fhStsFebChanDtCoinc[ uFebIdx ].resize( fuNbFebs, nullptr );
821 fhStsFebChanCoinc[ uFebIdx ].resize( fuNbFebs, nullptr );
822 for( UInt_t uFebIdxB = uFebIdx; uFebIdxB < fuNbFebs; ++uFebIdxB )
823 {
824 sHistName = Form( "hStsFebChanDtCoinc_%03u_%03u", uFebIdx, uFebIdxB );
825 title = Form( "Channel coincidences Time diff between FEB #%03u and FEB #%03u; Time difference [ns]",
826 uFebIdx, uFebIdxB );
827 fhStsFebChanDtCoinc[ uFebIdx ][ uFebIdxB ] = new TH1I( sHistName, title, 400, -1250., 1250.);
828
829 sHistName = Form( "hStsFebChanCoinc_%03u_%03u", uFebIdx, uFebIdxB );
830 title = Form( "Channel coincidences between FEB #%03u and FEB #%03u; Channel FEB #%03u []; Channel FEB #%03u []; Coinc. []",
831 uFebIdx, uFebIdxB, uFebIdx, uFebIdxB );
832 fhStsFebChanCoinc[ uFebIdx ][ uFebIdxB ] = new TH2I( sHistName, title,
833 fUnpackParSts->GetNbChanPerFeb(), -0.5, fUnpackParSts->GetNbChanPerFeb() - 0.5,
834 fUnpackParSts->GetNbChanPerFeb(), -0.5, fUnpackParSts->GetNbChanPerFeb() - 0.5 );
835 } // for( UInt_t uFebIdxB = uFebIdx; uFebIdxB < fuNbFebs; ++uFebIdxB )
836*/
837 } // for( UInt_t uFebIdx = 0; uFebIdx < fuNbFebs; ++uFebIdx )
838
840 /*
842 Double_t dSensorMinX = - fUnpackParSts->GetSensorSzX() / 2.0;
843 Double_t dSensorMaxX = fUnpackParSts->GetSensorSzX() / 2.0;
844 Double_t dSensorMinY = - fUnpackParSts->GetSensorSzY() / 2.0;
845 Double_t dSensorMaxY = fUnpackParSts->GetSensorSzY() / 2.0;
846 for( UInt_t uModIdx = 0; uModIdx < fuNbModules; ++ uModIdx )
847 {
849 sHistName = Form( "hStsModulePNCoincDt_%03u", uModIdx );
850 title = Form( "Channel coincidences Time diff between P and N sides on module #%03u; Time difference [ns]",
851 uModIdx );
852 fhStsModulePNCoincDt.push_back( new TH1I( sHistName, title, 400, -1250., 1250.) );
853
854 sHistName = Form( "hStsModulePNCoincDtAsicP_%03u", uModIdx );
855 title = Form( "Channel coincidences Time diff between P and N sides on module #%03u; Time difference [ns]; Asic on P FEB []",
856 uModIdx );
857 fhStsModulePNCoincDtAsicP.push_back( new TH2I( sHistName, title,
858 400, -1250., 1250.,
859 fUnpackParSts->GetNbAsicsPerFeb(), -0.5, fUnpackParSts->GetNbAsicsPerFeb() - 0.5) );
860
861 sHistName = Form( "hStsModulePNCoincDtAsicN_%03u", uModIdx );
862 title = Form( "Channel coincidences Time diff between P and N sides on module #%03u; Time difference [ns]; Asic on P FEB []",
863 uModIdx );
864 fhStsModulePNCoincDtAsicN.push_back( new TH2I( sHistName, title,
865 400, -1250., 1250.,
866 fUnpackParSts->GetNbAsicsPerFeb(), -0.5, fUnpackParSts->GetNbAsicsPerFeb() - 0.5) );
867
868
870 sHistName = Form( "hStsModulePNCoincChan_%03u", uModIdx );
871 title = Form( "P-N channel coincidences in module #%03u; Channel P []; Channel N []; Cnt []", uModIdx );
872 fhStsModulePNCoincChan.push_back( new TH2D( sHistName, title,
873 fUnpackParSts->GetNbChanPerFeb(), -0.5, fUnpackParSts->GetNbChanPerFeb() - 0.5,
874 fUnpackParSts->GetNbChanPerFeb(), -0.5, fUnpackParSts->GetNbChanPerFeb() - 0.5 ) );
875
877 sHistName = Form( "hStsModulePNCoincAdc_%03u", uModIdx );
878 title = Form( "Adc values of P-N coincidences in module #%03u; ADC Channel P [bin]; ADC Channel N [bin]; Cnt []", uModIdx );
879 fhStsModulePNCoincAdc.push_back( new TH2D( sHistName, title,
880 stsxyter::kuHitNbAdcBins, -0.5, stsxyter::kuHitNbAdcBins - 0.5,
881 stsxyter::kuHitNbAdcBins, -0.5, stsxyter::kuHitNbAdcBins - 0.5 ) );
883 sHistName = Form( "hStsModuleCoincAdcChanP_%03u", uModIdx );
884 title = Form( "Adc values of P chan in P-N coincidences in module #%03u; Channel P [bin]; ADC val. [bin]; Cnt []", uModIdx );
885 fhStsModuleCoincAdcChanP.push_back( new TH2D( sHistName, title,
886 fUnpackParSts->GetNbChanPerFeb(), -0.5, fUnpackParSts->GetNbChanPerFeb() - 0.5,
887 stsxyter::kuHitNbAdcBins, -0.5, stsxyter::kuHitNbAdcBins - 0.5 ) );
889 sHistName = Form( "hStsModuleCoincAdcChanN_%03u", uModIdx );
890 title = Form( "Adc values of N chan in P-N coincidences in module #%03u; Channel N [bin]; ADC val. [bin]; Cnt []", uModIdx );
891 fhStsModuleCoincAdcChanN.push_back( new TH2D( sHistName, title,
892 fUnpackParSts->GetNbChanPerFeb(), -0.5, fUnpackParSts->GetNbChanPerFeb() - 0.5,
893 stsxyter::kuHitNbAdcBins, -0.5, stsxyter::kuHitNbAdcBins - 0.5 ) );
894
896 sHistName = Form( "hStsModuleCoincMap_%03u", uModIdx );
897 title = Form( "X-Y map of P-N coincidences in module #%03u; Pos. X [mm]; Pos. Y [mm]; Cnt []", uModIdx );
898 fhStsModuleCoincMap.push_back( new TH2D( sHistName, title,
899 2*fUnpackParSts->GetSensorSzX(), 2*dSensorMinX, 2*dSensorMaxX,
900 2*fUnpackParSts->GetSensorSzY(), 2*dSensorMinY, 2*dSensorMaxY ) );
901 } // for( UInt_t uModIdx = 0; uModIdx < fuNbModules; ++ uModIdx )
902*/
904
907 if (kTRUE == fbEnableCheckBugSmx20) {
908 for (UInt_t uFebIdx = 0; uFebIdx < fuNbFebs; ++uFebIdx) {
910 sHistName = Form("hStsFebSmxErrRatioEvo_%03u", uFebIdx);
911 title = Form("Proportion of uS with SMX logic error in FEB #%03u; Time "
912 "[s]; Error MS fract. []",
913 uFebIdx);
914 fhStsFebSmxErrRatioEvo.push_back(new TProfile(sHistName, title, 1800, 0, 1800));
915
917 sHistName = Form("hStsFebSmxErrRatioEvoAsic_%03u", uFebIdx);
918 title = Form("Proportion of uS with SMX logic error per ASIC in FEB "
919 "#%03u; Time [s]; ASIC []; Error MS fract. []",
920 uFebIdx);
921 fhStsFebSmxErrRatioEvoAsic.push_back(new TProfile2D(sHistName, title, 1800, 0, 1800,
924
926 sHistName = Form("hStsFebSmxErrRatioCopyEvo_%03u", uFebIdx);
927 title = Form("Proportion of uS with hit copies in FEB #%03u; Time [s]; "
928 "Copies MS fract. []",
929 uFebIdx);
930 fhStsFebSmxErrRatioCopyEvo.push_back(new TProfile(sHistName, title, 1800, 0, 1800));
931
933 sHistName = Form("hStsFebSmxErrRatioCopyEvoAsic_%03u", uFebIdx);
934 title = Form("Proportion of uS with hit copies per ASIC in FEB #%03u; "
935 "Time [s]; ASIC []; Copies MS fract. []",
936 uFebIdx);
937 fhStsFebSmxErrRatioCopyEvoAsic.push_back(new TProfile2D(sHistName, title, 1800, 0, 1800,
940
942 sHistName = Form("hStsFebSmxErrRatioCopySameAdcEvo_%03u", uFebIdx);
943 title = Form("Proportion of uS with hit full copies in FEB #%03u; Time "
944 "[s]; Copies MS fract. []",
945 uFebIdx);
946 fhStsFebSmxErrRatioCopySameAdcEvo.push_back(new TProfile(sHistName, title, 1800, 0, 1800));
947
949 sHistName = Form("hStsFebSmxErrRatioCopySameAdcEvoAsic_%03u", uFebIdx);
950 title = Form("Proportion of uS with hit full copies per ASIC in FEB "
951 "#%03u; Time [s]; ASIC []; Copies MS fract. []",
952 uFebIdx);
953 fhStsFebSmxErrRatioCopySameAdcEvoAsic.push_back(new TProfile2D(sHistName, title, 1800, 0, 1800,
956 } // for( UInt_t uFebIdx = 0; uFebIdx < fuNbFebs; ++uFebIdx )
957 } // if( kTRUE == fbEnableCheckBugSmx20 )
959
960 fhMsErrorsEvo = new TH2I("fhMsErrorsEvo", "; MS index [s]; Error type []; Counts []", 600, 0.0, 600.0, 4, -0.5, 3.5);
962
963 // Miscroslice properties histos
964 for (Int_t component = 0; component < kiMaxNbFlibLinks; component++) {
965 fhMsSz[component] = NULL;
966 fhMsSzTime[component] = NULL;
967 } // for( Int_t component = 0; component < kiMaxNbFlibLinks; component ++ )
968
969 // Online histo browser commands
970 THttpServer* server = FairRunOnline::Instance()->GetHttpServer();
971 if (server) {
972 server->Register("/StsRaw", fhStsMessType);
973 server->Register("/StsRaw", fhStsSysMessType);
974 server->Register("/StsRaw", fhStsMessTypePerDpb);
975 server->Register("/StsRaw", fhStsSysMessTypePerDpb);
976 server->Register("/StsRaw", fhStsStatusMessType);
977 server->Register("/StsRaw", fhStsMsStatusFieldType);
978 server->Register("/StsRaw", fhStsMessTypePerElink);
979 server->Register("/StsRaw", fhStsHitsElinkPerDpb);
980 server->Register("/StsRaw", fhStsAllFebsHitRateEvo);
981 server->Register("/StsRaw", fhStsAllAsicsHitRateEvo);
982 server->Register("/StsRaw", fhStsFebAsicHitCounts);
983
984 for (UInt_t uFebIdx = 0; uFebIdx < fuNbFebs; ++uFebIdx) {
985 if (kTRUE == fUnpackParSts->IsFebActive(uFebIdx)) {
986 server->Register("/StsFeb", fhStsFebChanCntRaw[uFebIdx]);
987 server->Register("/StsFeb", fhStsFebChanCntRawGood[uFebIdx]);
988 server->Register("/StsFeb", fhStsFebChanAdcRaw[uFebIdx]);
989 server->Register("/StsFeb", fhStsFebChanAdcRawProf[uFebIdx]);
990 // server->Register("/StsFeb", fhStsFebChanAdcCal[ uFebIdx ] );
991 // server->Register("/StsFeb", fhStsFebChanAdcCalProf[ uFebIdx ] );
992 server->Register("/StsFeb", fhStsFebChanRawTs[uFebIdx]);
993 server->Register("/StsFeb", fhStsFebChanMissEvt[uFebIdx]);
994 server->Register("/StsFeb", fhStsFebChanMissEvtEvo[uFebIdx]);
995 server->Register("/StsFeb", fhStsFebAsicMissEvtEvo[uFebIdx]);
996 server->Register("/StsFeb", fhStsFebMissEvtEvo[uFebIdx]);
997 server->Register("/StsFeb", fhStsFebChanHitRateEvo[uFebIdx]);
998 server->Register("/StsFeb", fhStsFebChanHitRateProf[uFebIdx]);
999 server->Register("/StsFeb", fhStsFebAsicHitRateEvo[uFebIdx]);
1000 server->Register("/StsFeb", fhStsFebHitRateEvo[uFebIdx]);
1001 server->Register("/StsFeb", fhStsFebChanHitRateEvoLong[uFebIdx]);
1002 server->Register("/StsFeb", fhStsFebAsicHitRateEvoLong[uFebIdx]);
1003 server->Register("/StsFeb", fhStsFebHitRateEvoLong[uFebIdx]);
1004 server->Register("/StsFeb", fhStsFebChanDistT[uFebIdx]);
1005 server->Register("/StsFeb", fhStsFebChanCloseHitsCounts[uFebIdx]);
1006 server->Register("/StsFeb", fhStsFebChanCloseHitsRatio[uFebIdx]);
1007 /*
1008 for( UInt_t uFebIdxB = uFebIdx; uFebIdxB < fuNbFebs; ++uFebIdxB )
1009 {
1010 server->Register("/StsFeb", fhStsFebChanDtCoinc[ uFebIdx ][ uFebIdxB ] );
1011 server->Register("/StsFeb", fhStsFebChanCoinc[ uFebIdx ][ uFebIdxB ] );
1012 } // for( UInt_t uFebIdxB = uFebIdx; uFebIdxB < fuNbFebs; ++uFebIdxB )
1013*/
1014 if (kTRUE == fbEnableCheckBugSmx20) {
1015 server->Register("/StsSmxErr", fhStsFebSmxErrRatioEvo[uFebIdx]);
1016 server->Register("/StsSmxErr", fhStsFebSmxErrRatioEvoAsic[uFebIdx]);
1017 server->Register("/StsSmxErr", fhStsFebSmxErrRatioCopyEvo[uFebIdx]);
1018 server->Register("/StsSmxErr", fhStsFebSmxErrRatioCopyEvoAsic[uFebIdx]);
1019 server->Register("/StsSmxErr", fhStsFebSmxErrRatioCopySameAdcEvo[uFebIdx]);
1020 server->Register("/StsSmxErr", fhStsFebSmxErrRatioCopySameAdcEvoAsic[uFebIdx]);
1021 } // if( kTRUE == fbEnableCheckBugSmx20 )
1022 } // if( kTRUE == fUnpackParSts->IsFebActive( uFebIdx ) )
1023 } // for( UInt_t uFebIdx = 0; uFebIdx < fuNbFebs; ++uFebIdx )
1024
1025 server->Register("/StsRaw", fhMsErrorsEvo);
1026 /*
1027 for( UInt_t uModIdx = 0; uModIdx < fuNbModules; ++ uModIdx )
1028 {
1029 server->Register("/StsMod", fhStsModulePNCoincDt[ uModIdx ] );
1030 server->Register("/StsMod", fhStsModulePNCoincDtAsicP[ uModIdx ] );
1031 server->Register("/StsMod", fhStsModulePNCoincDtAsicN[ uModIdx ] );
1032 server->Register("/StsMod", fhStsModulePNCoincChan[ uModIdx ] );
1033 server->Register("/StsMod", fhStsModulePNCoincAdc[ uModIdx ] );
1034 server->Register("/StsMod", fhStsModuleCoincAdcChanP[ uModIdx ] );
1035 server->Register("/StsMod", fhStsModuleCoincAdcChanN[ uModIdx ] );
1036 server->Register("/StsMod", fhStsModuleCoincMap[ uModIdx ] );
1037 } // for( UInt_t uModIdx = 0; uModIdx < fuNbModules; ++ uModIdx )
1038*/
1039
1040 server->RegisterCommand("/Reset_All", "bMcbm2018ResetSts=kTRUE");
1041 server->RegisterCommand("/Write_All", "bMcbm2018WriteSts=kTRUE");
1042 server->RegisterCommand("/ScanNoisyCh", "bMcbm2018ScanNoisySts=kTRUE");
1043
1044
1045 server->Restrict("/Reset_All", "allow=admin");
1046 server->Restrict("/Write_All", "allow=admin");
1047 server->Restrict("/ScanNoisyCh", "allow=admin");
1048 } // if( server )
1049
1051 Double_t w = 10;
1052 Double_t h = 10;
1053
1054 // Summary per FEB
1055 fvcStsSumm.resize(fuNbFebs);
1056 fvcStsSmxErr.resize(fuNbFebs);
1057 for (UInt_t uFebIdx = 0; uFebIdx < fuNbFebs; ++uFebIdx) {
1058 if (kTRUE == fUnpackParSts->IsFebActive(uFebIdx)) {
1059 fvcStsSumm[uFebIdx] =
1060 new TCanvas(Form("cStsSum_%03u", uFebIdx), Form("Summary plots for FEB %03u", uFebIdx), w, h);
1061 fvcStsSumm[uFebIdx]->Divide(2, 3);
1062
1063 fvcStsSumm[uFebIdx]->cd(1);
1064 gPad->SetGridx();
1065 gPad->SetGridy();
1066 gPad->SetLogy();
1067 fhStsFebChanCntRaw[uFebIdx]->Draw();
1068
1069 fvcStsSumm[uFebIdx]->cd(2);
1070 gPad->SetGridx();
1071 gPad->SetGridy();
1072 gPad->SetLogy();
1073 fhStsFebChanHitRateProf[uFebIdx]->Draw("e0");
1074
1075 fvcStsSumm[uFebIdx]->cd(3);
1076 gPad->SetGridx();
1077 gPad->SetGridy();
1078 gPad->SetLogz();
1079 fhStsFebChanAdcRaw[uFebIdx]->Draw("colz");
1080
1081 fvcStsSumm[uFebIdx]->cd(4);
1082 gPad->SetGridx();
1083 gPad->SetGridy();
1084 // gPad->SetLogy();
1085 fhStsFebChanAdcRawProf[uFebIdx]->Draw();
1086
1087 fvcStsSumm[uFebIdx]->cd(5);
1088 gPad->SetGridx();
1089 gPad->SetGridy();
1090 gPad->SetLogz();
1091 fhStsFebChanHitRateEvo[uFebIdx]->Draw("colz");
1092
1093 fvcStsSumm[uFebIdx]->cd(6);
1094 gPad->SetGridx();
1095 gPad->SetGridy();
1096 // gPad->SetLogy();
1097 fhStsFebChanMissEvt[uFebIdx]->Draw("colz");
1098 /*
1099 fvcStsSumm[ uFebIdx ]->cd(5);
1100 gPad->SetGridx();
1101 gPad->SetGridy();
1102 gPad->SetLogz();
1103 fhStsFebChanAdcCal[ uFebIdx ]->Draw( "colz" );
1104
1105 fvcStsSumm[ uFebIdx ]->cd(6);
1106 gPad->SetGridx();
1107 gPad->SetGridy();
1108 // gPad->SetLogy();
1109 fhStsFebChanAdcCalProf[ uFebIdx ]->Draw();
1110*/
1111 server->Register("/canvases", fvcStsSumm[uFebIdx]);
1112
1113 if (kTRUE == fbEnableCheckBugSmx20) {
1114 fvcStsSmxErr[uFebIdx] =
1115 new TCanvas(Form("cStsSmxErr_%03u", uFebIdx), Form("SMX logic error plots for FEB %03u", uFebIdx), w, h);
1116 fvcStsSmxErr[uFebIdx]->Divide(2, 3);
1117
1118 fvcStsSmxErr[uFebIdx]->cd(1);
1119 gPad->SetGridx();
1120 gPad->SetGridy();
1121 gPad->SetLogy();
1122 fhStsFebSmxErrRatioEvo[uFebIdx]->Draw();
1123
1124 fvcStsSmxErr[uFebIdx]->cd(2);
1125 gPad->SetGridx();
1126 gPad->SetGridy();
1127 gPad->SetLogz();
1128 fhStsFebSmxErrRatioEvoAsic[uFebIdx]->Draw("colz");
1129
1130 fvcStsSmxErr[uFebIdx]->cd(3);
1131 gPad->SetGridx();
1132 gPad->SetGridy();
1133 gPad->SetLogy();
1134 fhStsFebSmxErrRatioCopyEvo[uFebIdx]->Draw();
1135
1136 fvcStsSmxErr[uFebIdx]->cd(4);
1137 gPad->SetGridx();
1138 gPad->SetGridy();
1139 gPad->SetLogz();
1140 fhStsFebSmxErrRatioCopyEvoAsic[uFebIdx]->Draw("colz");
1141
1142 fvcStsSmxErr[uFebIdx]->cd(5);
1143 gPad->SetGridx();
1144 gPad->SetGridy();
1145 gPad->SetLogy();
1146 fhStsFebSmxErrRatioCopySameAdcEvo[uFebIdx]->Draw();
1147
1148 fvcStsSmxErr[uFebIdx]->cd(6);
1149 gPad->SetGridx();
1150 gPad->SetGridy();
1151 gPad->SetLogz();
1152 fhStsFebSmxErrRatioCopySameAdcEvoAsic[uFebIdx]->Draw("colz");
1153
1154 server->Register("/canvases", fvcStsSmxErr[uFebIdx]);
1155 } // if( kTRUE == fbEnableCheckBugSmx20 )
1156 } // if( kTRUE == fUnpackParSts->IsFebActive( uFebIdx ) )
1157 } // for( UInt_t uFebIdx = 0; uFebIdx < fuNbFebs; ++uFebIdx )
1158
1159 //====================================================================//
1160
1161 //====================================================================//
1163 // Try to recover canvas in case it was created already by another monitor
1164 // If not existing, create it
1165 fcMsSizeAll = dynamic_cast<TCanvas*>(gROOT->FindObject("cMsSizeAll"));
1166 if (NULL == fcMsSizeAll) {
1167 fcMsSizeAll = new TCanvas("cMsSizeAll", "Evolution of MS size in last 300 s", w, h);
1168 fcMsSizeAll->Divide(4, 4);
1169 LOG(info) << "Created MS size canvas in STS monitor";
1170 } // if( NULL == fcMsSizeAll )
1171 else
1172 LOG(info) << "Recovered MS size canvas in STS monitor";
1173 server->Register("/canvases", fcMsSizeAll);
1174 //====================================================================//
1175
1176 /*****************************/
1177}
1178
1179Bool_t CbmMcbm2018MonitorSts::DoUnpack(const fles::Timeslice& ts, size_t component)
1180{
1181 if (bMcbm2018ResetSts) {
1183 bMcbm2018ResetSts = kFALSE;
1184 } // if( bMcbm2018ResetSts )
1185 if (bMcbm2018WriteSts) {
1187 bMcbm2018WriteSts = kFALSE;
1188 } // if( bMcbm2018WriteSts )
1191 bMcbm2018ScanNoisySts = kFALSE;
1192 } // if( bMcbm2018WriteSts )
1193
1194 LOG(debug) << "Timeslice contains " << ts.num_microslices(component) << "microslices.";
1195 fulCurrentTsIdx = ts.index();
1196
1198 if (0 == fulCurrentTsIdx) return kTRUE;
1199
1200 // Ignore overlap ms if flag set by user
1201 UInt_t uNbMsLoop = fuNbCoreMsPerTs;
1202 if (kFALSE == fbIgnoreOverlapMs) uNbMsLoop += fuNbOverMsPerTs;
1203
1204 // Loop over core microslices (and overlap ones if chosen)
1205 for (UInt_t uMsIdx = 0; uMsIdx < uNbMsLoop; uMsIdx++) {
1206 Double_t dMsTime = (1e-9) * static_cast<double>(ts.descriptor(fvMsComponentsList[0], uMsIdx).idx);
1207
1208 if (0 == fulCurrentTsIdx && 0 == uMsIdx) {
1209 for (UInt_t uMsCompIdx = 0; uMsCompIdx < fvMsComponentsList.size(); ++uMsCompIdx) {
1210 UInt_t uMsComp = fvMsComponentsList[uMsCompIdx];
1211 auto msDescriptor = ts.descriptor(uMsComp, uMsIdx);
1212 /*
1213 LOG(info) << "hi hv eqid flag si sv idx/start crc size offset";
1214 LOG(info) << Form( "%02x %02x %04x %04x %02x %02x %016llx %08x %08x %016llx",
1215 static_cast<unsigned int>(msDescriptor.hdr_id),
1216 static_cast<unsigned int>(msDescriptor.hdr_ver), msDescriptor.eq_id, msDescriptor.flags,
1217 static_cast<unsigned int>(msDescriptor.sys_id),
1218 static_cast<unsigned int>(msDescriptor.sys_ver), msDescriptor.idx, msDescriptor.crc,
1219 msDescriptor.size, msDescriptor.offset );
1220*/
1221 LOG(info) << FormatMsHeaderPrintout(msDescriptor);
1222 uint32_t uEqId = static_cast<uint32_t>(msDescriptor.eq_id & 0xFFFF);
1223 auto it = fDpbIdIndexMap.find(uEqId);
1224 if (fDpbIdIndexMap.end() == it) {
1225 LOG(warning) << "Could not find the sDPB index for AFCK id 0x" << std::hex << uEqId << std::dec
1226 << " component " << uMsCompIdx << "\n"
1227 << "If valid this index has to be added in the TOF parameter file "
1228 "in the RocIdArray field"
1229 << "\n"
1230 << "For now we remove it from the list of components analyzed";
1231 } // if( fDpbIdIndexMap.end() == it )
1232 } // for( UInt_t uMsCompIdx = 0; uMsCompIdx < fvMsComponentsList.size(); ++uMsCompIdx )
1233 } // if( 0 == fulCurrentTsIndex && 0 == uMsIdx )
1234
1235 // Loop over registered components
1236 for (UInt_t uMsCompIdx = 0; uMsCompIdx < fvMsComponentsList.size(); ++uMsCompIdx) {
1237 UInt_t uMsComp = fvMsComponentsList[uMsCompIdx];
1238
1239 if (kFALSE == ProcessStsMs(ts, uMsComp, uMsIdx)) return kFALSE;
1240 /*
1241 auto msDescriptor = ts.descriptor( uMsComp, uMsIdx );
1242 fuCurrentEquipmentId = msDescriptor.eq_id;
1243 const uint8_t* msContent = reinterpret_cast<const uint8_t*>( ts.content( uMsComp, uMsIdx ) );
1244
1245 uint32_t uSize = msDescriptor.size;
1246 fulCurrentMsIdx = msDescriptor.idx;
1247 dMsTime = (1e-9) * static_cast<double>(fulCurrentMsIdx);
1248 LOG(debug) << "Microslice: " << fulCurrentMsIdx
1249 << " from EqId " << std::hex << fuCurrentEquipmentId << std::dec
1250 << " has size: " << uSize;
1251
1252 fuCurrDpbId = static_cast< uint32_t >( fuCurrentEquipmentId & 0xFFFF );
1253 fuCurrDpbIdx = fDpbIdIndexMap[ fuCurrDpbId ];
1254
1255 if( uMsComp < kiMaxNbFlibLinks )
1256 {
1257 if( fdStartTimeMsSz < 0 )
1258 fdStartTimeMsSz = dMsTime;
1259 fhMsSz[ uMsComp ]->Fill( uSize );
1260 fhMsSzTime[ uMsComp ]->Fill( dMsTime - fdStartTimeMsSz, uSize);
1261 } // if( uMsComp < kiMaxNbFlibLinks )
1262
1264 if( static_cast<Int_t>( fvdMsTime[ uMsCompIdx ] ) < static_cast<Int_t>( dMsTime ) )
1265 {
1267 UInt_t uFebIdxOffset = fUnpackParSts->GetNbFebsPerDpb() * fuCurrDpbIdx;
1268 for( UInt_t uFebIdx = 0; uFebIdx < fUnpackParSts->GetNbFebsPerDpb(); ++uFebIdx )
1269 {
1270 UInt_t uFebIdxInSyst = uFebIdxOffset + uFebIdx;
1271
1273 if( 0 == fviFebTimeSecLastRateUpdate[uFebIdxInSyst] )
1274 {
1275 fviFebTimeSecLastRateUpdate[uFebIdxInSyst] = static_cast<Int_t>( dMsTime );
1276 fviFebCountsSinceLastRateUpdate[uFebIdxInSyst] = 0;
1277 for( UInt_t uChan = 0; uChan < fUnpackParSts->GetNbChanPerFeb(); ++uChan )
1278 fvdFebChanCountsSinceLastRateUpdate[uFebIdxInSyst][uChan] = 0.0;
1279 continue;
1280 } // if( 0 == fviFebTimeSecLastRateUpdate[uFebIdxInSyst] )
1281
1282 Int_t iTimeInt = static_cast<Int_t>( dMsTime ) - fviFebTimeSecLastRateUpdate[uFebIdxInSyst];
1283 if( fiTimeIntervalRateUpdate <= iTimeInt )
1284 {
1286 if( 0 == fviFebCountsSinceLastRateUpdate[uFebIdxInSyst] )
1287 {
1288 fviFebTimeSecLastRateUpdate[uFebIdxInSyst] = dMsTime;
1289 continue;
1290 } // if( 0 == fviFebCountsSinceLastRateUpdate[uFebIdxInSyst] )
1291
1292 for( UInt_t uChan = 0; uChan < fUnpackParSts->GetNbChanPerFeb(); ++uChan )
1293 {
1294 fhStsFebChanHitRateProf[uFebIdxInSyst]->Fill( uChan,
1295 fvdFebChanCountsSinceLastRateUpdate[uFebIdxInSyst][uChan] / iTimeInt );
1296 fvdFebChanCountsSinceLastRateUpdate[uFebIdxInSyst][uChan] = 0.0;
1297 } // for( UInt_t uChan = 0; uChan < fUnpackParSts->GetNbChanPerFeb(); ++uChan )
1298
1299 fviFebTimeSecLastRateUpdate[uFebIdxInSyst] = dMsTime;
1300 fviFebCountsSinceLastRateUpdate[uFebIdxInSyst] = 0;
1301 } // if( fiTimeIntervalRateUpdate <= iTimeInt )
1302 } // for( UInt_t uFebIdx = 0; uFebIdx < fUnpackParSts->GetNbFebsPerDpb(); ++uFebIdx )
1303 } // if( static_cast<Int_t>( fvdMsTime[ uMsCompIdx ] ) < static_cast<Int_t>( dMsTime ) )
1304
1305 // Store MS time for coincidence plots
1306 fvdMsTime[ uMsCompIdx ] = dMsTime;
1307
1309 UInt_t uTsMsbCycleHeader = std::floor( fulCurrentMsIdx /
1310 ( stsxyter::kulTsCycleNbBins * stsxyter::kdClockCycleNs ) )
1311 - fvuInitialTsMsbCycleHeader[ fuCurrDpbIdx ];
1312 if( kFALSE == fvuInitialHeaderDone[ fuCurrDpbIdx ] )
1313 {
1314 fvuInitialTsMsbCycleHeader[ fuCurrDpbIdx ] = uTsMsbCycleHeader;
1315 fvuInitialHeaderDone[ fuCurrDpbIdx ] = kTRUE;
1316 } // if( kFALSE == fvuInitialHeaderDone[ fuCurrDpbIdx ] )
1317 else if( uTsMsbCycleHeader != fvuCurrentTsMsbCycle[ fuCurrDpbIdx ] &&
1318 4194303 != fvulCurrentTsMsb[fuCurrDpbIdx] )
1319 {
1320 LOG(warning) << "TS MSB cycle from MS header does not match current cycle from data "
1321 << "for TS " << std::setw( 12 ) << fulCurrentTsIdx
1322 << " MS " << std::setw( 12 ) << fulCurrentMsIdx
1323 << " MsInTs " << std::setw( 3 ) << uMsIdx
1324 << " ====> " << fvuCurrentTsMsbCycle[ fuCurrDpbIdx ]
1325 << " VS " << uTsMsbCycleHeader;
1326 fvuCurrentTsMsbCycle[ fuCurrDpbIdx ] = uTsMsbCycleHeader;
1327 }
1328
1329 // If not integer number of message in input buffer, print warning/error
1330 if( 0 != ( uSize % kuBytesPerMessage ) )
1331 LOG(error) << "The input microslice buffer does NOT "
1332 << "contain only complete nDPB messages!";
1333
1334 // Compute the number of complete messages in the input microslice buffer
1335 uint32_t uNbMessages = ( uSize - ( uSize % kuBytesPerMessage ) )
1336 / kuBytesPerMessage;
1337
1338 // Prepare variables for the loop on contents
1339 const uint32_t* pInBuff = reinterpret_cast<const uint32_t*>( msContent );
1340
1341 for( uint32_t uIdx = 0; uIdx < uNbMessages; ++uIdx )
1342 {
1343 // Fill message
1344 uint32_t ulData = static_cast<uint32_t>( pInBuff[uIdx] );
1345
1346 stsxyter::Message mess( static_cast< uint32_t >( ulData & 0xFFFFFFFF ) );
1347
1348 // Print message if requested
1349 if( fbPrintMessages )
1350 mess.PrintMess( std::cout, fPrintMessCtrl );
1351
1352 if( 1000 == fulCurrentTsIdx )
1353 {
1354 mess.PrintMess( std::cout, fPrintMessCtrl );
1355 } // if( 0 == fulCurrentTsIdx )
1356
1357 stsxyter::MessType typeMess = mess.GetMessType();
1358 fmMsgCounter[ typeMess ] ++;
1359 fhStsMessType->Fill( static_cast< uint16_t > (typeMess) );
1360 fhStsMessTypePerDpb->Fill( fuCurrDpbIdx, static_cast< uint16_t > (typeMess) );
1361
1362 switch( typeMess )
1363 {
1364 case stsxyter::MessType::Hit :
1365 {
1366 // Extract the eLink and Asic indices => Should GO IN the fill method now that obly hits are link/asic specific!
1367 UShort_t usElinkIdx = mess.GetLinkIndex();
1368 UInt_t uCrobIdx = usElinkIdx / fUnpackParSts->GetNbElinkPerCrob();
1369 Int_t uFebIdx = fUnpackParSts->ElinkIdxToFebIdx( usElinkIdx );
1370 if( -1 == uFebIdx )
1371 {
1372 LOG(warning) << "CbmMcbm2018MonitorSts::DoUnpack => "
1373 << "Wrong elink Idx!";
1374 continue;
1375 } // if( -1 == uFebIdx )
1376
1377 UInt_t uAsicIdx = ( fuCurrDpbIdx * fUnpackParSts->GetNbCrobsPerDpb() + uCrobIdx
1378 ) * fUnpackParSts->GetNbAsicsPerCrob()
1379 + fUnpackParSts->ElinkIdxToAsicIdx( 1 == fviFebType[ fuCurrDpbIdx ][ uCrobIdx ][ uFebIdx ],
1380 usElinkIdx );
1381
1382 FillHitInfo( mess, usElinkIdx, uAsicIdx, uMsIdx );
1383 break;
1384 } // case stsxyter::MessType::Hit :
1385 case stsxyter::MessType::TsMsb :
1386 {
1387 FillTsMsbInfo( mess, uIdx, uMsIdx );
1388 break;
1389 } // case stsxyter::MessType::TsMsb :
1390 case stsxyter::MessType::Epoch :
1391 {
1392 // The first message in the TS is a special ones: EPOCH
1393 FillEpochInfo( mess );
1394
1395 if( 0 < uIdx )
1396 LOG(info) << "CbmMcbm2018MonitorSts::DoUnpack => "
1397 << "EPOCH message at unexpected position in MS: message "
1398 << uIdx << " VS message 0 expected!";
1399 break;
1400 } // case stsxyter::MessType::TsMsb :
1401 case stsxyter::MessType::Empty :
1402 {
1403// FillTsMsbInfo( mess );
1404 break;
1405 } // case stsxyter::MessType::Empty :
1406 case stsxyter::MessType::Dummy :
1407 {
1408 break;
1409 } // case stsxyter::MessType::Dummy / ReadDataAck / Ack :
1410 default:
1411 {
1412 LOG(fatal) << "CbmMcbm2018MonitorSts::DoUnpack => "
1413 << "Unknown message type, should never happen, stopping here!";
1414 }
1415 } // switch( mess.GetMessType() )
1416 } // for( uint32_t uIdx = 0; uIdx < uNbMessages; ++uIdx )
1417*/
1418 } // for( UInt_t uMsComp = 0; uMsComp < fvMsComponentsList.size(); ++uMsComp )
1419
1421 // Sort the buffer of hits
1422 std::sort(fvmHitsInMs.begin(), fvmHitsInMs.end());
1423
1424 // Time differences plotting using the fully time sorted hits
1425 if (0 < fvmHitsInMs.size()) {
1426 // ULong64_t ulLastHitTime = ( *( fvmHitsInMs.rbegin() ) ).GetTs();
1427 std::vector<stsxyter::FinalHit>::iterator itA;
1428 // comment unused variable, FU, 18.01.21 std::vector<stsxyter::FinalHit>::iterator itB;
1429
1430 // std::chrono::steady_clock::time_point tNow = std::chrono::steady_clock::now();
1431 // Double_t dUnixTimeInRun = std::chrono::duration_cast< std::chrono::seconds >(tNow - ftStartTimeUnix).count();
1432
1433 for (itA = fvmHitsInMs.begin(); itA != fvmHitsInMs.end();
1434 // itA != fvmHitsInMs.end() && (*itA).GetTs() < ulLastHitTime - 320; // 320 * 3.125 ns = 1000 ns
1435 ++itA) {
1436 UShort_t usAsicIdx = (*itA).GetAsic();
1437 // UShort_t usChanIdx = (*itA).GetChan();
1438 // ULong64_t ulHitTs = (*itA).GetTs();
1439 // UShort_t usHitAdc = (*itA).GetAdc();
1440 UShort_t usFebIdx = usAsicIdx / fUnpackParSts->GetNbAsicsPerFeb();
1441 // UShort_t usAsicInFeb = usAsicIdx % fUnpackParSts->GetNbAsicsPerFeb();
1442
1443 // Double_t dTimeSinceStartSec = (ulHitTs * stsxyter::kdClockCycleNs - fdStartTime)* 1e-9;
1444
1445 fvmAsicHitsInMs[usAsicIdx].push_back((*itA));
1446 fvmFebHitsInMs[usFebIdx].push_back((*itA));
1447 /*
1448 if( 1000 == fulCurrentTsIdx )
1449 {
1450 LOG(info) << Form( "FEB %02u ASIC %u Chan %03u TS %12u ADC %2u Time %8.3f",
1451 usFebIdx, usAsicInFeb, usChanIdx, ulHitTs, usHitAdc,
1452 ulHitTs* stsxyter::kdClockCycleNs );
1453 } // if( 0 == fulCurrentTsIdx )
1454*/
1455 } // loop on time sorted hits and split per asic/feb
1456
1457 // Remove all hits which were already used
1458 fvmHitsInMs.erase(fvmHitsInMs.begin(), itA);
1459
1461 Bool_t bHitCopyInThisMs[fuNbStsXyters];
1462 Bool_t bHitCopySameAdcInThisMs[fuNbStsXyters];
1463 Bool_t bFlagOnInThisMs[fuNbStsXyters];
1464 if (kTRUE == fbEnableCheckBugSmx20)
1465 for (UInt_t uAsic = 0; uAsic < fuNbStsXyters; uAsic++) {
1466 bHitCopyInThisMs[uAsic] = kFALSE;
1467 bHitCopySameAdcInThisMs[uAsic] = kFALSE;
1468 bFlagOnInThisMs[uAsic] = kFALSE;
1469 } // for( UInt_t uAsic = 0; uAsic < fuNbStsXyters; uAsic++)
1471
1472 for (UInt_t uAsic = 0; uAsic < fuNbStsXyters; uAsic++) {
1473 UInt_t uFebIdx = uAsic / fUnpackParSts->GetNbAsicsPerFeb();
1474 UInt_t uAsicInFeb = uAsic % fUnpackParSts->GetNbAsicsPerFeb();
1475
1476 std::vector<ULong64_t> vulLastHitTs(fUnpackParSts->GetNbChanPerAsic(), 0);
1477 std::vector<UShort_t> vusLastHitAdc(fUnpackParSts->GetNbChanPerAsic(), 0);
1478
1479 for (itA = fvmAsicHitsInMs[uAsic].begin(); itA != fvmAsicHitsInMs[uAsic].end(); ++itA) {
1480 // UShort_t usAsicIdx = (*itA).GetAsic();
1481 UShort_t usChanIdx = (*itA).GetChan();
1482 ULong64_t ulHitTs = (*itA).GetTs();
1483 UShort_t usHitAdc = (*itA).GetAdc();
1484
1485 UInt_t uChanInFeb = usChanIdx + fUnpackParSts->GetNbChanPerAsic() * uAsicInFeb;
1486
1488 if (kTRUE == fbEnableCheckBugSmx20) {
1490 Bool_t bIsNotCopy = kTRUE;
1491 if (vulLastHitTs[usChanIdx] == ulHitTs) {
1492 bIsNotCopy = kFALSE;
1493 bHitCopyInThisMs[uAsic] = kTRUE;
1494 if (vusLastHitAdc[usChanIdx] == usHitAdc) bHitCopySameAdcInThisMs[uAsic] = kTRUE;
1495 } // if( vulLastHitTs[ usChanIdx ] == ulHitTs)
1496
1497 vulLastHitTs[usChanIdx] = ulHitTs;
1498 vusLastHitAdc[usChanIdx] = usHitAdc;
1499
1500 if (bIsNotCopy) {
1501 fhStsFebChanCntRawGood[uFebIdx]->Fill(uChanInFeb);
1502 bFlagOnInThisMs[uAsic] |= SmxErrCheckCoinc(uFebIdx, uAsicInFeb, ulHitTs * stsxyter::kdClockCycleNs);
1503 } // if( bIsNotCopy )
1504 } // if( kTRUE == fbEnableCheckBugSmx20 )
1506 } // for( it = fvmAsicHitsInMs[ uAsic ].begin(); it != fvmAsicHitsInMs[ uAsic ].end(); ++it )
1507
1509 fvmAsicHitsInMs[uAsic].clear();
1510 } // for( UInt_t uAsic = 0; uAsic < fuNbStsXyters; uAsic++)
1511
1513 if (kTRUE == fbEnableCheckBugSmx20) {
1514 std::vector<Bool_t> vbCopyOnAnyAsicMs(fuNbFebs, kFALSE);
1515 std::vector<Bool_t> vbCopySameAdcOnAnyAsicMs(fuNbFebs, kFALSE);
1516 std::vector<Bool_t> vbFlagOnAnyAsicMs(fuNbFebs, kFALSE);
1517 // Bool_t bCopyOnAnyMs = kFALSE;
1518 // Bool_t bCopySameAdcOnAnyMs = kFALSE;
1519 // Bool_t bFlagOnAnyMs = kFALSE;
1520 for (UInt_t uAsic = 0; uAsic < fuNbStsXyters; uAsic++) {
1521 UInt_t uFebIdx = uAsic / fUnpackParSts->GetNbAsicsPerFeb();
1522 UInt_t uAsicInFeb = uAsic % fUnpackParSts->GetNbAsicsPerFeb();
1523
1524 fhStsFebSmxErrRatioCopyEvoAsic[uFebIdx]->Fill(dMsTime - fdStartTimeMsSz, uAsicInFeb,
1525 bHitCopyInThisMs[uAsic] ? 1.0 : 0.0);
1526
1527 fhStsFebSmxErrRatioCopySameAdcEvoAsic[uFebIdx]->Fill(dMsTime - fdStartTimeMsSz, uAsicInFeb,
1528 bHitCopySameAdcInThisMs[uAsic] ? 1.0 : 0.0);
1529
1530 fhStsFebSmxErrRatioEvoAsic[uFebIdx]->Fill(dMsTime - fdStartTimeMsSz, uAsicInFeb,
1531 bFlagOnInThisMs[uAsic] ? 1.0 : 0.0);
1532
1533 vbCopyOnAnyAsicMs[uFebIdx] = vbCopyOnAnyAsicMs[uFebIdx] || bHitCopyInThisMs[uAsic];
1534 vbCopySameAdcOnAnyAsicMs[uFebIdx] = vbCopySameAdcOnAnyAsicMs[uFebIdx] || bHitCopySameAdcInThisMs[uAsic];
1535 vbFlagOnAnyAsicMs[uFebIdx] = vbFlagOnAnyAsicMs[uFebIdx] || bFlagOnInThisMs[uAsic];
1536
1537 // bCopyOnAnyMs |= bHitCopyInThisMs[uAsic];
1538 // bCopySameAdcOnAnyMs |= bHitCopySameAdcInThisMs[uAsic];
1539 // bFlagOnAnyMs |= bFlagOnInThisMs[uAsic];
1540 } // for( UInt_t uAsic = 0; uAsic < fuNbStsXyters; uAsic++)
1541
1542 for (UInt_t uFebIdx = 0; uFebIdx < fuNbFebs; ++uFebIdx) {
1543 fhStsFebSmxErrRatioCopyEvo[uFebIdx]->Fill(dMsTime - fdStartTimeMsSz, vbCopyOnAnyAsicMs[uFebIdx] ? 1.0 : 0.0);
1544 fhStsFebSmxErrRatioCopySameAdcEvo[uFebIdx]->Fill(dMsTime - fdStartTimeMsSz,
1545 vbCopySameAdcOnAnyAsicMs[uFebIdx] ? 1.0 : 0.0);
1546 fhStsFebSmxErrRatioEvo[uFebIdx]->Fill(dMsTime - fdStartTimeMsSz, vbFlagOnAnyAsicMs[uFebIdx] ? 1.0 : 0.0);
1547 } // for( UInt_t uFebIdx = 0; uFebIdx < fuNbFebs; ++uFebIdx )
1548 } // if( kTRUE == fbEnableCheckBugSmx20 )
1550
1551 for (UInt_t uFebIdx = 0; uFebIdx < fuNbFebs; ++uFebIdx) {
1552 /*
1553 if( kTRUE == fbEnableCoincidenceMaps )
1554 {
1555 UInt_t uFebA = uFebIdx % fUnpackParSts->GetNbFebsPerCrob();
1556 UInt_t uCrobIdxA = ( uFebIdx / fUnpackParSts->GetNbFebsPerCrob() ) % fUnpackParSts->GetNbCrobsPerDpb();
1557 UInt_t uDpbIdxA = ( uFebIdx / fUnpackParSts->GetNbFebsPerCrob() ) / fUnpackParSts->GetNbCrobsPerDpb();
1558
1559 for( itA = fvmFebHitsInMs[ uFebIdx ].begin(); itA != fvmFebHitsInMs[ uFebIdx ].end(); ++itA )
1560 {
1561 UShort_t usAsicIdxA = (*itA).GetAsic();
1562 UShort_t usAsicInFebA = usAsicIdxA % fUnpackParSts->GetNbAsicsPerFeb();
1563 UShort_t usChanIdxA = (*itA).GetChan();
1564 UInt_t uChanInFebA = usChanIdxA + fUnpackParSts->GetNbChanPerAsic() * usAsicInFebA;
1565 ULong64_t ulHitTsA = (*itA).GetTs();
1566 Double_t dHitTsA = ulHitTsA * stsxyter::kdClockCycleNs;
1567
1569 if( -1 < fdStsFebChanLastTimeForDist[ uFebIdx ][ uChanInFebA ] )
1570 {
1571 fhStsFebChanDistT[ uFebIdx ]->Fill( dHitTsA - fdStsFebChanLastTimeForDist[ uFebIdx ][ uChanInFebA ],
1572 uChanInFebA );
1573 } // if( -1 < fdStsFebChanLastTimeForDist[ uFebIdx ][ uChanInFebA ] )
1574 fdStsFebChanLastTimeForDist[ uFebIdx ][ uChanInFebA ] = dHitTsA;
1575
1576 for( UInt_t uFebIdxB = uFebIdx; uFebIdxB < fuNbFebs; ++uFebIdxB )
1577 {
1579 Bool_t bSameModulePNsides = kFALSE;
1580 Double_t dBestDtMatch = 1e9; // ns
1581 std::vector< stsxyter::FinalHit >::iterator itBestMatch;
1582 UInt_t uFebB = uFebIdxB % fUnpackParSts->GetNbFebsPerCrob();
1583 UInt_t uCrobIdxB = ( uFebIdxB / fUnpackParSts->GetNbFebsPerCrob() ) % fUnpackParSts->GetNbCrobsPerDpb();
1584 UInt_t uDpbIdxB = ( uFebIdxB / fUnpackParSts->GetNbFebsPerCrob() ) / fUnpackParSts->GetNbCrobsPerDpb();
1585 if( fviFebModuleIdx[ uDpbIdxA ][ uCrobIdxA ][ uFebA ] == fviFebModuleIdx[ uDpbIdxB ][ uCrobIdxB ][ uFebB ] &&
1586 fviFebModuleSide[ uDpbIdxA ][ uCrobIdxA ][ uFebA ] != fviFebModuleSide[ uDpbIdxB ][ uCrobIdxB ][ uFebB ] )
1587 bSameModulePNsides = kTRUE;
1588
1589 for( itB = fvmFebHitsInMs[ uFebIdxB ].begin(); itB != fvmFebHitsInMs[ uFebIdxB ].end(); ++itB )
1590 {
1591 UShort_t usAsicIdxB = (*itB).GetAsic();
1592 UShort_t usChanIdxB = (*itB).GetChan();
1593 UInt_t uChanInFebB = usChanIdxB + fUnpackParSts->GetNbChanPerAsic() * (usAsicIdxB % fUnpackParSts->GetNbAsicsPerFeb());
1594
1595 if( uFebIdx == uFebIdxB && uChanInFebA == uChanInFebB )
1596 continue;
1597
1598 ULong64_t ulHitTsB = (*itB).GetTs();
1599 Double_t dHitTsB = ulHitTsB * stsxyter::kdClockCycleNs;
1600 Double_t dDtClk = static_cast< Double_t >( ulHitTsB ) - static_cast< Double_t >( ulHitTsA );
1601 Double_t dDt = dDtClk * stsxyter::kdClockCycleNs;
1602
1603 fhStsFebChanDtCoinc[ uFebIdx ][ uFebIdxB ]->Fill( dDt );
1604
1606 if( -1.0 * fdFebChanCoincidenceLimit < dDt )
1607 {
1609 if( fdFebChanCoincidenceLimit < dDt )
1610 break;
1611
1612 fhStsFebChanCoinc[ uFebIdx ][ uFebIdxB ]->Fill( uChanInFebA, uChanInFebB );
1613
1615 if( kTRUE == bSameModulePNsides )
1616 {
1618 if( TMath::Abs( dDt ) < TMath::Abs( dBestDtMatch ) )
1619 {
1620 itBestMatch = itB;
1621 dBestDtMatch = dDt;
1622 } // if( dDt < dBestDtMatch )
1623 } // if same module and opposite sides
1624 } // if( -1.0 * fdFebChanCoincidenceLimit < dDt )
1625 } // for( itB = fvmFebHitsInMs[ uFebIdxB ].begin(); itB != fvmFebHitsInMs[ uFebIdxB ].end(); ++itB )
1626
1628 if( kTRUE == bSameModulePNsides && dBestDtMatch < fdFebChanCoincidenceLimit )
1629 {
1630 UInt_t uModIdx = fviFebModuleIdx[ uDpbIdxA ][ uCrobIdxA ][ uFebA ];
1631
1632 UShort_t usAsicIdxB = (*itB).GetAsic();
1633 UShort_t usAsicInFebB = usAsicIdxB % fUnpackParSts->GetNbAsicsPerFeb();
1634 UShort_t usChanIdxB = (*itB).GetChan();
1635 UInt_t uChanInFebB = usChanIdxB + fUnpackParSts->GetNbChanPerAsic() * usAsicInFebB;
1636
1637 UShort_t usAdcA = (*itA).GetAdc();
1638 UShort_t usAdcB = (*itBestMatch).GetAdc();
1639 Double_t dPosX = 0.0;
1640 Double_t dPosY = 0.0;
1641
1642 fhStsModulePNCoincDt[ uModIdx ]->Fill( dBestDtMatch );
1643 if( 0 == fviFebModuleSide[ uDpbIdxA ][ uCrobIdxA ][ uFebA ] )
1644 {
1646 fUnpackParSts->ComputeModuleCoordinates( uModIdx, uChanInFebB, uChanInFebA, dPosX, dPosY );
1647
1649 fhStsModulePNCoincChan[ uModIdx ]->Fill( uChanInFebA, uChanInFebB );
1650 fhStsModulePNCoincAdc[ uModIdx ]->Fill( usAdcA, usAdcB );
1651 fhStsModuleCoincAdcChanP[ uModIdx ]->Fill( uChanInFebA, usAdcA );
1652 fhStsModuleCoincAdcChanN[ uModIdx ]->Fill( uChanInFebB, usAdcB );
1653 fhStsModulePNCoincDtAsicP[ uModIdx ]->Fill( dBestDtMatch, usAsicInFebA );
1654 fhStsModulePNCoincDtAsicN[ uModIdx ]->Fill( dBestDtMatch, usAsicInFebB );
1655 fhStsModuleCoincMap[ uModIdx ]->Fill( dPosX, dPosY );
1656 } // if( 0 == fviFebModuleSide[ uDpbIdxA ][ uCrobIdxA ][ uFebA ] )
1657 else
1658 {
1660 fUnpackParSts->ComputeModuleCoordinates( uModIdx, uChanInFebA, uChanInFebB, dPosX, dPosY );
1661
1663 fhStsModulePNCoincChan[ uModIdx ]->Fill( uChanInFebB, uChanInFebA );
1664 fhStsModulePNCoincAdc[ uModIdx ]->Fill( usAdcB, usAdcA );
1665 fhStsModuleCoincAdcChanP[ uModIdx ]->Fill( uChanInFebB, usAdcB );
1666 fhStsModuleCoincAdcChanN[ uModIdx ]->Fill( uChanInFebA, usAdcA );
1667 fhStsModulePNCoincDtAsicP[ uModIdx ]->Fill( dBestDtMatch, usAsicInFebB );
1668 fhStsModulePNCoincDtAsicN[ uModIdx ]->Fill( dBestDtMatch, usAsicInFebA );
1669 fhStsModuleCoincMap[ uModIdx ]->Fill( dPosX, dPosY );
1670 } // else of if( 0 == fviFebModuleSide[ uDpbIdxA ][ uCrobIdxA ][ uFebA ] )
1671
1673 fhStsModuleCoincMap[ uModIdx ]->Fill( dPosX, dPosY );
1674 } // if same module and opposite sides
1675 } // for( UInt_t uFebIdxB = uFebIdx; uFebIdxB < fuNbFebs; ++uFebIdxB )
1676 } // for( itA = fvmFebHitsInMs[ uFebIdx ].begin(); itA != fvmFebHitsInMs[ uFebIdx ].end(); ++itA )
1677 } // if( kTRUE == fbEnableCoincidenceMaps )
1678*/
1680 fvmFebHitsInMs[uFebIdx].clear();
1681 } // for( UInt_t uFebIdx = 0; uFebIdx < fuNbFebs; ++uFebIdx )
1682 } // if( 0 < fvmHitsInMs.size() )
1683 } // for( UInt_t uMsIdx = 0; uMsIdx < uNbMsLoop; uMsIdx ++ )
1684
1685 for (UInt_t uMsIdx = 0; uMsIdx < fuMaxNbMicroslices; ++uMsIdx) {
1686 fvdMsTime[uMsIdx] = 0.0;
1687 } // for( UInt_t uMsIdx = 0; uMsIdx < fuMaxNbMicroslices; ++uMsIdx )
1688
1689 if (0 == ts.index() % 1000) {
1690 for (UInt_t uDpb = 0; uDpb < fuNrOfDpbs; ++uDpb) {
1691 Double_t dTsMsbTime =
1692 static_cast<ULong64_t>(stsxyter::kuHitNbTsBins) * static_cast<ULong64_t>(fvulCurrentTsMsb[fuCurrDpbIdx])
1693 + static_cast<ULong64_t>(stsxyter::kulTsCycleNbBins)
1694 * static_cast<ULong64_t>(fvuCurrentTsMsbCycle[fuCurrDpbIdx]);
1695 dTsMsbTime *= stsxyter::kdClockCycleNs * 1e-9;
1696
1697 LOG(info) << "End of TS " << std::setw(7) << ts.index() << " eDPB " << std::setw(2) << uDpb
1698 << " current TS MSB counter is " << std::setw(12) << fvulCurrentTsMsb[uDpb]
1699 << " current TS MSB cycle counter is " << std::setw(12) << fvuCurrentTsMsbCycle[uDpb]
1700 << " current TS MSB time is " << std::setw(12) << dTsMsbTime << " s";
1701 }
1702 } // if( 0 == ts.index() % 1000 )
1703
1704 if (0 == ts.index() % 10000) SaveAllHistos("data/PulserPeriodicHistosSave.root");
1705
1706 return kTRUE;
1707}
1708
1709Bool_t CbmMcbm2018MonitorSts::ProcessStsMs(const fles::Timeslice& ts, size_t uMsComp, UInt_t uMsIdx)
1710{
1711 auto msDescriptor = ts.descriptor(uMsComp, uMsIdx);
1712 fuCurrentEquipmentId = msDescriptor.eq_id;
1713 const uint8_t* msContent = reinterpret_cast<const uint8_t*>(ts.content(uMsComp, uMsIdx));
1714
1715 fulCurrentTsIdx = ts.index();
1716 if (0 == fvbMaskedComponents.size()) fvbMaskedComponents.resize(ts.num_components(), kFALSE);
1717
1718 if (0 == fulCurrentTsIdx && 0 == uMsIdx) {
1719 /*
1720 LOG(info) << "hi hv eqid flag si sv idx/start crc size offset";
1721 LOG(info) << Form( "%02x %02x %04x %04x %02x %02x %016llx %08x %08x %016llx",
1722 static_cast<unsigned int>(msDescriptor.hdr_id),
1723 static_cast<unsigned int>(msDescriptor.hdr_ver), msDescriptor.eq_id, msDescriptor.flags,
1724 static_cast<unsigned int>(msDescriptor.sys_id),
1725 static_cast<unsigned int>(msDescriptor.sys_ver), msDescriptor.idx, msDescriptor.crc,
1726 msDescriptor.size, msDescriptor.offset );
1727*/
1728 LOG(info) << FormatMsHeaderPrintout(msDescriptor);
1729 } // if( 0 == fulCurrentTsIndex && 0 == uMsIdx )
1730 if (kFALSE == fvbMaskedComponents[uMsComp] && 0 == uMsIdx) {
1731 auto it = fDpbIdIndexMap.find(fuCurrentEquipmentId);
1732 if (fDpbIdIndexMap.end() == it) {
1733 LOG(warning) << "Could not find the sDPB index for AFCK id 0x" << std::hex << fuCurrentEquipmentId << std::dec
1734 << " component " << uMsComp << "\n"
1735 << "If valid this index has to be added in the TOF parameter file in "
1736 "the RocIdArray field"
1737 << "\n"
1738 << "For now we remove it from the list of components analyzed";
1739 fvbMaskedComponents[uMsComp] = kTRUE;
1740 } // if( fDpbIdIndexMap.end() == it )
1741
1742 } // if( kFALSE == fvbMaskedComponents[ uMsComp ] && 0 == uMsIdx )
1743
1744 if (kTRUE == fvbMaskedComponents[uMsComp]) return kTRUE;
1745
1746 uint32_t uSize = msDescriptor.size;
1747 fulCurrentMsIdx = msDescriptor.idx;
1748 Double_t dMsTime = (1e-9) * static_cast<double>(fulCurrentMsIdx);
1749 LOG(debug) << "Microslice: " << fulCurrentMsIdx << " from EqId " << std::hex << fuCurrentEquipmentId << std::dec
1750 << " has size: " << uSize;
1751
1752 fuCurrDpbId = static_cast<uint32_t>(fuCurrentEquipmentId & 0xFFFF);
1754
1755 if (uMsComp < kiMaxNbFlibLinks) {
1756 if (fdStartTimeMsSz < 0) fdStartTimeMsSz = dMsTime;
1757 fhMsSz[uMsComp]->Fill(uSize);
1758 fhMsSzTime[uMsComp]->Fill(dMsTime - fdStartTimeMsSz, uSize);
1759 } // if( uMsComp < kiMaxNbFlibLinks )
1760
1762 if (static_cast<Int_t>(fvdPrevMsTime[uMsComp]) < static_cast<Int_t>(dMsTime)) {
1764 UInt_t uFebIdxOffset = fUnpackParSts->GetNbFebsPerDpb() * fuCurrDpbIdx;
1765 for (UInt_t uFebIdx = 0; uFebIdx < fUnpackParSts->GetNbFebsPerDpb(); ++uFebIdx) {
1766 UInt_t uFebIdxInSyst = uFebIdxOffset + uFebIdx;
1767
1769 if (fvdFebTimeSecLastRateUpdate[uFebIdxInSyst] < 0.0) {
1770 fvdFebTimeSecLastRateUpdate[uFebIdxInSyst] = dMsTime;
1771 fviFebCountsSinceLastRateUpdate[uFebIdxInSyst] = 0;
1772 for (UInt_t uChan = 0; uChan < fUnpackParSts->GetNbChanPerFeb(); ++uChan)
1773 fvdFebChanCountsSinceLastRateUpdate[uFebIdxInSyst][uChan] = 0.0;
1774 continue;
1775 } // if( fvdFebTimeSecLastRateUpdate[uFebIdxInSyst] < 0.0 )
1776
1777 Double_t dTimeInt = dMsTime - fvdFebTimeSecLastRateUpdate[uFebIdxInSyst];
1778 if (fiTimeIntervalRateUpdate <= dTimeInt) {
1780 if (0 == fviFebCountsSinceLastRateUpdate[uFebIdxInSyst]) {
1781 fvdFebTimeSecLastRateUpdate[uFebIdxInSyst] = dMsTime;
1782 continue;
1783 } // if( 0 == fviFebCountsSinceLastRateUpdate[uFebIdxInSyst] )
1784
1785 for (UInt_t uChan = 0; uChan < fUnpackParSts->GetNbChanPerFeb(); ++uChan) {
1786 fhStsFebChanHitRateProf[uFebIdxInSyst]->Fill(uChan, fvdFebChanCountsSinceLastRateUpdate[uFebIdxInSyst][uChan]
1787 / dTimeInt);
1788 fvdFebChanCountsSinceLastRateUpdate[uFebIdxInSyst][uChan] = 0.0;
1789 } // for( UInt_t uChan = 0; uChan < fUnpackParSts->GetNbChanPerFeb(); ++uChan )
1790
1791 fvdFebTimeSecLastRateUpdate[uFebIdxInSyst] = dMsTime;
1792 fviFebCountsSinceLastRateUpdate[uFebIdxInSyst] = 0;
1793 } // if( fiTimeIntervalRateUpdate <= dTimeInt )
1794 } // for( UInt_t uFebIdx = 0; uFebIdx < fUnpackParSts->GetNbFebsPerDpb(); ++uFebIdx )
1795 } // if( static_cast<Int_t>( fvdMsTime[ uMsCompIdx ] ) < static_cast<Int_t>( dMsTime ) )
1796
1797 // Store MS time for coincidence plots
1798 fvdPrevMsTime[uMsComp] = dMsTime;
1799 /*
1801// if( 0 == fuCurrDpbIdx && fulCurrentTsIdx < 100 )
1802 if( fulCurrentTsIdx < 100 )
1803 LOG(info) << "TS " << std::setw( 12 ) << fulCurrentTsIdx
1804 << " MS " << std::setw( 12 ) << fulCurrentMsIdx
1805 << " MsInTs " << std::setw( 3 ) << uMsIdx
1806 << " DPB " << fuCurrDpbIdx;
1807*/
1808
1810 uint16_t uMsHeaderFlags = msDescriptor.flags;
1811 for (UInt_t uBit = 0; uBit < 16; ++uBit)
1812 fhStsMsStatusFieldType->Fill(uBit, (uMsHeaderFlags >> uBit) & 0x1);
1813
1815 UInt_t uTsMsbCycleHeader = std::floor(fulCurrentMsIdx / (stsxyter::kulTsCycleNbBins * stsxyter::kdClockCycleNs))
1817
1819 if (kTRUE == fbBinningFw)
1822
1823 if (kFALSE == fvuInitialHeaderDone[fuCurrDpbIdx]) {
1824 fvuInitialTsMsbCycleHeader[fuCurrDpbIdx] = uTsMsbCycleHeader;
1827 } // if( kFALSE == fvuInitialHeaderDone[ fuCurrDpbIdx ] )
1828 else if (0 == uMsIdx) {
1829 if (uTsMsbCycleHeader != fvuCurrentTsMsbCycle[fuCurrDpbIdx])
1830 LOG(info) << " TS " << std::setw(12) << fulCurrentTsIdx << " MS " << std::setw(12) << fulCurrentMsIdx
1831 << " MS Idx " << std::setw(4) << uMsIdx << " Msg Idx " << std::setw(5) << 0 << " DPB " << std::setw(2)
1832 << fuCurrDpbIdx << " Old TsMsb " << std::setw(5) << fvulCurrentTsMsb[fuCurrDpbIdx] << " Old MsbCy "
1833 << std::setw(5) << fvuCurrentTsMsbCycle[fuCurrDpbIdx] << " New MsbCy " << uTsMsbCycleHeader;
1834 fvuCurrentTsMsbCycle[fuCurrDpbIdx] = uTsMsbCycleHeader;
1836 } // if( 0 == uMsIdx )
1837 else if (uTsMsbCycleHeader != fvuCurrentTsMsbCycle[fuCurrDpbIdx] && 4194303 != fvulCurrentTsMsb[fuCurrDpbIdx]) {
1838 LOG(warning) << "TS MSB cycle from MS header does not match current cycle from data "
1839 << "for TS " << std::setw(12) << fulCurrentTsIdx << " MS " << std::setw(12) << fulCurrentMsIdx
1840 << " MsInTs " << std::setw(3) << uMsIdx << " ====> " << fvuCurrentTsMsbCycle[fuCurrDpbIdx] << " VS "
1841 << uTsMsbCycleHeader;
1842 fvuCurrentTsMsbCycle[fuCurrDpbIdx] = uTsMsbCycleHeader;
1843 }
1844 else if (uTsMsbCycleHeader != fvuCurrentTsMsbCycle[fuCurrDpbIdx]) {
1846 if (4194303 == fvulCurrentTsMsb[fuCurrDpbIdx]) {
1847 LOG(info) << " TS " << std::setw(12) << fulCurrentTsIdx << " MS " << std::setw(12) << fulCurrentMsIdx
1848 << " MS Idx " << std::setw(4) << uMsIdx << " Msg Idx " << std::setw(5) << 0 << " DPB " << std::setw(2)
1849 << fuCurrDpbIdx << " Old TsMsb " << std::setw(5) << fvulCurrentTsMsb[fuCurrDpbIdx] << " Old MsbCy "
1850 << std::setw(5) << fvuCurrentTsMsbCycle[fuCurrDpbIdx] << " New MsbCy " << uTsMsbCycleHeader;
1851 }
1852 else {
1853 LOG(warning) << "TS MSB cycle from MS header does not match current cycle from data "
1854 << "for TS " << std::setw(12) << fulCurrentTsIdx << " MS " << std::setw(12) << fulCurrentMsIdx
1855 << " MsInTs " << std::setw(3) << uMsIdx << " ====> " << fvuCurrentTsMsbCycle[fuCurrDpbIdx]
1856 << " (cnt) VS " << uTsMsbCycleHeader << " (header)";
1857 } // else of if( 4194303 == fvulCurrentTsMsb[fuCurrDpbIdx] )
1858 fvuCurrentTsMsbCycle[fuCurrDpbIdx] = uTsMsbCycleHeader;
1859 } // else if( uTsMsbCycleHeader != fvuCurrentTsMsbCycle[ fuCurrDpbIdx ] )
1860
1861 // If not integer number of message in input buffer, print warning/error
1862 if (0 != (uSize % kuBytesPerMessage))
1863 LOG(error) << "The input microslice buffer does NOT "
1864 << "contain only complete nDPB messages!";
1865
1866 // Compute the number of complete messages in the input microslice buffer
1867 uint32_t uNbMessages = (uSize - (uSize % kuBytesPerMessage)) / kuBytesPerMessage;
1868
1869 // Prepare variables for the loop on contents
1870 const uint32_t* pInBuff = reinterpret_cast<const uint32_t*>(msContent);
1871
1872 for (uint32_t uIdx = 0; uIdx < uNbMessages; ++uIdx) {
1873 // Fill message
1874 uint32_t ulData = static_cast<uint32_t>(pInBuff[uIdx]);
1875
1876 stsxyter::Message mess(static_cast<uint32_t>(ulData & 0xFFFFFFFF));
1877
1878 // Print message if requested
1879 if (fbPrintMessages) mess.PrintMess(std::cout, fPrintMessCtrl);
1880
1881 /*
1882 if( 1000 == fulCurrentTsIdx )
1883 {
1884 mess.PrintMess( std::cout, fPrintMessCtrl );
1885 } // if( 0 == fulCurrentTsIdx )
1886*/
1887 stsxyter::MessType typeMess = mess.GetMessType();
1888 fmMsgCounter[typeMess]++;
1889 fhStsMessType->Fill(static_cast<uint16_t>(typeMess));
1890 fhStsMessTypePerDpb->Fill(fuCurrDpbIdx, static_cast<uint16_t>(typeMess));
1891
1892 switch (typeMess) {
1894 // Extract the eLink and Asic indices => Should GO IN the fill method now that obly hits are link/asic specific!
1895 UShort_t usElinkIdx = mess.GetLinkIndex();
1897 if (kTRUE == fbBinningFw) usElinkIdx = mess.GetLinkIndexHitBinning();
1898
1900 static_cast<uint16_t>(typeMess));
1901 fhStsHitsElinkPerDpb->Fill(fuCurrDpbIdx, usElinkIdx);
1902 /*
1904 if( ( 0 == fuCurrDpbIdx || 13 < usElinkIdx ) && fulCurrentTsIdx < 100 )
1905 mess.PrintMess( std::cout, stsxyter::MessagePrintMask::msg_print_Hex | stsxyter::MessagePrintMask::msg_print_Human );
1907*/
1908 UInt_t uCrobIdx = usElinkIdx / fUnpackParSts->GetNbElinkPerCrob();
1909 Int_t uFebIdx = fUnpackParSts->ElinkIdxToFebIdx(usElinkIdx);
1910
1911 if (-1 == uFebIdx) {
1912 LOG(warning) << "CbmMcbm2018MonitorSts::DoUnpack => "
1913 << "Wrong elink Idx! Elink raw " << Form("%d remap %d", usElinkIdx, uFebIdx);
1914 continue;
1915 } // if( -1 == uFebIdx )
1916
1917 UInt_t uAsicIdx =
1919 + fUnpackParSts->ElinkIdxToAsicIdx(1 == fviFebType[fuCurrDpbIdx][uCrobIdx][uFebIdx], usElinkIdx);
1920
1921 FillHitInfo(mess, usElinkIdx, uAsicIdx, uMsIdx);
1922 break;
1923 } // case stsxyter::MessType::Hit :
1925 fhStsMessTypePerElink->Fill(fuCurrDpbIdx * fUnpackParSts->GetNbElinkPerDpb(), static_cast<uint16_t>(typeMess));
1926
1927 FillTsMsbInfo(mess, uIdx, uMsIdx);
1928 break;
1929 } // case stsxyter::MessType::TsMsb :
1931 fhStsMessTypePerElink->Fill(fuCurrDpbIdx * fUnpackParSts->GetNbElinkPerDpb(), static_cast<uint16_t>(typeMess));
1932
1933 // The first message in the TS is a special ones: EPOCH
1934 FillEpochInfo(mess);
1935
1936 if (0 < uIdx)
1937 LOG(info) << "CbmMcbm2018MonitorSts::DoUnpack => "
1938 << "EPOCH message at unexpected position in MS: message " << uIdx << " VS message 0 expected!";
1939 break;
1940 } // case stsxyter::MessType::TsMsb :
1942 UShort_t usElinkIdx = mess.GetStatusLink();
1944 static_cast<uint16_t>(typeMess));
1945 /*
1947 if( ( 0 == fuCurrDpbIdx || 13 < usElinkIdx ) && fulCurrentTsIdx < 100 )
1948 mess.PrintMess( std::cout, stsxyter::MessagePrintMask::msg_print_Hex | stsxyter::MessagePrintMask::msg_print_Human );
1950*/
1951 UInt_t uCrobIdx = usElinkIdx / fUnpackParSts->GetNbElinkPerCrob();
1952 Int_t uFebIdx = fUnpackParSts->ElinkIdxToFebIdx(usElinkIdx);
1953 UInt_t uAsicIdx =
1955 + fUnpackParSts->ElinkIdxToAsicIdx(1 == fviFebType[fuCurrDpbIdx][uCrobIdx][uFebIdx], usElinkIdx);
1956
1957 UShort_t usStatusField = mess.GetStatusStatus();
1958
1959 fhStsStatusMessType->Fill(uAsicIdx, usStatusField);
1961 if (fbPrintMessages) {
1962 std::cout << Form("DPB %2u TS %12llu MS %12llu mess %5u ", fuCurrDpbIdx, fulCurrentTsIdx, fulCurrentMsIdx,
1963 uIdx);
1964 mess.PrintMess(std::cout, fPrintMessCtrl);
1965 } // if( fbPrintMessages )
1966 // FillTsMsbInfo( mess );
1967 break;
1968 } // case stsxyter::MessType::Status
1970 fhStsMessTypePerElink->Fill(fuCurrDpbIdx * fUnpackParSts->GetNbElinkPerDpb(), static_cast<uint16_t>(typeMess));
1971 // FillTsMsbInfo( mess );
1972 break;
1973 } // case stsxyter::MessType::Empty :
1975 // ++vNbMessType[5];
1976 // sMessPatt += " En";
1977 // bError = pMess[uIdx].IsMsErrorFlagOn();
1978
1979 // fhStsMessTypePerElink->Fill( fuCurrDpbIdx * fUnpackPar->GetNbElinkPerDpb(), static_cast< uint16_t > (typeMess) );
1980 // FillTsMsbInfo( pMess[uIdx] );
1981 if (mess.IsMsErrorFlagOn()) {
1982 fhMsErrorsEvo->Fill(1e-9 * fulCurrentMsIdx, mess.GetMsErrorType());
1983 } // if( pMess[uIdx].IsMsErrorFlagOn() )
1984 break;
1985 } // case stsxyter::MessType::EndOfMs :
1987 fhStsMessTypePerElink->Fill(fuCurrDpbIdx * fUnpackParSts->GetNbElinkPerDpb(), static_cast<uint16_t>(typeMess));
1988 break;
1989 } // case stsxyter::MessType::Dummy / ReadDataAck / Ack :
1990 default: {
1991 LOG(fatal) << "CbmMcbm2018MonitorSts::DoUnpack => "
1992 << "Unknown message type, should never happen, stopping "
1993 "here! Type found was: "
1994 << static_cast<int>(typeMess);
1995 }
1996 } // switch( mess.GetMessType() )
1997 } // for( uint32_t uIdx = 0; uIdx < uNbMessages; ++uIdx )
1998
1999 return kTRUE;
2000}
2001
2002void CbmMcbm2018MonitorSts::FillHitInfo(stsxyter::Message mess, const UShort_t& /*usElinkIdx*/, const UInt_t& uAsicIdx,
2003 const UInt_t& uMsIdx)
2004{
2005 UShort_t usChan = mess.GetHitChannel();
2006 UShort_t usRawAdc = mess.GetHitAdc();
2007 // UShort_t usFullTs = mess.GetHitTimeFull();
2008 // UShort_t usTsOver = mess.GetHitTimeOver();
2009 UShort_t usRawTs = mess.GetHitTime();
2010
2012 if (kTRUE == fbBinningFw) usRawTs = mess.GetHitTimeBinning();
2013
2015 // usChan = 127 - usChan;
2016
2017 /*
2018 fhStsChanCntRaw[ uAsicIdx ]->Fill( usChan );
2019 fhStsChanAdcRaw[ uAsicIdx ]->Fill( usChan, usRawAdc );
2020 fhStsChanAdcRawProf[ uAsicIdx ]->Fill( usChan, usRawAdc );
2021 fhStsChanRawTs[ uAsicIdx ]->Fill( usChan, usRawTs );
2022 fhStsChanMissEvt[ uAsicIdx ]->Fill( usChan, mess.IsHitMissedEvts() );
2023*/
2024 // UInt_t uCrobIdx = usElinkIdx / fUnpackParSts->GetNbElinkPerCrob();
2025 UInt_t uFebIdx = uAsicIdx / fUnpackParSts->GetNbAsicsPerFeb();
2026 UInt_t uAsicInFeb = uAsicIdx % fUnpackParSts->GetNbAsicsPerFeb();
2027 UInt_t uChanInFeb = usChan + fUnpackParSts->GetNbChanPerAsic() * (uAsicIdx % fUnpackParSts->GetNbAsicsPerFeb());
2028
2029 // Double_t dCalAdc = fvdFebAdcOffs[ fuCurrDpbIdx ][ uCrobIdx ][ uFebIdx ]
2030 // + (usRawAdc - 1)* fvdFebAdcGain[ fuCurrDpbIdx ][ uCrobIdx ][ uFebIdx ];
2031
2032 fhStsFebChanCntRaw[uFebIdx]->Fill(uChanInFeb);
2033 fhStsFebChanAdcRaw[uFebIdx]->Fill(uChanInFeb, usRawAdc);
2034 fhStsFebChanAdcRawProf[uFebIdx]->Fill(uChanInFeb, usRawAdc);
2035 // fhStsFebChanAdcCal[ uFebIdx ]->Fill( uChanInFeb, dCalAdc );
2036 // fhStsFebChanAdcCalProf[ uFebIdx ]->Fill( uChanInFeb, dCalAdc );
2037 fhStsFebChanRawTs[uFebIdx]->Fill(uChanInFeb, usRawTs);
2038 fhStsFebChanMissEvt[uFebIdx]->Fill(uChanInFeb, mess.IsHitMissedEvts());
2039
2040 // Compute the Full time stamp
2041 // Long64_t ulOldHitTime = fvulChanLastHitTime[ uAsicIdx ][ usChan ];
2042 // Double_t dOldHitTime = fvdChanLastHitTime[ uAsicIdx ][ usChan ];
2043
2044 // Use TS w/o overlap bits as they will anyway come from the TS_MSB
2045 fvulChanLastHitTime[uAsicIdx][usChan] = usRawTs;
2046
2047 fvulChanLastHitTime[uAsicIdx][usChan] +=
2048 static_cast<ULong64_t>(stsxyter::kuHitNbTsBins) * static_cast<ULong64_t>(fvulCurrentTsMsb[fuCurrDpbIdx])
2049 + static_cast<ULong64_t>(stsxyter::kulTsCycleNbBins) * static_cast<ULong64_t>(fvuCurrentTsMsbCycle[fuCurrDpbIdx]);
2050
2052 if (kTRUE == fbBinningFw)
2053 fvulChanLastHitTime[uAsicIdx][usChan] =
2054 usRawTs
2055 + static_cast<ULong64_t>(stsxyter::kuHitNbTsBinsBinning) * static_cast<ULong64_t>(fvulCurrentTsMsb[fuCurrDpbIdx])
2056 + static_cast<ULong64_t>(stsxyter::kulTsCycleNbBinsBinning)
2057 * static_cast<ULong64_t>(fvuCurrentTsMsbCycle[fuCurrDpbIdx]);
2058
2059 // fvuElinkLastTsHit[fuCurrDpbIdx] = usRawTs;
2060
2061 // Convert the Hit time in bins to Hit time in ns
2062 Double_t dHitTimeNs = fvulChanLastHitTime[uAsicIdx][usChan] * stsxyter::kdClockCycleNs;
2063 /*
2064 // If needed fill the hit interval plots
2065 if( fbChanHitDtEna )
2066 {
2067 Double_t dDeltaT = dHitTimeNs - fvdChanLastHitTime[ uAsicIdx ][ usChan ];
2068 if( 0 == dDeltaT )
2069 fhStsChanHitDtNeg[ uAsicIdx ]->Fill( 1, usChan );
2070 else if( 0 < dDeltaT )
2071 fhStsChanHitDt[ uAsicIdx ]->Fill( dDeltaT, usChan );
2072 else fhStsChanHitDtNeg[ uAsicIdx ]->Fill( -dDeltaT, usChan );
2073 } // if( fbChanHitDtEna )
2074*/
2076 Double_t dDeltaT = dHitTimeNs - fvdChanLastHitTime[uAsicIdx][usChan];
2077 fhStsFebChanCloseHitsCounts[uFebIdx]->Fill(uChanInFeb, 0);
2078 fhStsFebChanCloseHitsRatio[uFebIdx]->Fill(uChanInFeb, 0);
2079 if (dDeltaT < 80.0) {
2080 fhStsFebChanCloseHitsCounts[uFebIdx]->Fill(uChanInFeb, 1);
2081 fhStsFebChanCloseHitsRatio[uFebIdx]->Fill(uChanInFeb, 1);
2082 // LOG(info) << Form( "Potential duplicate (bad Vref2) in FEB %2u ASIC %u channel %4u (dt = %f) TS %7llu MS %3u",
2083 // uFebIdx, uAsicInFeb, uChanInFeb, dDeltaT, fulCurrentTsIdx, uMsIdx );
2084 } //
2085
2086 // Store new value of Hit time in ns
2087 fvdChanLastHitTime[uAsicIdx][usChan] = fvulChanLastHitTime[uAsicIdx][usChan] * stsxyter::kdClockCycleNs;
2088 /*
2089 LOG(info) << " Asic " << std::setw( 2 ) << uAsicIdx
2090 << " Channel " << std::setw( 3 ) << usChan
2091 << " Diff to last hit " << std::setw( 12 ) << ( fvulChanLastHitTime[ uAsicIdx ][ usChan ] - ulOldHitTime)
2092 << " in s " << std::setw( 12 ) << ( fvdChanLastHitTime[ uAsicIdx ][ usChan ] - dOldHitTime) * 1e-9;
2093*/
2094 // Pulser and MS
2095 fvuChanNbHitsInMs[uAsicIdx][usChan][uMsIdx]++;
2096 fvdChanLastHitTimeInMs[uAsicIdx][usChan][uMsIdx] = dHitTimeNs;
2097 fvusChanLastHitAdcInMs[uAsicIdx][usChan][uMsIdx] = usRawAdc;
2098 /*
2099 fvmChanHitsInTs[ uAsicIdx ][ usChan ].insert( stsxyter::FinalHit( fvulChanLastHitTime[ uAsicIdx ][ usChan ],
2100 usRawAdc, uAsicIdx, usChan ) );
2101*/
2102 fvmHitsInMs.push_back(stsxyter::FinalHit(fvulChanLastHitTime[uAsicIdx][usChan], usRawAdc, uAsicIdx, usChan));
2103
2104 /*
2105 if( ( 214514 < fulCurrentTsIdx && fulCurrentTsIdx < 214517 ) ||
2106 ( 260113 < fulCurrentTsIdx && fulCurrentTsIdx < 260116 ) ||
2107 ( 388109 < fulCurrentTsIdx && fulCurrentTsIdx < 388114 ) ||
2108 ( 573361 < fulCurrentTsIdx && fulCurrentTsIdx < 573364 ) ||
2109 ( 661731 < fulCurrentTsIdx && fulCurrentTsIdx < 661734 ) ||
2110 ( 712982 < fulCurrentTsIdx && fulCurrentTsIdx < 712985 ) ||
2111 ( 713857 < fulCurrentTsIdx && fulCurrentTsIdx < 713860 ) ||
2112 ( 739365 < fulCurrentTsIdx && fulCurrentTsIdx < 739368 ))
2113 if( 0 < fulCurrentTsIdx && fulCurrentTsIdx < 3 )
2114 {
2115 LOG(info) << " TS " << std::setw( 12 ) << fulCurrentTsIdx
2116 << " MS " << std::setw( 12 ) << fulCurrentMsIdx
2117 << " MsInTs " << std::setw( 3 ) << uMsIdx
2118 << " Asic " << std::setw( 2 ) << uAsicIdx
2119 << " Channel " << std::setw( 3 ) << usChan
2120 << " ADC " << std::setw( 3 ) << usRawAdc
2121 << " TS " << std::setw( 3 ) << usRawTs // 9 bits TS
2122 << " SX TsMsb " << std::setw( 2 ) << ( fvulCurrentTsMsb[fuCurrDpbIdx] & 0x1F ) // Total StsXyter TS = 14 bits => 9b Hit TS + lower 5b TS_MSB after DPB
2123 << " DPB TsMsb " << std::setw( 6 ) << ( fvulCurrentTsMsb[fuCurrDpbIdx] >> 5 ) // Total StsXyter TS = 14 bits => 9b Hit TS + lower 5b of TS_MSB after DPB
2124 << " TsMsb " << std::setw( 7 ) << fvulCurrentTsMsb[fuCurrDpbIdx]
2125 << " TS(b) " << std::bitset<9>(usRawTs)
2126 << " TSM(b) " << std::bitset<24>(fvulCurrentTsMsb[fuCurrDpbIdx])
2127 << " MsbCy " << std::setw( 4 ) << fvuCurrentTsMsbCycle[fuCurrDpbIdx]
2128 << " Time " << std::setw ( 12 ) << fvulChanLastHitTime[ uAsicIdx ][ usChan ];
2129 }
2130*/
2131 // Check Starting point of histos with time as X axis
2132 if (-1 == fdStartTime) fdStartTime = fvdChanLastHitTime[uAsicIdx][usChan];
2133
2134 // Fill histos with time as X axis
2135 Double_t dTimeSinceStartSec = (fvdChanLastHitTime[uAsicIdx][usChan] - fdStartTime) * 1e-9;
2136 Double_t dTimeSinceStartMin = dTimeSinceStartSec / 60.0;
2137
2139 fvdFebChanCountsSinceLastRateUpdate[uFebIdx][uChanInFeb] += 1;
2140
2141 fhStsFebAsicHitCounts->Fill(uFebIdx, uAsicInFeb);
2142 fhStsAllFebsHitRateEvo->Fill(dTimeSinceStartSec, uFebIdx);
2143 fhStsAllAsicsHitRateEvo->Fill(dTimeSinceStartSec, uAsicIdx);
2144 fhStsFebChanHitRateEvo[uFebIdx]->Fill(dTimeSinceStartSec, uChanInFeb);
2145 fhStsFebAsicHitRateEvo[uFebIdx]->Fill(dTimeSinceStartSec, uAsicInFeb);
2146 fhStsFebHitRateEvo[uFebIdx]->Fill(dTimeSinceStartSec);
2147 fhStsFebChanHitRateEvoLong[uFebIdx]->Fill(dTimeSinceStartMin, uChanInFeb, 1.0 / 60.0);
2148 fhStsFebAsicHitRateEvoLong[uFebIdx]->Fill(dTimeSinceStartMin, uAsicInFeb, 1.0 / 60.0);
2149 fhStsFebHitRateEvoLong[uFebIdx]->Fill(dTimeSinceStartMin, 1.0 / 60.0);
2150 if (mess.IsHitMissedEvts()) {
2151 fhStsFebChanMissEvtEvo[uFebIdx]->Fill(dTimeSinceStartSec, uChanInFeb);
2152 fhStsFebAsicMissEvtEvo[uFebIdx]->Fill(dTimeSinceStartSec, uAsicInFeb);
2153 fhStsFebMissEvtEvo[uFebIdx]->Fill(dTimeSinceStartSec);
2154 } // if( mess.IsHitMissedEvts() )
2155 /*
2156 if( kTRUE == fbLongHistoEnable )
2157 {
2158 std::chrono::steady_clock::time_point tNow = std::chrono::steady_clock::now();
2159 Double_t dUnixTimeInRun = std::chrono::duration_cast< std::chrono::seconds >(tNow - ftStartTimeUnix).count();
2160 fhFebRateEvoLong[ uAsicIdx ]->Fill( dUnixTimeInRun , 1.0 / fuLongHistoBinSizeSec );
2161 fhFebChRateEvoLong[ uAsicIdx ]->Fill( dUnixTimeInRun , usChan, 1.0 / fuLongHistoBinSizeSec );
2162 } // if( kTRUE == fbLongHistoEnable )
2163*/
2164}
2165
2166void CbmMcbm2018MonitorSts::FillTsMsbInfo(stsxyter::Message mess, UInt_t uMessIdx, UInt_t uMsIdx)
2167{
2168 UInt_t uVal = mess.GetTsMsbVal();
2170 if (kTRUE == fbBinningFw) uVal = mess.GetTsMsbValBinning();
2171
2172 /*
2173 if( ( 419369 < fulCurrentTsIdx && fulCurrentTsIdx < 419371 ) )
2174 LOG(info) << " TS " << std::setw( 12 ) << fulCurrentTsIdx
2175 << " MS " << std::setw( 12 ) << fulCurrentMsIdx
2176 << " MsInTs " << std::setw( 3 ) << uMsIdx
2177 << " DPB " << std::setw( 2 ) << fuCurrDpbIdx
2178 << " Mess " << std::setw( 5 ) << uMessIdx
2179 << " TsMsb " << std::setw( 5 ) << uVal;
2180*/
2181 /*
2182 if( (uVal != fvulCurrentTsMsb[fuCurrDpbIdx] + 1) && 0 < uVal &&
2183 !( 1 == uMessIdx && usVal == fvulCurrentTsMsb[fuCurrDpbIdx] ) ) // 1st TS_MSB in MS is always a repeat of the last one in previous MS!
2184 {
2185 LOG(info) << "TS MSB not increasing by 1! TS " << std::setw( 12 ) << fulCurrentTsIdx
2186 << " MS " << std::setw( 12 ) << fulCurrentMsIdx
2187 << " MsInTs " << std::setw( 3 ) << uMsIdx
2188 << " DPB " << std::setw( 2 ) << fuCurrDpbIdx
2189 << " Mess " << std::setw( 5 ) << uMessIdx
2190 << " Old TsMsb " << std::setw( 5 ) << fvulCurrentTsMsb[fuCurrDpbIdx]
2191 << " new TsMsb " << std::setw( 5 ) << uVal
2192 << " Diff " << std::setw( 5 ) << uVal - fvulCurrentTsMsb[fuCurrDpbIdx]
2193 << " Old MsbCy " << std::setw( 5 ) << fvuCurrentTsMsbCycle[fuCurrDpbIdx];
2194 } // if( (uVal != fvulCurrentTsMsb[fuCurrDpbIdx] + 1) && 0 < uVal )
2195*/
2196
2197 // Update Status counters
2198 if (uVal < fvulCurrentTsMsb[fuCurrDpbIdx]) {
2199
2200 LOG(info) << " TS " << std::setw(12) << fulCurrentTsIdx << " MS " << std::setw(12) << fulCurrentMsIdx << " MS Idx "
2201 << std::setw(4) << uMsIdx << " Msg Idx " << std::setw(5) << uMessIdx << " DPB " << std::setw(2)
2202 << fuCurrDpbIdx << " Old TsMsb " << std::setw(5) << fvulCurrentTsMsb[fuCurrDpbIdx] << " Old MsbCy "
2203 << std::setw(5) << fvuCurrentTsMsbCycle[fuCurrDpbIdx] << " new TsMsb " << std::setw(5) << uVal;
2204
2206 } // if( uVal < fvulCurrentTsMsb[fuCurrDpbIdx] )
2207 if (
2208 uVal != fvulCurrentTsMsb[fuCurrDpbIdx] + 1 && 0 != uVal && 4194303 != fvulCurrentTsMsb[fuCurrDpbIdx]
2209 && 1 != uMessIdx &&
2210 !(0 == uVal && 0 == fvulCurrentTsMsb[fuCurrDpbIdx] && 2 == uMessIdx) &&
2211 !(uVal == fvulCurrentTsMsb[fuCurrDpbIdx] && 2 == uMessIdx)
2212 &&
2213 uVal < fvulCurrentTsMsb
2214 [fuCurrDpbIdx]
2215 ) {
2216 LOG(info) << "TS MSb Jump in "
2217 << " TS " << std::setw(12) << fulCurrentTsIdx << " MS " << std::setw(12) << fulCurrentMsIdx << " MS Idx "
2218 << std::setw(4) << uMsIdx << " Msg Idx " << std::setw(5) << uMessIdx << " DPB " << std::setw(2)
2219 << fuCurrDpbIdx << " => Old TsMsb " << std::setw(5) << fvulCurrentTsMsb[fuCurrDpbIdx] << " new TsMsb "
2220 << std::setw(5) << uVal;
2221 } // if( uVal + 1 != fvulCurrentTsMsb[fuCurrDpbIdx] && 4194303 != uVal && 0 != fvulCurrentTsMsb[fuCurrDpbIdx] )
2223 /*
2224 if( 1 < uMessIdx )
2225 {
2226 fhStsDpbRawTsMsb->Fill( fuCurrDpbIdx, fvulCurrentTsMsb[fuCurrDpbIdx] );
2227 fhStsDpbRawTsMsbSx->Fill( fuCurrDpbIdx, ( fvulCurrentTsMsb[fuCurrDpbIdx] & 0x1F ) );
2228 fhStsDpbRawTsMsbDpb->Fill( fuCurrDpbIdx, ( fvulCurrentTsMsb[fuCurrDpbIdx] >> 5 ) );
2229 } // if( 0 < uMessIdx )
2230*/
2231 // fhStsAsicTsMsb->Fill( fvulCurrentTsMsb[fuCurrDpbIdx], uAsicIdx );
2232 /*
2233 ULong64_t ulNewTsMsbTime = static_cast< ULong64_t >( stsxyter::kuHitNbTsBins )
2234 * static_cast< ULong64_t >( fvulCurrentTsMsb[fuCurrDpbIdx])
2235 + static_cast< ULong64_t >( stsxyter::kulTsCycleNbBins )
2236 * static_cast< ULong64_t >( fvuCurrentTsMsbCycle[fuCurrDpbIdx] );
2237*/
2238}
2239
2241{
2242 // UInt_t uVal = mess.GetEpochVal();
2243 // UInt_t uCurrentCycle = uVal % stsxyter::kulTsCycleNbBins;
2244
2245 /*
2246 // Update Status counters
2247 if( usVal < fvulCurrentTsMsb[fuCurrDpbIdx] )
2248 fvuCurrentTsMsbCycle[fuCurrDpbIdx] ++;
2249 fvulCurrentTsMsb[fuCurrDpbIdx] = usVal;
2250
2251// fhStsAsicTsMsb->Fill( fvulCurrentTsMsb[fuCurrDpbIdx], uAsicIdx );
2252*/
2253}
2254
2256
2258{
2259
2260 LOG(info) << "-------------------------------------";
2261 LOG(info) << "CbmMcbm2018MonitorSts statistics are ";
2262 LOG(info) << " Hit messages: " << fmMsgCounter[stsxyter::MessType::Hit] << "\n"
2263 << " Ts MSB messages: " << fmMsgCounter[stsxyter::MessType::TsMsb] << "\n"
2264 << " Dummy messages: " << fmMsgCounter[stsxyter::MessType::Dummy] << "\n"
2265 << " Epoch messages: " << fmMsgCounter[stsxyter::MessType::Epoch] << "\n"
2266 << " Empty messages: " << fmMsgCounter[stsxyter::MessType::Empty];
2267
2268 LOG(info) << "-------------------------------------";
2269
2271 // SaveAllHistos();
2272}
2273
2274
2276{
2278 TFile* oldFile = gFile;
2279 TDirectory* oldDir = gDirectory;
2280
2281 TFile* histoFile = NULL;
2282 if ("" != sFileName) {
2283 // open separate histo file in recreate mode
2284 histoFile = new TFile(sFileName, "RECREATE");
2285 histoFile->cd();
2286 } // if( "" != sFileName )
2287
2288 /***************************/
2289 gDirectory->mkdir("Sts_Raw");
2290 gDirectory->cd("Sts_Raw");
2291
2292 fhStsMessType->Write();
2293 fhStsSysMessType->Write();
2294 fhStsMessTypePerDpb->Write();
2295 fhStsSysMessTypePerDpb->Write();
2296 fhStsStatusMessType->Write();
2297 fhStsMsStatusFieldType->Write();
2298 fhStsMessTypePerElink->Write();
2299 fhStsHitsElinkPerDpb->Write();
2300 fhStsAllFebsHitRateEvo->Write();
2301 fhStsAllAsicsHitRateEvo->Write();
2302 fhStsFebAsicHitCounts->Write();
2303 gDirectory->cd("..");
2304 /***************************/
2305
2306 /***************************/
2307 gDirectory->mkdir("Sts_Feb");
2308 gDirectory->cd("Sts_Feb");
2309 for (UInt_t uFebIdx = 0; uFebIdx < fuNbFebs; ++uFebIdx) {
2310 if (kTRUE == fUnpackParSts->IsFebActive(uFebIdx)) {
2311 fhStsFebChanCntRaw[uFebIdx]->Write();
2312 fhStsFebChanCntRawGood[uFebIdx]->Write();
2313 fhStsFebChanAdcRaw[uFebIdx]->Write();
2314 fhStsFebChanAdcRawProf[uFebIdx]->Write();
2315 // fhStsFebChanAdcCal[ uFebIdx ]->Write();
2316 // fhStsFebChanAdcCalProf[ uFebIdx ]->Write();
2317 fhStsFebChanRawTs[uFebIdx]->Write();
2318 fhStsFebChanMissEvt[uFebIdx]->Write();
2319 fhStsFebChanMissEvtEvo[uFebIdx]->Write();
2320 fhStsFebAsicMissEvtEvo[uFebIdx]->Write();
2321 fhStsFebMissEvtEvo[uFebIdx]->Write();
2322 fhStsFebChanHitRateEvo[uFebIdx]->Write();
2323 fhStsFebChanHitRateProf[uFebIdx]->Write();
2324 fhStsFebAsicHitRateEvo[uFebIdx]->Write();
2325 fhStsFebHitRateEvo[uFebIdx]->Write();
2326 fhStsFebChanHitRateEvoLong[uFebIdx]->Write();
2327 fhStsFebAsicHitRateEvoLong[uFebIdx]->Write();
2328 fhStsFebHitRateEvoLong[uFebIdx]->Write();
2329 fhStsFebChanDistT[uFebIdx]->Write();
2330 fhStsFebChanCloseHitsCounts[uFebIdx]->Write();
2331 fhStsFebChanCloseHitsRatio[uFebIdx]->Write();
2332 /*
2333 for( UInt_t uFebIdxB = uFebIdx; uFebIdxB < fuNbFebs; ++uFebIdxB )
2334 {
2335 fhStsFebChanDtCoinc[ uFebIdx ][ uFebIdxB ]->Write();
2336 fhStsFebChanCoinc[ uFebIdx ][ uFebIdxB ]->Write();
2337 } // for( UInt_t uFebIdxB = uFebIdx; uFebIdxB < fuNbFebs; ++uFebIdxB )
2338*/
2339 } // if( kTRUE == fUnpackParSts->IsFebActive( uFebIdx ) )
2340 } // for( UInt_t uFebIdx = 0; uFebIdx < fuNbFebs; ++uFebIdx )
2341 gDirectory->cd("..");
2342 /***************************/
2343
2344 /***************************/
2345 /*
2346 gDirectory->mkdir("Sts_Module");
2347 gDirectory->cd("Sts_Module");
2348 for( UInt_t uModIdx = 0; uModIdx < fuNbModules; ++ uModIdx )
2349 {
2350 fhStsModulePNCoincDt[ uModIdx ]->Write();
2351 fhStsModulePNCoincDtAsicP[ uModIdx ]->Write();
2352 fhStsModulePNCoincDtAsicN[ uModIdx ]->Write();
2353 fhStsModulePNCoincChan[ uModIdx ]->Write();
2354 fhStsModulePNCoincAdc[ uModIdx ]->Write();
2355 fhStsModuleCoincAdcChanP[ uModIdx ]->Write();
2356 fhStsModuleCoincAdcChanN[ uModIdx ]->Write();
2357 fhStsModuleCoincMap[ uModIdx ]->Write();
2358 } // for( UInt_t uModIdx = 0; uModIdx < fuNbModules; ++ uModIdx )
2359 gDirectory->cd("..");
2360*/
2361 /***************************/
2362
2364 if (kTRUE == fbEnableCheckBugSmx20) {
2365 gDirectory->mkdir("Sts_SmxErr");
2366 gDirectory->cd("Sts_SmxErr");
2367 for (UInt_t uFebIdx = 0; uFebIdx < fuNbFebs; ++uFebIdx) {
2368 if (kTRUE == fUnpackParSts->IsFebActive(uFebIdx)) {
2369 fhStsFebSmxErrRatioEvo[uFebIdx]->Write();
2370 fhStsFebSmxErrRatioEvoAsic[uFebIdx]->Write();
2371 fhStsFebSmxErrRatioCopyEvo[uFebIdx]->Write();
2372 fhStsFebSmxErrRatioCopyEvoAsic[uFebIdx]->Write();
2373 fhStsFebSmxErrRatioCopySameAdcEvo[uFebIdx]->Write();
2374 fhStsFebSmxErrRatioCopySameAdcEvoAsic[uFebIdx]->Write();
2375 } // if( kTRUE == fUnpackParSts->IsFebActive( uFebIdx ) )
2376 } // for( UInt_t uFebIdx = 0; uFebIdx < fuNbFebs; ++uFebIdx )
2377 gDirectory->cd("..");
2378 } // if( kTRUE == fbEnableCheckBugSmx20 )
2380
2381 /***************************/
2382 // Flib Histos
2383 gDirectory->mkdir("Flib_Raw");
2384 gDirectory->cd("Flib_Raw");
2385 for (UInt_t uLinks = 0; uLinks < kiMaxNbFlibLinks; uLinks++) {
2386 TString sMsSzName = Form("MsSz_link_%02u", uLinks);
2387 if (fHM->Exists(sMsSzName.Data())) fHM->H1(sMsSzName.Data())->Write();
2388
2389 sMsSzName = Form("MsSzTime_link_%02u", uLinks);
2390 if (fHM->Exists(sMsSzName.Data())) fHM->P1(sMsSzName.Data())->Write();
2391 } // for( UInt_t uLinks = 0; uLinks < 16; uLinks ++)
2392
2393 TH1* pMissedTsH1 = dynamic_cast<TH1*>(gROOT->FindObjectAny("Missed_TS"));
2394 if (NULL != pMissedTsH1) pMissedTsH1->Write();
2395
2396 TProfile* pMissedTsEvoP = dynamic_cast<TProfile*>(gROOT->FindObjectAny("Missed_TS_Evo"));
2397 if (NULL != pMissedTsEvoP) pMissedTsEvoP->Write();
2398
2399 gDirectory->cd("..");
2400 /***************************/
2401 for (UInt_t uFebIdx = 0; uFebIdx < fuNbFebs; ++uFebIdx) {
2402 if (kTRUE == fUnpackParSts->IsFebActive(uFebIdx)) {
2403 fvcStsSumm[uFebIdx]->Write();
2404 if (kTRUE == fbEnableCheckBugSmx20) fvcStsSmxErr[uFebIdx]->Write();
2405 } // if( kTRUE == fUnpackParSts->IsFebActive( uFebIdx ) )
2406 } // for( UInt_t uFebIdx = 0; uFebIdx < fuNbFebs; ++uFebIdx )
2407 /***************************/
2408
2409 if ("" != sFileName) {
2410 // Restore original directory position
2411 histoFile->Close();
2412 } // if( "" != sFileName )
2413
2415 gFile = oldFile;
2416 gDirectory = oldDir;
2417}
2419{
2420 LOG(info) << "Reseting all STS histograms.";
2421
2422 fhStsMessType->Reset();
2423 fhStsSysMessType->Reset();
2424 fhStsMessTypePerDpb->Reset();
2425 fhStsSysMessTypePerDpb->Reset();
2426 fhStsStatusMessType->Reset();
2427 fhStsMsStatusFieldType->Reset();
2428 fhStsMessTypePerElink->Reset();
2429 fhStsHitsElinkPerDpb->Reset();
2430 fhStsAllFebsHitRateEvo->Reset();
2431 fhStsAllAsicsHitRateEvo->Reset();
2432 fhStsFebAsicHitCounts->Reset();
2433
2434 for (UInt_t uFebIdx = 0; uFebIdx < fuNbFebs; ++uFebIdx) {
2435 if (kTRUE == fUnpackParSts->IsFebActive(uFebIdx)) {
2436 fhStsFebChanCntRaw[uFebIdx]->Reset();
2437 fhStsFebChanCntRawGood[uFebIdx]->Reset();
2438 fhStsFebChanAdcRaw[uFebIdx]->Reset();
2439 fhStsFebChanAdcRawProf[uFebIdx]->Reset();
2440 // fhStsFebChanAdcCal[ uFebIdx ]->Reset();
2441 // fhStsFebChanAdcCalProf[ uFebIdx ]->Reset();
2442 fhStsFebChanRawTs[uFebIdx]->Reset();
2443 fhStsFebChanMissEvt[uFebIdx]->Reset();
2444 fhStsFebChanMissEvtEvo[uFebIdx]->Reset();
2445 fhStsFebAsicMissEvtEvo[uFebIdx]->Reset();
2446 fhStsFebMissEvtEvo[uFebIdx]->Reset();
2447 fhStsFebChanHitRateEvo[uFebIdx]->Reset();
2448 fhStsFebChanHitRateProf[uFebIdx]->Reset();
2449 fhStsFebAsicHitRateEvo[uFebIdx]->Reset();
2450 fhStsFebHitRateEvo[uFebIdx]->Reset();
2451 fhStsFebChanHitRateEvoLong[uFebIdx]->Reset();
2452 fhStsFebAsicHitRateEvoLong[uFebIdx]->Reset();
2453 fhStsFebHitRateEvoLong[uFebIdx]->Reset();
2454 fhStsFebChanDistT[uFebIdx]->Reset();
2455 fhStsFebChanCloseHitsCounts[uFebIdx]->Reset();
2456 fhStsFebChanCloseHitsRatio[uFebIdx]->Reset();
2457 /*
2458 for( UInt_t uFebIdxB = uFebIdx; uFebIdxB < fuNbFebs; ++uFebIdxB )
2459 {
2460 fhStsFebChanDtCoinc[ uFebIdx ][ uFebIdxB ]->Reset();
2461 fhStsFebChanCoinc[ uFebIdx ][ uFebIdxB ]->Reset();
2462 } // for( UInt_t uFebIdxB = uFebIdx; uFebIdxB < fuNbFebs; ++uFebIdxB )
2463*/
2465 if (kTRUE == fbEnableCheckBugSmx20) {
2466 fhStsFebSmxErrRatioEvo[uFebIdx]->Reset();
2467 fhStsFebSmxErrRatioEvoAsic[uFebIdx]->Reset();
2468 fhStsFebSmxErrRatioCopyEvo[uFebIdx]->Reset();
2469 fhStsFebSmxErrRatioCopyEvoAsic[uFebIdx]->Reset();
2470 fhStsFebSmxErrRatioCopySameAdcEvo[uFebIdx]->Reset();
2471 fhStsFebSmxErrRatioCopySameAdcEvoAsic[uFebIdx]->Reset();
2472 } // if( kTRUE == fbEnableCheckBugSmx20 )
2474 } // if( kTRUE == fUnpackParSts->IsFebActive( uFebIdx ) )
2475 } // for( UInt_t uFebIdx = 0; uFebIdx < fuNbFebs; ++uFebIdx )
2476 /*
2477 for( UInt_t uModIdx = 0; uModIdx < fuNbModules; ++ uModIdx )
2478 {
2479 fhStsModulePNCoincDt[ uModIdx ]->Reset();
2480 fhStsModulePNCoincDtAsicP[ uModIdx ]->Reset();
2481 fhStsModulePNCoincDtAsicN[ uModIdx ]->Reset();
2482 fhStsModulePNCoincChan[ uModIdx ]->Reset();
2483 fhStsModulePNCoincAdc[ uModIdx ]->Reset();
2484 fhStsModuleCoincAdcChanP[ uModIdx ]->Reset();
2485 fhStsModuleCoincAdcChanN[ uModIdx ]->Reset();
2486 fhStsModuleCoincMap[ uModIdx ]->Reset();
2487 } // for( UInt_t uModIdx = 0; uModIdx < fuNbModules; ++ uModIdx )
2488*/
2489 for (UInt_t uLinks = 0; uLinks < kiMaxNbFlibLinks; ++uLinks) {
2490 TString sMsSzName = Form("MsSz_link_%02u", uLinks);
2491 if (fHM->Exists(sMsSzName.Data())) fHM->H1(sMsSzName.Data())->Reset();
2492
2493 sMsSzName = Form("MsSzTime_link_%02u", uLinks);
2494 if (fHM->Exists(sMsSzName.Data())) fHM->P1(sMsSzName.Data())->Reset();
2495 } // for( UInt_t uLinks = 0; uLinks < kiMaxNbFlibLinks; ++uLinks )
2496
2497 fdStartTime = -1;
2498 fdStartTimeMsSz = -1;
2499}
2500/*
2501void CbmMcbm2018MonitorSts::UpdatePairMeanValue( UInt_t uAsicA, UInt_t uAsicB, Double_t dNewValue )
2502{
2503 if( fvuLastTimeDiffSlotAsicPair.size() < uAsicA )
2504 {
2505 LOG(warning) << "CbmMcbm2018MonitorSts::UpdatePairMeanValue => wrong ASIC A value: " << uAsicA
2506 << " VS " << fvuLastTimeDiffSlotAsicPair.size();
2507 return;
2508 } // if( fvuLastTimeDiffSlotAsicPair.size() < uAsicA )
2509 if( fvuLastTimeDiffSlotAsicPair[ uAsicA ].size() < uAsicB )
2510 {
2511 LOG(warning) << "CbmMcbm2018MonitorSts::UpdatePairMeanValue => wrong ASIC B value: " << uAsicB
2512 << " VS " << fvuLastTimeDiffSlotAsicPair[ uAsicA ].size();
2513 return;
2514 } // if( fvuLastTimeDiffSlotAsicPair[ uAsicA ].size() < uAsicB )
2515
2516 if( kuNbValuesForTimeDiffMean == fvdLastTimeDiffValuesAsicPair[ uAsicA ][ uAsicB ].size() )
2517 {
2518 fvdLastTimeDiffValuesAsicPair[ uAsicA ][ uAsicB ][ fvuLastTimeDiffSlotAsicPair[ uAsicA ][ uAsicB ] ] = dNewValue;
2519 fvuLastTimeDiffSlotAsicPair[ uAsicA ][ uAsicB ] = ( fvuLastTimeDiffSlotAsicPair[ uAsicA ][ uAsicB ] + 1 )
2520 % kuNbValuesForTimeDiffMean;
2521 } // if( kuNbValuesForTimeDiffMean == fvdLastTimeDiffValuesAsicPair[ uAsicA ][ uAsicB ].size() )
2522 else fvdLastTimeDiffValuesAsicPair[ uAsicA ][ uAsicB ].push_back( dNewValue );
2523
2524 Double_t dNewMean = 0.0;
2525 UInt_t uNbVal = fvdLastTimeDiffValuesAsicPair[ uAsicA ][ uAsicB ].size();
2526 for( UInt_t uIdx = 0; uIdx < uNbVal; ++uIdx )
2527 dNewMean += fvdLastTimeDiffValuesAsicPair[ uAsicA ][ uAsicB ][ uIdx ];
2528 dNewMean /= uNbVal;
2529
2530 fvdMeanTimeDiffAsicPair[ uAsicA ][ uAsicB ] = dNewMean;
2531}
2532*/
2533void CbmMcbm2018MonitorSts::SetRunStart(Int_t dateIn, Int_t timeIn, Int_t iBinSize)
2534{
2535 TDatime* fRunStartDateTime = new TDatime(dateIn, timeIn);
2536 fiRunStartDateTimeSec = fRunStartDateTime->Convert();
2537 fiBinSizeDatePlots = iBinSize;
2538
2539 LOG(info) << "Assigned new MUCH Run Start Date-Time: " << fRunStartDateTime->AsString();
2540}
2541
2542void CbmMcbm2018MonitorSts::SetLongDurationLimits(UInt_t uDurationSeconds, UInt_t uBinSize)
2543{
2544 fbLongHistoEnable = kTRUE;
2545 fuLongHistoNbSeconds = uDurationSeconds;
2546 fuLongHistoBinSizeSec = uBinSize;
2547}
2552{
2553
2554 if (kTRUE == fbSmx2ErrorUseNoiseLevels) {
2560 } // if( kTRUE == fbSmx2ErrorUseNoiseLevels )
2561
2569 for (UInt_t uFebIdx = 0; uFebIdx < fuNbFebs; ++uFebIdx) {
2577 for (UInt_t uAsicIdx = 0; uAsicIdx < fUnpackParSts->GetNbAsicsPerFeb(); ++uAsicIdx) {
2578 //fvulLastHitTs[ uXyterIdx ].resize( fuNbChanPerAsic, 0 );
2579 fvdSmxErrTimeLastHits[uFebIdx][uAsicIdx].resize(kuSmxErrCoincWinNbHits, -1.0);
2585 fvuSmxErrIdxLastHit[uFebIdx][uAsicIdx] = kuSmxErrCoincWinNbHits;
2586 } // for( UInt_t uAsicIdx = 0; uAsicIdx < fUnpackParSts->GetNbAsicsPerFeb(); ++uAsicIdx )
2587 } // for( UInt_t uFebIdx = 0; uFebIdx < fuNbFebs; ++uFebIdx )
2588}
2589
2590Bool_t CbmMcbm2018MonitorSts::SmxErrCheckCoinc(UInt_t uFebIdx, UInt_t uAsicIdx, Double_t dNewHitTime)
2591{
2592 if (kuSmxErrCoincWinNbHits == fvuSmxErrIdxFirstHitM07[uFebIdx][uAsicIdx]
2593 && kuSmxErrCoincWinNbHits == fvuSmxErrIdxFirstHitM08[uFebIdx][uAsicIdx]
2594 && kuSmxErrCoincWinNbHits == fvuSmxErrIdxFirstHitM09[uFebIdx][uAsicIdx]
2595 && kuSmxErrCoincWinNbHits == fvuSmxErrIdxFirstHitM10[uFebIdx][uAsicIdx]
2596 && kuSmxErrCoincWinNbHits == fvuSmxErrIdxFirstHitM11[uFebIdx][uAsicIdx]
2597 && kuSmxErrCoincWinNbHits == fvuSmxErrIdxLastHit[uFebIdx][uAsicIdx]) {
2599 fvuSmxErrIdxFirstHitM07[uFebIdx][uAsicIdx] = 4;
2600 fvuSmxErrIdxFirstHitM08[uFebIdx][uAsicIdx] = 3;
2601 fvuSmxErrIdxFirstHitM09[uFebIdx][uAsicIdx] = 2;
2602 fvuSmxErrIdxFirstHitM10[uFebIdx][uAsicIdx] = 1;
2603 fvuSmxErrIdxFirstHitM11[uFebIdx][uAsicIdx] = 0;
2604 fvuSmxErrIdxLastHit[uFebIdx][uAsicIdx] = 0;
2605 fvdSmxErrTimeLastHits[uFebIdx][uAsicIdx][fvuSmxErrIdxLastHit[uFebIdx][uAsicIdx]] = dNewHitTime;
2606
2608 return kFALSE;
2609 }
2610 else if (kuSmxErrCoincWinNbHits - 1
2611 == fvuSmxErrIdxLastHit[uFebIdx][uAsicIdx] - fvuSmxErrIdxFirstHitM11[uFebIdx][uAsicIdx]
2612 || fvuSmxErrIdxFirstHitM11[uFebIdx][uAsicIdx] - 1 == fvuSmxErrIdxLastHit[uFebIdx][uAsicIdx]) {
2614 fvuSmxErrIdxFirstHitM07[uFebIdx][uAsicIdx] =
2615 (fvuSmxErrIdxFirstHitM07[uFebIdx][uAsicIdx] + 1) % kuSmxErrCoincWinNbHits;
2616 fvuSmxErrIdxFirstHitM08[uFebIdx][uAsicIdx] =
2617 (fvuSmxErrIdxFirstHitM08[uFebIdx][uAsicIdx] + 1) % kuSmxErrCoincWinNbHits;
2618 fvuSmxErrIdxFirstHitM09[uFebIdx][uAsicIdx] =
2619 (fvuSmxErrIdxFirstHitM09[uFebIdx][uAsicIdx] + 1) % kuSmxErrCoincWinNbHits;
2620 fvuSmxErrIdxFirstHitM10[uFebIdx][uAsicIdx] =
2621 (fvuSmxErrIdxFirstHitM10[uFebIdx][uAsicIdx] + 1) % kuSmxErrCoincWinNbHits;
2622 fvuSmxErrIdxFirstHitM11[uFebIdx][uAsicIdx] =
2623 (fvuSmxErrIdxFirstHitM11[uFebIdx][uAsicIdx] + 1) % kuSmxErrCoincWinNbHits;
2624 fvuSmxErrIdxLastHit[uFebIdx][uAsicIdx] = (fvuSmxErrIdxLastHit[uFebIdx][uAsicIdx] + 1) % kuSmxErrCoincWinNbHits;
2625 fvdSmxErrTimeLastHits[uFebIdx][uAsicIdx][fvuSmxErrIdxLastHit[uFebIdx][uAsicIdx]] = dNewHitTime;
2626 }
2627 else {
2629 fvuSmxErrIdxLastHit[uFebIdx][uAsicIdx] = fvuSmxErrIdxLastHit[uFebIdx][uAsicIdx] + 1;
2630 fvdSmxErrTimeLastHits[uFebIdx][uAsicIdx][fvuSmxErrIdxLastHit[uFebIdx][uAsicIdx]] = dNewHitTime;
2631
2633 return kFALSE;
2634 }
2635
2637 Double_t dTimeDiff07 = fvdSmxErrTimeLastHits[uFebIdx][uAsicIdx][fvuSmxErrIdxLastHit[uFebIdx][uAsicIdx]]
2638 - fvdSmxErrTimeLastHits[uFebIdx][uAsicIdx][fvuSmxErrIdxFirstHitM07[uFebIdx][uAsicIdx]];
2639 Double_t dTimeDiff08 = fvdSmxErrTimeLastHits[uFebIdx][uAsicIdx][fvuSmxErrIdxLastHit[uFebIdx][uAsicIdx]]
2640 - fvdSmxErrTimeLastHits[uFebIdx][uAsicIdx][fvuSmxErrIdxFirstHitM08[uFebIdx][uAsicIdx]];
2641 Double_t dTimeDiff09 = fvdSmxErrTimeLastHits[uFebIdx][uAsicIdx][fvuSmxErrIdxLastHit[uFebIdx][uAsicIdx]]
2642 - fvdSmxErrTimeLastHits[uFebIdx][uAsicIdx][fvuSmxErrIdxFirstHitM09[uFebIdx][uAsicIdx]];
2643 Double_t dTimeDiff10 = fvdSmxErrTimeLastHits[uFebIdx][uAsicIdx][fvuSmxErrIdxLastHit[uFebIdx][uAsicIdx]]
2644 - fvdSmxErrTimeLastHits[uFebIdx][uAsicIdx][fvuSmxErrIdxFirstHitM10[uFebIdx][uAsicIdx]];
2645 Double_t dTimeDiff11 = fvdSmxErrTimeLastHits[uFebIdx][uAsicIdx][fvuSmxErrIdxLastHit[uFebIdx][uAsicIdx]]
2646 - fvdSmxErrTimeLastHits[uFebIdx][uAsicIdx][fvuSmxErrIdxFirstHitM11[uFebIdx][uAsicIdx]];
2647
2649 /*
2650 if( 3200 <= dTimeDiff07 && dTimeDiff07 <= 4500 )
2651 dTimeDiff7 -= 3200;
2652 if( 3200 <= dTimeDiff08 && dTimeDiff08 <= 4500 )
2653 dTimeDiff8 -= 3200;
2654 if( 3200 <= dTimeDiff09 && dTimeDiff09 <= 4500 )
2655 dTimeDiff9 -= 3200;
2656 if( 3200 <= dTimeDiff10 && dTimeDiff10 <= 4500 )
2657 dTimeDiff10 -= 3200;
2658 if( 3200 <= dTimeDiff11 && dTimeDiff11 <= 4500 )
2659 dTimeDiff11 -= 3200;
2660*/
2661
2663 if ((kdSmxErrCoincWinBeg <= dTimeDiff07 && dTimeDiff07 <= fdSmxErrCoincWinM07)
2664 || (kdSmxErrCoincWinBeg <= dTimeDiff08 && dTimeDiff08 <= fdSmxErrCoincWinM08)
2665 || (kdSmxErrCoincWinBeg <= dTimeDiff09 && dTimeDiff09 <= fdSmxErrCoincWinM09)
2666 || (kdSmxErrCoincWinBeg <= dTimeDiff10 && dTimeDiff10 <= fdSmxErrCoincWinM10)
2667 || (kdSmxErrCoincWinBeg <= dTimeDiff11 && dTimeDiff11 <= fdSmxErrCoincWinM11)) {
2668 return kTRUE;
2669 }
2670 else {
2671 return kFALSE;
2672 }
2673}
2675Bool_t CbmMcbm2018MonitorSts::ScanForNoisyChannels(Double_t dNoiseThreshold)
2676{
2677 for (UInt_t uFebIdx = 0; uFebIdx < fuNbFebs; ++uFebIdx) {
2678 if (kTRUE == fUnpackParSts->IsFebActive(uFebIdx)) {
2679 LOG(info) << Form(" ------------------ Noisy channels scan for FEB %2d ------------", uFebIdx);
2680 for (UInt_t uAsicIdx = 0; uAsicIdx < fUnpackParSts->GetNbAsicsPerFeb(); ++uAsicIdx)
2681 for (UInt_t uChanIdx = 0; uChanIdx < fUnpackParSts->GetNbChanPerAsic(); ++uChanIdx) {
2682 UInt_t uChanInFeb = uAsicIdx * fUnpackParSts->GetNbChanPerAsic() + uChanIdx;
2683 if (dNoiseThreshold < fhStsFebChanHitRateProf[uFebIdx]->GetBinContent(1 + uChanInFeb))
2684 LOG(info) << Form("Noisy Channel ASIC %d channel %3d (%4d) level %6.0f", uAsicIdx, uChanIdx, uChanInFeb,
2685 fhStsFebChanHitRateProf[uFebIdx]->GetBinContent(1 + uChanInFeb));
2686
2687 } // for( UInt_t uChanIdx = 0; uChanIdx < fUnpackParSts->GetNbChanPerAsic(); ++uChanIdx )
2688
2689 LOG(info) << " ---------------------------------------------------------------";
2690 } // if( kTRUE == fUnpackParSts->IsFebActive( uFebIdx ) )
2691 } // for( UInt_t uFebIdx = 0; uFebIdx < fuNbFebs; ++uFebIdx )
2692 return kTRUE;
2693}
2695
ClassImp(CbmConverterManager)
std::string FormatMsHeaderPrintout(const fles::MicrosliceDescriptor &msDescriptor)
Histogram manager.
Bool_t bMcbm2018ScanNoisySts
Bool_t bMcbm2018WriteSts
Bool_t bMcbm2018ResetSts
Histogram manager.
TProfile * P1(const std::string &name) const
Return pointer to TProfile.
Bool_t Exists(const std::string &name) const
Check existence of object in manager.
void Add(const std::string &name, TNamed *object)
Add new named object to manager.
TH1 * H1(const std::string &name) const
Return pointer to TH1 histogram.
std::vector< std::vector< std::vector< Int_t > > > fviFebModuleIdx
Number of StsXyter ASICs.
std::vector< TProfile2D * > fhStsFebSmxErrRatioCopySameAdcEvoAsic
Int_t fiTimeIntervalRateUpdate
Mean Rate per channel plots.
std::vector< TH2 * > fhStsFebAsicHitRateEvo
std::vector< std::vector< ULong64_t > > fvulChanLastHitTime
std::vector< UInt_t > fvuInitialTsMsbCycleHeader
Flag set after seeing MS header in 1st MS for DPB.
std::vector< std::vector< Double_t > > fvdChanLastHitTime
Last hit time in bins for each Channel.
std::vector< std::vector< std::vector< Int_t > > > fviFebModuleSide
Idx of the STS module for each FEB, [ NbDpb ][ NbCrobPerDpb ][ NbFebsPerCrob ], -1 if inactive.
std::vector< TH2 * > fhStsFebChanDistT
std::vector< ULong64_t > fvulCurrentTsMsb
Bin size in s for the plots with date as X axis.
Bool_t ScanForNoisyChannels(Double_t dNoiseThreshold=1e3)
---------------------------------------------------------------—///
std::vector< std::vector< stsxyter::FinalHit > > fvmAsicHitsInMs
All hits (time in bins, ADC in bins, asic, channel) in last TS, sorted with "<" operator.
std::map< stsxyter::MessType, UInt_t > fmMsgCounter
Current data properties.
std::vector< TProfile * > fhStsFebChanAdcRawProf
std::vector< TH1 * > fhStsFebChanCntRaw
std::vector< Double_t > fvdFebTimeSecLastRateUpdate
static constexpr const Double_t kdSmxErrCoincWinNoiseM11
TH2 * fhMsErrorsEvo
Binning FW error flag.
std::vector< TCanvas * > fvcStsSumm
Canvases.
Bool_t fbLongHistoEnable
Rate evolution histos.
std::vector< TProfile * > fhStsFebChanCloseHitsRatio
TH1 * fhMsSz[kiMaxNbFlibLinks]
std::vector< TH2 * > fhStsFebChanCloseHitsCounts
void SaveAllHistos(TString sFileName="")
std::vector< std::vector< std::vector< Int_t > > > fviFebType
STS module side for each FEB, [ NbDpb ][ NbCrobPerDpb ][ NbFebsPerCrob ], 0 = P, 1 = N,...
std::vector< TCanvas * > fvcStsSmxErr
Bool_t fbSmx2ErrorUseNoiseLevels
SXM 2.0 logic error detection and tagging, 1 eLink case.
std::vector< TH1 * > fhStsFebChanCntRawGood
std::vector< UInt_t > fvuInitialHeaderDone
Current TS MSB cycle for DPB.
std::map< UInt_t, UInt_t > fDpbIdIndexMap
Total number of STS DPBs in system.
stsxyter::MessagePrintMask fPrintMessCtrl
virtual void SetNbMsInTs(size_t uCoreMsNb, size_t uOverlapMsNb)
UInt_t fuCurrDpbId
Current equipment ID, tells from which DPB the current MS is originating.
Int_t fiBinSizeDatePlots
Start of run time since "epoch" in s, for the plots with date as X axis.
std::vector< Int_t > fviFebCountsSinceLastRateUpdate
std::vector< std::vector< UInt_t > > fvuSmxErrIdxLastHit
[ NbFebs ][ NbSmxPerFeb ]
std::vector< std::vector< Bool_t > > fvbCrobActiveFlag
Map of DPB Identifier to DPB index.
std::vector< Double_t > fvdPrevMsTime
Last hit time in ns for each Channel.
UInt_t fuNrOfDpbs
STS address for the first strip of each module.
std::vector< TProfile * > fhStsFebSmxErrRatioCopySameAdcEvo
std::vector< TH2 * > fhStsFebAsicHitRateEvoLong
std::vector< std::vector< Double_t > > fdStsFebChanLastTimeForDist
static constexpr const Double_t kdSmxErrCoincWinNoiseM10
std::vector< TProfile2D * > fhStsFebSmxErrRatioCopyEvoAsic
std::vector< std::vector< UInt_t > > fvuSmxErrIdxFirstHitM07
[ NbFebs ][ NbSmxPerFeb ][ kuSmxErrCoincWinNbHits ]
std::vector< std::vector< stsxyter::FinalHit > > fvmFebHitsInMs
All hits (time in bins, ADC in bins, asic, channel) in last TS, per ASIC, sorted with "<" operator.
std::vector< TProfile2D * > fhStsFebSmxErrRatioEvoAsic
std::vector< TH2 * > fhStsFebChanRawTs
Double_t fdStartTime
Last hit ADC in bins in each MS for each Channel.
std::vector< UInt_t > fvuElinkLastTsHit
TS MSB cycle from MS header in 1st MS for DPB.
static constexpr const Double_t kdSmxErrCoincWinNoiseM09
std::vector< TH2 * > fhStsFebChanMissEvt
std::vector< TH1 * > fhStsFebHitRateEvo
UInt_t fuCurrDpbIdx
Temp holder until Current equipment ID is properly filled in MS.
std::vector< Int_t > fviModAddress
Type of each module: 0 for connectors on the right, 1 for connectors on the left.
std::vector< std::vector< UInt_t > > fvuSmxErrIdxFirstHitM08
[ NbFebs ][ NbSmxPerFeb ]
std::vector< TH2 * > fhStsFebChanHitRateEvo
virtual Bool_t DoUnpack(const fles::Timeslice &ts, size_t component)
static constexpr const Double_t kdSmxErrCoincWinBeg
std::vector< std::vector< std::vector< Double_t > > > fvdChanLastHitTimeInMs
Number of hits in each MS for each Channel.
std::vector< std::vector< std::vector< Double_t > > > fvdFebAdcOffs
ADC gain in e-/b, [ NbDpb ][ NbCrobPerDpb ][ NbFebsPerCrob ].
std::vector< std::vector< std::vector< Double_t > > > fvdFebAdcGain
FEB type, [ NbDpb ][ NbCrobPerDpb ][ NbFebsPerCrob ], 0 = A, 1 = B, -1 if inactive.
static constexpr const Double_t kdSmxErrCoincWinNoiseM07
Coincidence windows 99.9% tagging (up to 0.1% of corruption not detected)
static const UInt_t kuBytesPerMessage
TH1 * fhStsMessType
Histogram manager.
std::vector< TProfile * > fhStsFebSmxErrRatioCopyEvo
static constexpr const Double_t kdSmxErrCoincWinNoiseM08
Bool_t ProcessStsMs(const fles::Timeslice &ts, size_t uMsComp, UInt_t uMsIdx)
UInt_t fuNbFebs
Array to hold the active flag for all CROBs, [ NbDpb ][ NbCrobPerDpb ].
std::vector< Int_t > fviModuleType
Total number of STS modules in the setup.
std::vector< TH2 * > fhStsFebChanMissEvtEvo
std::vector< std::vector< UInt_t > > fvuSmxErrIdxFirstHitM10
[ NbFebs ][ NbSmxPerFeb ]
std::vector< TH2 * > fhStsFebChanAdcRaw
std::vector< TProfile * > fhStsFebChanHitRateProf
ULong64_t fulCurrentTsIdx
TS/MS info.
void SetRunStart(Int_t dateIn, Int_t timeIn, Int_t iBinSize=5)
std::vector< Bool_t > fvbMaskedComponents
Double_t fdSmxErrCoincWinM07
Tagging variables.
std::vector< std::vector< std::vector< Double_t > > > fvdSmxErrTimeLastHits
std::vector< TProfile * > fhStsFebSmxErrRatioEvo
Histograms.
std::vector< std::vector< std::vector< UInt_t > > > fvuChanNbHitsInMs
Header time of each MS.
std::vector< std::vector< Double_t > > fvdFebChanCountsSinceLastRateUpdate
std::vector< TH2 * > fhStsFebChanHitRateEvoLong
void SetLongDurationLimits(UInt_t uDurationSeconds=3600, UInt_t uBinSize=1)
CbmMcbm2018StsPar * fUnpackParSts
/‍** Ignore Overlap Ms: all fuOverlapMsNb MS at the end of timeslice **‍/
std::vector< TH1 * > fhStsFebHitRateEvoLong
Bool_t fbBinningFw
=> Quick and dirty hack for binning FW!!!
Bool_t SmxErrCheckCoinc(UInt_t uFebIdx, UInt_t uAsicIdx, Double_t dNewHitTime)
std::vector< TH1 * > fhStsFebMissEvtEvo
std::vector< std::vector< std::vector< UShort_t > > > fvusChanLastHitAdcInMs
Last hit time in bins in each MS for each Channel.
UInt_t fuNbStsXyters
Number of StsXyter ASICs.
std::vector< stsxyter::FinalHit > fvmHitsInMs
Hits time-sorting.
std::vector< TH2 * > fhStsFebAsicMissEvtEvo
std::vector< UInt_t > fvuCurrentTsMsbCycle
Current TS MSB for each DPB.
TProfile * fhMsSzTime[kiMaxNbFlibLinks]
std::vector< size_t > fvMsComponentsList
virtual void AddMsComponentToList(size_t component, UShort_t usDetectorId)
Bool_t fbPrintMessages
Task configuration values.
std::vector< std::vector< UInt_t > > fvuSmxErrIdxFirstHitM09
[ NbFebs ][ NbSmxPerFeb ]
void FillHitInfo(stsxyter::Message mess, const UShort_t &usElinkIdx, const UInt_t &uAsicIdx, const UInt_t &uMsIdx)
Int_t fiRunStartDateTimeSec
Index of the DPB from which the MS currently unpacked is coming.
void FillEpochInfo(stsxyter::Message mess)
static const Int_t kiMaxNbFlibLinks
ADC offset in e-, [ NbDpb ][ NbCrobPerDpb ][ NbFebsPerCrob ].
static const UInt_t kuSmxErrCoincWinNbHits
std::vector< std::vector< UInt_t > > fvuSmxErrIdxFirstHitM11
[ NbFebs ][ NbSmxPerFeb ]
void FillTsMsbInfo(stsxyter::Message mess, UInt_t uMessIdx=0, UInt_t uMsIdx=0)
std::vector< Double_t > fvdMsTime
Header time of previous MS per link.
CbmHistManager * fHM
Histograms.
Double_t GetFebAdcGain(UInt_t uDpbIdx, UInt_t uCrobIdx, UInt_t uFebIdx)
UInt_t GetDpbId(UInt_t uDpbIdx)
static constexpr UInt_t GetNbFebsPerDpb()
Int_t ElinkIdxToFebIdx(UInt_t uElink)
Int_t GetFebModuleIdx(UInt_t uDpbIdx, UInt_t uCrobIdx, UInt_t uFebIdx)
Bool_t IsFebActive(UInt_t uFebInSystIdx)
UInt_t GetModuleType(UInt_t uModuleIdx)
static constexpr UInt_t GetNbFebsPerCrob()
static constexpr UInt_t GetNbAsicsPerFeb()
static constexpr UInt_t GetNbElinkPerCrob()
Double_t GetFebAdcOffset(UInt_t uDpbIdx, UInt_t uCrobIdx, UInt_t uFebIdx)
static constexpr UInt_t GetNbAsicsPerCrob()
Bool_t IsCrobActive(UInt_t uDpbIdx, UInt_t uCrobIdx)
static constexpr UInt_t GetNbCrobsPerDpb()
static constexpr UInt_t GetNbElinkPerDpb()
UInt_t GetModuleAddress(UInt_t uModuleIdx)
UInt_t ElinkIdxToAsicIdx(Bool_t bFebType, UInt_t uElink)
Int_t GetFebModuleSide(UInt_t uDpbIdx, UInt_t uCrobIdx, UInt_t uFebIdx)
static constexpr UInt_t GetNbChanPerAsic()
static constexpr UInt_t GetNbChanPerFeb()
Data class with information on a STS local track.
XPU_D bool IsHitMissedEvts() const
For Hit data: Returns Missed event flag (1 bit field)
XPU_D uint32_t GetTsMsbValBinning() const
For TS MSB data: Returns the TS MSB 29 bit field)
XPU_D uint16_t GetHitAdc() const
For Hit data: Returns ADC value (5 bit field)
XPU_D uint16_t GetHitChannel() const
For Hit data: Returns StsXYTER channel number (7 bit field)
bool PrintMess(std::ostream &os, MessagePrintMask ctrl=MessagePrintMask::msg_print_Human, bool bBinning=true) const
XPU_D uint16_t GetLinkIndex() const
For all data: Returns the (global) index of the eLink on which the message was received (n bit field)
XPU_D uint16_t GetStatusStatus() const
For Status data: Returns the Status field from ACK frame (4 bit field)
XPU_D MessType GetMessType() const
Returns the message type, see enum MessType.
XPU_D uint16_t GetLinkIndexHitBinning() const
XPU_D uint16_t GetHitTime() const
For Hit data: Returns timestamp (8 bit field, 2 MSB bits overlap removed)
XPU_D uint32_t GetTsMsbVal() const
For TS MSB data: Returns the TS MSB 22 bit field)
XPU_D uint16_t GetHitTimeBinning() const
XPU_D uint16_t GetStatusLink() const
For Status data: Returns the Link Inedx (9 bit field)
XPU_D uint16_t GetMsErrorType() const
For End of MS data: Returns the MS error type field (2 bit field)
XPU_D bool IsMsErrorFlagOn() const
For End of MS data: Returns the MS error flag (1 bit field)
Hash for CbmL1LinkKey.
static constexpr uint32_t kuHitNbTsBinsBinning
static constexpr uint64_t kulTsCycleNbBins
static constexpr uint64_t kulTsCycleNbBinsBinning
static constexpr uint32_t kuHitNbTsBins
static constexpr uint32_t kuHitNbAdcBins
Status/properties constants.
static constexpr double kdClockCycleNs
MessType
Message types.