CbmRoot
Loading...
Searching...
No Matches
CbmMcbm2018EventBuilder.h
Go to the documentation of this file.
1/* Copyright (C) 2019-2021 GSI Helmholtzzentrum fuer Schwerionenforschung, Darmstadt
2 SPDX-License-Identifier: GPL-3.0-only
3 Authors: Florian Uhlig [committer] */
4
5#ifndef CBMMCBM2018EVENTBUILDER_H
6#define CBMMCBM2018EVENTBUILDER_H
7
8#include "CbmDefs.h"
9#include "CbmEvent.h"
10#include "CbmTofDigi.h"
11
12#include "FairTask.h"
13
14#include <tuple>
15
16#include <array>
17#include <map>
18#include <set>
19#include <vector>
20
21class TClonesArray;
22class TH1;
23class TH2;
24class CbmDigiManager;
25
26
32
33//typedef std::tuple<ECbmModuleId, Int_t> digituple;
34
35typedef std::pair<ECbmModuleId, Int_t> digituple;
36
37/*
38struct classcomp {
39 bool operator() (const digituple& lhs, const digituple& rhs) const
40 {
41// CbmDigi* digi_lhs = std::get<0>(lhs);
42// CbmDigi* digi_rhs = std::get<0>(rhs);
43// Double_t time_lhs = std::get<0>(lhs)->GetTime();
44// Double_t time_rhs = std::get<0>(rhs)->GetTime();
45 return std::get<0>(lhs)->GetTime() < std::get<0>(rhs)->GetTime();
46 }
47};
48*/
49
50class CbmMcbm2018EventBuilder : public FairTask {
51public:
54
57
59 // CbmMcbm2018EventBuilder(Int_t verbose);
60
61
64
65
67 virtual InitStatus Init();
68
70 virtual InitStatus ReInit();
71
72
74 virtual void Exec(Option_t*);
75
77 virtual void SetParContainers();
78
80 virtual void Finish();
81
82 void SetFillHistos(Bool_t var) { fFillHistos = var; }
83 void SetOutFilename(TString sNameIn) { fOutFileName = sNameIn; }
84
86 void SetFixedTimeWindow(Double_t val) { fFixedTimeWindow = val; }
87 void SetMaximumTimeGap(Double_t val) { fMaximumTimeGap = val; }
88
103
118
119 void SetUseBaseMuchDigi(Bool_t bFlag = kTRUE) { fbUseBaseMuchDigi = bFlag; }
120
121private:
122 void InitSorter();
123 void BuildEvents();
124 void FillHisto();
125 void DefineGoodEvents();
126 void FillOutput();
127 template<class Digi>
128 void AddDigiToSorter(ECbmModuleId, Int_t);
129 void AddDigiToEvent(ECbmModuleId, Int_t);
130
131 Bool_t IsDigiInEvent(Double_t);
132 Bool_t HasTrigger(CbmEvent*);
133
134
135 Int_t fCurEv {0};
136 Int_t fErrors {0};
137 Int_t fNrTs {0};
138 Double_t fPrevTime {0.};
139
140 Bool_t fbUseBaseMuchDigi = kFALSE;
142 const std::vector<CbmTofDigi>* fBmonDigiVec = nullptr;
143 TClonesArray* fBmonDigiArr = nullptr;
144 TClonesArray* fEvents = nullptr;
145
146 std::array<TClonesArray*, ToIntegralType(ECbmModuleId::kNofSystems)>
148
149 //std::multiset<digituple, classcomp> fSorter; //! std::set to sort the digis time wise
150 std::multimap<Double_t, digituple> fSorter;
151
152 std::vector<std::pair<ECbmModuleId, Int_t>> fVect;
153
155 std::vector<CbmEvent*> fEventVector;
156
157 TH1* fDiffTime {nullptr};
158 TH1* fhEventTime {nullptr};
159 TH1* fhEventDt {nullptr};
160 TH1* fhEventSize {nullptr};
161 TH2* fhNbDigiPerEvtTime {nullptr};
162 TH2* fhNbDigiPerEvtTimeBmon {nullptr};
163 TH2* fhNbDigiPerEvtTimeSts {nullptr};
164 TH2* fhNbDigiPerEvtTimeMuch {nullptr};
165 TH2* fhNbDigiPerEvtTimeTrd {nullptr};
166 TH2* fhNbDigiPerEvtTimeTof {nullptr};
167 TH2* fhNbDigiPerEvtTimeRich {nullptr};
168 TH2* fhNbDigiPerEvtTimePsd {nullptr};
169 Bool_t fFillHistos {kTRUE};
170
174 Double_t fFixedTimeWindow {100.};
176 Double_t fStartTimeEvent {0.};
178 Double_t fMaximumTimeGap {100.};
179
208
210 TString fOutFileName {"HistosEventBuilder.root"};
211
213};
214
215#endif
XPU_D constexpr auto ToIntegralType(T enumerator) -> typename std::underlying_type< T >::type
Definition CbmDefs.h:29
ECbmModuleId
Definition CbmDefs.h:39
@ kNofSystems
For loops over active systems.
std::pair< ECbmModuleId, Int_t > digituple
CbmDigiManager.
Class characterising one event by a collection of links (indices) to data objects,...
Definition CbmEvent.h:34
Bool_t fFillHistos
histogram with the nb of PSD digis per event vs seed time of the events
std::multimap< Double_t, digituple > fSorter
array with pointers to input containers
void SetEventBuilderAlgo(EventBuilderAlgo algo=EventBuilderAlgo::FixedTimeWindow)
TH1 * fhEventDt
histogram with the seed time of the events
Double_t fPrevTime
Timeslice Counter.
TH1 * fDiffTime
vector with all created events
TH2 * fhNbDigiPerEvtTime
histogram with the nb of all digis in the event
TClonesArray * fEvents
input container of TO digis
TH2 * fhNbDigiPerEvtTimeTrd
histogram with the nb of MUCH digis per event vs seed time of the events
std::vector< std::pair< ECbmModuleId, Int_t > > fVect
for digi sorting
CbmMcbm2018EventBuilder operator=(const CbmMcbm2018EventBuilder &)=delete
TH1 * fhEventTime
histogram with the time difference between two consecutive digis
void SetFixedTimeWindow(Double_t val)
void SetOutFilename(TString sNameIn)
EventBuilderAlgo fEventBuilderAlgo
Switch ON/OFF filling of histograms.
TH2 * fhNbDigiPerEvtTimeMuch
histogram with the nb of STS digis per event vs seed time of the events
TH2 * fhNbDigiPerEvtTimeBmon
histogram with the nb of all digis per event vs seed time of the events
void SetMaximumTimeGap(Double_t val)
TH2 * fhNbDigiPerEvtTimeTof
histogram with the nb of TRD digis per event vs seed time of the events
TH1 * fhEventSize
histogram with the interval in seed time of consecutive events
std::vector< CbmEvent * > fEventVector
pointer to the event which is currently build
Bool_t fbUseBaseMuchDigi
Save previous time information.
void SetUseBaseMuchDigi(Bool_t bFlag=kTRUE)
TH2 * fhNbDigiPerEvtTimePsd
histogram with the nb of RICH digis per event vs seed time of the events
virtual void Exec(Option_t *)
TH2 * fhNbDigiPerEvtTimeRich
histogram with the nb of TOF digis per event vs seed time of the events
std::array< TClonesArray *, ToIntegralType(ECbmModuleId::kNofSystems)> fLinkArray
output container of CbmEvents
void AddDigiToEvent(ECbmModuleId, Int_t)
const std::vector< CbmTofDigi > * fBmonDigiVec
ClassDef(CbmMcbm2018EventBuilder, 2)
TH2 * fhNbDigiPerEvtTimeSts
histogram with the nb of Bmon digis per event vs seed time of the events
void AddDigiToSorter(ECbmModuleId, Int_t)
CbmMcbm2018EventBuilder(const CbmMcbm2018EventBuilder &)=delete