CbmRoot
Loading...
Searching...
No Matches
CbmMcbm2018MonitorAlgoBmon.h
Go to the documentation of this file.
1/* Copyright (C) 2019-2021 Facility for Antiproton and Ion Research in Europe, Darmstadt
2 SPDX-License-Identifier: GPL-3.0-only
3 Authors: Pierre-Alain Loizeau [committer] */
4
5// -----------------------------------------------------------------------------
6// ----- -----
7// ----- CbmMcbm2018MonitorAlgoBmon -----
8// ----- Created 10.02.2019 by P.-A. Loizeau -----
9// ----- -----
10// -----------------------------------------------------------------------------
11
12#ifndef CbmMcbm2018MonitorAlgoBmon_H
13#define CbmMcbm2018MonitorAlgoBmon_H
14
15#include "CbmStar2019Algo.h"
16
17// Data
18#include "CbmTofDigi.h"
19
20#include "gDpbMessv100.h"
21
22// CbmRoot
23
24// C++11
25#include <chrono>
26
27// C/C++
28#include <map>
29#include <vector>
30
32/*
33class TCanvas;
34class THttpServer;
35*/
36class TH1;
37class TH2;
38class TProfile;
39
40class CbmMcbm2018MonitorAlgoBmon : public CbmStar2019Algo<CbmTofDigi> {
41public:
44
45 virtual Bool_t Init();
46 virtual void Reset();
47 virtual void Finish();
48
49 Bool_t InitContainers();
50 Bool_t ReInitContainers();
51 TList* GetParList();
52
53 Bool_t InitParameters();
54
55 Bool_t ProcessTs(const fles::Timeslice& ts);
56 Bool_t ProcessTs(const fles::Timeslice& ts, size_t /*component*/) { return ProcessTs(ts); }
57 Bool_t ProcessMs(const fles::Timeslice& ts, size_t uMsCompIdx, size_t uMsIdx);
58
59 void AddMsComponentToList(size_t component, UShort_t usDetectorId);
60
61 Bool_t CreateHistograms();
62 Bool_t FillHistograms();
63 Bool_t ResetHistograms(Bool_t bResetTime = kTRUE);
64
65 inline void SetMonitorMode(Bool_t bFlagIn = kTRUE) { fbMonitorMode = bFlagIn; }
66 inline void SetHistoryHistoSize(UInt_t inHistorySizeSec = 1800) { fuHistoryHistoSize = inHistorySizeSec; }
67 inline void SetPulserTotLimits(UInt_t uMin, UInt_t uMax)
68 {
69 fuMinTotPulser = uMin;
70 fuMaxTotPulser = uMax;
71 }
72 inline void SetSpillThreshold(UInt_t uCntLimit) { fuOffSpillCountLimit = uCntLimit; }
73 inline void SetSpillThresholdNonPulser(UInt_t uCntLimit) { fuOffSpillCountLimitNonPulser = uCntLimit; }
74 inline void SetSpillCheckInterval(Double_t dIntervalSec) { fdSpillCheckInterval = dIntervalSec; }
75 inline void SetChannelMap(UInt_t uChan0, UInt_t uChan1, UInt_t uChan2, UInt_t uChan3, UInt_t uChan4, UInt_t uChan5,
76 UInt_t uChan6, UInt_t uChan7)
77 {
78 fuDiamChanMap[0] = uChan0;
79 fuDiamChanMap[1] = uChan1;
80 fuDiamChanMap[2] = uChan2;
81 fuDiamChanMap[3] = uChan3;
82 fuDiamChanMap[4] = uChan4;
83 fuDiamChanMap[5] = uChan5;
84 fuDiamChanMap[6] = uChan6;
85 fuDiamChanMap[7] = uChan7;
86 }
87
88private:
90 Bool_t fbMonitorMode = kFALSE;
91 Bool_t fbDebugMonitorMode = kFALSE;
92 std::vector<Bool_t> fvbMaskedComponents = {};
93
97 UInt_t fuNrOfGdpbs = 0;
98 std::map<UInt_t, UInt_t> fGdpbIdIndexMap = {};
99 UInt_t fuNrOfFeePerGdpb = 0;
100 UInt_t fuNrOfGet4PerFee = 0;
103 UInt_t fuNrOfGet4 = 0;
104 UInt_t fuNrOfGet4PerGdpb = 0;
106
108 UInt_t fuMinTotPulser = 90;
109 UInt_t fuMaxTotPulser = 100;
112 Double_t fdSpillCheckInterval = 1.0;
113
115 static const Int_t kiMaxNbFlibLinks = 32;
116 static const UInt_t kuBytesPerMessage = 8;
117 static const UInt_t kuNbChanDiamond = 8;
118
121 ULong64_t fulCurrentTsIdx = 0;
122 ULong64_t fulCurrentMsIdx = 0;
123 Double_t fdTsStartTime = -1.0;
125 -1.0;
126 Double_t fdMsTime = -1.0;
127 UInt_t fuMsIndex = 0;
129 std::map<gdpbv100::MessageTypes, UInt_t> fmMsgCounter = {};
131 UInt_t fuCurrDpbId = 0;
132 UInt_t fuCurrDpbIdx = 0;
135 UInt_t fuGet4Id =
136 0;
137 UInt_t fuGet4Nr = 0;
139 std::vector<ULong64_t> fvulCurrentEpoch = {};
140 std::vector<ULong64_t> fvulCurrentEpochCycle = {};
141 std::vector<ULong64_t> fvulCurrentEpochFull = {};
142
144 Double_t fdStartTime = -1.0;
145 Double_t fdStartTimeMsSz = 0.0;
146 std::chrono::steady_clock::time_point ftStartTimeUnix = std::chrono::steady_clock::
147 now();
150 std::vector<std::vector<gdpbv100::Message>> fvvmEpSupprBuffer = {};
151 std::vector<gdpbv100::FullMessage> fvmHitsInMs =
152 {};
153
155 Bool_t fbSpillOn = kTRUE;
158 Double_t fdStartTimeSpill = -1.0;
159 Double_t fdLastInterTime = -1.0;
162
163
165 UInt_t fuHistoryHistoSize = 3600;
169 std::vector<UInt_t> fvuHitCntChanMs = std::vector<UInt_t>(kuNbChanDiamond, 0);
170 std::vector<UInt_t> fvuErrorCntChanMs = std::vector<UInt_t>(kuNbChanDiamond, 0);
171 std::vector<UInt_t> fvuEvtLostCntChanMs = std::vector<UInt_t>(kuNbChanDiamond, 0);
172 std::vector<TH1*> fvhMsgCntEvoChan = std::vector<TH1*>(kuNbChanDiamond, nullptr);
173 std::vector<TH2*> fvhMsgCntPerMsEvoChan = std::vector<TH2*>(kuNbChanDiamond, nullptr);
174 std::vector<TH1*> fvhHitCntEvoChan = std::vector<TH1*>(kuNbChanDiamond, nullptr);
175 std::vector<TH2*> fvhHitCntPerMsEvoChan = std::vector<TH2*>(kuNbChanDiamond, nullptr);
176 std::vector<TH1*> fvhErrorCntEvoChan = std::vector<TH1*>(kuNbChanDiamond, nullptr);
177 std::vector<TH2*> fvhErrorCntPerMsEvoChan = std::vector<TH2*>(kuNbChanDiamond, nullptr);
178 std::vector<TH1*> fvhEvtLostCntEvoChan = std::vector<TH1*>(kuNbChanDiamond, nullptr);
179 std::vector<TH2*> fvhEvtLostCntPerMsEvoChan = std::vector<TH2*>(kuNbChanDiamond, nullptr);
180 std::vector<TProfile*> fvhErrorFractEvoChan = std::vector<TProfile*>(kuNbChanDiamond, nullptr);
181 std::vector<TH2*> fvhErrorFractPerMsEvoChan = std::vector<TH2*>(kuNbChanDiamond, nullptr);
182 std::vector<TProfile*> fvhEvtLostFractEvoChan = std::vector<TProfile*>(kuNbChanDiamond, nullptr);
183 std::vector<TH2*> fvhEvtLostFractPerMsEvoChan = std::vector<TH2*>(kuNbChanDiamond, nullptr);
185 static const UInt_t kuNbSpillPlots = 5;
186 // UInt_t kuDiamChanMap[ kuNbChanDiamond ] = { 2, 3, 4, 5, 0, 1, 6, 7 }; //! Map from electronics channel to Diamond strip
187 UInt_t fuDiamChanMap[kuNbChanDiamond] = {0, 1, 2, 3, 4, 5, 6, 7};
188 TH1* fhDpbMap = nullptr;
189 TH1* fhChannelMap = nullptr;
190 TH2* fhHitMapEvo = nullptr;
191 TH2* fhHitTotEvo = nullptr;
192 TH1* fhChanHitMap = nullptr;
193 TH2* fhChanHitMapEvo = nullptr;
194 std::vector<TH1*> fvhDpbMapSpill = {};
195 std::vector<TH1*> fvhChannelMapSpill = {};
196 TH1* fhHitsPerSpill = nullptr;
198 TH1* fhMsgCntEvo = nullptr;
199 TH1* fhHitCntEvo = nullptr;
200 TH1* fhErrorCntEvo = nullptr;
201 TH1* fhLostEvtCntEvo = nullptr;
202 TProfile* fhErrorFractEvo = nullptr;
203 TProfile* fhLostEvtFractEvo = nullptr;
204
205 TH2* fhMsgCntPerMsEvo = nullptr;
206 TH2* fhHitCntPerMsEvo = nullptr;
207 TH2* fhErrorCntPerMsEvo = nullptr;
208 TH2* fhLostEvtCntPerMsEvo = nullptr;
209 TH2* fhErrorFractPerMsEvo = nullptr;
211
213 TH1* fhChannelMapPulser = nullptr;
214 TH2* fhHitMapEvoPulser = nullptr;
215
217 TCanvas* fcSummary = nullptr;
218 TCanvas* fcSummaryMap = nullptr;
219 TCanvas* fcHitMaps = nullptr;
220 TCanvas* fcGenCntsPerMs = nullptr;
221 TCanvas* fcSpillCounts = nullptr;
222 TCanvas* fcSpillCountsHori = nullptr;
223 TCanvas* fcSpillDpbCountsHori = nullptr;
224
225 /*
226 void ProcessEpochCycle( uint64_t ulCycleData );
227 void ProcessEpoch( gdpbv100::Message mess );
228
229 void ProcessEpSupprBuffer();
230
231 void ProcessHit( gdpbv100::FullMessage mess );
232 void ProcessSysMess( gdpbv100::FullMessage mess );
233
234 void ProcessError( gdpbv100::FullMessage mess );
235
236 inline Int_t GetArrayIndex(Int_t gdpbId, Int_t get4Id)
237 {
238 return gdpbId * fuNrOfGet4PerGdpb + get4Id;
239 }
240*/
243
244 ClassDef(CbmMcbm2018MonitorAlgoBmon, 1)
245};
246
247#endif
UInt_t fuNrOfChannelsPerFee
Number of channels in each GET4.
Bool_t fbSpillOn
All hits (time in bins, TOT in bins, asic, channel) in last MS, sorted with "<" operator.
UInt_t fuNrOfFeePerGdpb
gDPB ID to index map
UInt_t fuNrOfGet4PerFee
Number of FEBs per GDPB.
Bool_t ResetHistograms(Bool_t bResetTime=kTRUE)
Double_t fdStartTime
Epoch + Epoch Cycle.
UInt_t fuNrOfGet4
Number of channels in each FEE.
Int_t fiRunStartDateTimeSec
Index of the DPB from which the MS currently unpacked is coming.
CbmMcbm2018MonitorAlgoBmon operator=(const CbmMcbm2018MonitorAlgoBmon &)
Bool_t fbDebugMonitorMode
Switch ON the filling of a minimal set of histograms.
std::vector< gdpbv100::FullMessage > fvmHitsInMs
[DPB]
Bool_t ProcessTs(const fles::Timeslice &ts, size_t)
static const Int_t kiMaxNbFlibLinks
Constants.
std::vector< TH2 * > fvhErrorFractPerMsEvoChan
UInt_t fuCurrDpbIdx
Temp holder until Current equipment ID is properly filled in MS.
std::vector< ULong64_t > fvulCurrentEpochCycle
Current epoch index, per DPB.
std::vector< TProfile * > fvhEvtLostFractEvoChan
void SetSpillThreshold(UInt_t uCntLimit)
std::map< UInt_t, UInt_t > fGdpbIdIndexMap
Total number of GDPBs in the system.
std::vector< TH2 * > fvhEvtLostCntPerMsEvoChan
UInt_t fuCurrDpbId
Current equipment ID, tells from which DPB the current MS is originating.
CbmMcbm2018TofPar * fUnpackPar
Settings from parameter file.
std::chrono::steady_clock::time_point ftStartTimeUnix
void SetMonitorMode(Bool_t bFlagIn=kTRUE)
std::vector< TH2 * > fvhEvtLostFractPerMsEvoChan
std::vector< Bool_t > fvbMaskedComponents
Switch ON the filling of a additional set of histograms.
UInt_t fuMinTotPulser
Number of channels per GDPB.
Double_t fdTsStopTimeCore
Time in ns of current TS from the index of the first MS first component.
UInt_t fuNrOfGdpbs
Readout chain dimensions and mapping.
std::vector< TProfile * > fvhErrorFractEvoChan
Double_t fdMsTime
End Time in ns of current TS Core from the index of the first MS first component.
void AddMsComponentToList(size_t component, UShort_t usDetectorId)
std::vector< std::vector< gdpbv100::Message > > fvvmEpSupprBuffer
Buffers.
CbmMcbm2018MonitorAlgoBmon(const CbmMcbm2018MonitorAlgoBmon &)
Bool_t ProcessTs(const fles::Timeslice &ts)
std::vector< ULong64_t > fvulCurrentEpochFull
Epoch cycle from the Ms Start message and Epoch counter flip.
UInt_t fuNrOfChannelsPerGet4
Number of GET4s per FEE.
UInt_t fuHistoryHistoSize
Histograms related variables.
std::map< gdpbv100::MessageTypes, UInt_t > fmMsgCounter
void SetChannelMap(UInt_t uChan0, UInt_t uChan1, UInt_t uChan2, UInt_t uChan3, UInt_t uChan4, UInt_t uChan5, UInt_t uChan6, UInt_t uChan7)
UInt_t fuNrOfChannelsPerGdpb
Number of GET4s per GDPB.
UInt_t fuGet4Nr
running number (0 to fuNrOfGet4PerGdpb) of the Get4 chip of a unique GDPB for current message
std::vector< ULong64_t > fvulCurrentEpoch
Data format control: Current time references for each GDPB: merged epoch marker, epoch cycle,...
Int_t fiBinSizeDatePlots
Start of run time since "epoch" in s, for the plots with date as X axis.
void SetSpillCheckInterval(Double_t dIntervalSec)
UInt_t fuNrOfGet4PerGdpb
Total number of Get4 chips in the system.
void SetHistoryHistoSize(UInt_t inHistorySizeSec=1800)
UInt_t fuGet4Id
Bin size in s for the plots with date as X axis.
Bool_t ProcessMs(const fles::Timeslice &ts, size_t uMsCompIdx, size_t uMsIdx)
static const UInt_t kuNbSpillPlots
Channels map.
void SetPulserTotLimits(UInt_t uMin, UInt_t uMax)
void SetSpillThresholdNonPulser(UInt_t uCntLimit)
TH1 * fhDpbMap
Map from electronics channel to Diamond strip.
UInt_t fuMsIndex
Start Time in ns of current MS from its index field in header.