CbmRoot
Loading...
Searching...
No Matches
CbmMcbm2018MonitorMuchLite.h
Go to the documentation of this file.
1/* Copyright (C) 2019-2020 GSI Helmholtzzentrum fuer Schwerionenforschung, Darmstadt
2 SPDX-License-Identifier: GPL-3.0-only
3 Authors: David Emschermann [committer] */
4
5// -----------------------------------------------------------------------------
6// ----- -----
7// ----- CbmMcbm2018MonitorMuchLite -----
8// ----- Created 11/05/18 by P.-A. Loizeau -----
9// ----- Modified 07/12/18 by Ajit Kumar -----
10// ----- Modified 05/03/19 by Vikas Singhal -----
11// ----- -----
12// -----------------------------------------------------------------------------
13
14#ifndef CBMMCBM2018MonitorMuchLite_H
15#define CBMMCBM2018MonitorMuchLite_H
16
17#ifndef __CINT__
18#include "Timeslice.hpp"
19#endif
20
21// Data
22#include "StsXyterFinalHit.h"
23#include "StsXyterMessage.h"
24
25// CbmRoot
26#include "CbmHistManager.h"
27#include "CbmMcbmUnpack.h"
28
29// C++11
30#include <chrono>
31
32// C/C++
33#include <map>
34#include <set>
35#include <vector>
36
38//class CbmCern2017UnpackParSts;
39
41public:
44
45 virtual Bool_t Init();
46#ifndef __CINT__
47 virtual Bool_t DoUnpack(const fles::Timeslice& ts, size_t component);
48#endif
49 virtual void Reset();
50
51 virtual void Finish();
52
53 void SetParContainers();
54
55 Bool_t InitContainers();
56
57 Bool_t ReInitContainers();
58
59 virtual void AddMsComponentToList(size_t component, UShort_t usDetectorId);
60 virtual void SetNbMsInTs(size_t uCoreMsNb, size_t uOverlapMsNb);
61 void SetMsOverlap(size_t uOverlapMsNb = 1) { fuNbOverMsPerTs = uOverlapMsNb; }
62 size_t GetMsOverlap() { return fuNbOverMsPerTs; }
63
64 void SetRunStart(Int_t dateIn, Int_t timeIn, Int_t iBinSize = 5);
65
66 void ResetAllHistos();
67 void SaveAllHistos(TString sFileName = "");
68 void SaveHistos(TString sFileName = "");
69 void SetHistoFileName(TString sFileName = "data/SetupHistos.root") { fsHistoFileFullname = sFileName; }
70
78 //void SetLongDurationLimits( UInt_t uDurationSeconds = 3600, UInt_t uBinSize = 1 );
79 //void SetEnableCoincidenceMaps( Bool_t bEnableCoincidenceMapsOn = kTRUE ) { fbEnableCoincidenceMaps = bEnableCoincidenceMapsOn; }
80 //void SetCoincidenceBorder( Double_t dCenterPos, Double_t dBorderVal );
81 //void SetFebChanCoincidenceLimitNs( Double_t dLimitIn ) { fdFebChanCoincidenceLimit = dLimitIn; }
82 //void UseNoiseLimitsSmx2LogicError( Bool_t bUseNoise = kTRUE ) { fbSmx2ErrorUseNoiseLevels = bUseNoise; }
83
84 void SetMuchMode(Bool_t bMuchMode = kTRUE) { fbMuchMode = bMuchMode; }
85
86 // void SetTimeBin( size_t uTimeBin );
87 void UseDaqBuffer(Bool_t) {}; //Virtual function in Mother Class, Need to update accordingly. VS
88
90 void SetBinningFwFlag(Bool_t bEnable = kTRUE) { fbBinningFw = bEnable; }
91
92private:
93 // Parameters
94 // Control flags
95 Bool_t fbMuchMode;
96 std::vector<Bool_t> fvbMaskedComponents;
98 Bool_t fbBinningFw = kFALSE;
99
100 // FLES containers
101 std::vector<size_t> fvMsComponentsList;
105 // Unpacking and mapping
107 UInt_t fuNrOfDpbs;
108 std::map<UInt_t, UInt_t> fDpbIdIndexMap;
109 std::vector<std::vector<Bool_t>>
111 UInt_t fuNbFebs;
113 //std::vector< std::vector< std::vector< Double_t > > > fvdFebAdcGain; //! ADC gain in e-/b, [ NbDpb ][ NbCrobPerDpb ][ NbFebsPerCrob ]
114 //std::vector< std::vector< std::vector< Double_t > > > fvdFebAdcOffs; //! ADC offset in e-, [ NbDpb ][ NbCrobPerDpb ][ NbFebsPerCrob ]
115
116 // Constants
117 static const Int_t kiMaxNbFlibLinks = 32;
118 static const UInt_t kuBytesPerMessage = 4;
119
126 // Bool_t fbEnableCoincidenceMaps;
131 std::map<stsxyter::MessType, UInt_t> fmMsgCounter;
133 UInt_t fuCurrDpbId;
137
139 std::vector<ULong64_t> fvulCurrentTsMsb;
140 std::vector<UInt_t> fvuCurrentTsMsbCycle;
141 std::vector<UInt_t> fvuInitialHeaderDone;
142 std::vector<UInt_t> fvuInitialTsMsbCycleHeader;
143 std::vector<UInt_t> fvuElinkLastTsHit;
145 std::vector<std::vector<ULong64_t>> fvulChanLastHitTime;
146 //std::vector< std::vector< ULong64_t > > fvdChanLastHitTime; //! Last hit time in ns for each Channel
147 std::vector<std::vector<Double_t>> fvdChanLastHitTime;
148 std::vector<Double_t> fvdPrevMsTime;
149 std::vector<Double_t> fvdMsTime;
150 std::vector<std::vector<std::vector<UInt_t>>> fvuChanNbHitsInMs;
151 std::vector<std::vector<std::vector<Double_t>>>
153 std::vector<std::vector<std::vector<UShort_t>>>
155 // std::vector< std::vector< std::multiset< stsxyter::FinalHit > > > fvmChanHitsInTs; //! All hits (time & ADC) in bins in last TS for each Channel
157 //Long64_t fdStartTime; /** Time of first valid hit (TS_MSB available), used as reference for evolution plots**/
158 Long64_t prevtime_new;
159 Long64_t prevTime;
160 UInt_t prevAsic;
161 UInt_t prevChan;
162 Double_t fdStartTime;
164 std::chrono::steady_clock::time_point
168 std::vector<stsxyter::FinalHit>
170 std::vector<std::vector<stsxyter::FinalHit>>
172 std::vector<std::vector<stsxyter::FinalHit>>
178 std::vector<Int_t> fviFebTimeSecLastRateUpdate;
180 std::vector<std::vector<Double_t>> fvdFebChanCountsSinceLastRateUpdate;
182 //Bool_t fbLongHistoEnable;
183 //UInt_t fuLongHistoNbSeconds;
184 //UInt_t fuLongHistoBinSizeSec;
185 //UInt_t fuLongHistoBinNb;
186 UInt_t Counter;
187 UInt_t Counter1;
189 //Double_t fdCoincCenter; // ns
190 //Double_t fdCoincBorder; // ns, +/-
191 //Double_t fdCoincMin; // ns
192 //Double_t fdCoincMax; // ns
193
204
205 TH1* fhRate;
207 TH1* fhFEBcount = nullptr;
208 // std::vector<TH1 *> fhMuchFebChanRateEvo;
209
211 //UInt_t kuNbAsicPerFeb = 1;
212
213 std::vector<TH2*> fHistPadDistr;
214 std::vector<TH2*> fRealHistPadDistr;
215
216 //Double_t fdFebChanCoincidenceLimit; // ns
217 std::vector<TH1*> fhMuchFebChanCntRaw;
218 std::vector<TH1*> fhMuchFebSpill = {};
219 std::vector<TH2*> fhMuchFebADC = {};
220 //std::vector<TH1 *> fhMuchFebChanCntRawGood;
221 std::vector<TH2*> fhMuchFebChanAdcRaw;
222 std::vector<TProfile*> fhMuchFebChanAdcRawProf;
223 //std::vector<TH2 *> fhMuchFebChanAdcCal;
224 //std::vector<TProfile*> fhMuchFebChanAdcCalProf;
225 std::vector<TH2*> fhMuchFebChanRawTs;
226 std::vector<TH2*> fhMuchChannelTime = {};
227 //std::vector<TH2*> fhMuchFebChanMissEvt;
228 //std::vector<TH2*> fhMuchFebChanMissEvtEvo;
229 //std::vector<TH2*> fhMuchFebAsicMissEvtEvo;
230 //std::vector<TH1*> fhMuchFebMissEvtEvo;
231 std::vector<TH2*> fhMuchFebChanHitRateEvo;
232 std::vector<TProfile*> fhMuchFebChanHitRateProf;
233 //std::vector<TH2*> fhMuchFebAsicHitRateEvo;
234 std::vector<TH1*> fhMuchFebHitRateEvo;
235 std::vector<TH1*> fhMuchFebHitRateEvo_mskch;
238 //std::vector<TH2*> fhMuchFebChanHitRateEvoLong;
239 //std::vector<TH2*> fhMuchFebAsicHitRateEvoLong;
240 //std::vector<TH1*> fhMuchFebHitRateEvoLong;
241 std::vector<std::vector<Double_t>> fdMuchFebChanLastTimeForDist;
242 std::vector<TH2*> fhMuchFebChanDistT;
243 //std::vector< std::vector<TH1*> > fhMuchFebChanDtCoinc;
244 //std::vector< std::vector<TH2*> > fhMuchFebChanCoinc;
245 std::vector<TProfile*> fhMuchFebDuplicateHitProf;
246
248 TH2* fhDpbMsErrors = nullptr;
249
250 TCanvas* fcMsSizeAll;
253
254 // Methods later going into Algo
255 Bool_t InitMuchParameters();
256 void CreateHistograms();
257 Bool_t ProcessMuchMs(const fles::Timeslice& ts, size_t uMsComp, UInt_t uMsIdx);
258
259 void FillHitInfo(stsxyter::Message mess, const UShort_t& usElinkIdx, const UInt_t& uAsicIdx, const UInt_t& uMsIdx);
260 void FillTsMsbInfo(stsxyter::Message mess, UInt_t uMessIdx = 0, UInt_t uMsIdx = 0);
262
264 void SaveMuchHistos(TString sFileName = "");
265 Bool_t ScanForNoisyChannels(Double_t dNoiseThreshold = 1e3);
266
269
270 ClassDef(CbmMcbm2018MonitorMuchLite, 1)
271};
272
273#endif // CBMMCBM2018MonitorMuchLite_H
Histogram manager.
Histogram manager.
std::vector< TH1 * > fhMuchFebHitRateEvo_mskch_adccut
std::chrono::steady_clock::time_point ftStartTimeUnix
Int_t fiBinSizeDatePlots
Start of run time since "epoch" in s, for the plots with date as X axis.
UInt_t fuCurrDpbIdx
Temp holder until Current equipment ID is properly filled in MS.
std::vector< std::vector< std::vector< UShort_t > > > fvusChanLastHitAdcInMs
Last hit time in bins in each MS for each Channel.
virtual void AddMsComponentToList(size_t component, UShort_t usDetectorId)
std::vector< stsxyter::FinalHit > fvmHitsInMs
Hits time-sorting.
void SetRunStart(Int_t dateIn, Int_t timeIn, Int_t iBinSize=5)
std::vector< TProfile * > fhMuchFebDuplicateHitProf
CbmHistManager * fHM
Coincidences in sorted hits.
std::map< UInt_t, UInt_t > fDpbIdIndexMap
Total number of STS DPBs in system.
UInt_t fuCurrDpbId
Current equipment ID, tells from which DPB the current MS is originating.
void SetBinningFwFlag(Bool_t bEnable=kTRUE)
=> Quick and dirty hack for binning FW!!!
std::vector< std::vector< ULong64_t > > fvulChanLastHitTime
stsxyter::MessagePrintMask fPrintMessCtrl
void SetMuchMode(Bool_t bMuchMode=kTRUE)
void SetHistoFileName(TString sFileName="data/SetupHistos.root")
std::map< stsxyter::MessType, UInt_t > fmMsgCounter
Current data properties.
CbmMcbm2018MonitorMuchLite operator=(const CbmMcbm2018MonitorMuchLite &)
std::vector< UInt_t > fvuInitialTsMsbCycleHeader
Flag set after seeing MS header in 1st MS for DPB.
Int_t fiRunStartDateTimeSec
Index of the DPB from which the MS currently unpacked is coming.
void SaveHistos(TString sFileName="")
std::vector< TH2 * > fHistPadDistr
Plots per FEB-8.
void FillEpochInfo(stsxyter::Message mess)
std::vector< UInt_t > fvuInitialHeaderDone
Current TS MSB cycle for DPB.
Int_t fiTimeIntervalRateUpdate
Mean Rate per channel plots.
void SetMsOverlap(size_t uOverlapMsNb=1)
virtual void SetNbMsInTs(size_t uCoreMsNb, size_t uOverlapMsNb)
std::vector< Double_t > fvdMsTime
Header time of previous MS per link.
std::vector< std::vector< std::vector< Double_t > > > fvdChanLastHitTimeInMs
Number of hits in each MS for each Channel.
std::vector< std::vector< Bool_t > > fvbCrobActiveFlag
Map of DPB Identifier to DPB index.
void SaveAllHistos(TString sFileName="")
CbmMcbm2018MonitorMuchLite(const CbmMcbm2018MonitorMuchLite &)
void SaveMuchHistos(TString sFileName="")
std::vector< TProfile * > fhMuchFebChanAdcRawProf
std::vector< UInt_t > fvuElinkLastTsHit
TS MSB cycle from MS header in 1st MS for DPB.
void FillTsMsbInfo(stsxyter::Message mess, UInt_t uMessIdx=0, UInt_t uMsIdx=0)
UInt_t Counter
Rate evolution histos.
std::vector< std::vector< std::vector< UInt_t > > > fvuChanNbHitsInMs
Header time of each MS.
std::vector< TH1 * > fhMuchFebHitRateEvo_mskch
std::vector< Bool_t > fvbMaskedComponents
TProfile * fhMsSzTime[kiMaxNbFlibLinks]
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.
Bool_t ScanForNoisyChannels(Double_t dNoiseThreshold=1e3)
---------------------------------------------------------------—///
Bool_t fbBinningFw
=> Quick and dirty hack for binning FW!!!
std::vector< UInt_t > fvuCurrentTsMsbCycle
Current TS MSB for each DPB.
std::vector< TH1 * > fhMuchFebHitRateEvo_WithoutDupli
std::vector< Double_t > fvdPrevMsTime
Last hit time in ns for each Channel.
std::vector< std::vector< Double_t > > fdMuchFebChanLastTimeForDist
std::vector< Int_t > fviFebTimeSecLastRateUpdate
UInt_t fuNbStsXyters
Number of StsXyter ASICs.
std::vector< ULong64_t > fvulCurrentTsMsb
Bin size in s for the plots with date as X axis.
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< Double_t > > fvdFebChanCountsSinceLastRateUpdate
static const Int_t kiMaxNbFlibLinks
Number of StsXyter ASICs.
virtual Bool_t DoUnpack(const fles::Timeslice &ts, size_t component)
std::vector< Int_t > fviFebCountsSinceLastRateUpdate
TH2 * fhDpbMsErrors
Binning FW error flag.
std::vector< std::vector< Double_t > > fvdChanLastHitTime
Last hit time in bins for each Channel.
void SetPrintMessage(Bool_t bPrintMessOn=kTRUE, stsxyter::MessagePrintMask ctrl=stsxyter::MessagePrintMask::msg_print_Hex|stsxyter::MessagePrintMask::msg_print_Human)
std::vector< TProfile * > fhMuchFebChanHitRateProf
Long64_t prevtime_new
Last hit ADC in bins in each MS for each Channel.
Bool_t ProcessMuchMs(const fles::Timeslice &ts, size_t uMsComp, UInt_t uMsIdx)
CbmMcbm2018MuchPar * fUnpackParMuch
/‍** Ignore Overlap Ms: all fuOverlapMsNb MS at the end of timeslice **‍/
Bool_t fbPrintMessages
Task configuration values.
UInt_t fuNbFebs
Array to hold the active flag for all CROBs, [ NbDpb ][ NbCrobPerDpb ].
void FillHitInfo(stsxyter::Message mess, const UShort_t &usElinkIdx, const UInt_t &uAsicIdx, const UInt_t &uMsIdx)
MessagePrintMask
Printout control.