CbmRoot
Loading...
Searching...
No Matches
CbmDigitizationSource.h
Go to the documentation of this file.
1/* Copyright (C) 2018-2020 GSI Helmholtzzentrum fuer Schwerionenforschung, Darmstadt
2 SPDX-License-Identifier: GPL-3.0-only
3 Authors: Volker Friese [committer] */
4
10#ifndef CBMDIGITIZATIONSOURCE_H
11#define CBMDIGITIZATIONSOURCE_H 1
12
13#include "CbmDefs.h"
14#include "CbmMCInputSet.h"
15
16#include "FairEventHeader.h"
17#include "FairMCEventHeader.h"
18#include "FairSource.h"
19#include <Logger.h>
20
21#include "TObject.h"
22#include "TString.h"
23
24#include <map>
25#include <set>
26
27class FairEventHeader;
28
49class CbmDigitizationSource : public FairSource {
50
51public:
54
55
57 virtual ~CbmDigitizationSource();
58
59
70 virtual Bool_t ActivateObject(TObject** object, const char* branchName);
71
72
78 void AddInput(UInt_t inputId, TChain* chain, cbm::sim::TimeDist dist, Double_t rate,
80
81
93 virtual Int_t CheckMaxEventNo(Int_t lastEntry = 0);
94
95
100 virtual void Close() {}
101
102
109 void EmbedInput(UInt_t inputId, TChain* chain, UInt_t targetInputId, ECbmTreeAccess mode = ECbmTreeAccess::kRegular);
110
111
117 virtual void FillEventHeader(FairEventHeader* event);
118
119
123 const std::set<TString>& GetBranchList() const { return fBranches; }
124
125
130
131
133 virtual Source_Type GetSourceType()
134 {
135 LOG(fatal) << "GetSourceTpye";
136
137 return kFILE;
138 }
139
141 Double_t GetStartTime() { return fTimeStart; }
142
143
145 virtual Bool_t Init();
146
147
152 virtual Bool_t InitUnpackers() { return kTRUE; }
153
154
165 virtual Int_t ReadEvent(UInt_t event = 0);
166
167
172 virtual Bool_t ReInitUnpackers() { return kTRUE; }
173
174
176 virtual void Reset() {}
177
178
184 virtual Bool_t SpecifyRunId()
185 {
186 if (ReadEvent(0)) return true;
187
188 return false;
189 }
190
197 void SetMode(cbm::sim::Mode mode) { fMode = mode; }
198
199
204 virtual void SetParUnpackers() {}
205
206
217 void SetTimeStart(Double_t time) { fTimeStart = time; }
218
219
220private:
221 std::vector<CbmMCInputSet*> fInputSets;
222 std::map<UInt_t, CbmMCInputSet*> fInputMap;
223 std::multimap<Double_t, CbmMCInputSet*> fNextEvent;
224 FairMCEventHeader* fMCEventHeader;
225 TObjArray* fListOfFolders;
226 std::set<TString> fBranches; // List of branches names
227 Double_t fTimeStart; // Time offset first first event
228 Double_t fCurrentTime;
235 Bool_t fSwitchInputSet; // Flag to switch the input set at next ReadEvent
236
237
247 Bool_t CheckBranchList(CbmMCInputSet* input);
248
249
257 Int_t ReadEventByEvent(UInt_t event);
258
259
267 void ReadRunId();
268
269
271};
272
273#endif /* CBMDIGITIZATIONSOURCE_H */
ECbmTreeAccess
Mode to read entries from a ROOT TTree.
Definition CbmDefs.h:152
Source class for the input to digitization in CBM.
std::vector< CbmMCInputSet * > fInputSets
CbmMCInput * GetFirstInput()
First input from the first input set @value Pointer to first input.
FairMCEventHeader * fMCEventHeader
time -> inputSet
virtual Bool_t Init()
Abstract in base class. No implementation here.
Int_t ReadEventByEvent(UInt_t event)
Get next entry in event-by-event mode.
virtual Bool_t ActivateObject(TObject **object, const char *branchName)
Activate a branch and set its address.
const std::set< TString > & GetBranchList() const
List of branch names @value Reference to set of branch names.
Double_t GetStartTime()
Run start time.
Bool_t CheckBranchList(CbmMCInputSet *input)
Compare an input set branch list with the reference list.
virtual Bool_t SpecifyRunId()
Implement abstract function from base class.
void AddInput(UInt_t inputId, TChain *chain, cbm::sim::TimeDist dist, Double_t rate, ECbmTreeAccess mode=ECbmTreeAccess::kRegular)
Add a transport input.
virtual void Close()
Abstract in base class. No implementation here.
virtual ~CbmDigitizationSource()
Destructor.
virtual Bool_t ReInitUnpackers()
Abstract in base class. No implementation here.
void EmbedInput(UInt_t inputId, TChain *chain, UInt_t targetInputId, ECbmTreeAccess mode=ECbmTreeAccess::kRegular)
Embed a transport input.
virtual Bool_t InitUnpackers()
Abstract in base class. No implementation here.
void SetMode(cbm::sim::Mode mode)
Set event-by-event mode @value choice kTRUE if event-by-event mode.
std::set< TString > fBranches
virtual Int_t CheckMaxEventNo(Int_t lastEntry=0)
Maximal entry number the source can run to.
void ReadRunId()
Read run ID from the first entry in the first input.
virtual void FillEventHeader(FairEventHeader *event)
Fill the output event header.
virtual Source_Type GetSourceType()
Source type is kFILE.
virtual void Reset()
Abstract in base class. No implementation here.
virtual void SetParUnpackers()
Abstract in base class. No implementation here.
std::map< UInt_t, CbmMCInputSet * > fInputMap
ClassDef(CbmDigitizationSource, 1)
void SetTimeStart(Double_t time)
Set the offset for the first event time.
std::multimap< Double_t, CbmMCInputSet * > fNextEvent
input ID -> inputSet
virtual Int_t ReadEvent(UInt_t event=0)
Provide one tree entry.
A MC transport input to digitisation in CBM.
An MC (transport) input to digitisation in CBM.
Definition CbmMCInput.h:33
TimeDist
Definition Defs.h:29