CbmRoot
CbmMcbm2018EventBuilder.h
Go to the documentation of this file.
1 /********************************************************************************
2  * Copyright (C) 2014 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH *
3  * *
4  * This software is distributed under the terms of the *
5  * GNU Lesser General Public Licence (LGPL) version 3, *
6  * copied verbatim in the file "LICENSE" *
7  ********************************************************************************/
8 #ifndef CBMMCBM2018EVENTBUILDER_H
9 #define CBMMCBM2018EVENTBUILDER_H
10 
11 #include "FairTask.h"
12 
13 #include "CbmDefs.h"
14 #include "CbmEvent.h"
15 
16 #include "CbmTofDigi.h"
17 #include <array>
18 #include <map>
19 #include <set>
20 #include <tuple>
21 #include <vector>
22 
23 class TClonesArray;
24 class TH1;
25 class TH2;
26 class CbmDigiManager;
27 
28 
30 
31 //typedef std::tuple<ECbmModuleId, Int_t> digituple;
32 
33 typedef std::pair<ECbmModuleId, Int_t> digituple;
34 
35 /*
36 struct classcomp {
37  bool operator() (const digituple& lhs, const digituple& rhs) const
38  {
39 // CbmDigi* digi_lhs = std::get<0>(lhs);
40 // CbmDigi* digi_rhs = std::get<0>(rhs);
41 // Double_t time_lhs = std::get<0>(lhs)->GetTime();
42 // Double_t time_rhs = std::get<0>(rhs)->GetTime();
43  return std::get<0>(lhs)->GetTime() < std::get<0>(rhs)->GetTime();
44  }
45 };
46 */
47 
48 class CbmMcbm2018EventBuilder : public FairTask {
49 public:
52 
55 
57  // CbmMcbm2018EventBuilder(Int_t verbose);
58 
59 
62 
63 
65  virtual InitStatus Init();
66 
68  virtual InitStatus ReInit();
69 
70 
72  virtual void Exec(Option_t*);
73 
75  virtual void SetParContainers();
76 
78  virtual void Finish();
79 
80  void SetFillHistos(Bool_t var) { fFillHistos = var; }
81  void SetOutFilename(TString sNameIn) { fOutFileName = sNameIn; }
82 
85  fEventBuilderAlgo = algo;
86  }
87  void SetFixedTimeWindow(Double_t val) { fFixedTimeWindow = val; }
88  void SetMaximumTimeGap(Double_t val) { fMaximumTimeGap = val; }
89 
91  void SetTriggerMinNumberT0(Int_t val) { fTriggerMinT0Digis = val; }
93  void SetTriggerMinNumberSts(Int_t val) { fTriggerMinStsDigis = val; }
95  void SetTriggerMinNumberMuch(Int_t val) { fTriggerMinMuchDigis = val; }
97  void SetTriggerMinNumberTrd(Int_t val) { fTriggerMinTrdDigis = val; }
99  void SetTriggerMinNumberTof(Int_t val) { fTriggerMinTofDigis = val; }
103  void SetTriggerMinNumberPsd(Int_t val) { fTriggerMinPsdDigis = val; }
104 
106  void SetTriggerMaxNumberT0(Int_t val) { fTriggerMaxT0Digis = val; }
108  void SetTriggerMaxNumberSts(Int_t val) { fTriggerMaxStsDigis = val; }
112  void SetTriggerMaxNumberTrd(Int_t val) { fTriggerMaxTrdDigis = val; }
114  void SetTriggerMaxNumberTof(Int_t val) { fTriggerMaxTofDigis = val; }
118  void SetTriggerMaxNumberPsd(Int_t val) { fTriggerMaxPsdDigis = val; }
119 
120  void SetUseBaseMuchDigi(Bool_t bFlag = kTRUE) { fbUseBaseMuchDigi = bFlag; }
121 
122 private:
123  void InitSorter();
124  void BuildEvents();
125  void FillHisto();
126  void DefineGoodEvents();
127  void FillOutput();
128  template<class Digi>
129  void AddDigiToSorter(ECbmModuleId, Int_t);
130  void AddDigiToEvent(ECbmModuleId, Int_t);
131 
132  Bool_t IsDigiInEvent(Double_t);
133  Bool_t HasTrigger(CbmEvent*);
134 
135 
136  Int_t fCurEv {0};
137  Int_t fErrors {0};
138  Int_t fNrTs {0};
139  Double_t fPrevTime {0.};
140 
141  Bool_t fbUseBaseMuchDigi = kFALSE;
143  const std::vector<CbmTofDigi>* fT0DigiVec = nullptr;
144  TClonesArray* fT0DigiArr = nullptr;
145  TClonesArray* fEvents = nullptr;
146 
147  std::array<TClonesArray*, ToIntegralType(ECbmModuleId::kNofSystems)>
149 
150  //std::multiset<digituple, classcomp> fSorter; //! std::set to sort the digis time wise
151  std::multimap<Double_t, digituple> fSorter;
152 
153  std::vector<std::pair<ECbmModuleId, Int_t>> fVect;
154 
156  nullptr};
157  std::vector<CbmEvent*> fEventVector;
158 
159  TH1* fDiffTime {
160  nullptr};
161  TH1* fhEventTime {nullptr};
162  TH1* fhEventDt {
163  nullptr};
164  TH1* fhEventSize {
165  nullptr};
167  nullptr};
169  nullptr};
171  nullptr};
173  nullptr};
175  nullptr};
177  nullptr};
179  nullptr};
181  nullptr};
182  Bool_t fFillHistos {kTRUE};
183 
187  Double_t fFixedTimeWindow {100.};
189  Double_t fStartTimeEvent {0.};
191  Double_t fMaximumTimeGap {100.};
192 
208  Int_t fTriggerMaxT0Digis = -1;
221 
223  TString fOutFileName {"HistosEventBuilder.root"};
224 
226 };
227 
228 #endif
CbmMcbm2018EventBuilder::fPrevTime
Double_t fPrevTime
Timeslice Counter.
Definition: CbmMcbm2018EventBuilder.h:139
EventBuilderAlgo::FixedTimeWindow
@ FixedTimeWindow
CbmMcbm2018EventBuilder::SetTriggerMinNumberPsd
void SetTriggerMinNumberPsd(Int_t val)
Definition: CbmMcbm2018EventBuilder.h:103
CbmMcbm2018EventBuilder::fTriggerMaxStsDigis
Int_t fTriggerMaxStsDigis
Definition: CbmMcbm2018EventBuilder.h:210
CbmMcbm2018EventBuilder::fFixedTimeWindow
Double_t fFixedTimeWindow
Definition: CbmMcbm2018EventBuilder.h:187
CbmMcbm2018EventBuilder::fCurrentEvent
CbmEvent * fCurrentEvent
Definition: CbmMcbm2018EventBuilder.h:155
CbmMcbm2018EventBuilder::FillOutput
void FillOutput()
Definition: CbmMcbm2018EventBuilder.cxx:542
CbmMcbm2018EventBuilder::fhNbDigiPerEvtTimeTrd
TH2 * fhNbDigiPerEvtTimeTrd
histogram with the nb of MUCH digis per event vs seed time of the events
Definition: CbmMcbm2018EventBuilder.h:174
CbmMcbm2018EventBuilder::fhNbDigiPerEvtTimeMuch
TH2 * fhNbDigiPerEvtTimeMuch
histogram with the nb of STS digis per event vs seed time of the events
Definition: CbmMcbm2018EventBuilder.h:172
CbmMcbm2018EventBuilder::fTriggerMinRichDigis
Int_t fTriggerMinRichDigis
Definition: CbmMcbm2018EventBuilder.h:204
CbmMcbm2018EventBuilder::IsDigiInEvent
Bool_t IsDigiInEvent(Double_t)
Definition: CbmMcbm2018EventBuilder.cxx:372
CbmMcbm2018EventBuilder::ClassDef
ClassDef(CbmMcbm2018EventBuilder, 2)
CbmMcbm2018EventBuilder::Init
virtual InitStatus Init()
Definition: CbmMcbm2018EventBuilder.cxx:55
CbmMcbm2018EventBuilder::fhEventDt
TH1 * fhEventDt
histogram with the seed time of the events
Definition: CbmMcbm2018EventBuilder.h:162
CbmMcbm2018EventBuilder::InitSorter
void InitSorter()
Definition: CbmMcbm2018EventBuilder.cxx:239
CbmMcbm2018EventBuilder::SetTriggerMinNumberTof
void SetTriggerMinNumberTof(Int_t val)
Definition: CbmMcbm2018EventBuilder.h:99
CbmMcbm2018EventBuilder::AddDigiToSorter
void AddDigiToSorter(ECbmModuleId, Int_t)
Definition: CbmMcbm2018EventBuilder.cxx:602
CbmMcbm2018EventBuilder::fDigiMan
CbmDigiManager * fDigiMan
Definition: CbmMcbm2018EventBuilder.h:142
CbmMcbm2018EventBuilder::fT0DigiVec
const std::vector< CbmTofDigi > * fT0DigiVec
Definition: CbmMcbm2018EventBuilder.h:143
CbmMcbm2018EventBuilder::CbmMcbm2018EventBuilder
CbmMcbm2018EventBuilder()
Definition: CbmMcbm2018EventBuilder.cxx:36
CbmMcbm2018EventBuilder::HasTrigger
Bool_t HasTrigger(CbmEvent *)
Definition: CbmMcbm2018EventBuilder.cxx:381
CbmMcbm2018EventBuilder::SetOutFilename
void SetOutFilename(TString sNameIn)
Definition: CbmMcbm2018EventBuilder.h:81
CbmMcbm2018EventBuilder::DefineGoodEvents
void DefineGoodEvents()
Definition: CbmMcbm2018EventBuilder.cxx:530
CbmMcbm2018EventBuilder::SetFixedTimeWindow
void SetFixedTimeWindow(Double_t val)
Definition: CbmMcbm2018EventBuilder.h:87
EventBuilderAlgo
EventBuilderAlgo
Definition: CbmMcbm2018EventBuilder.h:29
CbmMcbm2018EventBuilder::fTriggerMinTofDigis
Int_t fTriggerMinTofDigis
Definition: CbmMcbm2018EventBuilder.h:202
CbmMcbm2018EventBuilder::SetUseBaseMuchDigi
void SetUseBaseMuchDigi(Bool_t bFlag=kTRUE)
Definition: CbmMcbm2018EventBuilder.h:120
CbmMcbm2018EventBuilder::SetTriggerMaxNumberTof
void SetTriggerMaxNumberTof(Int_t val)
Definition: CbmMcbm2018EventBuilder.h:114
CbmMcbm2018EventBuilder::fCurEv
Int_t fCurEv
Definition: CbmMcbm2018EventBuilder.h:136
ECbmModuleId
ECbmModuleId
Definition: CbmDefs.h:33
CbmMcbm2018EventBuilder::SetTriggerMinNumberMuch
void SetTriggerMinNumberMuch(Int_t val)
Definition: CbmMcbm2018EventBuilder.h:95
CbmMcbm2018EventBuilder::fFillHistos
Bool_t fFillHistos
histogram with the nb of PSD digis per event vs seed time of the events
Definition: CbmMcbm2018EventBuilder.h:182
CbmTofDigi.h
CbmMcbm2018EventBuilder::SetParContainers
virtual void SetParContainers()
Definition: CbmMcbm2018EventBuilder.cxx:43
CbmMcbm2018EventBuilder::fhNbDigiPerEvtTimeSts
TH2 * fhNbDigiPerEvtTimeSts
histogram with the nb of T0 digis per event vs seed time of the events
Definition: CbmMcbm2018EventBuilder.h:170
CbmMcbm2018EventBuilder::operator=
CbmMcbm2018EventBuilder operator=(const CbmMcbm2018EventBuilder &)=delete
CbmMcbm2018EventBuilder::fhNbDigiPerEvtTimeT0
TH2 * fhNbDigiPerEvtTimeT0
histogram with the nb of all digis per event vs seed time of the events
Definition: CbmMcbm2018EventBuilder.h:168
CbmMcbm2018EventBuilder::SetFillHistos
void SetFillHistos(Bool_t var)
Definition: CbmMcbm2018EventBuilder.h:80
digituple
std::pair< ECbmModuleId, Int_t > digituple
Definition: CbmMcbm2018EventBuilder.h:33
CbmMcbm2018EventBuilder::Exec
virtual void Exec(Option_t *)
Definition: CbmMcbm2018EventBuilder.cxx:218
CbmMcbm2018EventBuilder::ReInit
virtual InitStatus ReInit()
Definition: CbmMcbm2018EventBuilder.cxx:215
CbmMcbm2018EventBuilder::SetEventBuilderAlgo
void SetEventBuilderAlgo(EventBuilderAlgo algo=EventBuilderAlgo::FixedTimeWindow)
Definition: CbmMcbm2018EventBuilder.h:83
CbmEvent.h
CbmMcbm2018EventBuilder::SetTriggerMaxNumberSts
void SetTriggerMaxNumberSts(Int_t val)
Definition: CbmMcbm2018EventBuilder.h:108
CbmMcbm2018EventBuilder::fTriggerMaxTrdDigis
Int_t fTriggerMaxTrdDigis
Definition: CbmMcbm2018EventBuilder.h:214
CbmMcbm2018EventBuilder::fMaximumTimeGap
Double_t fMaximumTimeGap
Definition: CbmMcbm2018EventBuilder.h:191
CbmMcbm2018EventBuilder::fVect
std::vector< std::pair< ECbmModuleId, Int_t > > fVect
for digi sorting
Definition: CbmMcbm2018EventBuilder.h:153
CbmMcbm2018EventBuilder::fNrTs
Int_t fNrTs
Error Counter.
Definition: CbmMcbm2018EventBuilder.h:138
CbmMcbm2018EventBuilder::fOutFileName
TString fOutFileName
Definition: CbmMcbm2018EventBuilder.h:223
CbmMcbm2018EventBuilder::fErrors
Int_t fErrors
Event Counter.
Definition: CbmMcbm2018EventBuilder.h:137
CbmMcbm2018EventBuilder::fTriggerMinStsDigis
Int_t fTriggerMinStsDigis
Definition: CbmMcbm2018EventBuilder.h:196
EventBuilderAlgo::MaximumTimeGap
@ MaximumTimeGap
ECbmModuleId::kNofSystems
@ kNofSystems
For loops over active systems.
CbmMcbm2018EventBuilder::fhNbDigiPerEvtTimePsd
TH2 * fhNbDigiPerEvtTimePsd
histogram with the nb of RICH digis per event vs seed time of the events
Definition: CbmMcbm2018EventBuilder.h:180
CbmMcbm2018EventBuilder::fEventVector
std::vector< CbmEvent * > fEventVector
pointer to the event which is currently build
Definition: CbmMcbm2018EventBuilder.h:157
CbmMcbm2018EventBuilder::fTriggerMaxT0Digis
Int_t fTriggerMaxT0Digis
Definition: CbmMcbm2018EventBuilder.h:208
CbmDigiManager
CbmDigiManager.
Definition: CbmDigiManager.h:37
CbmMcbm2018EventBuilder::BuildEvents
void BuildEvents()
Definition: CbmMcbm2018EventBuilder.cxx:295
CbmMcbm2018EventBuilder::SetTriggerMaxNumberTrd
void SetTriggerMaxNumberTrd(Int_t val)
Definition: CbmMcbm2018EventBuilder.h:112
CbmMcbm2018EventBuilder
Definition: CbmMcbm2018EventBuilder.h:48
CbmMcbm2018EventBuilder::fEvents
TClonesArray * fEvents
input container of TO digis
Definition: CbmMcbm2018EventBuilder.h:145
CbmMcbm2018EventBuilder::FillHisto
void FillHisto()
Definition: CbmMcbm2018EventBuilder.cxx:470
CbmMcbm2018EventBuilder::fStartTimeEvent
Double_t fStartTimeEvent
Definition: CbmMcbm2018EventBuilder.h:189
CbmMcbm2018EventBuilder::~CbmMcbm2018EventBuilder
~CbmMcbm2018EventBuilder()
Definition: CbmMcbm2018EventBuilder.cxx:40
CbmMcbm2018EventBuilder::fhEventSize
TH1 * fhEventSize
histogram with the interval in seed time of consecutive events
Definition: CbmMcbm2018EventBuilder.h:164
CbmMcbm2018EventBuilder::SetTriggerMaxNumberPsd
void SetTriggerMaxNumberPsd(Int_t val)
Definition: CbmMcbm2018EventBuilder.h:118
CbmMcbm2018EventBuilder::fTriggerMaxPsdDigis
Int_t fTriggerMaxPsdDigis
Definition: CbmMcbm2018EventBuilder.h:220
CbmMcbm2018EventBuilder::fhEventTime
TH1 * fhEventTime
histogram with the time difference between two consecutive digis
Definition: CbmMcbm2018EventBuilder.h:161
CbmMcbm2018EventBuilder::CbmMcbm2018EventBuilder
CbmMcbm2018EventBuilder(const CbmMcbm2018EventBuilder &)=delete
CbmMcbm2018EventBuilder::fTriggerMinT0Digis
Int_t fTriggerMinT0Digis
Definition: CbmMcbm2018EventBuilder.h:194
CbmMcbm2018EventBuilder::fhNbDigiPerEvtTimeRich
TH2 * fhNbDigiPerEvtTimeRich
histogram with the nb of TOF digis per event vs seed time of the events
Definition: CbmMcbm2018EventBuilder.h:178
CbmMcbm2018EventBuilder::fhNbDigiPerEvtTimeTof
TH2 * fhNbDigiPerEvtTimeTof
histogram with the nb of TRD digis per event vs seed time of the events
Definition: CbmMcbm2018EventBuilder.h:176
CbmMcbm2018EventBuilder::fLinkArray
std::array< TClonesArray *, ToIntegralType(ECbmModuleId::kNofSystems)> fLinkArray
output container of CbmEvents
Definition: CbmMcbm2018EventBuilder.h:148
ToIntegralType
constexpr auto ToIntegralType(T enumerator) -> typename std::underlying_type< T >::type
Definition: CbmDefs.h:24
CbmMcbm2018EventBuilder::fDiffTime
TH1 * fDiffTime
vector with all created events
Definition: CbmMcbm2018EventBuilder.h:159
CbmMcbm2018EventBuilder::fTriggerMaxTofDigis
Int_t fTriggerMaxTofDigis
Definition: CbmMcbm2018EventBuilder.h:216
CbmMcbm2018EventBuilder::fTriggerMinPsdDigis
Int_t fTriggerMinPsdDigis
Definition: CbmMcbm2018EventBuilder.h:206
CbmEvent
Class characterising one event by a collection of links (indices) to data objects,...
Definition: CbmEvent.h:30
CbmMcbm2018EventBuilder::Finish
virtual void Finish()
Definition: CbmMcbm2018EventBuilder.cxx:650
CbmMcbm2018EventBuilder::SetTriggerMinNumberT0
void SetTriggerMinNumberT0(Int_t val)
Definition: CbmMcbm2018EventBuilder.h:91
CbmMcbm2018EventBuilder::SetTriggerMaxNumberMuch
void SetTriggerMaxNumberMuch(Int_t val)
Definition: CbmMcbm2018EventBuilder.h:110
CbmMcbm2018EventBuilder::SetMaximumTimeGap
void SetMaximumTimeGap(Double_t val)
Definition: CbmMcbm2018EventBuilder.h:88
CbmMcbm2018EventBuilder::SetTriggerMinNumberTrd
void SetTriggerMinNumberTrd(Int_t val)
Definition: CbmMcbm2018EventBuilder.h:97
CbmMcbm2018EventBuilder::fTriggerMinTrdDigis
Int_t fTriggerMinTrdDigis
Definition: CbmMcbm2018EventBuilder.h:200
CbmMcbm2018EventBuilder::SetTriggerMaxNumberT0
void SetTriggerMaxNumberT0(Int_t val)
Definition: CbmMcbm2018EventBuilder.h:106
CbmMcbm2018EventBuilder::fEventBuilderAlgo
EventBuilderAlgo fEventBuilderAlgo
Switch ON/OFF filling of histograms.
Definition: CbmMcbm2018EventBuilder.h:185
CbmMcbm2018EventBuilder::fbUseBaseMuchDigi
Bool_t fbUseBaseMuchDigi
Save previous time information.
Definition: CbmMcbm2018EventBuilder.h:141
CbmMcbm2018EventBuilder::fSorter
std::multimap< Double_t, digituple > fSorter
array with pointers to input containers
Definition: CbmMcbm2018EventBuilder.h:151
CbmMcbm2018EventBuilder::fTriggerMaxMuchDigis
Int_t fTriggerMaxMuchDigis
Definition: CbmMcbm2018EventBuilder.h:212
CbmMcbm2018EventBuilder::fTriggerMinMuchDigis
Int_t fTriggerMinMuchDigis
Definition: CbmMcbm2018EventBuilder.h:198
CbmMcbm2018EventBuilder::fT0DigiArr
TClonesArray * fT0DigiArr
Definition: CbmMcbm2018EventBuilder.h:144
CbmMcbm2018EventBuilder::fTriggerMaxRichDigis
Int_t fTriggerMaxRichDigis
Definition: CbmMcbm2018EventBuilder.h:218
CbmMcbm2018EventBuilder::SetTriggerMinNumberSts
void SetTriggerMinNumberSts(Int_t val)
Definition: CbmMcbm2018EventBuilder.h:93
CbmMcbm2018EventBuilder::fhNbDigiPerEvtTime
TH2 * fhNbDigiPerEvtTime
histogram with the nb of all digis in the event
Definition: CbmMcbm2018EventBuilder.h:166
CbmMcbm2018EventBuilder::AddDigiToEvent
void AddDigiToEvent(ECbmModuleId, Int_t)
Definition: CbmMcbm2018EventBuilder.cxx:569
CbmMcbm2018EventBuilder::SetTriggerMinNumberRich
void SetTriggerMinNumberRich(Int_t val)
Definition: CbmMcbm2018EventBuilder.h:101
CbmMcbm2018EventBuilder::SetTriggerMaxNumberRich
void SetTriggerMaxNumberRich(Int_t val)
Definition: CbmMcbm2018EventBuilder.h:116
CbmDefs.h