CbmRoot
Loading...
Searching...
No Matches
CbmMcbm2018MonitorMuch.h
Go to the documentation of this file.
1/* Copyright (C) 2019 Variable Energy Cyclotron Centre, Kolkata
2 SPDX-License-Identifier: GPL-3.0-only
3 Authors: Vikas Singhal [committer] */
4
5// -----------------------------------------------------------------------------
6// ----- -----
7// ----- CbmMcbm2018MonitorMuch -----
8// ----- Created 11/05/18 by P.-A. Loizeau -----
9// ----- Modified 07/12/18 by Ajit Kumar -----
10// ----- -----
11// -----------------------------------------------------------------------------
12
13#ifndef CBMMCBM2018MONITORMUCH_H
14#define CBMMCBM2018MONITORMUCH_H
15
16#ifndef __CINT__
17#include "Timeslice.hpp"
18#endif
19
20// Data
21#include "StsXyterFinalHit.h"
22#include "StsXyterMessage.h"
23
24// CbmRoot
25#include "CbmHistManager.h"
26#include "CbmMcbmUnpack.h"
27
28// C++11
29#include <chrono>
30
31// C/C++
32#include <map>
33#include <set>
34#include <vector>
35
37class CbmCern2017UnpackParSts;
38
40public:
43
44 virtual Bool_t Init();
45#ifndef __CINT__
46 virtual Bool_t DoUnpack(const fles::Timeslice& ts, size_t component);
47#endif
48 virtual void Reset();
49
50 virtual void Finish();
51
52 void SetParContainers();
53
54 Bool_t InitContainers();
55
56 Bool_t ReInitContainers();
57
58 virtual void AddMsComponentToList(size_t component, UShort_t usDetectorId);
59 virtual void SetNbMsInTs(size_t uCoreMsNb, size_t uOverlapMsNb);
60 void SetMsOverlap(size_t uOverlapMsNb = 1) { fuNbOverMsPerTs = uOverlapMsNb; }
61 size_t GetMsOverlap() { return fuNbOverMsPerTs; }
62
63 void SetRunStart(Int_t dateIn, Int_t timeIn, Int_t iBinSize = 5);
64
65 void ResetAllHistos();
66 void SaveAllHistos(TString sFileName = "");
67 void SavePulserHistos(TString sFileName = "");
68 void SetHistoFileName(TString sFileName = "data/SetupHistos.root") { fsHistoFileFullname = sFileName; }
69
77 void SetLongDurationLimits(UInt_t uDurationSeconds = 3600, UInt_t uBinSize = 1);
78 void SetEnableCoincidenceMaps(Bool_t bEnableCoincidenceMapsOn = kTRUE)
79 {
80 fbEnableCoincidenceMaps = bEnableCoincidenceMapsOn;
81 }
82 void SetCoincidenceBorder(Double_t dCenterPos, Double_t dBorderVal);
83 void SetFebChanCoincidenceLimitNs(Double_t dLimitIn) { fdFebChanCoincidenceLimit = dLimitIn; }
84 void UseNoiseLimitsSmx2LogicError(Bool_t bUseNoise = kTRUE) { fbSmx2ErrorUseNoiseLevels = bUseNoise; }
85
86 void SetMuchMode(Bool_t bMuchMode = kTRUE) { fbMuchMode = bMuchMode; }
87
88 // void SetTimeBin( size_t uTimeBin );
89 void UseDaqBuffer(Bool_t) {}; //Virtual function in Mother Class, Need to update accordingly. VS
90private:
91 // Parameters
92 // Control flags
93 Bool_t fbMuchMode;
94 // FLES containers
95 std::vector<size_t> fvMsComponentsList;
99 // Unpacking and mapping
101 UInt_t fuNrOfDpbs;
102 std::map<UInt_t, UInt_t> fDpbIdIndexMap;
103 std::vector<std::vector<Bool_t>>
105 UInt_t fuNbFebs;
107 std::vector<std::vector<std::vector<Double_t>>>
109 std::vector<std::vector<std::vector<Double_t>>>
111
112 // Constants
113 static const Int_t kiMaxNbFlibLinks = 32;
114 static const UInt_t kuBytesPerMessage = 4;
115
127 std::map<stsxyter::MessType, UInt_t> fmMsgCounter;
129 UInt_t fuCurrDpbId;
133
135 std::vector<ULong64_t> fvulCurrentTsMsb;
136 std::vector<UInt_t> fvuCurrentTsMsbCycle;
137 std::vector<UInt_t> fvuInitialHeaderDone;
138 std::vector<UInt_t> fvuInitialTsMsbCycleHeader;
139 std::vector<UInt_t> fvuElinkLastTsHit;
141 std::vector<std::vector<ULong64_t>> fvulChanLastHitTime;
142 std::vector<std::vector<Double_t>> fvdChanLastHitTime;
143 //std::vector< std::vector< Double_t > > fvdChanLastHitTime; //! Last hit time in ns for each Channel
144 std::vector<Double_t> fvdPrevMsTime;
145 std::vector<Double_t> fvdMsTime;
146 std::vector<std::vector<std::vector<UInt_t>>> fvuChanNbHitsInMs;
147 std::vector<std::vector<std::vector<Double_t>>>
149 std::vector<std::vector<std::vector<UShort_t>>>
151 // std::vector< std::vector< std::multiset< stsxyter::FinalHit > > > fvmChanHitsInTs; //! All hits (time & ADC) in bins in last TS for each Channel
153 Long64_t fdStartTime;
154 Long64_t prevtime;
155 //Double_t fdStartTime; /** Time of first valid hit (TS_MSB available), used as reference for evolution plots**/
157 std::chrono::steady_clock::time_point
161 std::vector<stsxyter::FinalHit>
163 std::vector<std::vector<stsxyter::FinalHit>>
165 std::vector<std::vector<stsxyter::FinalHit>>
171 std::vector<Int_t> fviFebTimeSecLastRateUpdate;
173 std::vector<std::vector<Double_t>> fvdFebChanCountsSinceLastRateUpdate;
179 UInt_t Counter;
180 UInt_t Counter1;
182 Double_t fdCoincCenter; // ns
183 Double_t fdCoincBorder; // ns, +/-
184 Double_t fdCoincMin; // ns
185 Double_t fdCoincMax; // ns
186
197
198 TH1* fhRate;
200 // std::vector<TH1 *> fhStsFebChanRateEvo;
201
203 // UInt_t kuNbAsicPerFeb = 8;
204
205 std::vector<TH2*> fHistPadDistr;
206 std::vector<TH2*> fRealHistPadDistr;
207
209 std::vector<TH1*> fhStsFebChanCntRaw;
210 std::vector<TH1*> fhStsFebChanCntRawGood;
211 std::vector<TH2*> fhStsFebChanAdcRaw;
212 std::vector<TProfile*> fhStsFebChanAdcRawProf;
213 std::vector<TH2*> fhStsFebChanAdcCal;
214 std::vector<TProfile*> fhStsFebChanAdcCalProf;
215 std::vector<TH2*> fhStsFebChanRawTs;
216 std::vector<TH2*> fhStsFebChanMissEvt;
217 std::vector<TH2*> fhStsFebChanMissEvtEvo;
218 std::vector<TH2*> fhStsFebAsicMissEvtEvo;
219 std::vector<TH1*> fhStsFebMissEvtEvo;
220 std::vector<TH2*> fhStsFebChanHitRateEvo;
221 std::vector<TProfile*> fhStsFebChanHitRateProf;
222 std::vector<TH2*> fhStsFebAsicHitRateEvo;
223 std::vector<TH1*> fhStsFebHitRateEvo;
224 std::vector<TH1*> fhStsFebHitRateEvo_mskch;
226 std::vector<TH2*> fhStsFebChanHitRateEvoLong;
227 std::vector<TH2*> fhStsFebAsicHitRateEvoLong;
228 std::vector<TH1*> fhStsFebHitRateEvoLong;
229 std::vector<std::vector<Double_t>> fdStsFebChanLastTimeForDist;
230 std::vector<TH2*> fhStsFebChanDistT;
231 std::vector<std::vector<TH1*>> fhStsFebChanDtCoinc;
232 std::vector<std::vector<TH2*>> fhStsFebChanCoinc;
233
236 static const UInt_t kuSmxErrCoincWinNbHits = 11;
237 constexpr static const Double_t kdSmxErrCoincWinBeg = 0; //ns, true for time sorted hits!
239 constexpr static const Double_t kdSmxErrCoincWinMainM07 = 320; //ns
240 constexpr static const Double_t kdSmxErrCoincWinMainM08 = 380; //ns
241 constexpr static const Double_t kdSmxErrCoincWinMainM09 = 450; //ns
242 constexpr static const Double_t kdSmxErrCoincWinMainM10 = 510; //ns
243 constexpr static const Double_t kdSmxErrCoincWinMainM11 = 570; //ns
245 constexpr static const Double_t kdSmxErrCoincWinNoiseM07 = 390; //ns
246 constexpr static const Double_t kdSmxErrCoincWinNoiseM08 = 460; //ns
247 constexpr static const Double_t kdSmxErrCoincWinNoiseM09 = 540; //ns
248 constexpr static const Double_t kdSmxErrCoincWinNoiseM10 = 600; //ns
249 constexpr static const Double_t kdSmxErrCoincWinNoiseM11 = 660; //ns
256 std::vector<std::vector<std::vector<Double_t>>>
258 std::vector<std::vector<UInt_t>> fvuSmxErrIdxFirstHitM07;
259 std::vector<std::vector<UInt_t>> fvuSmxErrIdxFirstHitM08;
260 std::vector<std::vector<UInt_t>> fvuSmxErrIdxFirstHitM09;
261 std::vector<std::vector<UInt_t>> fvuSmxErrIdxFirstHitM10;
262 std::vector<std::vector<UInt_t>> fvuSmxErrIdxFirstHitM11;
263 std::vector<std::vector<UInt_t>> fvuSmxErrIdxLastHit;
266 Bool_t SmxErrCheckCoinc(UInt_t uFebIdx, UInt_t uAsicIdx, Double_t dNewHitTime);
268 std::vector<TProfile*> fhStsFebSmxErrRatioEvo;
269 std::vector<TProfile2D*> fhStsFebSmxErrRatioEvoAsic;
270 std::vector<TProfile*> fhStsFebSmxErrRatioCopyEvo;
271 std::vector<TProfile2D*> fhStsFebSmxErrRatioCopyEvoAsic;
272 std::vector<TProfile*> fhStsFebSmxErrRatioCopySameAdcEvo;
274
275
276 TCanvas* fcMsSizeAll;
279 /*
281 Double_t fdStartTs; //! Last hits in each ASIC
282 std::vector< stsxyter::FinalHit > fvmLastHitAsic; //! Last hits in each ASIC
283 std::vector<TH2 *> fhStsTimeDiffPerAsic;
284 std::vector< std::vector<TH1 *> > fhStsTimeDiffPerAsicPair;
285 std::vector< std::vector<TH1 *> > fhStsTimeDiffClkPerAsicPair;
286 std::vector< std::vector<TH2 *> > fhStsTimeDiffEvoPerAsicPair;
287 std::vector< std::vector<TProfile *> > fhStsTimeDiffEvoPerAsicPairProf;
288 std::vector< std::vector<TProfile *> > fhStsRawTimeDiffEvoPerAsicPairProf;
289 std::vector< std::vector<TH2 *> > fhStsTsLsbMatchPerAsicPair;
290 std::vector< std::vector<TH2 *> > fhStsTsMsbMatchPerAsicPair;
291 std::vector<TH1 *> fhStsIntervalAsic;
292 std::vector<TH1 *> fhStsIntervalLongAsic;
293
294 static const UInt_t kuNbValuesForTimeDiffMean = 100;
295 constexpr static const double kdPulserPeriod = 154000; /// ns
296 constexpr static const double kdTimeDiffToMeanMargin = 50;
297 std::vector< std::vector< std::vector< Double_t > > > fvdLastTimeDiffValuesAsicPair;
298 std::vector< std::vector< UInt_t > > fvuLastTimeDiffSlotAsicPair;
299 std::vector< std::vector< Double_t > > fvdMeanTimeDiffAsicPair;
300
301 void UpdatePairMeanValue( UInt_t uAsicA, UInt_t uAsicB, Double_t dNewValue );
302*/
303
304 // Methods later going into Algo
305 Bool_t InitStsParameters();
306 void CreateHistograms();
307 Bool_t ProcessStsMs(const fles::Timeslice& ts, size_t uMsComp, UInt_t uMsIdx);
308
309 void FillHitInfo(stsxyter::Message mess, const UShort_t& usElinkIdx, const UInt_t& uAsicIdx, const UInt_t& uMsIdx);
310 void FillTsMsbInfo(stsxyter::Message mess, UInt_t uMessIdx = 0, UInt_t uMsIdx = 0);
312
314 void SaveStsHistos(TString sFileName = "");
315 Bool_t ScanForNoisyChannels(Double_t dNoiseThreshold = 1e3);
316
319
320 ClassDef(CbmMcbm2018MonitorMuch, 1)
321};
322
323#endif // CBMMCBM2018MONITORMUCH_H
Histogram manager.
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
void UseNoiseLimitsSmx2LogicError(Bool_t bUseNoise=kTRUE)
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 ]
void SavePulserHistos(TString sFileName="")
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.
void SetMsOverlap(size_t uOverlapMsNb=1)
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.
void SetFebChanCoincidenceLimitNs(Double_t dLimitIn)
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
void SetEnableCoincidenceMaps(Bool_t bEnableCoincidenceMapsOn=kTRUE)
void SetHistoFileName(TString sFileName="data/SetupHistos.root")
void SetMuchMode(Bool_t bMuchMode=kTRUE)
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
void SetPrintMessage(Bool_t bPrintMessOn=kTRUE, stsxyter::MessagePrintMask ctrl=stsxyter::MessagePrintMask::msg_print_Hex|stsxyter::MessagePrintMask::msg_print_Human)
std::vector< TH2 * > fhStsFebChanMissEvtEvo
static const UInt_t kuBytesPerMessage
CbmMcbm2018MonitorMuch operator=(const CbmMcbm2018MonitorMuch &)
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.
CbmMcbm2018MonitorMuch(const CbmMcbm2018MonitorMuch &)
std::vector< TH1 * > fhStsFebHitRateEvo_mskch_adccut
void SaveStsHistos(TString sFileName="")
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
MessagePrintMask
Printout control.