CbmRoot
Loading...
Searching...
No Matches
CbmMCInputSet.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 CBMMCINPUTSET_H
11#define CBMMCINPUTSET_H 1
12
13#include "CbmDefs.h"
14#include "CbmMCInput.h"
15
16#include "TF1.h"
17#include "TObject.h"
18
19#include <map>
20#include <set>
21#include <utility>
22
23#include "Defs.h"
24
25
42class CbmMCInputSet : public TObject {
43
44public:
47
48
52 CbmMCInputSet(cbm::sim::TimeDist dist, Double_t rate);
53
54
56 virtual ~CbmMCInputSet();
57
58
65 virtual Bool_t ActivateObject(TObject** object, const char* branchName);
66
67
72 void AddInput(UInt_t inputId, TChain* chain, ECbmTreeAccess mode = ECbmTreeAccess::kRegular);
73
74
78 const std::set<TString>& GetBranchList() const { return fBranches; }
79
80
89 Double_t GetDeltaT();
90
91
97 std::pair<UInt_t, CbmMCInput*> GetFirstInput()
98 {
99 return (fInputs.empty() ? std::make_pair(-1, nullptr)
100 : std::make_pair(fInputs.begin()->first, fInputs.begin()->second));
101 }
102
103
108 CbmMCInput* GetInput(UInt_t id) { return (fInputs.find(id) == fInputs.end() ? nullptr : fInputs[id]); }
109
110
120 Int_t GetMaxNofEvents() const;
121
122
132 std::tuple<Bool_t, UInt_t, Int_t> GetNextEntry();
133
134
138 Double_t GetEventRate() const { return fEventRate; }
139
140
142 void RegisterChains();
143
144
145private:
146 cbm::sim::TimeDist fTimeDist = cbm::sim::TimeDist::Poisson; // Event time distribution model
147 Double_t fEventRate; // Event rate [1/s]
148 std::map<UInt_t, CbmMCInput*> fInputs; // Key is input ID
149 std::map<UInt_t, CbmMCInput*>::iterator fInputHandle; // Handle for inputs
150 std::set<TString> fBranches; // List of branch names
151 TF1* fDeltaDist; // Probability distribution for delta(t)
152
153
163 Bool_t CheckBranchList(CbmMCInput* input);
164
165
167};
168
169#endif /* CBMMCINPUT_H */
ECbmTreeAccess
Mode to read entries from a ROOT TTree.
Definition CbmDefs.h:152
A MC transport input to digitisation in CBM.
ClassDef(CbmMCInputSet, 1)
std::pair< UInt_t, CbmMCInput * > GetFirstInput()
Accessor to first input @value ID and Pointer to first CbmMCInput object.
Double_t GetDeltaT()
Time difference to next event @value Time difference to next event [ns].
void AddInput(UInt_t inputId, TChain *chain, ECbmTreeAccess mode=ECbmTreeAccess::kRegular)
Add an input to the set.
virtual ~CbmMCInputSet()
Destructor.
Double_t GetEventRate() const
Event rate @value Event rate [1/s].
std::tuple< Bool_t, UInt_t, Int_t > GetNextEntry()
Get the next entry from the inputs @value Status tuple.
void RegisterChains()
register all input chains to the FairRootManager
cbm::sim::TimeDist fTimeDist
Bool_t CheckBranchList(CbmMCInput *input)
Compare an input branch list with the reference branch list.
virtual Bool_t ActivateObject(TObject **object, const char *branchName)
Activate and connect all input chains.
std::set< TString > fBranches
CbmMCInput * GetInput(UInt_t id)
Accessor to input.
Int_t GetMaxNofEvents() const
Maximal number of events to be read from the input set @value Maximal number of events.
CbmMCInputSet()
Default constructor.
std::map< UInt_t, CbmMCInput * >::iterator fInputHandle
const std::set< TString > & GetBranchList() const
List of branches @value Reference to branch list.
Double_t fEventRate
std::map< UInt_t, CbmMCInput * > fInputs
An MC (transport) input to digitisation in CBM.
Definition CbmMCInput.h:33
TimeDist
Definition Defs.h:29