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