CbmRoot
CbmDigitizationSource.h
Go to the documentation of this file.
1 
6 #ifndef CBMDIGITIZATIONSOURCE_H
7 #define CBMDIGITIZATIONSOURCE_H 1
8 
9 #include "CbmDefs.h"
10 #include "CbmMCInputSet.h"
11 #include "FairEventHeader.h"
12 #include "FairLogger.h"
13 #include "FairMCEventHeader.h"
14 #include "FairSource.h"
15 #include "TObject.h"
16 #include "TString.h"
17 #include <map>
18 #include <set>
19 
20 class FairEventHeader;
21 
42 class CbmDigitizationSource : public FairSource {
43 
44 public:
47 
48 
50  virtual ~CbmDigitizationSource();
51 
52 
63  virtual Bool_t ActivateObject(TObject** object, const char* branchName);
64 
65 
71  void AddInput(UInt_t inputId,
72  TChain* chain,
73  Double_t rate,
75 
76 
88  virtual Int_t CheckMaxEventNo(Int_t lastEntry = 0);
89 
90 
95  virtual void Close() {}
96 
97 
104  void EmbedInput(UInt_t inputId,
105  TChain* chain,
106  UInt_t targetInputId,
108 
109 
115  virtual void FillEventHeader(FairEventHeader* event);
116 
117 
121  const std::set<TString>& GetBranchList() const { return fBranches; }
122 
123 
128 
129 
131  virtual Source_Type GetSourceType() {
132  LOG(fatal) << "GetSourceTpye";
133 
134  return kFILE;
135  }
136 
137 
139  virtual Bool_t Init();
140 
141 
146  virtual Bool_t InitUnpackers() { return kTRUE; }
147 
148 
159  virtual Int_t ReadEvent(UInt_t event = 0);
160 
161 
166  virtual Bool_t ReInitUnpackers() { return kTRUE; }
167 
168 
170  virtual void Reset() {}
171 
172 
179  void SetEventMode(Bool_t choice = kTRUE) { fEventMode = choice; }
180 
181 
186  virtual void SetParUnpackers() {}
187 
188 
199  void SetTimeStart(Double_t time) { fTimeStart = time; }
200 
201 
202 private:
203  std::vector<CbmMCInputSet*> fInputSets;
204  std::map<UInt_t, CbmMCInputSet*> fInputMap;
205  std::map<Double_t, CbmMCInputSet*> fNextEvent;
206  FairMCEventHeader* fMCEventHeader;
207  TObjArray* fListOfFolders;
208  std::set<TString> fBranches; // List of branches names
209  Double_t fTimeStart; // Time offset first first event
210  Double_t fCurrentTime;
214  Bool_t fFirstCall;
215  Bool_t fEventMode;
217  Bool_t fSwitchInputSet; // Flag to switch the input set at next ReadEvent
218 
219 
229  Bool_t CheckBranchList(CbmMCInputSet* input);
230 
231 
239  Int_t ReadEventByEvent(UInt_t event);
240 
241 
249  void ReadRunId();
250 
251 
253 };
254 
255 #endif /* CBMDIGITIZATIONSOURCE_H */
CbmDigitizationSource::GetBranchList
const std::set< TString > & GetBranchList() const
List of branch names @value Reference to set of branch names.
Definition: CbmDigitizationSource.h:121
CbmDigitizationSource::ActivateObject
virtual Bool_t ActivateObject(TObject **object, const char *branchName)
Activate a branch and set its address.
Definition: CbmDigitizationSource.cxx:51
CbmDigitizationSource::~CbmDigitizationSource
virtual ~CbmDigitizationSource()
Destructor.
Definition: CbmDigitizationSource.cxx:42
CbmDigitizationSource::AddInput
void AddInput(UInt_t inputId, TChain *chain, Double_t rate, ECbmTreeAccess mode=ECbmTreeAccess::kRegular)
Add a transport input.
Definition: CbmDigitizationSource.cxx:64
CbmDigitizationSource::Close
virtual void Close()
Abstract in base class. No implementation here.
Definition: CbmDigitizationSource.h:95
CbmDigitizationSource::Init
virtual Bool_t Init()
Abstract in base class. No implementation here.
Definition: CbmDigitizationSource.cxx:216
CbmDigitizationSource::fCurrentInputSet
CbmMCInputSet * fCurrentInputSet
Definition: CbmDigitizationSource.h:216
CbmDigitizationSource::fCurrentRunId
Int_t fCurrentRunId
Definition: CbmDigitizationSource.h:213
CbmDigitizationSource::fFirstCall
Bool_t fFirstCall
Definition: CbmDigitizationSource.h:214
ECbmTreeAccess::kRegular
@ kRegular
CbmDigitizationSource::fNextEvent
std::map< Double_t, CbmMCInputSet * > fNextEvent
input ID -> inputSet
Definition: CbmDigitizationSource.h:205
CbmDigitizationSource::ReadEventByEvent
Int_t ReadEventByEvent(UInt_t event)
Get next entry in event-by-event mode.
Definition: CbmDigitizationSource.cxx:330
CbmDigitizationSource::CheckBranchList
Bool_t CheckBranchList(CbmMCInputSet *input)
Compare an input set branch list with the reference list.
Definition: CbmDigitizationSource.cxx:107
CbmDigitizationSource::fCurrentTime
Double_t fCurrentTime
Definition: CbmDigitizationSource.h:210
CbmDigitizationSource::InitUnpackers
virtual Bool_t InitUnpackers()
Abstract in base class. No implementation here.
Definition: CbmDigitizationSource.h:146
CbmDigitizationSource::CbmDigitizationSource
CbmDigitizationSource()
Constructor.
Definition: CbmDigitizationSource.cxx:21
CbmDigitizationSource::ReInitUnpackers
virtual Bool_t ReInitUnpackers()
Abstract in base class. No implementation here.
Definition: CbmDigitizationSource.h:166
CbmDigitizationSource::SetTimeStart
void SetTimeStart(Double_t time)
Set the offset for the first event time.
Definition: CbmDigitizationSource.h:199
CbmDigitizationSource::GetFirstInput
CbmMCInput * GetFirstInput()
First input from the first input set @value Pointer to first input.
Definition: CbmDigitizationSource.cxx:208
ECbmTreeAccess
ECbmTreeAccess
Mode to read entries from a ROOT TTree.
Definition: CbmDefs.h:130
CbmMCInputSet.h
CbmDigitizationSource::fTimeStart
Double_t fTimeStart
Definition: CbmDigitizationSource.h:209
CbmDigitizationSource::SetParUnpackers
virtual void SetParUnpackers()
Abstract in base class. No implementation here.
Definition: CbmDigitizationSource.h:186
CbmDigitizationSource::Reset
virtual void Reset()
Abstract in base class. No implementation here.
Definition: CbmDigitizationSource.h:170
CbmDigitizationSource
Source class for the input to digitization in CBM.
Definition: CbmDigitizationSource.h:42
CbmDigitizationSource::fListOfFolders
TObjArray * fListOfFolders
Definition: CbmDigitizationSource.h:207
CbmDigitizationSource::ClassDef
ClassDef(CbmDigitizationSource, 1)
CbmMCInput
An MC (transport) input to digitisation in CBM.
Definition: CbmMCInput.h:27
CbmDigitizationSource::fEventMode
Bool_t fEventMode
Definition: CbmDigitizationSource.h:215
CbmDigitizationSource::fSwitchInputSet
Bool_t fSwitchInputSet
Definition: CbmDigitizationSource.h:217
CbmDigitizationSource::fCurrentEntryId
Int_t fCurrentEntryId
Definition: CbmDigitizationSource.h:211
CbmDigitizationSource::fBranches
std::set< TString > fBranches
Definition: CbmDigitizationSource.h:208
CbmDigitizationSource::SetEventMode
void SetEventMode(Bool_t choice=kTRUE)
Set event-by-event mode @value choice kTRUE if event-by-event mode.
Definition: CbmDigitizationSource.h:179
CbmMCInputSet
A MC transport input to digitisation in CBM.
Definition: CbmMCInputSet.h:34
CbmDigitizationSource::EmbedInput
void EmbedInput(UInt_t inputId, TChain *chain, UInt_t targetInputId, ECbmTreeAccess mode=ECbmTreeAccess::kRegular)
Embed a transport input.
Definition: CbmDigitizationSource.cxx:161
CbmDigitizationSource::ReadRunId
void ReadRunId()
Read run ID from the first entry in the first input.
Definition: CbmDigitizationSource.cxx:367
CbmDigitizationSource::GetSourceType
virtual Source_Type GetSourceType()
Source type is kFILE.
Definition: CbmDigitizationSource.h:131
CbmDigitizationSource::fMCEventHeader
FairMCEventHeader * fMCEventHeader
time -> inputSet
Definition: CbmDigitizationSource.h:206
CbmDigitizationSource::fInputMap
std::map< UInt_t, CbmMCInputSet * > fInputMap
Definition: CbmDigitizationSource.h:204
CbmDigitizationSource::ReadEvent
virtual Int_t ReadEvent(UInt_t event=0)
Provide one tree entry.
Definition: CbmDigitizationSource.cxx:271
CbmDigitizationSource::fCurrentInputId
Int_t fCurrentInputId
Definition: CbmDigitizationSource.h:212
CbmDigitizationSource::CheckMaxEventNo
virtual Int_t CheckMaxEventNo(Int_t lastEntry=0)
Maximal entry number the source can run to.
Definition: CbmDigitizationSource.cxx:141
CbmDigitizationSource::FillEventHeader
virtual void FillEventHeader(FairEventHeader *event)
Fill the output event header.
Definition: CbmDigitizationSource.cxx:194
CbmDigitizationSource::fInputSets
std::vector< CbmMCInputSet * > fInputSets
Definition: CbmDigitizationSource.h:203
CbmDefs.h