CbmRoot
Loading...
Searching...
No Matches
CbmMcbm2018MonitorAlgoPsd.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: Nikolay Karpushkin, David Emschermann [committer] */
4
5// -----------------------------------------------------------------------------
6// ----- -----
7// ----- CbmMcbm2018MonitorAlgoPsd -----
8// ----- Created 26.09.2019 by N.Karpushkin -----
9// ----- based on CbmMcbm2018MonitorAlgoT0 by P.-A. Loizeau -----
10// ----- -----
11// -----------------------------------------------------------------------------
12
13#ifndef CbmMcbm2018MonitorAlgoPsd_H
14#define CbmMcbm2018MonitorAlgoPsd_H
15
16#include "CbmStar2019Algo.h"
17
18// Data
19#include "CbmPsdDigi.h"
20
21#include "PronyFitter.h"
22#include "PsdGbtReader-v0.00.h"
23#include "PsdGbtReader-v1.00.h"
24// CbmRoot
25
26// C++11
27#include <chrono>
28
29// C/C++
30#include <map>
31#include <numeric>
32#include <vector>
33
35class TH1;
36class TH2;
37class TProfile;
38class TGraph;
39
40class CbmMcbm2018MonitorAlgoPsd : public CbmStar2019Algo<CbmPsdDigi> {
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 SetMonitorChanMode(Bool_t bFlagIn = kTRUE) { fbMonitorChanMode = bFlagIn; }
67 inline void SetMonitorWfmMode(Bool_t bFlagIn = kTRUE) { fbMonitorWfmMode = bFlagIn; }
68 inline void SetMonitorFitMode(Bool_t bFlagIn = kTRUE) { fbMonitorFitMode = bFlagIn; }
69 inline void SetHistoryHistoSize(UInt_t inHistorySizeSec = 1800) { fuHistoryHistoSize = inHistorySizeSec; }
70 inline void SetChargeHistoArgs(std::vector<Int_t> inVec)
71 {
72 fviHistoChargeArgs = inVec;
73 kvuWfmRanges.clear();
74 for (uint8_t i = 0; i <= kuNbWfmRanges; ++i)
75 kvuWfmRanges.push_back(fviHistoChargeArgs.at(1)
77 }
78 inline void SetAmplHistoArgs(std::vector<Int_t> inVec) { fviHistoAmplArgs = inVec; }
79 inline void SetZLHistoArgs(std::vector<Int_t> inVec) { fviHistoZLArgs = inVec; }
80
81
82private:
84 Bool_t fbMonitorMode = kTRUE;
85 Bool_t fbMonitorChanMode = kFALSE;
86 Bool_t fbMonitorWfmMode = kFALSE;
87 Bool_t fbMonitorFitMode = kFALSE;
88 Bool_t fbDebugMonitorMode = kFALSE;
89 Bool_t fbFirstPackageError = kTRUE;
90 Bool_t fbPsdMissedData = kFALSE;
91 std::vector<Bool_t> fvbMaskedComponents = {};
92
95 UInt_t fuRawDataVersion = 0;
97 UInt_t fuNrOfGdpbs = 0;
98 std::map<UInt_t, UInt_t> fGdpbIdIndexMap = {};
99 UInt_t fuNrOfFeePerGdpb = 0;
102
104 static const Int_t kiMaxNbFlibLinks = 32;
105 static const UInt_t kuBytesPerMessage = 8;
106 static const UInt_t kuNbChanPsd = 12;
107 const float kfAdc_to_mV = 16.5;
108
109 static constexpr UInt_t GetNbChanPsd() { return kuNbChanPsd; }
112 ULong64_t fulCurrentTsIdx = 0;
113 ULong64_t fulCurrentMsIdx = 0;
114 Double_t fdTsStartTime = -1.0;
115 Double_t fdMsTime = -1.0;
116 Double_t fdPrevMsTime = -1.0;
117 UInt_t fuMsIndex = 0;
118
121 UInt_t fuCurrDpbId = 0;
122 UInt_t fuCurrDpbIdx = 0;
123
125 Double_t fdStartTime = -1.0;
126 std::chrono::steady_clock::time_point ftStartTimeUnix = std::chrono::steady_clock::
127 now();
130 UInt_t fuHistoryHistoSize = 3600;
131 std::vector<Int_t> fviHistoChargeArgs = std::vector<Int_t>(3, 0);
132 std::vector<Int_t> fviHistoAmplArgs = std::vector<Int_t>(3, 0);
133 std::vector<Int_t> fviHistoZLArgs = std::vector<Int_t>(3, 0);
136 UInt_t fuMsgsCntInMs = 0;
140
142 std::vector<TH2*> fvhHitZLChanEvo = std::vector<TH2*>(kuNbChanPsd, nullptr);
143 std::vector<TH2*> fvhHitLPChanEvo = std::vector<TH2*>(kuNbChanPsd, nullptr);
144 std::vector<TH2*> fvhHitFAChanEvo = std::vector<TH2*>(kuNbChanPsd, nullptr);
145 std::vector<TH1*> fvhHitChargeChan = std::vector<TH1*>(kuNbChanPsd, nullptr);
146 std::vector<TH1*> fvhHitZeroLevelChan = std::vector<TH1*>(kuNbChanPsd, nullptr);
147 std::vector<TH1*> fvhHitAmplChan = std::vector<TH1*>(kuNbChanPsd, nullptr);
148 std::vector<TH1*> fvhHitChargeByWfmChan = std::vector<TH1*>(kuNbChanPsd, nullptr);
149 std::vector<TH1*> fvhHitWfmChan = std::vector<TH1*>(kuNbChanPsd, nullptr);
150
151 static const UInt_t kuNbWfmRanges = 8;
152 static const UInt_t kuNbWfmExamples = 8;
153 std::vector<UInt_t> kvuWfmRanges = std::vector<UInt_t>(kuNbWfmRanges, 0);
154 std::vector<UInt_t> kvuWfmInRangeToChangeChan = std::vector<UInt_t>(kuNbChanPsd * kuNbWfmRanges, 0);
155 std::vector<TH1*> fv3hHitWfmFlattenedChan = std::vector<TH1*>(kuNbChanPsd * kuNbWfmRanges * kuNbWfmExamples, 0);
156
158 Bool_t fbSpillOn = kTRUE;
161 Double_t fdStartTimeSpill = -1.0;
162 Double_t fdLastSecondTime = -1.0;
164 static const UInt_t kuOffSpillCountLimit = 200;
165
166 const UInt_t kuPsdChanMap[kuNbChanPsd] = {
167 0}; // = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 }; //! Map from electronics channel to PSD physical channel
168 TH1* fhHitChargeMap = nullptr;
169 TH1* fhHitMapEvo = nullptr;
170 TH2* fhChanHitMapEvo = nullptr;
171
173 TH1* fhMissedData = nullptr;
174 TH1* fhAdcTime = nullptr;
175 TH2* fhMsLengthEvo = nullptr;
176
177 TH2* fhMsgsCntPerMsEvo = nullptr;
178 TH2* fhReadMsgsCntPerMsEvo = nullptr;
179 TH2* fhLostMsgsCntPerMsEvo = nullptr;
180 TH2* fhReadEvtsCntPerMsEvo = nullptr;
181
183 std::vector<TH1*> fvhHitFitWfmChan = std::vector<TH1*>(kuNbChanPsd, nullptr);
184 std::vector<TH2*> fvhFitHarmonic1Chan = std::vector<TH2*>(kuNbChanPsd, nullptr);
185 std::vector<TH2*> fvhFitHarmonic2Chan = std::vector<TH2*>(kuNbChanPsd, nullptr);
186 std::vector<TH2*> fvhFitQaChan = std::vector<TH2*>(kuNbChanPsd, nullptr);
187
189 TCanvas* fcSummary = nullptr;
190 TCanvas* fcHitMaps = nullptr;
191 TCanvas* fcZLevo = nullptr;
192 TCanvas* fcChargesFPGA = nullptr;
193 TCanvas* fcChargesWfm = nullptr;
194 TCanvas* fcAmplitudes = nullptr;
195 TCanvas* fcZeroLevels = nullptr;
196 TCanvas* fcGenCntsPerMs = nullptr;
197 TCanvas* fcWfmsAllChannels = nullptr;
198 std::vector<TCanvas*> fvcWfmsChan = std::vector<TCanvas*>(kuNbChanPsd, nullptr);
199 TCanvas* fcPronyFit = nullptr;
200
203
204 ClassDef(CbmMcbm2018MonitorAlgoPsd, 1)
205};
206
207#endif
UInt_t fuNrOfChannelsPerGdpb
Number of channels in each FEE.
void SetZLHistoArgs(std::vector< Int_t > inVec)
std::vector< UInt_t > kvuWfmInRangeToChangeChan
void SetMonitorFitMode(Bool_t bFlagIn=kTRUE)
UInt_t fuMsIndex
Start Time in ns of previous MS from its index field in header.
std::vector< Bool_t > fvbMaskedComponents
static constexpr UInt_t GetNbChanPsd()
Double_t fdStartTime
Index of the DPB from which the MS currently unpacked is coming.
Bool_t fbFirstPackageError
Switch ON the filling of a additional set of histograms.
std::vector< TH1 * > fvhHitFitWfmChan
Waveform fitting.
UInt_t fuCurrDpbId
Current equipment ID, tells from which DPB the current MS is originating.
void SetMonitorMode(Bool_t bFlagIn=kTRUE)
void SetAmplHistoArgs(std::vector< Int_t > inVec)
CbmMcbm2018PsdPar * fUnpackPar
Settings from parameter file.
UInt_t fuNrOfChannelsPerFee
Number of FEBs per GDPB.
void SetMonitorWfmMode(Bool_t bFlagIn=kTRUE)
std::vector< TH1 * > fvhHitChargeByWfmChan
Bool_t ProcessTs(const fles::Timeslice &ts)
void SetMonitorChanMode(Bool_t bFlagIn=kTRUE)
UInt_t fuCurrentEquipmentId
Index of current MS within the TS.
Bool_t fbDebugMonitorMode
Switch ON the filling waveform fitting histograms.
UInt_t fuCurrDpbIdx
Temp holder until Current equipment ID is properly filled in MS.
std::vector< TH2 * > fvhHitZLChanEvo
Channel rate plots.
UInt_t fuHistoryHistoSize
Histograms related variables.
Bool_t ProcessMs(const fles::Timeslice &ts, size_t uMsCompIdx, size_t uMsIdx)
Double_t fdPrevMsTime
Start Time in ns of current MS from its index field in header.
CbmMcbm2018MonitorAlgoPsd operator=(const CbmMcbm2018MonitorAlgoPsd &)
Bool_t fbMonitorFitMode
Switch ON the filling waveforms histograms.
void SetHistoryHistoSize(UInt_t inHistorySizeSec=1800)
void SetChargeHistoArgs(std::vector< Int_t > inVec)
Bool_t fbMonitorChanMode
Switch ON the filling of a minimal set of histograms.
Bool_t ProcessTs(const fles::Timeslice &ts, size_t)
std::vector< TCanvas * > fvcWfmsChan
UInt_t fuNrOfFeePerGdpb
gDPB ID to index map
std::chrono::steady_clock::time_point ftStartTimeUnix
CbmMcbm2018MonitorAlgoPsd(const CbmMcbm2018MonitorAlgoPsd &)
Double_t fdMsTime
Time in ns of current TS from the index of the first MS first component.
void AddMsComponentToList(size_t component, UShort_t usDetectorId)
const UInt_t kuPsdChanMap[kuNbChanPsd]
std::map< UInt_t, UInt_t > fGdpbIdIndexMap
Total number of GDPBs in the system.
Bool_t fbMonitorWfmMode
Switch ON the filling channelwise histograms.
static const Int_t kiMaxNbFlibLinks
Number of channels per GDPB.
Bool_t ResetHistograms(Bool_t bResetTime=kTRUE)
std::vector< TH1 * > fv3hHitWfmFlattenedChan