Go to the documentation of this file.
10 #include "FairRootManager.h"
27 , fListOfFolders(new TObjArray())
36 , fCurrentInputSet(nullptr)
37 , fSwitchInputSet(kFALSE) {}
44 if (inputSet)
delete inputSet;
52 const char* branchName) {
56 inputSet->ActivateObject(
object, branchName);
71 LOG(fatal) <<
"DigitizationSource: Input ID " << inputId
72 <<
" is already defined!";
78 inputSet->
AddInput(inputId, chain, mode);
88 LOG(fatal) <<
"DigitizationSource: Incompatible branch list!";
97 LOG(info) <<
"DigitizationSource: Added input " << inputId <<
" with rate "
98 << rate <<
" / s, mode: "
110 Bool_t success = kTRUE;
114 LOG(debug) <<
"DigitizationSource: required branch " << entry
115 <<
" not present in input set!";
122 std::stringstream ss;
123 ss <<
"DigitizationSource: Global branch list is ";
126 LOG(info) << ss.str();
127 std::stringstream ss1;
128 ss1 <<
"DigitizationSource: Input set branch list is ";
132 LOG(info) << ss1.str();
155 return (maxEvents >= 0 ? maxEvents : 1e6);
163 UInt_t targetInputId,
168 LOG(fatal) <<
"DigitizationSource: Input ID " << inputId
169 <<
" is already defined!";
175 LOG(fatal) <<
"DigitizationSource: Target input ID " << targetInputId
176 <<
" for input " << inputId <<
" does not exist!";
181 fInputMap[targetInputId]->AddInput(inputId, chain, mode);
184 LOG(info) <<
"DigitizationSource: Embedded input " << inputId
185 <<
" into input " << targetInputId <<
", mode: "
200 LOG(debug) <<
"DigitizationSource: Event with RunId " <<
fCurrentRunId
210 return fInputMap.begin()->second->GetFirstInput().second;
220 LOG(fatal) <<
"DigitizationSource: No input sets defined!";
224 LOG(fatal) <<
"DigitizationSource: More than one input defined "
225 <<
"in event-by-event mode!";
231 inputSet->RegisterChains();
235 TFile* file = input->
GetChain()->GetFile();
236 TFolder* folder =
dynamic_cast<TFolder*
>(file->Get(
"cbmroot"));
238 gROOT->GetListOfBrowsables()->Add(folder);
252 for (
size_t iSet = 0; iSet <
fInputSets.size(); iSet++) {
255 LOG(info) <<
"First time for input set " << iSet <<
" is " << time
257 fNextEvent.insert(std::make_pair(time, inputSet));
311 std::cout << std::endl;
312 LOG(info) <<
"DigitizationSource: Event " <<
event <<
" at t = " << std::fixed
319 LOG(info) <<
"DigitizationSource: No more entries in input "
333 auto result =
fInputSets.front()->GetFirstInput();
341 LOG(info) <<
"DigitizationSource: Requested event " <<
event
356 LOG(info) <<
"DigitizationSource: Event " <<
event
369 auto firstInput =
fInputSets.front()->GetFirstInput();
377 LOG(info) <<
"DigitizationSource: Run ID is " <<
fCurrentRunId;
virtual Bool_t ActivateObject(TObject **object, const char *branchName)
Activate a branch and set its address.
virtual ~CbmDigitizationSource()
Destructor.
void AddInput(UInt_t inputId, TChain *chain, Double_t rate, ECbmTreeAccess mode=ECbmTreeAccess::kRegular)
Add a transport input.
virtual Bool_t Init()
Abstract in base class. No implementation here.
CbmMCInputSet * fCurrentInputSet
std::map< Double_t, CbmMCInputSet * > fNextEvent
input ID -> inputSet
Int_t ReadEventByEvent(UInt_t event)
Get next entry in event-by-event mode.
Bool_t CheckBranchList(CbmMCInputSet *input)
Compare an input set branch list with the reference list.
CbmDigitizationSource()
Constructor.
CbmMCInput * GetFirstInput()
First input from the first input set @value Pointer to first input.
ECbmTreeAccess
Mode to read entries from a ROOT TTree.
Source class for the input to digitization in CBM.
TObjArray * fListOfFolders
ClassImp(CbmConverterManager) InitStatus CbmConverterManager
std::set< TString > fBranches
void EmbedInput(UInt_t inputId, TChain *chain, UInt_t targetInputId, ECbmTreeAccess mode=ECbmTreeAccess::kRegular)
Embed a transport input.
void ReadRunId()
Read run ID from the first entry in the first input.
FairMCEventHeader * fMCEventHeader
time -> inputSet
std::map< UInt_t, CbmMCInputSet * > fInputMap
virtual Int_t ReadEvent(UInt_t event=0)
Provide one tree entry.
virtual Int_t CheckMaxEventNo(Int_t lastEntry=0)
Maximal entry number the source can run to.
virtual void FillEventHeader(FairEventHeader *event)
Fill the output event header.
std::vector< CbmMCInputSet * > fInputSets