CbmRoot
CbmMCInputSet.h
Go to the documentation of this file.
1 
6 #ifndef CBMMCINPUTSET_H
7 #define CBMMCINPUTSET_H 1
8 
9 #include "CbmDefs.h"
10 #include "CbmMCInput.h"
11 #include "TF1.h"
12 #include "TObject.h"
13 #include <map>
14 #include <set>
15 #include <utility>
16 
17 
34 class CbmMCInputSet : public TObject {
35 
36 public:
38  CbmMCInputSet();
39 
40 
44  CbmMCInputSet(Double_t rate);
45 
46 
48  virtual ~CbmMCInputSet();
49 
50 
57  virtual Bool_t ActivateObject(TObject** object, const char* branchName);
58 
59 
64  void AddInput(UInt_t inputId,
65  TChain* chain,
67 
68 
72  const std::set<TString>& GetBranchList() const { return fBranches; }
73 
74 
83  Double_t GetDeltaT();
84 
85 
91  std::pair<UInt_t, CbmMCInput*> GetFirstInput() {
92  return (fInputs.empty() ? std::make_pair(-1, nullptr)
93  : std::make_pair(fInputs.begin()->first,
94  fInputs.begin()->second));
95  }
96 
97 
102  CbmMCInput* GetInput(UInt_t id) {
103  return (fInputs.find(id) == fInputs.end() ? nullptr : fInputs[id]);
104  }
105 
106 
116  Int_t GetMaxNofEvents() const;
117 
118 
128  std::tuple<Bool_t, UInt_t, Int_t> GetNextEntry();
129 
130 
134  Double_t GetRate() const { return fRate; }
135 
136 
138  void RegisterChains();
139 
140 
141 private:
142  Double_t fRate; // Event rate [1/s]
143  std::map<UInt_t, CbmMCInput*> fInputs; // Key is input ID
144  std::map<UInt_t, CbmMCInput*>::iterator fInputHandle; // Handle for inputs
145  std::set<TString> fBranches; // List of branch names
146  TF1* fDeltaDist; // Probability distribution for delta(t)
147 
148 
158  Bool_t CheckBranchList(CbmMCInput* input);
159 
160 
162 };
163 
164 #endif /* CBMMCINPUT_H */
CbmMCInputSet::AddInput
void AddInput(UInt_t inputId, TChain *chain, ECbmTreeAccess mode=ECbmTreeAccess::kRegular)
Add an input to the set.
Definition: CbmMCInputSet.cxx:63
CbmMCInputSet::~CbmMCInputSet
virtual ~CbmMCInputSet()
Destructor.
Definition: CbmMCInputSet.cxx:38
CbmMCInputSet::GetNextEntry
std::tuple< Bool_t, UInt_t, Int_t > GetNextEntry()
Get the next entry from the inputs @value Status tuple.
Definition: CbmMCInputSet.cxx:164
CbmMCInputSet::GetMaxNofEvents
Int_t GetMaxNofEvents() const
Maximal number of events to be read from the input set @value Maximal number of events.
Definition: CbmMCInputSet.cxx:144
CbmMCInputSet::fInputs
std::map< UInt_t, CbmMCInput * > fInputs
Definition: CbmMCInputSet.h:143
CbmMCInputSet::GetRate
Double_t GetRate() const
Event rate @value Event rate [1/s].
Definition: CbmMCInputSet.h:134
CbmMCInputSet::fDeltaDist
TF1 * fDeltaDist
Definition: CbmMCInputSet.h:146
CbmMCInputSet::ClassDef
ClassDef(CbmMCInputSet, 1)
CbmMCInputSet::CbmMCInputSet
CbmMCInputSet()
Default constructor.
Definition: CbmMCInputSet.cxx:14
ECbmTreeAccess::kRegular
@ kRegular
CbmMCInputSet::fRate
Double_t fRate
Definition: CbmMCInputSet.h:142
ECbmTreeAccess
ECbmTreeAccess
Mode to read entries from a ROOT TTree.
Definition: CbmDefs.h:130
CbmMCInputSet::fBranches
std::set< TString > fBranches
Definition: CbmMCInputSet.h:145
CbmMCInputSet::GetFirstInput
std::pair< UInt_t, CbmMCInput * > GetFirstInput()
Accessor to first input @value ID and Pointer to first CbmMCInput object.
Definition: CbmMCInputSet.h:91
CbmMCInputSet::ActivateObject
virtual Bool_t ActivateObject(TObject **object, const char *branchName)
Activate and connect all input chains.
Definition: CbmMCInputSet.cxx:47
CbmMCInputSet::GetBranchList
const std::set< TString > & GetBranchList() const
List of branches @value Reference to branch list.
Definition: CbmMCInputSet.h:72
CbmMCInputSet::fInputHandle
std::map< UInt_t, CbmMCInput * >::iterator fInputHandle
Definition: CbmMCInputSet.h:144
CbmMCInput
An MC (transport) input to digitisation in CBM.
Definition: CbmMCInput.h:27
CbmMCInputSet::GetDeltaT
Double_t GetDeltaT()
Time difference to next event @value Time difference to next event [ns].
Definition: CbmMCInputSet.cxx:136
CbmMCInputSet::GetInput
CbmMCInput * GetInput(UInt_t id)
Accessor to input.
Definition: CbmMCInputSet.h:102
CbmMCInputSet::CheckBranchList
Bool_t CheckBranchList(CbmMCInput *input)
Compare an input branch list with the reference branch list.
Definition: CbmMCInputSet.cxx:103
CbmMCInputSet
A MC transport input to digitisation in CBM.
Definition: CbmMCInputSet.h:34
CbmMCInputSet::RegisterChains
void RegisterChains()
register all input chains to the FairRootManager
Definition: CbmMCInputSet.cxx:187
CbmMCInput.h
CbmDefs.h