CbmRoot
Loading...
Searching...
No Matches
CbmCheckTiming.h
Go to the documentation of this file.
1/* Copyright (C) 2019-2021 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH, Darmstadt
2 SPDX-License-Identifier: GPL-3.0-only
3 Authors: Florian Uhlig [committer], Pierre-Alain Loizeau, Andreas Redelbach */
4
5#ifndef CBMCHECKTIMING_H
6#define CBMCHECKTIMING_H
7
8#include "CbmModuleList.h"
9#include "CbmTofDigi.h"
10
11#include "FairTask.h"
12
13#include "TString.h"
14
15#include <vector>
16
17class TClonesArray;
18class TH1;
19class TH2;
20class CbmDigiManager;
21
22class CbmCheckTiming : public FairTask {
23public:
25
28
30 // CbmCheckTiming(Int_t verbose);
31
32
35
36
38 virtual InitStatus Init();
39
41 virtual InitStatus ReInit();
42
43
45 virtual void Exec(Option_t*);
46
48 virtual void SetParContainers();
49
51 virtual void Finish();
52
54 void SetCheckTimeOrder(Bool_t val = kFALSE) { fCheckTimeOrdering = val; }
55
57 void SetCheckInterSystemOffset(Bool_t val = kTRUE) { fCheckInterSystemOffset = val; }
58
59 void SetOffsetSearchRange(Int_t val = 1000) { fOffsetRange = val; }
60
61 void SetStsOffsetSearchRange(Int_t val = 1000) { fStsOffsetRange = val; }
62
63 void SetMuchOffsetSearchRange(Int_t val = 1000) { fMuchOffsetRange = val; }
64
65 void SetTrdOffsetSearchRange(Int_t val = 1000) { fTrdOffsetRange = val; }
66
67 void SetTofOffsetSearchRange(Int_t val = 1000) { fTofOffsetRange = val; }
68
69 void SetRichOffsetSearchRange(Int_t val = 1000) { fRichOffsetRange = val; }
70
71 void SetPsdOffsetSearchRange(Int_t val = 1000) { fPsdOffsetRange = val; }
72
73 void SetNrTsForFit(Int_t val = 200) { fNrTsForFit = val; }
74 void SetTrdPeakWidthNs(Double_t val = 120.) { fTrdPeakWidthNs = val; }
75 void SetStsPeakWidthNs(Double_t val = 30.) { fStsPeakWidthNs = val; }
76 void SetMuchPeakWidthNs(Double_t val = 100.) { fMuchPeakWidthNs = val; }
77 void SetTofPeakWidthNs(Double_t val = 20.) { fTofPeakWidthNs = val; }
78 void SetRichPeakWidthNs(Double_t val = 40.) { fRichPeakWidthNs = val; }
79 void SetPsdPeakWidthNs(Double_t val = 20.) { fPsdPeakWidthNs = val; }
80
81 inline void SetBmonPulserTotLimits(UInt_t uMin, UInt_t uMax)
82 {
83 fuMinTotPulserBmon = uMin;
84 fuMaxTotPulserBmon = uMax;
85 }
86 inline void SetTofPulserTotLimits(UInt_t uMin, UInt_t uMax)
87 {
88 fuMinTotPulserTof = uMin;
89 fuMaxTotPulserTof = uMax;
90 }
91
92 inline void SetOutFilename(TString sNameIn) { fOutFileName = sNameIn; }
93
94private:
95 void CheckTimeOrder();
96 template<class Digi>
97 Int_t CheckIfSorted(TH1*, Double_t&, TString);
98 Int_t CheckIfSortedBmon(TH1*, Double_t&, TString);
99
101
102 /*
103 Int_t FillSystemOffsetHistos(TClonesArray* array,
104 TH1* histo, TH2* histoCharge,
105 TH2* histoEvo, TH2* histoEvoLong, TH2* histoAFCK,
106 const Double_t T0Time, const Int_t offsetRange, Int_t iStartDigi,
107 Bool_t bSts = kFALSE, Bool_t bMuch = kFALSE, Bool_t bTof = kFALSE );
108 */
109 template<class Digi>
110 Int_t FillSystemOffsetHistos(TH1* histo, TH2* histoCharge, TH2* histoEvo, TH2* histoEvoLong, TH2* histoAFCK,
111 const Double_t T0Time, const Int_t offsetRange, Int_t iStartDigi, Bool_t bSts = kFALSE,
112 Bool_t bMuch = kFALSE, Bool_t bTof = kFALSE, Bool_t bPsd = kFALSE);
113
114 template<class Digi>
115 Int_t FillHistosSelBmon(TH1* histo, const Double_t T0Time, const Int_t offsetRange, Int_t iStartDigi,
116 Bool_t bSts = kFALSE, Bool_t bMuch = kFALSE, Bool_t bTof = kFALSE, Bool_t bPsd = kFALSE);
117
118 Int_t CalcNrBins(Int_t);
119 void CreateHistos();
120 void WriteHistos();
121 void FitPeaks();
122
125
127 const std::vector<CbmTofDigi>* fBmonDigiVec = nullptr;
128 TClonesArray* fBmonDigiArr = nullptr;
129
131 Double_t trd_peak_pos;
132 Double_t sts_peak_pos;
134 Double_t tof_peak_pos;
136 Double_t psd_peak_pos;
137
144
146 Double_t trd_average;
147 Double_t sts_average;
148 Double_t much_average;
149 Double_t tof_average;
150 Double_t rich_average;
151 Double_t psd_average;
152
160
162 Double_t fPrevTimeBmon = 0.;
163 Double_t fPrevTimeSts = 0.;
164 Double_t fPrevTimeMuch = 0.;
165 Double_t fPrevTimeTrd = 0.;
166 Double_t fPrevTimeTof = 0.;
167 Double_t fPrevTimeRich = 0.;
168 Double_t fPrevTimePsd = 0.;
169
178
181 UInt_t fuMaxTotPulserBmon = 100;
182 UInt_t fuMinTotPulserTof = 92;
183 UInt_t fuMaxTotPulserTof = 96;
184
185 //
186 Int_t fNrTs = 0;
187
189 Int_t fNrOfBmonDigis = 0;
190 Int_t fNrOfStsErrors = 0;
191 Int_t fNrOfStsDigis = 0;
193 Int_t fNrOfMuchDigis = 0;
194 Int_t fNrOfTrdErrors = 0;
195 Int_t fNrOfTrdDigis = 0;
196 Int_t fNrOfTofErrors = 0;
197 Int_t fNrOfTofDigis = 0;
199 Int_t fNrOfRichDigis = 0;
200 Int_t fNrOfPsdErrors = 0;
201 Int_t fNrOfPsdDigis = 0;
202
203 Bool_t fCheckTimeOrdering = kTRUE;
205
206 Int_t fOffsetRange = 1000;
207 Int_t fStsOffsetRange = 1000;
208 Int_t fMuchOffsetRange = 1000;
209 Int_t fTrdOffsetRange = 1000;
210 Int_t fTofOffsetRange = 1000;
211 Int_t fRichOffsetRange = 1000;
212 Int_t fPsdOffsetRange = 1000;
213
214 Int_t fNrTsForFit = 200;
215 Double_t fTrdPeakWidthNs = 120.;
216 Double_t fStsPeakWidthNs = 30.;
217 Double_t fMuchPeakWidthNs = 100.;
218 Double_t fTofPeakWidthNs = 20.;
219 Double_t fRichPeakWidthNs = 40.;
220 Double_t fPsdPeakWidthNs = 20.;
221
222 Int_t fBinWidth = 1;
223
224 TH1* fBmonStsDiff = nullptr;
225 TH1* fBmonMuchDiff = nullptr;
226 TH1* fBmonTrdDiff = nullptr;
227 TH1* fBmonTofDiff = nullptr;
228 TH1* fBmonRichDiff = nullptr;
229 TH1* fBmonPsdDiff = nullptr;
230
231 TH2* fBmonStsDiffCharge = nullptr;
232 TH2* fBmonMuchDiffCharge = nullptr;
233 TH2* fBmonTrdDiffCharge = nullptr;
234 TH2* fBmonTofDiffCharge = nullptr;
235 TH2* fBmonRichDiffCharge = nullptr;
236 TH2* fBmonPsdDiffCharge = nullptr;
237
238 TH2* fBmonStsDiffEvo = nullptr;
239 TH2* fBmonMuchDiffEvo = nullptr;
240 TH2* fBmonTrdDiffEvo = nullptr;
241 TH2* fBmonTofDiffEvo = nullptr;
242 TH2* fBmonRichDiffEvo = nullptr;
243 TH2* fBmonPsdDiffEvo = nullptr;
244
245 TH2* fBmonStsDiffEvoLong = nullptr;
246 TH2* fBmonMuchDiffEvoLong = nullptr;
247 TH2* fBmonTrdDiffEvoLong = nullptr;
248 TH2* fBmonTofDiffEvoLong = nullptr;
249 TH2* fBmonRichDiffEvoLong = nullptr;
250 TH2* fBmonPsdDiffEvoLong = nullptr;
251
252 TH1* fBmonBmonDiff = nullptr;
253 TH1* fStsStsDiff = nullptr;
254 TH1* fMuchMuchDiff = nullptr;
255 TH1* fTrdTrdDiff = nullptr;
256 TH1* fTofTofDiff = nullptr;
257 TH1* fRichRichDiff = nullptr;
258 TH1* fPsdPsdDiff = nullptr;
259
260 TH1* fBmonAddress = nullptr;
261 TH1* fBmonChannel = nullptr;
262
263 TH2* fBmonStsDpbDiff = nullptr;
264 static const UInt_t kuMaxNbStsDpbs = 2;
267
268 static const UInt_t kuMaxNbMuchDpbs = 6;
269 TH2* fBmonMuchRocDiff = nullptr;
270 static const UInt_t kuMaxNbMuchAsics = 36;
271 TH2* fBmonMuchAsicDiff = nullptr;
273
274 UInt_t fuNbTofDigisSel = 6;
276 std::vector<Double_t> fvdTimeSelectedBmon;
277 TH1* fSelBmonStsDiff = nullptr;
278 TH1* fSelBmonMuchDiff = nullptr;
279 TH1* fSelBmonTrdDiff = nullptr;
280 TH1* fSelBmonTofDiff = nullptr;
281 TH1* fSelBmonRichDiff = nullptr;
282 TH1* fSelBmonPsdDiff = nullptr;
283
284 TString fOutFileName {"test.root"};
285
287};
288
289#endif
void SetPsdPeakWidthNs(Double_t val=20.)
void SetRichPeakWidthNs(Double_t val=40.)
void SetStsPeakWidthNs(Double_t val=30.)
Int_t CalcNrBins(Int_t)
TClonesArray * fBmonDigiArr
Double_t fStsPeakWidthNs
Double_t sts_coin_peak_pos
Double_t rich_width0_ns
TH2 * fBmonMuchAsicDiffEvo[kuMaxNbMuchAsics]
Double_t much_coin_peak_pos
Double_t psd_width0_ns
TH1 * fStsDpbCntsEvo[kuMaxNbStsDpbs]
Int_t fPrevBmonFirstDigiTrd
TH2 * fBmonStsDpbDiffEvo[kuMaxNbStsDpbs]
CbmCheckTiming(const CbmCheckTiming &)=delete
virtual InitStatus Init()
Double_t tof_width0_ns
Double_t fPrevTimeTrd
Double_t fTrdPeakWidthNs
const std::vector< CbmTofDigi > * fBmonDigiVec
void SetRichOffsetSearchRange(Int_t val=1000)
void SetTofPeakWidthNs(Double_t val=20.)
Double_t sts_width0_ns
Int_t fPrevBmonFirstDigiMuch
static const UInt_t kuMaxNbStsDpbs
Double_t fMuchPeakWidthNs
Double_t fPrevTimeTof
void SetCheckTimeOrder(Bool_t val=kFALSE)
void CheckInterSystemOffset()
Double_t much_average
virtual InitStatus ReInit()
Double_t psd_coin_peak_pos
void SetOffsetSearchRange(Int_t val=1000)
Int_t FillHistosSelBmon(TH1 *histo, const Double_t T0Time, const Int_t offsetRange, Int_t iStartDigi, Bool_t bSts=kFALSE, Bool_t bMuch=kFALSE, Bool_t bTof=kFALSE, Bool_t bPsd=kFALSE)
Double_t fPrevTimeMuch
Int_t fPrevBmonFirstDigiSts
Double_t much_width0_ns
void SetTofPulserTotLimits(UInt_t uMin, UInt_t uMax)
void SetTofOffsetSearchRange(Int_t val=1000)
ClassDef(CbmCheckTiming, 2)
Double_t tof_peak_pos
void SetBmonPulserTotLimits(UInt_t uMin, UInt_t uMax)
Double_t rich_coin_peak_pos
Double_t fPrevTimeBmon
Variables to store the previous digi time.
Double_t trd_coin_peak_pos
Bool_t fCheckTimeOrdering
void SetMuchOffsetSearchRange(Int_t val=1000)
Double_t fPrevTimeRich
CbmCheckTiming operator=(const CbmCheckTiming &)=delete
Double_t sts_peak_pos
Int_t fPrevBmonFirstDigiRich
static const UInt_t kuMaxNbMuchDpbs
Double_t fPsdPeakWidthNs
CbmDigiManager * fDigiMan
Int_t fPrevBmonFirstDigiTof
Int_t FillSystemOffsetHistos(TH1 *histo, TH2 *histoCharge, TH2 *histoEvo, TH2 *histoEvoLong, TH2 *histoAFCK, const Double_t T0Time, const Int_t offsetRange, Int_t iStartDigi, Bool_t bSts=kFALSE, Bool_t bMuch=kFALSE, Bool_t bTof=kFALSE, Bool_t bPsd=kFALSE)
Int_t CheckIfSorted(TH1 *, Double_t &, TString)
void SetTrdPeakWidthNs(Double_t val=120.)
Double_t trd_width0_ns
Double_t much_peak_pos
std::vector< Double_t > fvdTimeSelectedBmon
Double_t psd_peak_pos
Double_t trd_peak_pos
virtual void Finish()
Double_t fPrevTimeSts
virtual void SetParContainers()
void SetCheckInterSystemOffset(Bool_t val=kTRUE)
Double_t rich_average
static const UInt_t kuMaxNbMuchAsics
void SetNrTsForFit(Int_t val=200)
UInt_t fuMinTotPulserBmon
User settings: Data correction parameters.
void SetTrdOffsetSearchRange(Int_t val=1000)
Double_t fPrevTimePsd
UInt_t fuMaxTotPulserBmon
Int_t CheckIfSortedBmon(TH1 *, Double_t &, TString)
Double_t fTofPeakWidthNs
Double_t fRichPeakWidthNs
void SetMuchPeakWidthNs(Double_t val=100.)
void SetStsOffsetSearchRange(Int_t val=1000)
Int_t fPrevBmonFirstDigiPsd
virtual void Exec(Option_t *)
Bool_t fCheckInterSystemOffset
void SetPsdOffsetSearchRange(Int_t val=1000)
void SetOutFilename(TString sNameIn)
Double_t rich_peak_pos
CbmDigiManager.