CbmRoot
Loading...
Searching...
No Matches
CbmMcbm2018MonitorMuch.cxx
Go to the documentation of this file.
1/* Copyright (C) 2018-2020 Variable Energy Cyclotron Centre, Kolkata
2 SPDX-License-Identifier: GPL-3.0-only
3 Authors: Pierre-Alain Loizeau, Vikas Singhal [committer] */
4
5// -----------------------------------------------------------------------------
6// ----- -----
7// ----- CbmMcbm2018MonitorMuch -----
8// ----- Created 11/05/18 by P.-A. Loizeau -----
9// ----- Modified 11/05/18 by Ajit kumar -----
10// ----- -----
11// -----------------------------------------------------------------------------
12
14
15// Data
16
17// CbmRoot
18#include "CbmHistManager.h"
19#include "CbmMcbm2018MuchPar.h"
20
21// FairRoot
22#include "FairRootManager.h"
23#include "FairRun.h"
24#include "FairRunOnline.h"
25#include "FairRuntimeDb.h"
26#include <Logger.h>
27
28// Root
29#include "TClonesArray.h"
30#include "THttpServer.h"
31#include "TMath.h"
32#include "TROOT.h"
33#include "TRandom.h"
34#include "TString.h"
35#include "TStyle.h"
36#include <TFile.h>
37
38// C++11
39#include <bitset>
40
41// C/C++
42#include <iomanip>
43#include <iostream>
44
45#include <stdint.h>
46
47Bool_t bMcbm2018ResetMuch = kFALSE;
48Bool_t bMcbm2018WriteMuch = kFALSE;
49Bool_t bMcbm2018ScanNoisyMuch = kFALSE;
50
53 , fbMuchMode(kFALSE)
54 , fvMsComponentsList()
55 , fuNbCoreMsPerTs(0)
56 , fuNbOverMsPerTs(0)
57 ,
58 //uTimeBin(1e-9),
59 fbIgnoreOverlapMs(kFALSE)
60 , fUnpackParMuch(NULL)
61 , fuNrOfDpbs(0)
62 , fDpbIdIndexMap()
63 , fvbCrobActiveFlag()
64 , fuNbFebs(0)
65 , fuNbStsXyters(0)
66 , fvdFebAdcGain()
67 , fvdFebAdcOffs()
68 ,
69 /*
70 fuNrOfDpbs(0),
71 fDpbIdIndexMap(),
72 fuNbStsXyters(0),
73 fUnpackParMuch->GetNbChanPerAsic()(0),
74 fuNbFebs(0),
75*/
76 fsHistoFileFullname("data/SetupHistos.root")
77 , fbPrintMessages(kFALSE)
78 , fPrintMessCtrl(stsxyter::MessagePrintMask::msg_print_Human)
79 , fbEnableCoincidenceMaps(kFALSE)
80 , fulCurrentTsIdx(0)
81 , fulCurrentMsIdx(0)
82 , fmMsgCounter()
83 , fuCurrentEquipmentId(0)
84 , fuCurrDpbId(0)
85 , fuCurrDpbIdx(0)
86 , fiRunStartDateTimeSec(-1)
87 , fiBinSizeDatePlots(-1)
88 , fvulCurrentTsMsb()
89 , fvuCurrentTsMsbCycle()
90 , fvuInitialHeaderDone()
91 , fvuInitialTsMsbCycleHeader()
92 , fvuElinkLastTsHit()
93 , fvulChanLastHitTime()
94 , fvdChanLastHitTime()
95 , fvdPrevMsTime()
96 , fvdMsTime()
97 , fvuChanNbHitsInMs()
98 , fvdChanLastHitTimeInMs()
99 , fvusChanLastHitAdcInMs()
100 ,
101 // fvmChanHitsInTs(),
102 fdStartTime(-1.0)
103 , prevtime(0.0)
104 , fdStartTimeMsSz(-1.0)
105 , ftStartTimeUnix(std::chrono::steady_clock::now())
106 , fvmHitsInMs()
107 , fvmAsicHitsInMs()
108 , fvmFebHitsInMs()
109 , fuMaxNbMicroslices(100)
110 , fiTimeIntervalRateUpdate(10)
111 , fviFebTimeSecLastRateUpdate()
112 , fviFebCountsSinceLastRateUpdate()
113 , fvdFebChanCountsSinceLastRateUpdate()
114 , fbLongHistoEnable(kFALSE)
115 , fuLongHistoNbSeconds(0)
116 , fuLongHistoBinSizeSec(0)
117 , fuLongHistoBinNb(0)
118 , Counter(0)
119 , Counter1(0)
120 , fdCoincCenter(0.0)
121 , fdCoincBorder(50.0)
122 , fdCoincMin(fdCoincCenter - fdCoincBorder)
123 , fdCoincMax(fdCoincCenter + fdCoincBorder)
124 , fHM(new CbmHistManager())
125 , fhStsMessType(NULL)
126 , fhStsSysMessType(NULL)
127 , fhStsFebChanAdcRaw_combined(NULL)
128 , fhStsMessTypePerDpb(NULL)
129 , fhStsSysMessTypePerDpb(NULL)
130 , fhPulserStatusMessType(NULL)
131 , fhPulserMsStatusFieldType(NULL)
132 , fhStsHitsElinkPerDpb(NULL)
133 , fhRate(NULL)
134 , fhRateAdcCut(NULL)
135 , fHistPadDistr()
136 , fRealHistPadDistr()
137 , fdFebChanCoincidenceLimit(100.0)
138 , fhStsFebChanCntRaw()
139 , fhStsFebChanCntRawGood()
140 , fhStsFebChanAdcRaw()
141 , fhStsFebChanAdcRawProf()
142 , fhStsFebChanAdcCal()
143 , fhStsFebChanAdcCalProf()
144 , fhStsFebChanRawTs()
145 , fhStsFebChanMissEvt()
146 , fhStsFebChanMissEvtEvo()
147 , fhStsFebAsicMissEvtEvo()
148 , fhStsFebMissEvtEvo()
149 , fhStsFebChanHitRateEvo()
150 , fhStsFebChanHitRateProf()
151 , fhStsFebAsicHitRateEvo()
152 , fhStsFebHitRateEvo()
153 , fhStsFebHitRateEvo_mskch()
154 , fhStsFebHitRateEvo_mskch_adccut()
155 , fhStsFebChanHitRateEvoLong()
156 , fhStsFebAsicHitRateEvoLong()
157 , fhStsFebHitRateEvoLong()
158 , fdStsFebChanLastTimeForDist()
159 , fhStsFebChanDistT()
160 , fhStsFebChanDtCoinc()
161 , fhStsFebChanCoinc()
162 , fbSmx2ErrorUseNoiseLevels(kFALSE)
163 , fdSmxErrCoincWinM07(kdSmxErrCoincWinMainM07)
164 , fdSmxErrCoincWinM08(kdSmxErrCoincWinMainM08)
165 , fdSmxErrCoincWinM09(kdSmxErrCoincWinMainM09)
166 , fdSmxErrCoincWinM10(kdSmxErrCoincWinMainM10)
167 , fdSmxErrCoincWinM11(kdSmxErrCoincWinMainM11)
168 , fvdSmxErrTimeLastHits()
169 , fvuSmxErrIdxFirstHitM07()
170 , fvuSmxErrIdxFirstHitM08()
171 , fvuSmxErrIdxFirstHitM09()
172 , fvuSmxErrIdxFirstHitM10()
173 , fvuSmxErrIdxFirstHitM11()
174 , fvuSmxErrIdxLastHit()
175 , fhStsFebSmxErrRatioEvo()
176 , fhStsFebSmxErrRatioEvoAsic()
177 , fhStsFebSmxErrRatioCopyEvo()
178 , fhStsFebSmxErrRatioCopyEvoAsic()
179 , fhStsFebSmxErrRatioCopySameAdcEvo()
180 , fhStsFebSmxErrRatioCopySameAdcEvoAsic()
181 , fcMsSizeAll(NULL)
182{
183}
184
186
188{
189 LOG(info) << "Initializing flib StsXyter unpacker for STS";
190
191 FairRootManager* ioman = FairRootManager::Instance();
192 if (ioman == NULL) { LOG(fatal) << "No FairRootManager instance"; }
193
194 return kTRUE;
195}
196
198{
199 LOG(info) << "Setting parameter containers for " << GetName();
200 fUnpackParMuch = (CbmMcbm2018MuchPar*) (FairRun::Instance()->GetRuntimeDb()->getContainer("CbmMcbm2018MuchPar"));
201}
202
203
205{
206 LOG(info) << "Init parameter containers for " << GetName();
207
208 Bool_t bInit = InitStsParameters();
209 if (kTRUE == bInit) CreateHistograms();
210
211 return bInit;
212}
213
215{
216 LOG(info) << "ReInit parameter containers for " << GetName();
217
218 return InitStsParameters();
219}
220
222{
223
225 LOG(info) << "Nr. of MUCH DPBs: " << fuNrOfDpbs;
226
227 fDpbIdIndexMap.clear();
228 for (UInt_t uDpb = 0; uDpb < fuNrOfDpbs; ++uDpb) {
230 LOG(info) << "Eq. ID for DPB #" << std::setw(2) << uDpb << " = 0x" << std::setw(4) << std::hex
231 << fUnpackParMuch->GetDpbId(uDpb) << std::dec << " => " << fDpbIdIndexMap[fUnpackParMuch->GetDpbId(uDpb)];
232 } // for( UInt_t uDpb = 0; uDpb < fuNrOfDpbs; ++uDpb )
233
235 LOG(info) << "Nr. of FEBs: " << fuNbFebs;
236
238 LOG(info) << "Nr. of StsXyter ASICs: " << fuNbStsXyters;
239
243 for (UInt_t uDpb = 0; uDpb < fuNrOfDpbs; ++uDpb) {
247 for (UInt_t uCrobIdx = 0; uCrobIdx < fUnpackParMuch->GetNbCrobsPerDpb(); ++uCrobIdx) {
248 fvbCrobActiveFlag[uDpb][uCrobIdx] = fUnpackParMuch->IsCrobActive(uDpb, uCrobIdx);
249 fvdFebAdcGain[uDpb][uCrobIdx].resize(fUnpackParMuch->GetNbFebsPerCrob(), 0.0);
250 fvdFebAdcOffs[uDpb][uCrobIdx].resize(fUnpackParMuch->GetNbFebsPerCrob(), 0.0);
251 } // for( UInt_t uCrobIdx = 0; uCrobIdx < fUnpackParMuch->GetNbCrobsPerDpb(); ++uCrobIdx )
252 } // for( UInt_t uDpb = 0; uDpb < fuNrOfDpbs; ++uDpb )
253
254 for (UInt_t uDpb = 0; uDpb < fuNrOfDpbs; ++uDpb) {
255 for (UInt_t uCrobIdx = 0; uCrobIdx < fUnpackParMuch->GetNbCrobsPerDpb(); ++uCrobIdx) {
256 LOG(info) << Form("DPB #%02u CROB #%02u Active: ", uDpb, uCrobIdx) << fvbCrobActiveFlag[uDpb][uCrobIdx];
257 } // for( UInt_t uCrobIdx = 0; uCrobIdx < fUnpackParMuch->GetNbCrobsPerDpb(); ++uCrobIdx )
258 } // for( UInt_t uDpb = 0; uDpb < fuNrOfDpbs; ++uDpb )
259
260 // Internal status initialization
266 for (UInt_t uDpb = 0; uDpb < fuNrOfDpbs; ++uDpb) {
267 fvulCurrentTsMsb[uDpb] = 0;
268 fvuCurrentTsMsbCycle[uDpb] = 0;
269 fvuInitialHeaderDone[uDpb] = kFALSE;
271 } // for( UInt_t uDpb = 0; uDpb < fuNrOfDpbs; ++uDpb )
272
274
282
283 for (UInt_t uXyterIdx = 0; uXyterIdx < fuNbStsXyters; ++uXyterIdx) {
289 fvmAsicHitsInMs[uXyterIdx].clear();
290
291 for (UInt_t uChan = 0; uChan < fUnpackParMuch->GetNbChanPerAsic(); ++uChan) {
292 fvulChanLastHitTime[uXyterIdx][uChan] = 0;
293 fvdChanLastHitTime[uXyterIdx][uChan] = -1.0;
294
295 fvuChanNbHitsInMs[uXyterIdx][uChan].resize(fuMaxNbMicroslices);
296 fvdChanLastHitTimeInMs[uXyterIdx][uChan].resize(fuMaxNbMicroslices);
297 fvusChanLastHitAdcInMs[uXyterIdx][uChan].resize(fuMaxNbMicroslices);
298 for (UInt_t uMsIdx = 0; uMsIdx < fuMaxNbMicroslices; ++uMsIdx) {
299 fvuChanNbHitsInMs[uXyterIdx][uChan][uMsIdx] = 0;
300 fvdChanLastHitTimeInMs[uXyterIdx][uChan][uMsIdx] = -1.0;
301 fvusChanLastHitAdcInMs[uXyterIdx][uChan][uMsIdx] = 0;
302 } // for( UInt_t uMsIdx = 0; uMsIdx < fuMaxNbMicroslices; ++uMsIdx )
303 } // for( UInt_t uChan = 0; uChan < fUnpackParMuch->GetNbChanPerAsic(); ++uChan )
304 } // for( UInt_t uXyterIdx = 0; uXyterIdx < fuNbStsXyters; ++uXyterIdx )
305
306 LOG(info) << "CbmMcbm2018MonitorMuch::ReInitContainers => Changed "
307 "fvuChanNbHitsInMs size "
308 << fvuChanNbHitsInMs.size() << " VS " << fuNbStsXyters;
309 LOG(info) << "CbmMcbm2018MonitorMuch::ReInitContainers => Changed "
310 "fvuChanNbHitsInMs size "
311 << fvuChanNbHitsInMs[0].size() << " VS " << fUnpackParMuch->GetNbChanPerAsic();
312 LOG(info) << "CbmMcbm2018MonitorMuch::ReInitContainers => Changed "
313 "fvuChanNbHitsInMs size "
314 << fvuChanNbHitsInMs[0][0].size() << " VS " << fuMaxNbMicroslices;
315
316 fvmFebHitsInMs.resize(fuNbFebs);
321 for (UInt_t uFebIdx = 0; uFebIdx < fuNbFebs; ++uFebIdx) {
322 fvmFebHitsInMs[uFebIdx].clear();
325 } // for( UInt_t uFebIdx = 0; uFebIdx < fuNbFebs; ++uFebIdx )
326
330
331 return kTRUE;
332}
333
334void CbmMcbm2018MonitorMuch::AddMsComponentToList(size_t component, UShort_t /*usDetectorId*/)
335{
337 for (UInt_t uCompIdx = 0; uCompIdx < fvMsComponentsList.size(); ++uCompIdx)
338 if (component == fvMsComponentsList[uCompIdx]) return;
339
341 if (kiMaxNbFlibLinks <= component) {
342 LOG(error) << "CbmMcbm2018MonitorMuch::AddMsComponentToList => "
343 << "Ignored the addition of component " << component << " as it is above the hadcoded limit of "
344 << static_cast<Int_t>(kiMaxNbFlibLinks) << " !!!!!!!!! "
345 << "\n"
346 << " To change this behavior check kiMaxNbFlibLinks in "
347 "CbmMcbm2018MonitorMuch.cxx";
348 return;
349 } // if( kiMaxNbFlibLinks <= component )
350
351
353 fvMsComponentsList.push_back(component);
354 LOG(info) << "CbmMcbm2018MonitorMuch::AddMsComponentToList => Added component: " << component;
355
357 if (NULL == fhMsSz[component]) {
358 TString sMsSzName = Form("MsSz_link_%02lu", component);
359 TString sMsSzTitle = Form("Size of MS for nDPB of link %02lu; Ms Size [bytes]", component);
360 fhMsSz[component] = new TH1F(sMsSzName.Data(), sMsSzTitle.Data(), 160000, 0., 20000.);
361 fHM->Add(sMsSzName.Data(), fhMsSz[component]);
362
363 sMsSzName = Form("MsSzTime_link_%02lu", component);
364 sMsSzTitle = Form("Size of MS vs time for gDPB of link %02lu; Time[s] ; Ms Size [bytes]", component);
365 fhMsSzTime[component] = new TProfile(sMsSzName.Data(), sMsSzTitle.Data(), 15000, 0., 300.);
366 fHM->Add(sMsSzName.Data(), fhMsSzTime[component]);
367
368 if (NULL != fcMsSizeAll) {
369 fcMsSizeAll->cd(1 + component);
370 gPad->SetLogy();
371 fhMsSzTime[component]->Draw("hist le0");
372 } // if( NULL != fcMsSizeAll )
373 LOG(info) << "Added MS size histo for component: " << component << " (DPB)";
374
375#ifdef USE_HTTP_SERVER
376 THttpServer* server = FairRunOnline::Instance()->GetHttpServer();
377 if (server) {
378 server->Register("/FlibRaw", fhMsSz[component]);
379 server->Register("/FlibRaw", fhMsSzTime[component]);
380 } // if( server )
381#endif
382 } // if( NULL == fhMsSz[ component ] )
383}
384void CbmMcbm2018MonitorMuch::SetNbMsInTs(size_t uCoreMsNb, size_t uOverlapMsNb)
385{
386 fuNbCoreMsPerTs = uCoreMsNb;
387 fuNbOverMsPerTs = uOverlapMsNb;
388 //LOG(info) <<" fuNbCoreMsPerTs "<<fuNbCoreMsPerTs<<" fuNbOverMsPerTs "<<fuNbOverMsPerTs;
389 UInt_t uNbMsTotal = fuNbCoreMsPerTs + fuNbOverMsPerTs;
390
391 if (fuMaxNbMicroslices < uNbMsTotal) {
392 fuMaxNbMicroslices = uNbMsTotal;
393
398 for (UInt_t uXyterIdx = 0; uXyterIdx < fuNbStsXyters; ++uXyterIdx) {
402 for (UInt_t uChan = 0; uChan < fUnpackParMuch->GetNbChanPerAsic(); ++uChan) {
403 fvuChanNbHitsInMs[uXyterIdx][uChan].resize(fuMaxNbMicroslices);
404 fvdChanLastHitTimeInMs[uXyterIdx][uChan].resize(fuMaxNbMicroslices);
405 fvusChanLastHitAdcInMs[uXyterIdx][uChan].resize(fuMaxNbMicroslices);
406 for (UInt_t uMsIdx = 0; uMsIdx < fuMaxNbMicroslices; ++uMsIdx) {
407 fvuChanNbHitsInMs[uXyterIdx][uChan][uMsIdx] = 0;
408 fvdChanLastHitTimeInMs[uXyterIdx][uChan][uMsIdx] = -1.0;
409 fvusChanLastHitAdcInMs[uXyterIdx][uChan][uMsIdx] = 0;
410 } // for( UInt_t uMsIdx = 0; uMsIdx < fuMaxNbMicroslices; ++uMsIdx )
411 } // for( UInt_t uChan = 0; uChan < fUnpackParMuch->GetNbChanPerAsic(); ++uChan )
412 } // for( UInt_t uXyterIdx = 0; uXyterIdx < fuNbStsXyters; ++uXyterIdx )
413 LOG(info) << "CbmMcbm2018MonitorMuch::DoUnpack => Changed fvuChanNbHitsInMs size " << fvuChanNbHitsInMs.size()
414 << " VS " << fuNbStsXyters;
415 LOG(info) << "CbmMcbm2018MonitorMuch::DoUnpack => Changed fvuChanNbHitsInMs size " << fvuChanNbHitsInMs[0].size()
416 << " VS " << fUnpackParMuch->GetNbChanPerAsic();
417 LOG(info) << "CbmMcbm2018MonitorMuch::DoUnpack => Changed fvuChanNbHitsInMs size "
418 << fvuChanNbHitsInMs[0][0].size() << " VS " << fuMaxNbMicroslices;
419 } // if( fuMaxNbMicroslices < uNbMsTotal )
420}
421
422void CbmMcbm2018MonitorMuch::SetCoincidenceBorder(Double_t dCenterPos, Double_t dBorderVal)
423{
424 fdCoincCenter = dCenterPos;
425 fdCoincBorder = dBorderVal;
426 fdCoincMin = dCenterPos - dBorderVal;
427 fdCoincMax = dCenterPos + dBorderVal;
428}
429
431{
432 TString sHistName {""};
433 TString title {""};
434
435 sHistName = "hPulserMessageType";
436 title = "Nb of message for each type; Type";
437 fhStsMessType = new TH1I(sHistName, title, 6, 0., 6.);
438 fhStsMessType->GetXaxis()->SetBinLabel(1, "Dummy");
439 fhStsMessType->GetXaxis()->SetBinLabel(2, "Hit");
440 fhStsMessType->GetXaxis()->SetBinLabel(3, "TsMsb");
441 fhStsMessType->GetXaxis()->SetBinLabel(4, "Epoch");
442 fhStsMessType->GetXaxis()->SetBinLabel(5, "Status");
443 fhStsMessType->GetXaxis()->SetBinLabel(6, "Empty");
444
445 /* *** Missing int + MessType OP!!!! ****
446 fhStsMessType->GetXaxis()->SetBinLabel(1 + stsxyter::MessType::Dummy, "Dummy");
447 fhStsMessType->GetXaxis()->SetBinLabel(1 + stsxyter::MessType::Hit, "Hit");
448 fhStsMessType->GetXaxis()->SetBinLabel(1 + stsxyter::MessType::TsMsb, "TsMsb");
449 fhStsMessType->GetXaxis()->SetBinLabel(1 + stsxyter::MessType::ReadDataAck, "ReadDataAck");
450 fhStsMessType->GetXaxis()->SetBinLabel(1 + stsxyter::MessType::Ack, "Ack");
451*/
452
453 sHistName = "hPulserSysMessType";
454 title = "Nb of system message for each type; System Type";
455 fhStsSysMessType = new TH1I(sHistName, title, 17, 0., 17.);
456 /*
457 hSysMessType->GetXaxis()->SetBinLabel(1 + ngdpb::SYSMSG_DAQ_START, "DAQ START");
458 hSysMessType->GetXaxis()->SetBinLabel(1 + ngdpb::SYSMSG_DAQ_FINISH, "DAQ FINISH");
459 hSysMessType->GetXaxis()->SetBinLabel(1 + 16, "GET4 Hack 32B");
460*/
461 sHistName = "hStsFebChanAdcRaw_combined";
462 title = "ADC hist combined";
464 new TH1I(sHistName, title, stsxyter::kuHitNbAdcBins, -0.5, stsxyter::kuHitNbAdcBins - 0.5);
465
466 LOG(debug) << "Initialized 1st Histo";
467 sHistName = "hPulserMessageTypePerDpb";
468 title = "Nb of message of each type for each DPB; DPB; Type";
469 fhStsMessTypePerDpb = new TH2I(sHistName, title, fuNrOfDpbs, 0, fuNrOfDpbs, 6, 0., 6.);
470 fhStsMessTypePerDpb->GetYaxis()->SetBinLabel(1, "Dummy");
471 fhStsMessTypePerDpb->GetYaxis()->SetBinLabel(2, "Hit");
472 fhStsMessTypePerDpb->GetYaxis()->SetBinLabel(3, "TsMsb");
473 fhStsMessTypePerDpb->GetYaxis()->SetBinLabel(4, "Epoch");
474 fhStsMessTypePerDpb->GetYaxis()->SetBinLabel(5, "Status");
475 fhStsMessTypePerDpb->GetYaxis()->SetBinLabel(6, "Empty");
476 /* *** Missing int + MessType OP!!!! ****
477 fhStsMessType->GetYaxis()->SetBinLabel(1 + stsxyter::MessType::Dummy, "Dummy");
478 fhStsMessType->GetYaxis()->SetBinLabel(1 + stsxyter::MessType::Hit, "Hit");
479 fhStsMessType->GetYaxis()->SetBinLabel(1 + stsxyter::MessType::TsMsb, "TsMsb");
480 fhStsMessType->GetYaxis()->SetBinLabel(1 + stsxyter::MessType::ReadDataAck, "ReadDataAck");
481 fhStsMessType->GetYaxis()->SetBinLabel(1 + stsxyter::MessType::Ack, "Ack");
482*/
483
484
485 for (UInt_t uModuleId = 0; uModuleId < 2; ++uModuleId) {
487 sHistName = Form("HistPadDistr_Module_%01u", uModuleId);
488 title = Form("Pad distribution for, Module #%01u; ", uModuleId);
489
490 //Below for Rectangular Module shape VS
491 fHistPadDistr.push_back(new TH2I(sHistName, title, 23, -0.5, 22.5, 97, -0.5, 96.5));
492
493 sHistName = Form("RealHistPadDistr_Module_%01u", uModuleId);
494 title = Form("Progressive Pad distribution for, Module #%01u; ", uModuleId);
495 //Below for Progressive Geometry Module shape VS
496 fRealHistPadDistr.push_back(new TH2D(sHistName, title, 500, -0.5, 499.5, 1000, -0.5, 999.5));
497 }
498
499 sHistName = "hRate";
500 title = "Rate in kHz";
501 fhRate = new TH1I(sHistName, title, 10000, -0.5, 9999.5);
502
503 sHistName = "hRateAdcCut";
504 title = "Rate in kHz with Adc cut";
505 fhRateAdcCut = new TH1I(sHistName, title, 10000, -0.5, 9999.5);
506
507 sHistName = "hPulserSysMessTypePerDpb";
508 title = "Nb of system message of each type for each DPB; DPB; System Type";
509 fhStsSysMessTypePerDpb = new TH2I(sHistName, title, fuNrOfDpbs, 0, fuNrOfDpbs, 17, 0., 17.);
510 /*
511 hSysMessType->GetYaxis()->SetBinLabel(1 + ngdpb::SYSMSG_DAQ_START, "DAQ START");
512 hSysMessType->GetYaxis()->SetBinLabel(1 + ngdpb::SYSMSG_DAQ_FINISH, "DAQ FINISH");
513 hSysMessType->GetYaxis()->SetBinLabel(1 + 16, "GET4 Hack 32B");
514*/
515
516 sHistName = "hPulserStatusMessType";
517 title = "Nb of status message of each type for each DPB; ASIC; Status Type";
518 fhPulserStatusMessType = new TH2I(sHistName, title, fuNbStsXyters, 0, fuNbStsXyters, 16, 0., 16.);
519 /*
520 fhPulserStatusMessType->GetYaxis()->SetBinLabel( 1, "Dummy");
521 fhPulserStatusMessType->GetYaxis()->SetBinLabel( 2, "Hit");
522 fhPulserStatusMessType->GetYaxis()->SetBinLabel( 3, "TsMsb");
523 fhPulserStatusMessType->GetYaxis()->SetBinLabel( 4, "Epoch");
524*/
525
526 sHistName = "hPulserMsStatusFieldType";
527 title = "For each flag in the MS header, ON/OFF counts; Flag bit []; ON/OFF; MS []";
528 fhPulserMsStatusFieldType = new TH2I(sHistName, title, 16, -0.5, 15.5, 2, -0.5, 1.5);
529 /*
530 fhPulserMsStatusFieldType->GetYaxis()->SetBinLabel( 1, "Dummy");
531 fhPulserMsStatusFieldType->GetYaxis()->SetBinLabel( 2, "Hit");
532 fhPulserMsStatusFieldType->GetYaxis()->SetBinLabel( 3, "TsMsb");
533 fhPulserMsStatusFieldType->GetYaxis()->SetBinLabel( 4, "Epoch");
534*/
535
536 sHistName = "hStsHitsElinkPerDpb";
537 title = "Nb of hit messages per eLink for each DPB; DPB; eLink; Hits nb []";
538 fhStsHitsElinkPerDpb = new TH2I(sHistName, title, fuNrOfDpbs, 0, fuNrOfDpbs, 42, 0., 42.);
539
540 LOG(debug) << "Initialized 2nd Histo";
541 /*
542 // Number of rate bins =
543 // 9 for the sub-unit decade
544 // + 9 for each unit of each decade * 10 for the subdecade range
545 // + 1 for the closing bin top edge
546 const Int_t iNbDecadesRate = 9;
547 const Int_t iNbStepsDecade = 9;
548 const Int_t iNbSubStepsInStep = 10;
549 const Int_t iNbBinsRate = iNbStepsDecade
550 + iNbStepsDecade * iNbSubStepsInStep * iNbDecadesRate
551 + 1;
552 Double_t dBinsRate[iNbBinsRate];
553 // First fill sub-unit decade
554 for( Int_t iSubU = 0; iSubU < iNbStepsDecade; iSubU ++ )
555 dBinsRate[ iSubU ] = 0.1 * ( 1 + iSubU );
556 std::cout << std::endl;
557 // Then fill the main decades
558 Double_t dSubstepSize = 1.0 / iNbSubStepsInStep;
559 for( Int_t iDecade = 0; iDecade < iNbDecadesRate; iDecade ++)
560 {
561 Double_t dBase = std::pow( 10, iDecade );
562 Int_t iDecadeIdx = iNbStepsDecade
563 + iDecade * iNbStepsDecade * iNbSubStepsInStep;
564 for( Int_t iStep = 0; iStep < iNbStepsDecade; iStep++ )
565 {
566 Int_t iStepIdx = iDecadeIdx + iStep * iNbSubStepsInStep;
567 for( Int_t iSubStep = 0; iSubStep < iNbSubStepsInStep; iSubStep++ )
568 {
569 dBinsRate[ iStepIdx + iSubStep ] = dBase * (1 + iStep)
570 + dBase * dSubstepSize * iSubStep;
571 } // for( Int_t iSubStep = 0; iSubStep < iNbSubStepsInStep; iSubStep++ )
572 } // for( Int_t iStep = 0; iStep < iNbStepsDecade; iStep++ )
573 } // for( Int_t iDecade = 0; iDecade < iNbDecadesRate; iDecade ++)
574 dBinsRate[ iNbBinsRate - 1 ] = std::pow( 10, iNbDecadesRate );
575*/
576
577 LOG(debug) << "Initialized 3rd Histo";
579
580 //UInt_t uAlignedLimit = fuLongHistoNbSeconds - (fuLongHistoNbSeconds % fuLongHistoBinSizeSec);
581 UInt_t uAlignedLimit = 0;
582 //fuLongHistoBinNb = uAlignedLimit / fuLongHistoBinSizeSec; VS & AK: Commented due to Floating Point Exception error;
583 /*
584 UInt_t uNbBinEvo = (32768 + 1) * 2;
585 Double_t dMaxEdgeEvo = stsxyter::kdClockCycleNs
586 * static_cast< Double_t >( uNbBinEvo ) / 2.0;
587 Double_t dMinEdgeEvo = dMaxEdgeEvo * -1.0;
588
589 UInt_t uNbBinDt = static_cast<UInt_t>( (fdCoincMax - fdCoincMin )/stsxyter::kdClockCycleNs );
590*/
596 for (UInt_t uFebIdx = 0; uFebIdx < fuNbFebs; ++uFebIdx) {
598 sHistName = Form("hStsFebChanCntRaw_%03u", uFebIdx);
599 title = Form("Hits Count per channel, FEB #%03u; Channel; Hits []", uFebIdx);
600 fhStsFebChanCntRaw.push_back(
601 new TH1I(sHistName, title, fUnpackParMuch->GetNbChanPerFeb(), -0.5, fUnpackParMuch->GetNbChanPerFeb() - 0.5));
602
603 sHistName = Form("hStsFebChanCntRawGood_%03u", uFebIdx);
604 title = Form("Hits Count per channel in good MS (SX2 bug flag off), FEB "
605 "#%03u; Channel; Hits []",
606 uFebIdx);
607 fhStsFebChanCntRawGood.push_back(
608 new TH1I(sHistName, title, fUnpackParMuch->GetNbChanPerFeb(), -0.5, fUnpackParMuch->GetNbChanPerFeb() - 0.5));
609
611 sHistName = Form("hStsFebChanAdcRaw_%03u", uFebIdx);
612 title = Form("Raw Adc distribution per channel, FEB #%03u; Channel []; Adc "
613 "[]; Hits []",
614 uFebIdx);
615 fhStsFebChanAdcRaw.push_back(new TH2I(sHistName, title, fUnpackParMuch->GetNbChanPerFeb(), -0.5,
618
620 sHistName = Form("hStsFebChanAdcRawProfc_%03u", uFebIdx);
621 title = Form("Raw Adc prodile per channel, FEB #%03u; Channel []; Adc []", uFebIdx);
622 fhStsFebChanAdcRawProf.push_back(
623 new TProfile(sHistName, title, fUnpackParMuch->GetNbChanPerFeb(), -0.5, fUnpackParMuch->GetNbChanPerFeb() - 0.5));
624
626 sHistName = Form("hStsFebChanAdcCal_%03u", uFebIdx);
627 title = Form("Cal. Adc distribution per channel, FEB #%03u; Channel []; "
628 "Adc [e-]; Hits []",
629 uFebIdx);
630 fhStsFebChanAdcCal.push_back(new TH2I(sHistName, title, fUnpackParMuch->GetNbChanPerFeb(), -0.5,
631 fUnpackParMuch->GetNbChanPerFeb() - 0.5, 50, 0., 100000.));
632
634 sHistName = Form("hStsFebChanAdcCalProfc_%03u", uFebIdx);
635 title = Form("Cal. Adc prodile per channel, FEB #%03u; Channel []; Adc [e-]", uFebIdx);
636 fhStsFebChanAdcCalProf.push_back(
637 new TProfile(sHistName, title, fUnpackParMuch->GetNbChanPerFeb(), -0.5, fUnpackParMuch->GetNbChanPerFeb() - 0.5));
638
640 sHistName = Form("hStsFebChanRawTs_%03u", uFebIdx);
641 title = Form("Raw Timestamp distribution per channel, FEB #%03u; Channel "
642 "[]; Ts []; Hits []",
643 uFebIdx);
644 fhStsFebChanRawTs.push_back(new TH2I(sHistName, title, fUnpackParMuch->GetNbChanPerFeb(), -0.5,
647
649 sHistName = Form("hStsFebChanMissEvt_%03u", uFebIdx);
650 title = Form("Missed Event flags per channel, FEB #%03u; Channel []; Miss "
651 "Evt []; Hits []",
652 uFebIdx);
653 fhStsFebChanMissEvt.push_back(new TH2I(sHistName, title, fUnpackParMuch->GetNbChanPerFeb(), -0.5,
654 fUnpackParMuch->GetNbChanPerFeb() - 0.5, 2, -0.5, 1.5));
655
657 sHistName = Form("hStsFebChanMissEvtEvo_%03u", uFebIdx);
658 title = Form("Missed Evt flags per second & channel in FEB #%03u; Time "
659 "[s]; Channel []; Missed Evt flags []",
660 uFebIdx);
661 fhStsFebChanMissEvtEvo.push_back(new TH2I(sHistName, title, 1800, 0, 1800, fUnpackParMuch->GetNbChanPerFeb(), -0.5,
663
665 sHistName = Form("hStsFebAsicMissEvtEvo_%03u", uFebIdx);
666 title = Form("Missed Evt flags per second & StsXyter in FEB #%03u; Time "
667 "[s]; Asic []; Missed Evt flags []",
668 uFebIdx);
669 fhStsFebAsicMissEvtEvo.push_back(new TH2I(sHistName, title, 1800, 0, 1800, fUnpackParMuch->GetNbAsicsPerFeb(), -0.5,
671
673 sHistName = Form("hStsFebMissEvtEvo_%03u", uFebIdx);
674 title = Form("Missed Evt flags per second & channel in FEB #%03u; Time "
675 "[s]; Missed Evt flags []",
676 uFebIdx);
677 fhStsFebMissEvtEvo.push_back(new TH1I(sHistName, title, 1800, 0, 1800));
678
680 sHistName = Form("hStsFebChanRateEvo_%03u", uFebIdx);
681 title = Form("Hits per second & channel in FEB #%03u; Time [s]; Channel []; Hits []", uFebIdx);
682 fhStsFebChanHitRateEvo.push_back(new TH2I(sHistName, title, 1800, 0, 1800, fUnpackParMuch->GetNbChanPerFeb(), -0.5,
684
686 sHistName = Form("hStsFebChanRateProf_%03u", uFebIdx);
687 title = Form("Hits per second for each channel in FEB #%03u; Channel []; Hits/s []", uFebIdx);
688 fhStsFebChanHitRateProf.push_back(
689 new TProfile(sHistName, title, fUnpackParMuch->GetNbChanPerFeb(), -0.5, fUnpackParMuch->GetNbChanPerFeb() - 0.5));
690
692 sHistName = Form("hStsFebAsicRateEvo_%03u", uFebIdx);
693 title = Form("Hits per second & StsXyter in FEB #%03u; Time [s]; Asic []; Hits []", uFebIdx);
694 fhStsFebAsicHitRateEvo.push_back(new TH2I(sHistName, title, 1800, 0, 1800, fUnpackParMuch->GetNbAsicsPerFeb(), -0.5,
696 /*
698 sHistName = Form( "hStsFebRateEvo_%03u", uFebIdx );
699 title = Form( "Hits per second in FEB #%03u; Time [s]; Hits []", uFebIdx );
700 fhStsFebHitRateEvo.push_back( new TH1I(sHistName, title, 1800, 0, 1800 ) );
701*/
703 sHistName = Form("hStsFebRateEvo_%03u", uFebIdx);
704 title = Form("Hits per second in FEB #%03u; Time [s]; Hits []", uFebIdx);
705 //fhStsFebHitRateEvo.push_back( new TH1I(sHistName, title, 5000000, 0., 10000000. ) ); //2ms
706 fhStsFebHitRateEvo.push_back(new TH1I(sHistName, title, 250000, 0., 1000000.)); //4ms
707 //fhStsFebHitRateEvo.push_back( new TH1I(sHistName, title, 200000, 0., 1000000. ) ); //5ms
708 // fhStsFebHitRateEvo.push_back( new TH1I(sHistName, title, 125000, 0., 1000000. ) ); //8ms
709 // fhStsFebHitRateEvo.push_back( new TH1I(sHistName, title, 100000, 0., 1000000. ) ); //10ms
710 // fhStsFebHitRateEvo.push_back( new TH1I(sHistName, title, 62500, 0., 1000000. ) ); //16ms
711 // fhStsFebHitRateEvo.push_back( new TH1I(sHistName, title, 50000, 0., 1000000. ) ); //20ms
712 // fhStsFebHitRateEvo.push_back( new TH1I(sHistName, title, 20000, 0., 1000000. ) ); //50ms
713 // fhStsFebHitRateEvo.push_back( new TH1I(sHistName, title, 10000, 0., 1000000. ) ); //100ms
714 // fhStsFebHitRateEvo.push_back( new TH1I(sHistName, title, 2000, 0., 1000000. ) ); //500ms
715
717 sHistName = Form("hStsFebRateEvo_mskch_%03u", uFebIdx);
718 title = Form("Hits per second in FEB #%03u; Time [s]; Hits []", uFebIdx);
719 fhStsFebHitRateEvo_mskch.push_back(new TH1I(sHistName, title, 1800, 0, 1800));
720
722 sHistName = Form("hStsFebRateEvo_mskch_adcut_%03u", uFebIdx);
723 title = Form("Hits per second in FEB #%03u; Time [s]; Hits []", uFebIdx);
724 fhStsFebHitRateEvo_mskch_adccut.push_back(new TH1I(sHistName, title, 1800, 0, 1800));
725
727 sHistName = Form("hStsFebChanRateEvoLong_%03u", uFebIdx);
728 title = Form("Hits per second & channel in FEB #%03u; Time [min]; Channel []; Hits []", uFebIdx);
729 fhStsFebChanHitRateEvoLong.push_back(new TH2D(sHistName, title, fuLongHistoBinNb, -0.5, uAlignedLimit - 0.5,
732
734 sHistName = Form("hStsFebAsicRateEvoLong_%03u", uFebIdx);
735 title = Form("Hits per second & StsXyter in FEB #%03u; Time [min]; Asic []; Hits []", uFebIdx);
736 fhStsFebAsicHitRateEvoLong.push_back(new TH2D(sHistName, title, fuLongHistoBinNb, -0.5, uAlignedLimit - 0.5,
739
741 sHistName = Form("hStsFebRateEvoLong_%03u", uFebIdx);
742 title = Form("Hits per second in FEB #%03u; Time [min]; Hits []", uFebIdx);
743 fhStsFebHitRateEvoLong.push_back(new TH1D(sHistName, title, fuLongHistoBinNb, -0.5, uAlignedLimit - 0.5));
744
746 sHistName = Form("hStsFebChanDistT_%03u", uFebIdx);
747 title = Form("Time distance between hits on same channel in between FEB "
748 "#%03u; Time difference [ns]; Channel []; ",
749 uFebIdx);
750 fhStsFebChanDistT.push_back(new TH2I(sHistName, title, 1000, -0.5, 6250.0 - 0.5, fUnpackParMuch->GetNbChanPerFeb(),
751 -0.5, fUnpackParMuch->GetNbChanPerFeb() - 0.5));
752
754 fhStsFebChanDtCoinc[uFebIdx].resize(fuNbFebs, nullptr);
755 fhStsFebChanCoinc[uFebIdx].resize(fuNbFebs, nullptr);
756 for (UInt_t uFebIdxB = uFebIdx; uFebIdxB < fuNbFebs; ++uFebIdxB) {
757 sHistName = Form("hStsFebChanDtCoinc_%03u_%03u", uFebIdx, uFebIdxB);
758 title = Form("Channel coincidences Time diff between FEB #%03u and FEB "
759 "#%03u; Time difference [ns]",
760 uFebIdx, uFebIdxB);
761 fhStsFebChanDtCoinc[uFebIdx][uFebIdxB] = new TH1I(sHistName, title, 400, -1250., 1250.);
762
763 sHistName = Form("hStsFebChanCoinc_%03u_%03u", uFebIdx, uFebIdxB);
764 title = Form("Channel coincidences between FEB #%03u and FEB #%03u; "
765 "Channel FEB #%03u []; Channel FEB #%03u []; Coinc. []",
766 uFebIdx, uFebIdxB, uFebIdx, uFebIdxB);
767 fhStsFebChanCoinc[uFebIdx][uFebIdxB] =
768 new TH2I(sHistName, title, fUnpackParMuch->GetNbChanPerFeb(), -0.5, fUnpackParMuch->GetNbChanPerFeb() - 0.5,
770 } // for( UInt_t uFebIdxB = uFebIdx; uFebIdxB < fuNbFebs; ++uFebIdxB )
771
772 } // for( UInt_t uFebIdx = 0; uFebIdx < fuNbFebs; ++uFebIdx )
773
775
776 LOG(debug) << "Initialized 4th Histo before SXM 2.0 Logic Error";
779 for (UInt_t uFebIdx = 0; uFebIdx < fuNbFebs; ++uFebIdx) {
781 sHistName = Form("hStsFebSmxErrRatioEvo_%03u", uFebIdx);
782 title = Form("Proportion of uS with SMX logic error in FEB #%03u; Time "
783 "[s]; Error MS fract. []",
784 uFebIdx);
785 fhStsFebSmxErrRatioEvo.push_back(new TProfile(sHistName, title, 1800, 0, 1800));
786
788 sHistName = Form("hStsFebSmxErrRatioEvoAsic_%03u", uFebIdx);
789 title = Form("Proportion of uS with SMX logic error per ASIC in FEB #%03u; "
790 "Time [s]; ASIC []; Error MS fract. []",
791 uFebIdx);
792 fhStsFebSmxErrRatioEvoAsic.push_back(new TProfile2D(sHistName, title, 1800, 0, 1800,
795
797 sHistName = Form("hStsFebSmxErrRatioCopyEvo_%03u", uFebIdx);
798 title = Form("Proportion of uS with hit copies in FEB #%03u; Time [s]; "
799 "Copies MS fract. []",
800 uFebIdx);
801 fhStsFebSmxErrRatioCopyEvo.push_back(new TProfile(sHistName, title, 1800, 0, 1800));
802
804 sHistName = Form("hStsFebSmxErrRatioCopyEvoAsic_%03u", uFebIdx);
805 title = Form("Proportion of uS with hit copies per ASIC in FEB #%03u; Time "
806 "[s]; ASIC []; Copies MS fract. []",
807 uFebIdx);
808 fhStsFebSmxErrRatioCopyEvoAsic.push_back(new TProfile2D(sHistName, title, 1800, 0, 1800,
811
813 sHistName = Form("hStsFebSmxErrRatioCopySameAdcEvo_%03u", uFebIdx);
814 title = Form("Proportion of uS with hit full copies in FEB #%03u; Time "
815 "[s]; Copies MS fract. []",
816 uFebIdx);
817 fhStsFebSmxErrRatioCopySameAdcEvo.push_back(new TProfile(sHistName, title, 1800, 0, 1800));
818
820 sHistName = Form("hStsFebSmxErrRatioCopySameAdcEvoAsic_%03u", uFebIdx);
821 title = Form("Proportion of uS with hit full copies per ASIC in FEB #%03u; "
822 "Time [s]; ASIC []; Copies MS fract. []",
823 uFebIdx);
824 fhStsFebSmxErrRatioCopySameAdcEvoAsic.push_back(new TProfile2D(sHistName, title, 1800, 0, 1800,
827 } // for( UInt_t uFebIdx = 0; uFebIdx < fuNbFebs; ++uFebIdx )
830
831 // Miscroslice properties histos
832 for (Int_t component = 0; component < kiMaxNbFlibLinks; component++) {
833 fhMsSz[component] = NULL;
834 fhMsSzTime[component] = NULL;
835 } // for( Int_t component = 0; component < kiMaxNbFlibLinks; component ++ )
836
837 LOG(debug) << "Initialized 6th Histo before FairRunOnlne Instance";
838
839 // Online histo browser commands
840#ifdef USE_HTTP_SERVER
841 THttpServer* server = FairRunOnline::Instance()->GetHttpServer();
842 if (server) {
843 for (UInt_t uModuleId = 0; uModuleId < 2; ++uModuleId) {
844 server->Register("/StsRaw", fHistPadDistr[uModuleId]);
845 server->Register("/StsRaw", fRealHistPadDistr[uModuleId]);
846 }
847
848 server->Register("/StsRaw", fhRate);
849 server->Register("/StsRaw", fhRateAdcCut);
850 server->Register("/StsRaw", fhStsMessType);
851 server->Register("/StsRaw", fhStsSysMessType);
852 server->Register("/StsRaw", fhStsMessTypePerDpb);
853 server->Register("/StsRaw", fhStsSysMessTypePerDpb);
854 server->Register("/StsRaw", fhPulserStatusMessType);
855 server->Register("/StsRaw", fhPulserMsStatusFieldType);
856 server->Register("/StsRaw", fhStsHitsElinkPerDpb);
857 server->Register("/StsRaw", fhStsFebChanAdcRaw_combined);
858
859
860 for (UInt_t uFebIdx = 0; uFebIdx < fuNbFebs; ++uFebIdx) {
861 if (kTRUE == fUnpackParMuch->IsFebActive(uFebIdx)) {
862 server->Register("/StsFeb", fhStsFebChanCntRaw[uFebIdx]);
863 server->Register("/StsFeb", fhStsFebChanCntRawGood[uFebIdx]);
864 server->Register("/StsFeb", fhStsFebChanAdcRaw[uFebIdx]);
865 server->Register("/StsFeb", fhStsFebChanAdcRawProf[uFebIdx]);
866 server->Register("/StsFeb", fhStsFebChanAdcCal[uFebIdx]);
867 server->Register("/StsFeb", fhStsFebChanAdcCalProf[uFebIdx]);
868 server->Register("/StsFeb", fhStsFebChanRawTs[uFebIdx]);
869 server->Register("/StsFeb", fhStsFebChanMissEvt[uFebIdx]);
870 server->Register("/StsFeb", fhStsFebChanMissEvtEvo[uFebIdx]);
871 server->Register("/StsFeb", fhStsFebAsicMissEvtEvo[uFebIdx]);
872 server->Register("/StsFeb", fhStsFebMissEvtEvo[uFebIdx]);
873 server->Register("/StsFeb", fhStsFebChanHitRateEvo[uFebIdx]);
874 server->Register("/StsFeb", fhStsFebChanHitRateProf[uFebIdx]);
875 server->Register("/StsFeb", fhStsFebAsicHitRateEvo[uFebIdx]);
876 server->Register("/StsFeb", fhStsFebHitRateEvo[uFebIdx]);
877 server->Register("/StsFeb", fhStsFebHitRateEvo_mskch[uFebIdx]);
878 server->Register("/StsFeb", fhStsFebHitRateEvo_mskch_adccut[uFebIdx]);
879 server->Register("/StsFeb", fhStsFebChanHitRateEvoLong[uFebIdx]);
880 server->Register("/StsFeb", fhStsFebAsicHitRateEvoLong[uFebIdx]);
881 server->Register("/StsFeb", fhStsFebHitRateEvoLong[uFebIdx]);
882 server->Register("/StsFeb", fhStsFebChanDistT[uFebIdx]);
883 for (UInt_t uFebIdxB = uFebIdx; uFebIdxB < fuNbFebs; ++uFebIdxB) {
884 server->Register("/StsFeb", fhStsFebChanDtCoinc[uFebIdx][uFebIdxB]);
885 server->Register("/StsFeb", fhStsFebChanCoinc[uFebIdx][uFebIdxB]);
886 } // for( UInt_t uFebIdxB = uFebIdx; uFebIdxB < fuNbFebs; ++uFebIdxB )
887
888 server->Register("/StsSmxErr", fhStsFebSmxErrRatioEvo[uFebIdx]);
889 server->Register("/StsSmxErr", fhStsFebSmxErrRatioEvoAsic[uFebIdx]);
890 server->Register("/StsSmxErr", fhStsFebSmxErrRatioCopyEvo[uFebIdx]);
891 server->Register("/StsSmxErr", fhStsFebSmxErrRatioCopyEvoAsic[uFebIdx]);
892 server->Register("/StsSmxErr", fhStsFebSmxErrRatioCopySameAdcEvo[uFebIdx]);
893 server->Register("/StsSmxErr", fhStsFebSmxErrRatioCopySameAdcEvoAsic[uFebIdx]);
894 } // if( kTRUE == fUnpackParMuch->IsFebActive( uFebIdx ) )
895 } // for( UInt_t uFebIdx = 0; uFebIdx < fuNbFebs; ++uFebIdx )
896
897 server->RegisterCommand("/Reset_All", "bMcbm2018ResetMuch=kTRUE");
898 server->RegisterCommand("/Write_All", "bMcbm2018WriteMuch=kTRUE");
899 server->RegisterCommand("/ScanNoisyCh", "bMcbm2018ScanNoisyMuch=kTRUE");
900
901
902 server->Restrict("/Reset_All", "allow=admin");
903 server->Restrict("/Write_All", "allow=admin");
904 server->Restrict("/ScanNoisyCh", "allow=admin");
905 } // if( server )
906#endif
907
909 Double_t w = 10;
910 Double_t h = 10;
911 LOG(debug) << "Initialized 7th Histo before Summary per FEB";
912 // Summary per FEB
913 for (UInt_t uFebIdx = 0; uFebIdx < fuNbFebs; ++uFebIdx) {
914 if (kTRUE == fUnpackParMuch->IsFebActive(uFebIdx)) {
915 TCanvas* cStsSumm = new TCanvas(Form("cStsSum_%03u", uFebIdx), Form("Summary plots for FEB %03u", uFebIdx), w, h);
916 cStsSumm->Divide(2, 3);
917
918 cStsSumm->cd(1);
919 gPad->SetGridx();
920 gPad->SetGridy();
921 gPad->SetLogy();
922 fhStsFebChanCntRaw[uFebIdx]->Draw();
923
924 cStsSumm->cd(2);
925 gPad->SetGridx();
926 gPad->SetGridy();
927 gPad->SetLogy();
928 fhStsFebChanHitRateProf[uFebIdx]->Draw("e0");
929
930 cStsSumm->cd(3);
931 gPad->SetGridx();
932 gPad->SetGridy();
933 gPad->SetLogz();
934 fhStsFebChanAdcRaw[uFebIdx]->Draw("colz");
935
936 cStsSumm->cd(4);
937 gPad->SetGridx();
938 gPad->SetGridy();
939 // gPad->SetLogy();
940 fhStsFebChanAdcRawProf[uFebIdx]->Draw();
941
942 cStsSumm->cd(5);
943 gPad->SetGridx();
944 gPad->SetGridy();
945 gPad->SetLogz();
946 fhStsFebChanAdcCal[uFebIdx]->Draw("colz");
947
948 cStsSumm->cd(6);
949 gPad->SetGridx();
950 gPad->SetGridy();
951 // gPad->SetLogy();
952 fhStsFebChanAdcCalProf[uFebIdx]->Draw();
953
954
955 TCanvas* cStsSmxErr =
956 new TCanvas(Form("cStsSmxErr_%03u", uFebIdx), Form("SMX logic error plots for FEB %03u", uFebIdx), w, h);
957 cStsSmxErr->Divide(2, 3);
958
959 cStsSmxErr->cd(1);
960 gPad->SetGridx();
961 gPad->SetGridy();
962 gPad->SetLogy();
963 fhStsFebSmxErrRatioEvo[uFebIdx]->Draw();
964
965 cStsSmxErr->cd(2);
966 gPad->SetGridx();
967 gPad->SetGridy();
968 gPad->SetLogz();
969 fhStsFebSmxErrRatioEvoAsic[uFebIdx]->Draw("colz");
970
971 cStsSmxErr->cd(3);
972 gPad->SetGridx();
973 gPad->SetGridy();
974 gPad->SetLogy();
975 fhStsFebSmxErrRatioCopyEvo[uFebIdx]->Draw();
976
977 cStsSmxErr->cd(4);
978 gPad->SetGridx();
979 gPad->SetGridy();
980 gPad->SetLogz();
981 fhStsFebSmxErrRatioCopyEvoAsic[uFebIdx]->Draw("colz");
982
983 cStsSmxErr->cd(5);
984 gPad->SetGridx();
985 gPad->SetGridy();
986 gPad->SetLogy();
987 fhStsFebSmxErrRatioCopySameAdcEvo[uFebIdx]->Draw();
988
989 cStsSmxErr->cd(6);
990 gPad->SetGridx();
991 gPad->SetGridy();
992 gPad->SetLogz();
993 fhStsFebSmxErrRatioCopySameAdcEvoAsic[uFebIdx]->Draw("colz");
994 } // if( kTRUE == fUnpackParMuch->IsFebActive( uFebIdx ) )
995 } // for( UInt_t uFebIdx = 0; uFebIdx < fuNbFebs; ++uFebIdx )
996
997 //====================================================================//
998 LOG(debug) << "Initialized Last Histo before exiting CreateHistograms";
999 //====================================================================//
1001 // Try to recover canvas in case it was created already by another monitor
1002 // If not existing, create it
1003 fcMsSizeAll = dynamic_cast<TCanvas*>(gROOT->FindObject("cMsSizeAll"));
1004 if (NULL == fcMsSizeAll) {
1005 fcMsSizeAll = new TCanvas("cMsSizeAll", "Evolution of MS size in last 300 s", w, h);
1006 fcMsSizeAll->Divide(4, 4);
1007 LOG(info) << "Created MS size canvas in STS monitor";
1008 } // if( NULL == fcMsSizeAll )
1009 else
1010 LOG(info) << "Recovered MS size canvas in STS monitor";
1011 //====================================================================//
1012
1013 /*****************************/
1014}
1015
1016Bool_t CbmMcbm2018MonitorMuch::DoUnpack(const fles::Timeslice& ts, size_t component)
1017{
1018 if (bMcbm2018ResetMuch) {
1020 bMcbm2018ResetMuch = kFALSE;
1021 } // if( bMcbm2018ResetMuch )
1022 if (bMcbm2018WriteMuch) {
1024 bMcbm2018WriteMuch = kFALSE;
1025 } // if( bMcbm2018WriteMuch )
1028 bMcbm2018ScanNoisyMuch = kFALSE;
1029 } // if( bMcbm2018WriteMuch )
1030
1031 LOG(debug) << "Timeslice contains " << ts.num_microslices(component) << " microslices.";
1032 fulCurrentTsIdx = ts.index();
1033
1034 // Ignore overlap ms if flag set by user
1035 UInt_t uNbMsLoop = fuNbCoreMsPerTs;
1036 if (kFALSE == fbIgnoreOverlapMs) uNbMsLoop += fuNbOverMsPerTs;
1037
1038 //LOG(info) <<" uNbMsLoop "<<uNbMsLoop;
1039 // Loop over core microslices (and overlap ones if chosen)
1040 for (UInt_t uMsIdx = 0; uMsIdx < uNbMsLoop; uMsIdx++) {
1041 Double_t dMsTime = (1e-9) * static_cast<double>(ts.descriptor(fvMsComponentsList[0], uMsIdx).idx);
1042
1043 // Loop over registered components
1044 for (UInt_t uMsCompIdx = 0; uMsCompIdx < fvMsComponentsList.size(); ++uMsCompIdx) {
1045 UInt_t uMsComp = fvMsComponentsList[uMsCompIdx];
1046
1047 if (kFALSE == ProcessStsMs(ts, uMsComp, uMsIdx)) return kFALSE;
1048
1049 } // for( UInt_t uMsComp = 0; uMsComp < fvMsComponentsList.size(); ++uMsComp )
1050
1052 // Sort the buffer of hits
1053 std::sort(fvmHitsInMs.begin(), fvmHitsInMs.end());
1054
1055 // Time differences plotting using the fully time sorted hits
1056 if (0 < fvmHitsInMs.size()) {
1057 // ULong64_t ulLastHitTime = ( *( fvmHitsInMs.rbegin() ) ).GetTs();
1058 std::vector<stsxyter::FinalHit>::iterator itA;
1059 std::vector<stsxyter::FinalHit>::iterator itB;
1060
1061 // std::chrono::steady_clock::time_point tNow = std::chrono::steady_clock::now();
1062 // Double_t dUnixTimeInRun = std::chrono::duration_cast< std::chrono::seconds >(tNow - ftStartTimeUnix).count();
1063 //LOG(info) <<" ulLastHitTime "<<ulLastHitTime<<" dUnixTimeInRun "<<dUnixTimeInRun;
1064 for (itA = fvmHitsInMs.begin(); itA != fvmHitsInMs.end();
1065 // itA != fvmHitsInMs.end() && (*itA).GetTs() < ulLastHitTime - 320; // 320 * 3.125 ns = 1000 ns
1066 ++itA) {
1067 UShort_t usAsicIdx = (*itA).GetAsic();
1068 // UShort_t usChanIdx = (*itA).GetChan();
1069 // ULong64_t ulHitTs = (*itA).GetTs();
1070 // UShort_t usHitAdc = (*itA).GetAdc();
1071 UShort_t usFebIdx = usAsicIdx / fUnpackParMuch->GetNbAsicsPerFeb();
1072 // UShort_t usAsicInFeb = usAsicIdx % fUnpackParMuch->GetNbAsicsPerFeb();
1073 //LOG(info) <<" usAsicIdx "<<usAsicIdx<<" usChanIdx "<<usChanIdx<<" ulHitTs "<<ulHitTs<<" usHitAdc "<<usHitAdc<<" usFebIdx "<<usFebIdx<<" usAsicInFeb "<<usAsicInFeb;
1074 // Double_t dTimeSinceStartSec = (ulHitTs * stsxyter::kdClockCycleNs - fdStartTime)* 1e-9;
1075 //LOG(info) <<" dTimeSinceStartSec "<<dTimeSinceStartSec;
1076 fvmAsicHitsInMs[usAsicIdx].push_back((*itA));
1077 fvmFebHitsInMs[usFebIdx].push_back((*itA));
1078 /*
1079 if( 1000 == fulCurrentTsIdx )
1080 {
1081 LOG(info) << Form( "FEB %02u ASIC %u Chan %03u TS %12u ADC %2u Time %8.3f",
1082 usFebIdx, usAsicInFeb, usChanIdx, ulHitTs, usHitAdc,
1083 ulHitTs* stsxyter::kdClockCycleNs );
1084 } // if( 0 == fulCurrentTsIdx )
1085*/
1086 } // loop on time sorted hits and split per asic/feb
1087
1088 // Remove all hits which were already used
1089 fvmHitsInMs.erase(fvmHitsInMs.begin(), itA);
1090
1092 Bool_t bHitCopyInThisMs[fuNbStsXyters];
1093 Bool_t bHitCopySameAdcInThisMs[fuNbStsXyters];
1094 Bool_t bFlagOnInThisMs[fuNbStsXyters];
1095 for (UInt_t uAsic = 0; uAsic < fuNbStsXyters; uAsic++) {
1096 bHitCopyInThisMs[uAsic] = kFALSE;
1097 bHitCopySameAdcInThisMs[uAsic] = kFALSE;
1098 bFlagOnInThisMs[uAsic] = kFALSE;
1099 } // for( UInt_t uAsic = 0; uAsic < fuNbStsXyters; uAsic++)
1101
1102 for (UInt_t uAsic = 0; uAsic < fuNbStsXyters; uAsic++) {
1103 UInt_t uFebIdx = uAsic / fUnpackParMuch->GetNbAsicsPerFeb();
1104 UInt_t uAsicInFeb = uAsic % fUnpackParMuch->GetNbAsicsPerFeb();
1105
1106 std::vector<ULong64_t> vulLastHitTs(fUnpackParMuch->GetNbChanPerAsic(), 0);
1107 std::vector<UShort_t> vusLastHitAdc(fUnpackParMuch->GetNbChanPerAsic(), 0);
1108
1109 for (itA = fvmAsicHitsInMs[uAsic].begin(); itA != fvmAsicHitsInMs[uAsic].end(); ++itA) {
1110 // UShort_t usAsicIdx = (*itA).GetAsic();
1111 UShort_t usChanIdx = (*itA).GetChan();
1112 ULong64_t ulHitTs = (*itA).GetTs();
1113 UShort_t usHitAdc = (*itA).GetAdc();
1114
1115 UInt_t uChanInFeb = usChanIdx + fUnpackParMuch->GetNbChanPerAsic() * uAsicInFeb;
1116
1119 Bool_t bIsNotCopy = kTRUE;
1120 if (vulLastHitTs[usChanIdx] == ulHitTs) {
1121 bIsNotCopy = kFALSE;
1122 bHitCopyInThisMs[uAsic] = kTRUE;
1123 if (vusLastHitAdc[usChanIdx] == usHitAdc) bHitCopySameAdcInThisMs[uAsic] = kTRUE;
1124 } // if( vulLastHitTs[ usChanIdx ] == ulHitTs)
1125
1126 vulLastHitTs[usChanIdx] = ulHitTs;
1127 vusLastHitAdc[usChanIdx] = usHitAdc;
1128
1129 if (bIsNotCopy) {
1130 fhStsFebChanCntRawGood[uFebIdx]->Fill(uChanInFeb);
1131 bFlagOnInThisMs[uAsic] |= SmxErrCheckCoinc(uFebIdx, uAsicInFeb, ulHitTs * stsxyter::kdClockCycleNs);
1132 } // if( bIsNotCopy )
1134 } // for( it = fvmAsicHitsInMs[ uAsic ].begin(); it != fvmAsicHitsInMs[ uAsic ].end(); ++it )
1135
1137 fvmAsicHitsInMs[uAsic].clear();
1138 } // for( UInt_t uAsic = 0; uAsic < fuNbStsXyters; uAsic++)
1139
1141 std::vector<Bool_t> vbCopyOnAnyAsicMs(fuNbFebs, kFALSE);
1142 std::vector<Bool_t> vbCopySameAdcOnAnyAsicMs(fuNbFebs, kFALSE);
1143 std::vector<Bool_t> vbFlagOnAnyAsicMs(fuNbFebs, kFALSE);
1144 // Bool_t bCopyOnAnyMs = kFALSE; // not used FU 23.03.23
1145 // Bool_t bCopySameAdcOnAnyMs = kFALSE; // not used FU 23.03.23
1146 // Bool_t bFlagOnAnyMs = kFALSE; // not used FU 23.03.23
1147 for (UInt_t uAsic = 0; uAsic < fuNbStsXyters; uAsic++) {
1148 UInt_t uFebIdx = uAsic / fUnpackParMuch->GetNbAsicsPerFeb();
1149 UInt_t uAsicInFeb = uAsic % fUnpackParMuch->GetNbAsicsPerFeb();
1150
1151 fhStsFebSmxErrRatioCopyEvoAsic[uFebIdx]->Fill(dMsTime - fdStartTimeMsSz, uAsicInFeb,
1152 bHitCopyInThisMs[uAsic] ? 1.0 : 0.0);
1153
1154 fhStsFebSmxErrRatioCopySameAdcEvoAsic[uFebIdx]->Fill(dMsTime - fdStartTimeMsSz, uAsicInFeb,
1155 bHitCopySameAdcInThisMs[uAsic] ? 1.0 : 0.0);
1156
1157 fhStsFebSmxErrRatioEvoAsic[uFebIdx]->Fill(dMsTime - fdStartTimeMsSz, uAsicInFeb,
1158 bFlagOnInThisMs[uAsic] ? 1.0 : 0.0);
1159
1160 vbCopyOnAnyAsicMs[uFebIdx] = vbCopyOnAnyAsicMs[uFebIdx] || bHitCopyInThisMs[uAsic];
1161 vbCopySameAdcOnAnyAsicMs[uFebIdx] = vbCopySameAdcOnAnyAsicMs[uFebIdx] || bHitCopySameAdcInThisMs[uAsic];
1162 vbFlagOnAnyAsicMs[uFebIdx] = vbFlagOnAnyAsicMs[uFebIdx] || bFlagOnInThisMs[uAsic];
1163
1164 // bCopyOnAnyMs |= bHitCopyInThisMs[uAsic]; // not used FU 23.03.23
1165 // bCopySameAdcOnAnyMs |= bHitCopySameAdcInThisMs[uAsic]; // not used FU 23.03.23
1166 // bFlagOnAnyMs |= bFlagOnInThisMs[uAsic]; // not used FU 23.03.23
1167 } // for( UInt_t uAsic = 0; uAsic < fuNbStsXyters; uAsic++)
1168
1169 for (UInt_t uFebIdx = 0; uFebIdx < fuNbFebs; ++uFebIdx) {
1170 fhStsFebSmxErrRatioCopyEvo[uFebIdx]->Fill(dMsTime - fdStartTimeMsSz, vbCopyOnAnyAsicMs[uFebIdx] ? 1.0 : 0.0);
1171 fhStsFebSmxErrRatioCopySameAdcEvo[uFebIdx]->Fill(dMsTime - fdStartTimeMsSz,
1172 vbCopySameAdcOnAnyAsicMs[uFebIdx] ? 1.0 : 0.0);
1173 fhStsFebSmxErrRatioEvo[uFebIdx]->Fill(dMsTime - fdStartTimeMsSz, vbFlagOnAnyAsicMs[uFebIdx] ? 1.0 : 0.0);
1174 } // for( UInt_t uFebIdx = 0; uFebIdx < fuNbFebs; ++uFebIdx )
1176
1177 for (UInt_t uFebIdx = 0; uFebIdx < fuNbFebs; ++uFebIdx) {
1178 if (kTRUE == fbEnableCoincidenceMaps) {
1179 // UInt_t uFebA = uFebIdx % fUnpackParMuch->GetNbFebsPerCrob();
1180 // UInt_t uCrobIdxA = ( uFebIdx / fUnpackParMuch->GetNbFebsPerCrob() ) % fUnpackParMuch->GetNbCrobsPerDpb();
1181 // UInt_t uDpbIdxA = ( uFebIdx / fUnpackParMuch->GetNbFebsPerCrob() ) / fUnpackParMuch->GetNbCrobsPerDpb();
1182
1183 for (itA = fvmFebHitsInMs[uFebIdx].begin(); itA != fvmFebHitsInMs[uFebIdx].end(); ++itA) {
1184 UShort_t usAsicIdxA = (*itA).GetAsic();
1185 UShort_t usAsicInFebA = usAsicIdxA % fUnpackParMuch->GetNbAsicsPerFeb();
1186 UShort_t usChanIdxA = (*itA).GetChan();
1187 UInt_t uChanInFebA = usChanIdxA + fUnpackParMuch->GetNbChanPerAsic() * usAsicInFebA;
1188 ULong64_t ulHitTsA = (*itA).GetTs();
1189 Double_t dHitTsA = ulHitTsA * stsxyter::kdClockCycleNs;
1190
1192 if (-1 < fdStsFebChanLastTimeForDist[uFebIdx][uChanInFebA]) {
1193 fhStsFebChanDistT[uFebIdx]->Fill(dHitTsA - fdStsFebChanLastTimeForDist[uFebIdx][uChanInFebA],
1194 uChanInFebA);
1195 } // if( -1 < fdStsFebChanLastTimeForDist[ uFebIdx ][ uChanInFebA ] )
1196 fdStsFebChanLastTimeForDist[uFebIdx][uChanInFebA] = dHitTsA;
1197
1198 for (UInt_t uFebIdxB = uFebIdx; uFebIdxB < fuNbFebs; ++uFebIdxB) {
1200 //Bool_t bSameModulePNsides = kFALSE;
1201 // Double_t dBestDtMatch = 1e9; // ns
1202 // comment unused variable, FU, 18.01.21 std::vector<stsxyter::FinalHit>::iterator itBestMatch;
1203 // UInt_t uFebB = uFebIdxB % fUnpackParMuch->GetNbFebsPerCrob();
1204 // UInt_t uCrobIdxB = ( uFebIdxB / fUnpackParMuch->GetNbFebsPerCrob() ) % fUnpackParMuch->GetNbCrobsPerDpb();
1205 // UInt_t uDpbIdxB = ( uFebIdxB / fUnpackParMuch->GetNbFebsPerCrob() ) / fUnpackParMuch->GetNbCrobsPerDpb();
1206 /*if( fviFebModuleIdx[ uDpbIdxA ][ uCrobIdxA ][ uFebA ] == fviFebModuleIdx[ uDpbIdxB ][ uCrobIdxB ][ uFebB ] &&
1207 fviFebModuleSide[ uDpbIdxA ][ uCrobIdxA ][ uFebA ] != fviFebModuleSide[ uDpbIdxB ][ uCrobIdxB ][ uFebB ] )
1208 bSameModulePNsides = kTRUE;
1209 */
1210 for (itB = fvmFebHitsInMs[uFebIdxB].begin(); itB != fvmFebHitsInMs[uFebIdxB].end(); ++itB) {
1211 UShort_t usAsicIdxB = (*itB).GetAsic();
1212 UShort_t usChanIdxB = (*itB).GetChan();
1213 UInt_t uChanInFebB =
1214 usChanIdxB + fUnpackParMuch->GetNbChanPerAsic() * (usAsicIdxB % fUnpackParMuch->GetNbAsicsPerFeb());
1215
1216 if (uFebIdx == uFebIdxB && uChanInFebA == uChanInFebB) continue;
1217
1218 ULong64_t ulHitTsB = (*itB).GetTs();
1219 // Double_t dHitTsB = ulHitTsB * stsxyter::kdClockCycleNs;
1220 Double_t dDtClk = static_cast<Double_t>(ulHitTsB) - static_cast<Double_t>(ulHitTsA);
1221 Double_t dDt = dDtClk * stsxyter::kdClockCycleNs;
1222
1223 fhStsFebChanDtCoinc[uFebIdx][uFebIdxB]->Fill(dDt);
1224
1226 if (-1.0 * fdFebChanCoincidenceLimit < dDt) {
1228 if (fdFebChanCoincidenceLimit < dDt) break;
1229
1230 fhStsFebChanCoinc[uFebIdx][uFebIdxB]->Fill(uChanInFebA, uChanInFebB);
1231
1232 } // if( -1.0 * fdFebChanCoincidenceLimit < dDt )
1233 } // for( itB = fvmFebHitsInMs[ uFebIdxB ].begin(); itB != fvmFebHitsInMs[ uFebIdxB ].end(); ++itB )
1234 } // for( UInt_t uFebIdxB = uFebIdx; uFebIdxB < fuNbFebs; ++uFebIdxB )
1235 } // for( itA = fvmFebHitsInMs[ uFebIdx ].begin(); itA != fvmFebHitsInMs[ uFebIdx ].end(); ++itA )
1236 } // if( kTRUE == fbEnableCoincidenceMaps )
1237
1239 fvmFebHitsInMs[uFebIdx].clear();
1240 } // for( UInt_t uFebIdx = 0; uFebIdx < fuNbFebs; ++uFebIdx )
1241 } // if( 0 < fvmHitsInMs.size() )
1242 } // for( UInt_t uMsIdx = 0; uMsIdx < uNbMsLoop; uMsIdx ++ )
1243
1244 for (UInt_t uMsIdx = 0; uMsIdx < fuMaxNbMicroslices; ++uMsIdx) {
1245 fvdMsTime[uMsIdx] = 0.0;
1246 } // for( UInt_t uMsIdx = 0; uMsIdx < fuMaxNbMicroslices; ++uMsIdx )
1247
1248 if (0 == ts.index() % 1000) {
1249 for (UInt_t uDpb = 0; uDpb < fuNrOfDpbs; ++uDpb) {
1250 Double_t dTsMsbTime =
1251 static_cast<ULong64_t>(stsxyter::kuHitNbTsBins) * static_cast<ULong64_t>(fvulCurrentTsMsb[fuCurrDpbIdx])
1252 + static_cast<ULong64_t>(stsxyter::kulTsCycleNbBins)
1253 * static_cast<ULong64_t>(fvuCurrentTsMsbCycle[fuCurrDpbIdx]);
1254 dTsMsbTime *= stsxyter::kdClockCycleNs * 1e-9;
1255
1256 LOG(info) << "End of TS " << std::setw(7) << ts.index() << " eDPB " << std::setw(2) << uDpb
1257 << " current TS MSB counter is " << std::setw(12) << fvulCurrentTsMsb[uDpb]
1258 << " current TS MSB cycle counter is " << std::setw(12) << fvuCurrentTsMsbCycle[uDpb]
1259 << " current TS MSB time is " << std::setw(12) << dTsMsbTime << " s";
1260 }
1261 } // if( 0 == ts.index() % 1000 )
1262
1263 // if( 0 == ts.index() % 10000 )
1264 //SaveAllHistos( "data/PulserPeriodicHistosSave.root");
1265
1266 return kTRUE;
1267}
1268
1269Bool_t CbmMcbm2018MonitorMuch::ProcessStsMs(const fles::Timeslice& ts, size_t uMsComp, UInt_t uMsIdx)
1270{
1271 auto msDescriptor = ts.descriptor(uMsComp, uMsIdx);
1272 fuCurrentEquipmentId = msDescriptor.eq_id;
1273 //LOG(info) << " fuCurrentEquipmentId "<<fuCurrentEquipmentId;
1274 const uint8_t* msContent = reinterpret_cast<const uint8_t*>(ts.content(uMsComp, uMsIdx));
1275
1276 uint32_t uSize = msDescriptor.size;
1277 fulCurrentMsIdx = msDescriptor.idx;
1278 Double_t dMsTime = (1e-9) * static_cast<double>(fulCurrentMsIdx);
1279 LOG(debug) << "Microslice: " << fulCurrentMsIdx << " from EqId " << std::hex << fuCurrentEquipmentId << std::dec
1280 << " has size: " << uSize;
1281
1282 fuCurrDpbId = static_cast<uint32_t>(fuCurrentEquipmentId & 0xFFFF);
1284 //LOG(info) <<" fuCurrDpbIdx "<<fuCurrDpbIdx<<" fuCurrDpbId "<<fuCurrDpbId;
1285
1286 if (uMsComp < kiMaxNbFlibLinks) {
1287 if (fdStartTimeMsSz < 0) fdStartTimeMsSz = dMsTime;
1288 fhMsSz[uMsComp]->Fill(uSize);
1289 fhMsSzTime[uMsComp]->Fill(dMsTime - fdStartTimeMsSz, uSize);
1290 } // if( uMsComp < kiMaxNbFlibLinks )
1291
1293 if (static_cast<Int_t>(fvdPrevMsTime[uMsComp]) < static_cast<Int_t>(dMsTime)) {
1295 UInt_t uFebIdxOffset = fUnpackParMuch->GetNbFebsPerDpb() * fuCurrDpbIdx;
1296 for (UInt_t uFebIdx = 0; uFebIdx < fUnpackParMuch->GetNbFebsPerDpb(); ++uFebIdx) {
1297 UInt_t uFebIdxInSyst = uFebIdxOffset + uFebIdx;
1298
1300 if (0 == fviFebTimeSecLastRateUpdate[uFebIdxInSyst]) {
1301 fviFebTimeSecLastRateUpdate[uFebIdxInSyst] = static_cast<Int_t>(dMsTime);
1302 fviFebCountsSinceLastRateUpdate[uFebIdxInSyst] = 0;
1303 for (UInt_t uChan = 0; uChan < fUnpackParMuch->GetNbChanPerFeb(); ++uChan)
1304 fvdFebChanCountsSinceLastRateUpdate[uFebIdxInSyst][uChan] = 0.0;
1305 continue;
1306 } // if( 0 == fviFebTimeSecLastRateUpdate[uFebIdxInSyst] )
1307
1308 Int_t iTimeInt = static_cast<Int_t>(dMsTime) - fviFebTimeSecLastRateUpdate[uFebIdxInSyst];
1309 if (fiTimeIntervalRateUpdate <= iTimeInt) {
1311 if (0 == fviFebCountsSinceLastRateUpdate[uFebIdxInSyst]) {
1312 fviFebTimeSecLastRateUpdate[uFebIdxInSyst] = static_cast<Int_t>(dMsTime);
1313 continue;
1314 } // if( 0 == fviFebCountsSinceLastRateUpdate[uFebIdxInSyst] )
1315
1316 for (UInt_t uChan = 0; uChan < fUnpackParMuch->GetNbChanPerFeb(); ++uChan) {
1317 fhStsFebChanHitRateProf[uFebIdxInSyst]->Fill(uChan, fvdFebChanCountsSinceLastRateUpdate[uFebIdxInSyst][uChan]
1318 / iTimeInt);
1319 fvdFebChanCountsSinceLastRateUpdate[uFebIdxInSyst][uChan] = 0.0;
1320 } // for( UInt_t uChan = 0; uChan < fUnpackParMuch->GetNbChanPerFeb(); ++uChan )
1321
1322 fviFebTimeSecLastRateUpdate[uFebIdxInSyst] = static_cast<Int_t>(dMsTime);
1323 fviFebCountsSinceLastRateUpdate[uFebIdxInSyst] = 0;
1324 } // if( fiTimeIntervalRateUpdate <= iTimeInt )
1325 } // for( UInt_t uFebIdx = 0; uFebIdx < fUnpackParMuch->GetNbFebsPerDpb(); ++uFebIdx )
1326 } // if( static_cast<Int_t>( fvdMsTime[ uMsCompIdx ] ) < static_cast<Int_t>( dMsTime ) )
1327
1328 // Store MS time for coincidence plots
1329 fvdPrevMsTime[uMsComp] = dMsTime;
1330
1332 uint16_t uMsHeaderFlags = msDescriptor.flags;
1333 for (UInt_t uBit = 0; uBit < 16; ++uBit)
1334 fhPulserMsStatusFieldType->Fill(uBit, (uMsHeaderFlags >> uBit) & 0x1);
1335
1337 UInt_t uTsMsbCycleHeader = std::floor(fulCurrentMsIdx / (stsxyter::kulTsCycleNbBins * stsxyter::kdClockCycleNs))
1339 if (kFALSE == fvuInitialHeaderDone[fuCurrDpbIdx]) {
1340 fvuInitialTsMsbCycleHeader[fuCurrDpbIdx] = uTsMsbCycleHeader;
1342 } // if( kFALSE == fvuInitialHeaderDone[ fuCurrDpbIdx ] )
1343 else if (uTsMsbCycleHeader != fvuCurrentTsMsbCycle[fuCurrDpbIdx] && 4194303 != fvulCurrentTsMsb[fuCurrDpbIdx]) {
1344 /*
1345 LOG(warning) << "TS MSB cycle from MS header does not match current cycle from data "
1346 << "for TS " << std::setw( 12 ) << fulCurrentTsIdx
1347 << " MS " << std::setw( 12 ) << fulCurrentMsIdx
1348 << " MsInTs " << std::setw( 3 ) << uMsIdx
1349 << " ====> " << fvuCurrentTsMsbCycle[ fuCurrDpbIdx ]
1350 << " VS " << uTsMsbCycleHeader;
1351*/
1352 fvuCurrentTsMsbCycle[fuCurrDpbIdx] = uTsMsbCycleHeader;
1353 }
1354
1355 // If not integer number of message in input buffer, print warning/error
1356 if (0 != (uSize % kuBytesPerMessage))
1357 LOG(error) << "The input microslice buffer does NOT "
1358 << "contain only complete nDPB messages!";
1359
1360 // Compute the number of complete messages in the input microslice buffer
1361 uint32_t uNbMessages = (uSize - (uSize % kuBytesPerMessage)) / kuBytesPerMessage;
1362
1363 // Prepare variables for the loop on contents
1364 const uint32_t* pInBuff = reinterpret_cast<const uint32_t*>(msContent);
1365
1366 for (uint32_t uIdx = 0; uIdx < uNbMessages; ++uIdx) {
1367 // Fill message
1368 uint32_t ulData = static_cast<uint32_t>(pInBuff[uIdx]);
1369
1370 stsxyter::Message mess(static_cast<uint32_t>(ulData & 0xFFFFFFFF));
1371
1372 // Print message if requested
1373 if (fbPrintMessages) mess.PrintMess(std::cout, fPrintMessCtrl);
1374 /*
1375 if( 1000 == fulCurrentTsIdx )
1376 {
1377 mess.PrintMess( std::cout, fPrintMessCtrl );
1378 } // if( 0 == fulCurrentTsIdx )
1379*/
1380 stsxyter::MessType typeMess = mess.GetMessType();
1381 fmMsgCounter[typeMess]++;
1382 fhStsMessType->Fill(static_cast<uint16_t>(typeMess));
1383 fhStsMessTypePerDpb->Fill(fuCurrDpbIdx, static_cast<uint16_t>(typeMess));
1384
1385 switch (typeMess) {
1387 // Extract the eLink and Asic indices => Should GO IN the fill method now that obly hits are link/asic specific!
1388 UShort_t usElinkIdx = mess.GetLinkIndex();
1389 UInt_t uCrobIdx = usElinkIdx / fUnpackParMuch->GetNbElinkPerCrob();
1390 Int_t uFebIdx = fUnpackParMuch->ElinkIdxToFebIdx(usElinkIdx);
1391 // if(usElinkIdx!=0)
1392 //LOG(info) <<" usElinkIdx "<<usElinkIdx<<" uCrobIdx "<<uCrobIdx<<" uFebIdx "<<uFebIdx;
1393 if (kTRUE == fbMuchMode) uFebIdx = usElinkIdx;
1394 fhStsHitsElinkPerDpb->Fill(fuCurrDpbIdx, usElinkIdx);
1395 if (-1 == uFebIdx) {
1396 LOG(warning) << "CbmMcbm2018MonitorMuch::DoUnpack => "
1397 << "Wrong elink Idx! Elink raw " << Form("%d remap %d", usElinkIdx, uFebIdx);
1398 continue;
1399 } // if( -1 == uFebIdx )
1400 //LOG(info) << " uCrobIdx "<<uCrobIdx<<" fUnpackParMuch->ElinkIdxToAsicIdx( usElinkIdx ) "<<fUnpackParMuch->ElinkIdxToAsicIdx( usElinkIdx )<<" usElinkIdx "<<usElinkIdx;
1401 UInt_t uAsicIdx =
1403 + fUnpackParMuch->ElinkIdxToAsicIdx(usElinkIdx);
1404
1405 FillHitInfo(mess, usElinkIdx, uAsicIdx, uMsIdx);
1406 break;
1407 } // case stsxyter::MessType::Hit :
1409 FillTsMsbInfo(mess, uIdx, uMsIdx);
1410 break;
1411 } // case stsxyter::MessType::TsMsb :
1413 // The first message in the TS is a special ones: EPOCH
1414 FillEpochInfo(mess);
1415
1416 if (0 < uIdx)
1417 LOG(info) << "CbmMcbm2018MonitorMuch::DoUnpack => "
1418 << "EPOCH message at unexpected position in MS: message " << uIdx << " VS message 0 expected!";
1419 break;
1420 } // case stsxyter::MessType::TsMsb :
1422 UShort_t usElinkIdx = mess.GetStatusLink();
1423 UInt_t uCrobIdx = usElinkIdx / fUnpackParMuch->GetNbElinkPerCrob();
1424 // Int_t uFebIdx = fUnpackParMuch->ElinkIdxToFebIdx( usElinkIdx );
1425 UInt_t uAsicIdx =
1427 + fUnpackParMuch->ElinkIdxToAsicIdx(usElinkIdx);
1428
1429 UShort_t usStatusField = mess.GetStatusStatus();
1430
1431 fhPulserStatusMessType->Fill(uAsicIdx, usStatusField);
1433 if (fbPrintMessages) {
1434 std::cout << Form("DPB %2u TS %12llu MS %12llu mess %5u ", fuCurrDpbIdx, fulCurrentTsIdx, fulCurrentMsIdx,
1435 uIdx);
1436 mess.PrintMess(std::cout, fPrintMessCtrl);
1437 } // if( fbPrintMessages )
1438 // FillTsMsbInfo( mess );
1439 break;
1440 } // case stsxyter::MessType::Status
1442 // FillTsMsbInfo( mess );
1443 break;
1444 } // case stsxyter::MessType::Empty :
1446 break;
1447 } // case stsxyter::MessType::Dummy / ReadDataAck / Ack :
1448 default: {
1449 LOG(fatal) << "CbmMcbm2018MonitorMuch::DoUnpack => "
1450 << "Unknown message type, should never happen, stopping "
1451 "here! Type found was: "
1452 << static_cast<int>(typeMess);
1453 }
1454 } // switch( mess.GetMessType() )
1455 } // for( uint32_t uIdx = 0; uIdx < uNbMessages; ++uIdx )
1456
1457 return kTRUE;
1458}
1459
1460void CbmMcbm2018MonitorMuch::FillHitInfo(stsxyter::Message mess, const UShort_t& usElinkIdx, const UInt_t& uAsicIdx,
1461 const UInt_t& uMsIdx)
1462{
1463 UShort_t usChan = mess.GetHitChannel();
1464 UShort_t usRawAdc = mess.GetHitAdc();
1465 // UShort_t usFullTs = mess.GetHitTimeFull();
1466 // UShort_t usTsOver = mess.GetHitTimeOver();
1467 UShort_t usRawTs = mess.GetHitTime();
1468
1470 // usChan = 127 - usChan;
1471
1472 /*
1473 fhStsChanCntRaw[ uAsicIdx ]->Fill( usChan );
1474 fhStsChanAdcRaw[ uAsicIdx ]->Fill( usChan, usRawAdc );
1475 fhStsChanAdcRawProf[ uAsicIdx ]->Fill( usChan, usRawAdc );
1476 fhStsChanRawTs[ uAsicIdx ]->Fill( usChan, usRawTs );
1477 fhStsChanMissEvt[ uAsicIdx ]->Fill( usChan, mess.IsHitMissedEvts() );
1478*/
1479 //LOG(info) <<" uAsicIdx "<<uAsicIdx<<" usChan "<<usChan;
1480 Int_t FebId = fUnpackParMuch->GetFebId(uAsicIdx);
1481
1482 UInt_t uFebIdx = uAsicIdx / fUnpackParMuch->GetNbAsicsPerFeb();
1483 UInt_t uCrobIdx = usElinkIdx / fUnpackParMuch->GetNbElinkPerCrob();
1484 UInt_t uAsicInFeb = uAsicIdx % fUnpackParMuch->GetNbAsicsPerFeb();
1485 UInt_t uChanInFeb = usChan + fUnpackParMuch->GetNbChanPerAsic() * (uAsicIdx % fUnpackParMuch->GetNbAsicsPerFeb());
1486 Int_t sector = fUnpackParMuch->GetPadXA(FebId, usChan);
1487 Int_t channel = fUnpackParMuch->GetPadYA(FebId, usChan);
1488 //Convert into Real X Y Position
1489 Double_t ActualX = (fUnpackParMuch->GetRealPadSize(channel) * sector);
1490 Double_t ActualY = fUnpackParMuch->GetRealX(channel);
1491 //LOG(info) <<" sector "<<sector<<" channel "<<channel<<" FebId "<<FebId<<" usChan "<<usChan;
1492 Int_t ModuleNr = fUnpackParMuch->GetModule(uAsicIdx);
1493 fHistPadDistr[ModuleNr]->Fill(sector, channel);
1494 fRealHistPadDistr[ModuleNr]->Fill(ActualY, ActualX);
1495
1496 //LOG(info) <<" usElinkIdx "<<usElinkIdx<<" uAsicIdx "<<uAsicIdx<<" uMsIdx "<<uMsIdx<<" uCrobIdx "<<uCrobIdx<<" uFebIdx "<<uFebIdx<<" uAsicInFeb "<<uAsicInFeb<<" uChanInFeb "<<uChanInFeb<<" usChan "<<usChan;
1497
1498 Double_t dCalAdc =
1499 fvdFebAdcOffs[fuCurrDpbIdx][uCrobIdx][uFebIdx] + (usRawAdc - 1) * fvdFebAdcGain[fuCurrDpbIdx][uCrobIdx][uFebIdx];
1500 //if(uChanInFeb!=37 && uChanInFeb!=58 && uChanInFeb!=68 && uChanInFeb!=69 && uChanInFeb!=101 && uChanInFeb!=109 ){
1501 fhStsFebChanCntRaw[uFebIdx]->Fill(uChanInFeb);
1502 fhStsFebChanAdcRaw[uFebIdx]->Fill(uChanInFeb, usRawAdc);
1503 fhStsFebChanAdcRawProf[uFebIdx]->Fill(uChanInFeb, usRawAdc);
1504 fhStsFebChanAdcCal[uFebIdx]->Fill(uChanInFeb, dCalAdc);
1505 fhStsFebChanAdcCalProf[uFebIdx]->Fill(uChanInFeb, dCalAdc);
1506 fhStsFebChanRawTs[uFebIdx]->Fill(usChan, usRawTs);
1507 fhStsFebChanMissEvt[uFebIdx]->Fill(usChan, mess.IsHitMissedEvts());
1508 fhStsFebChanAdcRaw_combined->Fill(usRawAdc);
1509 //}
1510 // Compute the Full time stamp
1511 // Long64_t ulOldHitTime = fvulChanLastHitTime[ uAsicIdx ][ usChan ];
1512 //Double_t dOldHitTime = fvdChanLastHitTime[ uAsicIdx ][ usChan ];
1513 // Long64_t dOldHitTime = fvdChanLastHitTime[ uAsicIdx ][ usChan ];
1514
1515 // Use TS w/o overlap bits as they will anyway come from the TS_MSB
1516 fvulChanLastHitTime[uAsicIdx][usChan] = usRawTs;
1517
1518 fvulChanLastHitTime[uAsicIdx][usChan] +=
1519 static_cast<ULong64_t>(stsxyter::kuHitNbTsBins) * static_cast<ULong64_t>(fvulCurrentTsMsb[fuCurrDpbIdx])
1520 + static_cast<ULong64_t>(stsxyter::kulTsCycleNbBins) * static_cast<ULong64_t>(fvuCurrentTsMsbCycle[fuCurrDpbIdx]);
1521
1522 // fvuElinkLastTsHit[fuCurrDpbIdx] = usRawTs;
1523
1524 // Convert the Hit time in bins to Hit time in ns
1525 Long64_t dHitTimeNs = fvulChanLastHitTime[uAsicIdx][usChan] * stsxyter::kdClockCycleNs;
1526 //Double_t dHitTimeNs = fvulChanLastHitTime[ uAsicIdx ][ usChan ] * stsxyter::kdClockCycleNs;
1527
1528 /*
1529 // If needed fill the hit interval plots
1530 if( fbChanHitDtEna )
1531 {
1532 Double_t dDeltaT = dHitTimeNs - fvdChanLastHitTime[ uAsicIdx ][ usChan ];
1533 if( 0 == dDeltaT )
1534 fhStsChanHitDtNeg[ uAsicIdx ]->Fill( 1, usChan );
1535 else if( 0 < dDeltaT )
1536 fhStsChanHitDt[ uAsicIdx ]->Fill( dDeltaT, usChan );
1537 else fhStsChanHitDtNeg[ uAsicIdx ]->Fill( -dDeltaT, usChan );
1538 } // if( fbChanHitDtEna )
1539*/
1540 // Store new value of Hit time in ns
1541 fvdChanLastHitTime[uAsicIdx][usChan] = fvulChanLastHitTime[uAsicIdx][usChan] * stsxyter::kdClockCycleNs;
1542 /*
1543 LOG(info) << " Asic " << std::setw( 2 ) << uAsicIdx
1544 << " Channel " << std::setw( 3 ) << usChan
1545 << " Diff to last hit " << std::setw( 12 ) << ( fvulChanLastHitTime[ uAsicIdx ][ usChan ] - ulOldHitTime)
1546 << " in s " << std::setw( 12 ) << ( fvdChanLastHitTime[ uAsicIdx ][ usChan ] - dOldHitTime) * 1e-9;
1547*/
1548 // Pulser and MS
1549 fvuChanNbHitsInMs[uAsicIdx][usChan][uMsIdx]++;
1550 fvdChanLastHitTimeInMs[uAsicIdx][usChan][uMsIdx] = dHitTimeNs;
1551 fvusChanLastHitAdcInMs[uAsicIdx][usChan][uMsIdx] = usRawAdc;
1552 /*
1553 fvmChanHitsInTs[ uAsicIdx ][ usChan ].insert( stsxyter::FinalHit( fvulChanLastHitTime[ uAsicIdx ][ usChan ],
1554 usRawAdc, uAsicIdx, usChan ) );
1555*/
1556 fvmHitsInMs.push_back(stsxyter::FinalHit(fvulChanLastHitTime[uAsicIdx][usChan], usRawAdc, uAsicIdx, usChan));
1557
1558 // Check Starting point of histos with time as X axis
1559 if (-1 == fdStartTime) fdStartTime = fvdChanLastHitTime[uAsicIdx][usChan];
1560
1561 int64_t constime = (fvdChanLastHitTime[uAsicIdx][usChan] - prevtime);
1562
1563 if (constime < 1000000) {
1564 if (usRawAdc > 1) { Counter1++; }
1565 Counter++;
1566 }
1567 else {
1568 fhRate->Fill(Counter);
1569 fhRateAdcCut->Fill(Counter1);
1570 Counter = 0;
1571 Counter1 = 0;
1572 }
1573
1574 prevtime = fvdChanLastHitTime[uAsicIdx][usChan];
1575
1576 // Fill histos with time as X axis
1577 Double_t dTimeSinceStartSec = (fvdChanLastHitTime[uAsicIdx][usChan] - fdStartTime) * 1e-6; //uTimeBin
1578 // Double_t SpillTimeMs = dTimeSinceStartSec/1000000;
1579 //Double_t dTimeSinceStartSec = (fvdChanLastHitTime[ uAsicIdx ][ usChan ] - fdStartTime)* uTimeBin; //uTimeBin
1580 Double_t dTimeSinceStartMin = dTimeSinceStartSec / 60.0;
1581
1582 //LOG(info)<<" full time "<<fvdChanLastHitTime[ uAsicIdx ][ usChan ]<<" start time "<<fdStartTime<<" dTimeSinceStartSec "<<dTimeSinceStartSec<<" dTimeSinceStartSec*1e-9 "<<dTimeSinceStartSec*1e+9<< " fvulChanLastHitTime[ uAsicIdx ][ usChan ] "<<fvulChanLastHitTime[ uAsicIdx ][ usChan ]<< " usChan "<<usChan<<" usrawadc "<<usRawAdc;
1584 fvdFebChanCountsSinceLastRateUpdate[uFebIdx][uChanInFeb] += 1;
1585 //LOG(info)<<" fviFebCountsSinceLastRateUpdate "<<fviFebCountsSinceLastRateUpdate[uFebIdx]<<" fvdFebChanCountsSinceLastRateUpdate "<<fvdFebChanCountsSinceLastRateUpdate[uFebIdx][uChanInFeb] <<" uFebIdx " << uFebIdx;
1586 //if((fvdChanLastHitTime[ uAsicIdx ][ usChan ] - fdStartTime) < 60.0)
1587 //fviFebCountsSinceLastRateUpdate[uFebIdx]++;
1588 fhStsFebChanHitRateEvo[uFebIdx]->Fill(dTimeSinceStartSec, uChanInFeb);
1589 fhStsFebAsicHitRateEvo[uFebIdx]->Fill(dTimeSinceStartSec, uAsicInFeb);
1590 fhStsFebHitRateEvo[uFebIdx]->Fill(dTimeSinceStartSec);
1591 // fhStsFebHitRateEvo[ uFebIdx ]->Fill( 10.0*SpillTimeMs );
1592 fhStsFebHitRateEvo_mskch[uFebIdx]->Fill(dTimeSinceStartSec);
1593 if (usRawAdc > 1) fhStsFebHitRateEvo_mskch_adccut[uFebIdx]->Fill(dTimeSinceStartSec);
1594 fhStsFebChanHitRateEvoLong[uFebIdx]->Fill(dTimeSinceStartMin, uChanInFeb, 1.0 / 60.0);
1595 fhStsFebAsicHitRateEvoLong[uFebIdx]->Fill(dTimeSinceStartMin, uAsicInFeb, 1.0 / 60.0);
1596 fhStsFebHitRateEvoLong[uFebIdx]->Fill(dTimeSinceStartMin, 1.0 / 60.0);
1597 if (mess.IsHitMissedEvts()) {
1598 fhStsFebChanMissEvtEvo[uFebIdx]->Fill(dTimeSinceStartSec, uChanInFeb);
1599 fhStsFebAsicMissEvtEvo[uFebIdx]->Fill(dTimeSinceStartSec, uAsicInFeb);
1600 fhStsFebMissEvtEvo[uFebIdx]->Fill(dTimeSinceStartSec);
1601 } // if( mess.IsHitMissedEvts() )
1602}
1603
1604void CbmMcbm2018MonitorMuch::FillTsMsbInfo(stsxyter::Message mess, UInt_t uMessIdx, UInt_t /*uMsIdx*/)
1605{
1606 UInt_t uVal = mess.GetTsMsbVal();
1607 /*
1608 if( ( 419369 < fulCurrentTsIdx && fulCurrentTsIdx < 419371 ) )
1609 LOG(info) << " TS " << std::setw( 12 ) << fulCurrentTsIdx
1610 << " MS " << std::setw( 12 ) << fulCurrentMsIdx
1611 << " MsInTs " << std::setw( 3 ) << uMsIdx
1612 << " DPB " << std::setw( 2 ) << fuCurrDpbIdx
1613 << " Mess " << std::setw( 5 ) << uMessIdx
1614 << " TsMsb " << std::setw( 5 ) << uVal;
1615*/
1616 /*
1617 if( (uVal != fvulCurrentTsMsb[fuCurrDpbIdx] + 1) && 0 < uVal &&
1618 !( 1 == uMessIdx && usVal == fvulCurrentTsMsb[fuCurrDpbIdx] ) ) // 1st TS_MSB in MS is always a repeat of the last one in previous MS!
1619 {
1620 LOG(info) << "TS MSB not increasing by 1! TS " << std::setw( 12 ) << fulCurrentTsIdx
1621 << " MS " << std::setw( 12 ) << fulCurrentMsIdx
1622 << " MsInTs " << std::setw( 3 ) << uMsIdx
1623 << " DPB " << std::setw( 2 ) << fuCurrDpbIdx
1624 << " Mess " << std::setw( 5 ) << uMessIdx
1625 << " Old TsMsb " << std::setw( 5 ) << fvulCurrentTsMsb[fuCurrDpbIdx]
1626 << " new TsMsb " << std::setw( 5 ) << uVal
1627 << " Diff " << std::setw( 5 ) << uVal - fvulCurrentTsMsb[fuCurrDpbIdx]
1628 << " Old MsbCy " << std::setw( 5 ) << fvuCurrentTsMsbCycle[fuCurrDpbIdx];
1629 } // if( (uVal != fvulCurrentTsMsb[fuCurrDpbIdx] + 1) && 0 < uVal )
1630*/
1631
1632 // Update Status counters
1633 if (uVal < fvulCurrentTsMsb[fuCurrDpbIdx]) {
1634 /*
1635 LOG(info) << " TS " << std::setw( 12 ) << fulCurrentTsIdx
1636 << " MS " << std::setw( 12 ) << fulCurrentMsIdx
1637 << " MS Idx " << std::setw( 4 ) << uMsIdx
1638 << " Msg Idx " << std::setw( 5 ) << uMessIdx
1639 << " DPB " << std::setw( 2 ) << fuCurrDpbIdx
1640 << " Old TsMsb " << std::setw( 5 ) << fvulCurrentTsMsb[fuCurrDpbIdx]
1641 << " Old MsbCy " << std::setw( 5 ) << fvuCurrentTsMsbCycle[fuCurrDpbIdx]
1642 << " new TsMsb " << std::setw ( 5 ) << uVal;
1643*/
1644
1646 } // if( uVal < fvulCurrentTsMsb[fuCurrDpbIdx] )
1647 if (uVal != fvulCurrentTsMsb[fuCurrDpbIdx] + 1 && 0 != uVal && 4194303 != fvulCurrentTsMsb[fuCurrDpbIdx]
1648 && 1 != uMessIdx) {
1649 /*
1650 LOG(info) << "TS MSb Jump in "
1651 << " TS " << std::setw( 12 ) << fulCurrentTsIdx
1652 << " MS " << std::setw( 12 ) << fulCurrentMsIdx
1653 << " MS Idx " << std::setw( 4 ) << uMsIdx
1654 << " Msg Idx " << std::setw( 5 ) << uMessIdx
1655 << " DPB " << std::setw( 2 ) << fuCurrDpbIdx
1656 << " => Old TsMsb " << std::setw( 5 ) << fvulCurrentTsMsb[fuCurrDpbIdx]
1657 << " new TsMsb " << std::setw ( 5 ) << uVal;
1658*/
1659 } // if( uVal + 1 != fvulCurrentTsMsb[fuCurrDpbIdx] && 4194303 != uVal && 0 != fvulCurrentTsMsb[fuCurrDpbIdx] )
1661 /*
1662 ULong64_t ulNewTsMsbTime = static_cast< ULong64_t >( stsxyter::kuHitNbTsBins )
1663 * static_cast< ULong64_t >( fvulCurrentTsMsb[fuCurrDpbIdx])
1664 + static_cast< ULong64_t >( stsxyter::kulTsCycleNbBins )
1665 * static_cast< ULong64_t >( fvuCurrentTsMsbCycle[fuCurrDpbIdx] );
1666*/
1667}
1668
1670{
1671 // UInt_t uVal = mess.GetEpochVal();
1672 // UInt_t uCurrentCycle = uVal % stsxyter::kulTsCycleNbBins;
1673}
1674
1676
1678{
1679
1680 LOG(info) << "-------------------------------------";
1681 LOG(info) << "CbmMcbm2018MonitorMuch statistics are ";
1682 LOG(info) << " Hit messages: " << fmMsgCounter[stsxyter::MessType::Hit] << "\n"
1683 << " Ts MSB messages: " << fmMsgCounter[stsxyter::MessType::TsMsb] << "\n"
1684 << " Dummy messages: " << fmMsgCounter[stsxyter::MessType::Dummy] << "\n"
1685 << " Epoch messages: " << fmMsgCounter[stsxyter::MessType::Epoch] << "\n"
1686 << " Empty messages: " << fmMsgCounter[stsxyter::MessType::Empty];
1687
1688 LOG(info) << "-------------------------------------";
1689
1691 //SaveAllHistos();
1692}
1693
1694
1696{
1698 TFile* oldFile = gFile;
1699 TDirectory* oldDir = gDirectory;
1700
1701 TFile* histoFile = NULL;
1702 if ("" != sFileName) {
1703 // open separate histo file in recreate mode
1704 histoFile = new TFile(sFileName, "RECREATE");
1705 histoFile->cd();
1706 } // if( "" != sFileName )
1707
1708 /***************************/
1709 gDirectory->mkdir("Sts_Raw");
1710 gDirectory->cd("Sts_Raw");
1711
1712 for (UInt_t uModuleId = 0; uModuleId < 2; ++uModuleId) {
1713 fHistPadDistr[uModuleId]->Write();
1714 fRealHistPadDistr[uModuleId]->Write();
1715 }
1716 fhRate->Write();
1717 fhRateAdcCut->Write();
1718 fhStsMessType->Write();
1719 fhStsSysMessType->Write();
1720 fhStsMessTypePerDpb->Write();
1721 fhStsSysMessTypePerDpb->Write();
1722 fhPulserStatusMessType->Write();
1724 fhStsHitsElinkPerDpb->Write();
1726 gDirectory->cd("..");
1727 /***************************/
1728
1729 /***************************/
1730 gDirectory->mkdir("Sts_Feb");
1731 gDirectory->cd("Sts_Feb");
1732 for (UInt_t uFebIdx = 0; uFebIdx < fuNbFebs; ++uFebIdx) {
1733 if (kTRUE == fUnpackParMuch->IsFebActive(uFebIdx)) {
1734 fhStsFebChanCntRaw[uFebIdx]->Write();
1735 fhStsFebChanCntRawGood[uFebIdx]->Write();
1736 fhStsFebChanAdcRaw[uFebIdx]->Write();
1737 fhStsFebChanAdcRawProf[uFebIdx]->Write();
1738 fhStsFebChanAdcCal[uFebIdx]->Write();
1739 fhStsFebChanAdcCalProf[uFebIdx]->Write();
1740 fhStsFebChanRawTs[uFebIdx]->Write();
1741 fhStsFebChanMissEvt[uFebIdx]->Write();
1742 fhStsFebChanMissEvtEvo[uFebIdx]->Write();
1743 fhStsFebAsicMissEvtEvo[uFebIdx]->Write();
1744 fhStsFebMissEvtEvo[uFebIdx]->Write();
1745 fhStsFebChanHitRateEvo[uFebIdx]->Write();
1746 fhStsFebChanHitRateProf[uFebIdx]->Write();
1747 fhStsFebAsicHitRateEvo[uFebIdx]->Write();
1748 fhStsFebHitRateEvo[uFebIdx]->Write();
1749 fhStsFebHitRateEvo_mskch[uFebIdx]->Write();
1750 fhStsFebHitRateEvo_mskch_adccut[uFebIdx]->Write();
1751 fhStsFebChanHitRateEvoLong[uFebIdx]->Write();
1752 fhStsFebAsicHitRateEvoLong[uFebIdx]->Write();
1753 fhStsFebHitRateEvoLong[uFebIdx]->Write();
1754 fhStsFebChanDistT[uFebIdx]->Write();
1755 for (UInt_t uFebIdxB = uFebIdx; uFebIdxB < fuNbFebs; ++uFebIdxB) {
1756 fhStsFebChanDtCoinc[uFebIdx][uFebIdxB]->Write();
1757 fhStsFebChanCoinc[uFebIdx][uFebIdxB]->Write();
1758 } // for( UInt_t uFebIdxB = uFebIdx; uFebIdxB < fuNbFebs; ++uFebIdxB )
1759 } // if( kTRUE == fUnpackParMuch->IsFebActive( uFebIdx ) )
1760 } // for( UInt_t uFebIdx = 0; uFebIdx < fuNbFebs; ++uFebIdx )
1761 gDirectory->cd("..");
1762 /***************************/
1763
1764
1766 gDirectory->mkdir("Sts_SmxErr");
1767 gDirectory->cd("Sts_SmxErr");
1768 for (UInt_t uFebIdx = 0; uFebIdx < fuNbFebs; ++uFebIdx) {
1769 if (kTRUE == fUnpackParMuch->IsFebActive(uFebIdx)) {
1770 fhStsFebSmxErrRatioEvo[uFebIdx]->Write();
1771 fhStsFebSmxErrRatioEvoAsic[uFebIdx]->Write();
1772 fhStsFebSmxErrRatioCopyEvo[uFebIdx]->Write();
1773 fhStsFebSmxErrRatioCopyEvoAsic[uFebIdx]->Write();
1774 fhStsFebSmxErrRatioCopySameAdcEvo[uFebIdx]->Write();
1775 fhStsFebSmxErrRatioCopySameAdcEvoAsic[uFebIdx]->Write();
1776 } // if( kTRUE == fUnpackParMuch->IsFebActive( uFebIdx ) )
1777 } // for( UInt_t uFebIdx = 0; uFebIdx < fuNbFebs; ++uFebIdx )
1778 gDirectory->cd("..");
1780
1781 /***************************/
1782 // Flib Histos
1783 gDirectory->mkdir("Flib_Raw");
1784 gDirectory->cd("Flib_Raw");
1785 for (UInt_t uLinks = 0; uLinks < kiMaxNbFlibLinks; uLinks++) {
1786 TString sMsSzName = Form("MsSz_link_%02u", uLinks);
1787 if (fHM->Exists(sMsSzName.Data())) fHM->H1(sMsSzName.Data())->Write();
1788
1789 sMsSzName = Form("MsSzTime_link_%02u", uLinks);
1790 if (fHM->Exists(sMsSzName.Data())) fHM->P1(sMsSzName.Data())->Write();
1791 } // for( UInt_t uLinks = 0; uLinks < 16; uLinks ++)
1792
1793 TH1* pMissedTsH1 = dynamic_cast<TH1*>(gROOT->FindObjectAny("Missed_TS"));
1794 if (NULL != pMissedTsH1) pMissedTsH1->Write();
1795
1796 TProfile* pMissedTsEvoP = dynamic_cast<TProfile*>(gROOT->FindObjectAny("Missed_TS_Evo"));
1797 if (NULL != pMissedTsEvoP) pMissedTsEvoP->Write();
1798
1799 gDirectory->cd("..");
1800 /***************************/
1801
1802 if ("" != sFileName) {
1803 // Restore original directory position
1804 histoFile->Close();
1805 } // if( "" != sFileName )
1806
1808 gFile = oldFile;
1809 gDirectory = oldDir;
1810}
1812{
1813 LOG(info) << "Reseting all STS histograms.";
1814
1815 for (UInt_t uModuleId = 0; uModuleId < 2; ++uModuleId) {
1816 fHistPadDistr[uModuleId]->Reset();
1817 fRealHistPadDistr[uModuleId]->Reset();
1818 }
1819
1820 fhRate->Reset();
1821 fhRateAdcCut->Reset();
1822 fhStsMessType->Reset();
1823 fhStsSysMessType->Reset();
1824 fhStsMessTypePerDpb->Reset();
1825 fhStsSysMessTypePerDpb->Reset();
1826 fhPulserStatusMessType->Reset();
1828 fhStsHitsElinkPerDpb->Reset();
1830
1831 for (UInt_t uFebIdx = 0; uFebIdx < fuNbFebs; ++uFebIdx) {
1832 if (kTRUE == fUnpackParMuch->IsFebActive(uFebIdx)) {
1833 fhStsFebChanCntRaw[uFebIdx]->Reset();
1834 fhStsFebChanCntRawGood[uFebIdx]->Reset();
1835 fhStsFebChanAdcRaw[uFebIdx]->Reset();
1836 fhStsFebChanAdcRawProf[uFebIdx]->Reset();
1837 fhStsFebChanAdcCal[uFebIdx]->Reset();
1838 fhStsFebChanAdcCalProf[uFebIdx]->Reset();
1839 fhStsFebChanRawTs[uFebIdx]->Reset();
1840 fhStsFebChanMissEvt[uFebIdx]->Reset();
1841 fhStsFebChanMissEvtEvo[uFebIdx]->Reset();
1842 fhStsFebAsicMissEvtEvo[uFebIdx]->Reset();
1843 fhStsFebMissEvtEvo[uFebIdx]->Reset();
1844 fhStsFebChanHitRateEvo[uFebIdx]->Reset();
1845 fhStsFebChanHitRateProf[uFebIdx]->Reset();
1846 fhStsFebAsicHitRateEvo[uFebIdx]->Reset();
1847 fhStsFebHitRateEvo[uFebIdx]->Reset();
1848 fhStsFebHitRateEvo_mskch[uFebIdx]->Reset();
1849 fhStsFebHitRateEvo_mskch_adccut[uFebIdx]->Reset();
1850 fhStsFebChanHitRateEvoLong[uFebIdx]->Reset();
1851 fhStsFebAsicHitRateEvoLong[uFebIdx]->Reset();
1852 fhStsFebHitRateEvoLong[uFebIdx]->Reset();
1853 fhStsFebChanDistT[uFebIdx]->Reset();
1854 for (UInt_t uFebIdxB = uFebIdx; uFebIdxB < fuNbFebs; ++uFebIdxB) {
1855 fhStsFebChanDtCoinc[uFebIdx][uFebIdxB]->Reset();
1856 fhStsFebChanCoinc[uFebIdx][uFebIdxB]->Reset();
1857 } // for( UInt_t uFebIdxB = uFebIdx; uFebIdxB < fuNbFebs; ++uFebIdxB )
1858
1860 fhStsFebSmxErrRatioEvo[uFebIdx]->Reset();
1861 fhStsFebSmxErrRatioEvoAsic[uFebIdx]->Reset();
1862 fhStsFebSmxErrRatioCopyEvo[uFebIdx]->Reset();
1863 fhStsFebSmxErrRatioCopyEvoAsic[uFebIdx]->Reset();
1864 fhStsFebSmxErrRatioCopySameAdcEvo[uFebIdx]->Reset();
1865 fhStsFebSmxErrRatioCopySameAdcEvoAsic[uFebIdx]->Reset();
1867 } // if( kTRUE == fUnpackParMuch->IsFebActive( uFebIdx ) )
1868 } // for( UInt_t uFebIdx = 0; uFebIdx < fuNbFebs; ++uFebIdx )
1869
1870 for (UInt_t uLinks = 0; uLinks < kiMaxNbFlibLinks; ++uLinks) {
1871 TString sMsSzName = Form("MsSz_link_%02u", uLinks);
1872 if (fHM->Exists(sMsSzName.Data())) fHM->H1(sMsSzName.Data())->Reset();
1873
1874 sMsSzName = Form("MsSzTime_link_%02u", uLinks);
1875 if (fHM->Exists(sMsSzName.Data())) fHM->P1(sMsSzName.Data())->Reset();
1876 } // for( UInt_t uLinks = 0; uLinks < kiMaxNbFlibLinks; ++uLinks )
1877
1878 fdStartTime = -1;
1879 fdStartTimeMsSz = -1;
1880}
1881
1882void CbmMcbm2018MonitorMuch::SetRunStart(Int_t dateIn, Int_t timeIn, Int_t iBinSize)
1883{
1884 TDatime* fRunStartDateTime = new TDatime(dateIn, timeIn);
1885 fiRunStartDateTimeSec = fRunStartDateTime->Convert();
1886 fiBinSizeDatePlots = iBinSize;
1887
1888 LOG(info) << "Assigned new MUCH Run Start Date-Time: " << fRunStartDateTime->AsString();
1889}
1890
1891void CbmMcbm2018MonitorMuch::SetLongDurationLimits(UInt_t uDurationSeconds, UInt_t uBinSize)
1892{
1893 fbLongHistoEnable = kTRUE;
1894 fuLongHistoNbSeconds = uDurationSeconds;
1895 fuLongHistoBinSizeSec = uBinSize;
1896}
1901{
1902
1903 if (kTRUE == fbSmx2ErrorUseNoiseLevels) {
1909 } // if( kTRUE == fbSmx2ErrorUseNoiseLevels )
1910
1918 for (UInt_t uFebIdx = 0; uFebIdx < fuNbFebs; ++uFebIdx) {
1926 for (UInt_t uAsicIdx = 0; uAsicIdx < fUnpackParMuch->GetNbAsicsPerFeb(); ++uAsicIdx) {
1927 //fvulLastHitTs[ uXyterIdx ].resize( fuNbChanPerAsic, 0 );
1928 fvdSmxErrTimeLastHits[uFebIdx][uAsicIdx].resize(kuSmxErrCoincWinNbHits, -1.0);
1934 fvuSmxErrIdxLastHit[uFebIdx][uAsicIdx] = kuSmxErrCoincWinNbHits;
1935 } // for( UInt_t uAsicIdx = 0; uAsicIdx < fUnpackParMuch->GetNbAsicsPerFeb(); ++uAsicIdx )
1936 } // for( UInt_t uFebIdx = 0; uFebIdx < fuNbFebs; ++uFebIdx )
1937}
1938
1939Bool_t CbmMcbm2018MonitorMuch::SmxErrCheckCoinc(UInt_t uFebIdx, UInt_t uAsicIdx, Double_t dNewHitTime)
1940{
1941 if (kuSmxErrCoincWinNbHits == fvuSmxErrIdxFirstHitM07[uFebIdx][uAsicIdx]
1942 && kuSmxErrCoincWinNbHits == fvuSmxErrIdxFirstHitM08[uFebIdx][uAsicIdx]
1943 && kuSmxErrCoincWinNbHits == fvuSmxErrIdxFirstHitM09[uFebIdx][uAsicIdx]
1944 && kuSmxErrCoincWinNbHits == fvuSmxErrIdxFirstHitM10[uFebIdx][uAsicIdx]
1945 && kuSmxErrCoincWinNbHits == fvuSmxErrIdxFirstHitM11[uFebIdx][uAsicIdx]
1946 && kuSmxErrCoincWinNbHits == fvuSmxErrIdxLastHit[uFebIdx][uAsicIdx]) {
1948 fvuSmxErrIdxFirstHitM07[uFebIdx][uAsicIdx] = 4;
1949 fvuSmxErrIdxFirstHitM08[uFebIdx][uAsicIdx] = 3;
1950 fvuSmxErrIdxFirstHitM09[uFebIdx][uAsicIdx] = 2;
1951 fvuSmxErrIdxFirstHitM10[uFebIdx][uAsicIdx] = 1;
1952 fvuSmxErrIdxFirstHitM11[uFebIdx][uAsicIdx] = 0;
1953 fvuSmxErrIdxLastHit[uFebIdx][uAsicIdx] = 0;
1954 fvdSmxErrTimeLastHits[uFebIdx][uAsicIdx][fvuSmxErrIdxLastHit[uFebIdx][uAsicIdx]] = dNewHitTime;
1955
1957 return kFALSE;
1958 }
1959 else if (kuSmxErrCoincWinNbHits - 1
1960 == fvuSmxErrIdxLastHit[uFebIdx][uAsicIdx] - fvuSmxErrIdxFirstHitM11[uFebIdx][uAsicIdx]
1961 || fvuSmxErrIdxFirstHitM11[uFebIdx][uAsicIdx] - 1 == fvuSmxErrIdxLastHit[uFebIdx][uAsicIdx]) {
1963 fvuSmxErrIdxFirstHitM07[uFebIdx][uAsicIdx] =
1964 (fvuSmxErrIdxFirstHitM07[uFebIdx][uAsicIdx] + 1) % kuSmxErrCoincWinNbHits;
1965 fvuSmxErrIdxFirstHitM08[uFebIdx][uAsicIdx] =
1966 (fvuSmxErrIdxFirstHitM08[uFebIdx][uAsicIdx] + 1) % kuSmxErrCoincWinNbHits;
1967 fvuSmxErrIdxFirstHitM09[uFebIdx][uAsicIdx] =
1968 (fvuSmxErrIdxFirstHitM09[uFebIdx][uAsicIdx] + 1) % kuSmxErrCoincWinNbHits;
1969 fvuSmxErrIdxFirstHitM10[uFebIdx][uAsicIdx] =
1970 (fvuSmxErrIdxFirstHitM10[uFebIdx][uAsicIdx] + 1) % kuSmxErrCoincWinNbHits;
1971 fvuSmxErrIdxFirstHitM11[uFebIdx][uAsicIdx] =
1972 (fvuSmxErrIdxFirstHitM11[uFebIdx][uAsicIdx] + 1) % kuSmxErrCoincWinNbHits;
1973 fvuSmxErrIdxLastHit[uFebIdx][uAsicIdx] = (fvuSmxErrIdxLastHit[uFebIdx][uAsicIdx] + 1) % kuSmxErrCoincWinNbHits;
1974 fvdSmxErrTimeLastHits[uFebIdx][uAsicIdx][fvuSmxErrIdxLastHit[uFebIdx][uAsicIdx]] = dNewHitTime;
1975 }
1976 else {
1978 fvuSmxErrIdxLastHit[uFebIdx][uAsicIdx] = fvuSmxErrIdxLastHit[uFebIdx][uAsicIdx] + 1;
1979 fvdSmxErrTimeLastHits[uFebIdx][uAsicIdx][fvuSmxErrIdxLastHit[uFebIdx][uAsicIdx]] = dNewHitTime;
1980
1982 return kFALSE;
1983 }
1984
1986 Double_t dTimeDiff07 = fvdSmxErrTimeLastHits[uFebIdx][uAsicIdx][fvuSmxErrIdxLastHit[uFebIdx][uAsicIdx]]
1987 - fvdSmxErrTimeLastHits[uFebIdx][uAsicIdx][fvuSmxErrIdxFirstHitM07[uFebIdx][uAsicIdx]];
1988 Double_t dTimeDiff08 = fvdSmxErrTimeLastHits[uFebIdx][uAsicIdx][fvuSmxErrIdxLastHit[uFebIdx][uAsicIdx]]
1989 - fvdSmxErrTimeLastHits[uFebIdx][uAsicIdx][fvuSmxErrIdxFirstHitM08[uFebIdx][uAsicIdx]];
1990 Double_t dTimeDiff09 = fvdSmxErrTimeLastHits[uFebIdx][uAsicIdx][fvuSmxErrIdxLastHit[uFebIdx][uAsicIdx]]
1991 - fvdSmxErrTimeLastHits[uFebIdx][uAsicIdx][fvuSmxErrIdxFirstHitM09[uFebIdx][uAsicIdx]];
1992 Double_t dTimeDiff10 = fvdSmxErrTimeLastHits[uFebIdx][uAsicIdx][fvuSmxErrIdxLastHit[uFebIdx][uAsicIdx]]
1993 - fvdSmxErrTimeLastHits[uFebIdx][uAsicIdx][fvuSmxErrIdxFirstHitM10[uFebIdx][uAsicIdx]];
1994 Double_t dTimeDiff11 = fvdSmxErrTimeLastHits[uFebIdx][uAsicIdx][fvuSmxErrIdxLastHit[uFebIdx][uAsicIdx]]
1995 - fvdSmxErrTimeLastHits[uFebIdx][uAsicIdx][fvuSmxErrIdxFirstHitM11[uFebIdx][uAsicIdx]];
1996
1997
1999 if ((kdSmxErrCoincWinBeg <= dTimeDiff07 && dTimeDiff07 <= fdSmxErrCoincWinM07)
2000 || (kdSmxErrCoincWinBeg <= dTimeDiff08 && dTimeDiff08 <= fdSmxErrCoincWinM08)
2001 || (kdSmxErrCoincWinBeg <= dTimeDiff09 && dTimeDiff09 <= fdSmxErrCoincWinM09)
2002 || (kdSmxErrCoincWinBeg <= dTimeDiff10 && dTimeDiff10 <= fdSmxErrCoincWinM10)
2003 || (kdSmxErrCoincWinBeg <= dTimeDiff11 && dTimeDiff11 <= fdSmxErrCoincWinM11)) {
2004 return kTRUE;
2005 }
2006 else {
2007 return kFALSE;
2008 }
2009}
2011Bool_t CbmMcbm2018MonitorMuch::ScanForNoisyChannels(Double_t dNoiseThreshold)
2012{
2013 for (UInt_t uFebIdx = 0; uFebIdx < fuNbFebs; ++uFebIdx) {
2014 if (kTRUE == fUnpackParMuch->IsFebActive(uFebIdx)) {
2015 LOG(info) << Form(" ------------------ Noisy channels scan for FEB %2d ------------", uFebIdx);
2016 for (UInt_t uAsicIdx = 0; uAsicIdx < fUnpackParMuch->GetNbAsicsPerFeb(); ++uAsicIdx)
2017 for (UInt_t uChanIdx = 0; uChanIdx < fUnpackParMuch->GetNbChanPerAsic(); ++uChanIdx) {
2018 UInt_t uChanInFeb = uAsicIdx * fUnpackParMuch->GetNbChanPerAsic() + uChanIdx;
2019 if (dNoiseThreshold < fhStsFebChanHitRateProf[uFebIdx]->GetBinContent(1 + uChanInFeb))
2020 LOG(info) << Form("Noisy Channel ASIC %d channel %3d (%4d) level %6.0f", uAsicIdx, uChanIdx, uChanInFeb,
2021 fhStsFebChanHitRateProf[uFebIdx]->GetBinContent(1 + uChanInFeb));
2022
2023 } // for( UInt_t uChanIdx = 0; uChanIdx < fUnpackParMuch->GetNbChanPerAsic(); ++uChanIdx )
2024
2025 LOG(info) << " ---------------------------------------------------------------";
2026 } // if( kTRUE == fUnpackParMuch->IsFebActive( uFebIdx ) )
2027 } // for( UInt_t uFebIdx = 0; uFebIdx < fuNbFebs; ++uFebIdx )
2028 return kTRUE;
2029}
2031
ClassImp(CbmConverterManager)
Histogram manager.
Bool_t bMcbm2018ScanNoisyMuch
Bool_t bMcbm2018WriteMuch
Bool_t bMcbm2018ResetMuch
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.
Bool_t SmxErrCheckCoinc(UInt_t uFebIdx, UInt_t uAsicIdx, Double_t dNewHitTime)
std::vector< TH2 * > fhStsFebChanHitRateEvo
virtual void SetNbMsInTs(size_t uCoreMsNb, size_t uOverlapMsNb)
void FillTsMsbInfo(stsxyter::Message mess, UInt_t uMessIdx=0, UInt_t uMsIdx=0)
std::vector< TProfile * > fhStsFebSmxErrRatioCopySameAdcEvo
stsxyter::MessagePrintMask fPrintMessCtrl
Int_t fiBinSizeDatePlots
Start of run time since "epoch" in s, for the plots with date as X axis.
std::vector< TH1 * > fhStsFebChanCntRawGood
std::vector< std::vector< UInt_t > > fvuSmxErrIdxFirstHitM11
[ NbFebs ][ NbSmxPerFeb ]
std::vector< stsxyter::FinalHit > fvmHitsInMs
Hits time-sorting.
std::vector< std::vector< UInt_t > > fvuSmxErrIdxLastHit
[ NbFebs ][ NbSmxPerFeb ]
std::vector< std::vector< UInt_t > > fvuSmxErrIdxFirstHitM10
[ NbFebs ][ NbSmxPerFeb ]
std::vector< TH2 * > fHistPadDistr
Plots per FEB-8.
std::vector< TH2 * > fhStsFebChanAdcCal
std::vector< std::vector< std::vector< Double_t > > > fvdFebAdcGain
Number of StsXyter ASICs.
std::vector< UInt_t > fvuInitialHeaderDone
Current TS MSB cycle for DPB.
std::vector< TProfile * > fhStsFebSmxErrRatioCopyEvo
std::vector< size_t > fvMsComponentsList
std::vector< std::vector< UInt_t > > fvuSmxErrIdxFirstHitM08
[ NbFebs ][ NbSmxPerFeb ]
std::vector< TProfile * > fhStsFebSmxErrRatioEvo
Histograms.
std::vector< TH2 * > fRealHistPadDistr
std::vector< std::vector< Double_t > > fvdChanLastHitTime
Last hit time in bins for each Channel.
std::vector< TH1 * > fhStsFebHitRateEvo
Bool_t fbPrintMessages
Task configuration values.
Int_t fiRunStartDateTimeSec
Index of the DPB from which the MS currently unpacked is coming.
void SetRunStart(Int_t dateIn, Int_t timeIn, Int_t iBinSize=5)
Bool_t ScanForNoisyChannels(Double_t dNoiseThreshold=1e3)
---------------------------------------------------------------—///
virtual Bool_t DoUnpack(const fles::Timeslice &ts, size_t component)
Bool_t ProcessStsMs(const fles::Timeslice &ts, size_t uMsComp, UInt_t uMsIdx)
static constexpr const Double_t kdSmxErrCoincWinNoiseM10
std::vector< std::vector< UInt_t > > fvuSmxErrIdxFirstHitM09
[ NbFebs ][ NbSmxPerFeb ]
Int_t fiTimeIntervalRateUpdate
Mean Rate per channel plots.
std::vector< ULong64_t > fvulCurrentTsMsb
Bin size in s for the plots with date as X axis.
UInt_t fuCurrDpbId
Current equipment ID, tells from which DPB the current MS is originating.
std::vector< TH2 * > fhStsFebChanDistT
std::vector< TH2 * > fhStsFebChanAdcRaw
std::vector< std::vector< ULong64_t > > fvulChanLastHitTime
TH1 * fhStsMessType
Histogram manager.
UInt_t fuNbStsXyters
Number of StsXyter ASICs.
Long64_t fdStartTime
Last hit ADC in bins in each MS for each Channel.
std::vector< TProfile * > fhStsFebChanAdcCalProf
std::vector< std::vector< std::vector< Double_t > > > fvdSmxErrTimeLastHits
std::vector< Double_t > fvdMsTime
Header time of previous MS per link.
std::vector< std::vector< Double_t > > fvdFebChanCountsSinceLastRateUpdate
std::vector< Double_t > fvdPrevMsTime
Last hit time in ns for each Channel.
std::vector< TH1 * > fhStsFebMissEvtEvo
void SaveAllHistos(TString sFileName="")
Bool_t fbSmx2ErrorUseNoiseLevels
SXM 2.0 logic error detection and tagging, 1 eLink case.
UInt_t fuNbFebs
Array to hold the active flag for all CROBs, [ NbDpb ][ NbCrobPerDpb ].
std::map< UInt_t, UInt_t > fDpbIdIndexMap
Total number of STS DPBs in system.
static constexpr const Double_t kdSmxErrCoincWinNoiseM07
Coincidence windows 99.9% tagging (up to 0.1% of corruption not detected)
static const Int_t kiMaxNbFlibLinks
ADC offset in e-, [ NbDpb ][ NbCrobPerDpb ][ NbFebsPerCrob ].
Bool_t fbLongHistoEnable
Rate evolution histos.
Double_t fdSmxErrCoincWinM07
Tagging variables.
CbmMcbm2018MuchPar * fUnpackParMuch
/‍** Ignore Overlap Ms: all fuOverlapMsNb MS at the end of timeslice **‍/
std::vector< TH2 * > fhStsFebChanMissEvt
std::vector< TH2 * > fhStsFebAsicMissEvtEvo
static constexpr const Double_t kdSmxErrCoincWinBeg
std::vector< std::vector< std::vector< UInt_t > > > fvuChanNbHitsInMs
Header time of each MS.
TProfile * fhMsSzTime[kiMaxNbFlibLinks]
void FillHitInfo(stsxyter::Message mess, const UShort_t &usElinkIdx, const UInt_t &uAsicIdx, const UInt_t &uMsIdx)
std::vector< std::vector< TH1 * > > fhStsFebChanDtCoinc
CbmHistManager * fHM
Histograms.
std::map< stsxyter::MessType, UInt_t > fmMsgCounter
Current data properties.
std::vector< UInt_t > fvuCurrentTsMsbCycle
Current TS MSB for each DPB.
std::vector< TH2 * > fhStsFebAsicHitRateEvoLong
static constexpr const Double_t kdSmxErrCoincWinNoiseM11
static constexpr const Double_t kdSmxErrCoincWinNoiseM08
std::vector< TProfile * > fhStsFebChanAdcRawProf
std::vector< TH1 * > fhStsFebHitRateEvo_mskch
std::vector< Int_t > fviFebCountsSinceLastRateUpdate
Double_t fdCoincCenter
Coincidences in sorted hits.
std::vector< std::vector< std::vector< Double_t > > > fvdChanLastHitTimeInMs
Number of hits in each MS for each Channel.
static const UInt_t kuSmxErrCoincWinNbHits
std::vector< std::vector< Double_t > > fdStsFebChanLastTimeForDist
void FillEpochInfo(stsxyter::Message mess)
std::vector< UInt_t > fvuInitialTsMsbCycleHeader
Flag set after seeing MS header in 1st MS for DPB.
TH1 * fhMsSz[kiMaxNbFlibLinks]
UInt_t fuCurrDpbIdx
Temp holder until Current equipment ID is properly filled in MS.
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< TH1 * > fhStsFebHitRateEvoLong
void SetLongDurationLimits(UInt_t uDurationSeconds=3600, UInt_t uBinSize=1)
std::vector< std::vector< UInt_t > > fvuSmxErrIdxFirstHitM07
[ NbFebs ][ NbSmxPerFeb ][ kuSmxErrCoincWinNbHits ]
std::vector< Int_t > fviFebTimeSecLastRateUpdate
std::vector< TProfile2D * > fhStsFebSmxErrRatioCopySameAdcEvoAsic
std::vector< TH2 * > fhStsFebChanMissEvtEvo
static const UInt_t kuBytesPerMessage
std::vector< TH1 * > fhStsFebChanCntRaw
std::vector< TH2 * > fhStsFebChanRawTs
virtual void AddMsComponentToList(size_t component, UShort_t usDetectorId)
void SetCoincidenceBorder(Double_t dCenterPos, Double_t dBorderVal)
std::vector< std::vector< stsxyter::FinalHit > > fvmAsicHitsInMs
All hits (time in bins, ADC in bins, asic, channel) in last TS, sorted with "<" operator.
std::vector< std::vector< Bool_t > > fvbCrobActiveFlag
Map of DPB Identifier to DPB index.
std::vector< TH2 * > fhStsFebAsicHitRateEvo
std::vector< TProfile2D * > fhStsFebSmxErrRatioCopyEvoAsic
std::vector< std::vector< std::vector< Double_t > > > fvdFebAdcOffs
ADC gain in e-/b, [ NbDpb ][ NbCrobPerDpb ][ NbFebsPerCrob ].
std::vector< TProfile * > fhStsFebChanHitRateProf
std::vector< TH2 * > fhStsFebChanHitRateEvoLong
std::vector< std::vector< std::vector< UShort_t > > > fvusChanLastHitAdcInMs
Last hit time 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
ULong64_t fulCurrentTsIdx
TS/MS info.
std::vector< TH1 * > fhStsFebHitRateEvo_mskch_adccut
std::vector< std::vector< TH2 * > > fhStsFebChanCoinc
std::vector< TProfile2D * > fhStsFebSmxErrRatioEvoAsic
Int_t ElinkIdxToFebIdx(UInt_t uElink)
static constexpr UInt_t GetNbElinkPerCrob()
Double_t GetRealPadSize(Int_t)
static constexpr UInt_t GetNbFebsPerCrob()
Short_t GetPadXA(UShort_t febid, UShort_t channelid)
static constexpr UInt_t GetNbChanPerAsic()
static constexpr UInt_t GetNbAsicsPerCrob()
static constexpr UInt_t GetNbChanPerFeb()
UInt_t GetDpbId(UInt_t uDpbIdx)
UInt_t ElinkIdxToAsicIdx(UInt_t uElink)
Short_t GetPadYA(UShort_t febid, UShort_t channelid)
Bool_t IsCrobActive(UInt_t uDpbIdx, UInt_t uCrobIdx)
Bool_t IsFebActive(UInt_t uFebInSystIdx)
static constexpr UInt_t GetNbFebsPerDpb()
static constexpr UInt_t GetNbCrobsPerDpb()
static constexpr UInt_t GetNbAsicsPerFeb()
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 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 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 GetStatusLink() const
For Status data: Returns the Link Inedx (9 bit field)
Hash for CbmL1LinkKey.
static constexpr uint64_t kulTsCycleNbBins
static constexpr uint32_t kuHitNbTsBins
static constexpr uint32_t kuHitNbAdcBins
Status/properties constants.
static constexpr double kdClockCycleNs
MessType
Message types.