CbmRoot
CbmMCInput.h
Go to the documentation of this file.
1 
6 #ifndef CBMMCINPUT_H
7 #define CBMMCINPUT_H 1
8 
9 #include "CbmDefs.h"
10 #include "TChain.h"
11 #include "TF1.h"
12 #include "TObject.h"
13 #include <set>
14 
15 
27 class CbmMCInput : public TObject {
28 
29 public:
31  CbmMCInput();
32 
33 
38  CbmMCInput(TChain* chain, ECbmTreeAccess mode = ECbmTreeAccess::kRegular);
39 
40 
42  virtual ~CbmMCInput();
43 
44 
48  std::set<TString>& GetBranchList();
49 
50 
54  TChain* GetChain() const { return fChain; }
55 
56 
62  Int_t GetNextEntry();
63 
64 
68  Int_t GetMaxNofEvents() const {
69  return (fMode == ECbmTreeAccess::kRegular ? fChain->GetEntries() : -1);
70  }
71 
72 
76  ECbmTreeAccess GetMode() const { return fMode; }
77 
78 
82  Long64_t GetNofEntries() const { return fChain->GetEntries(); }
83 
84 
88  UInt_t GetNofUsedEntries() const { return fNofUsedEntries; }
89 
90 
91 private:
92  TChain* fChain;
93  ECbmTreeAccess fMode; // Access mode to tree
94  std::set<TString> fBranches; // List of branch names
95  UInt_t fLastUsedEntry; // Index of last used entry
96  UInt_t fNofUsedEntries; // Number of used entries
97 
98 
104  UInt_t ReadBranches();
105 
106 
108 };
109 
110 #endif /* CBMMCINPUT_H */
CbmMCInput::fMode
ECbmTreeAccess fMode
Input chain.
Definition: CbmMCInput.h:93
CbmMCInput::fNofUsedEntries
UInt_t fNofUsedEntries
Definition: CbmMCInput.h:96
CbmMCInput::GetMode
ECbmTreeAccess GetMode() const
Tree access mode @value Access mode.
Definition: CbmMCInput.h:76
CbmMCInput::~CbmMCInput
virtual ~CbmMCInput()
Destructor.
Definition: CbmMCInput.cxx:34
ECbmTreeAccess::kRegular
@ kRegular
CbmMCInput::GetNofUsedEntries
UInt_t GetNofUsedEntries() const
Number of used entries @value Number of successful calls to GetNextEvent()
Definition: CbmMCInput.h:88
CbmMCInput::GetNofEntries
Long64_t GetNofEntries() const
Number of entries @value Number of entries in this input chain.
Definition: CbmMCInput.h:82
CbmMCInput::GetBranchList
std::set< TString > & GetBranchList()
List of branches @value Reference to branch list.
Definition: CbmMCInput.cxx:39
ECbmTreeAccess
ECbmTreeAccess
Mode to read entries from a ROOT TTree.
Definition: CbmDefs.h:130
CbmMCInput::GetMaxNofEvents
Int_t GetMaxNofEvents() const
Maximal number of events to be read from the input. @value Number of entries in the tree for kRegular...
Definition: CbmMCInput.h:68
CbmMCInput::ClassDef
ClassDef(CbmMCInput, 1)
CbmMCInput::fLastUsedEntry
UInt_t fLastUsedEntry
Definition: CbmMCInput.h:95
CbmMCInput::GetNextEntry
Int_t GetNextEntry()
Get the next unused entry from the chain @value Id of tree entry.
Definition: CbmMCInput.cxx:50
CbmMCInput
An MC (transport) input to digitisation in CBM.
Definition: CbmMCInput.h:27
CbmMCInput::fChain
TChain * fChain
Definition: CbmMCInput.h:92
CbmMCInput::ReadBranches
UInt_t ReadBranches()
Read list of branches from file @value Number of branches.
Definition: CbmMCInput.cxx:83
CbmMCInput::CbmMCInput
CbmMCInput()
Default constructor.
Definition: CbmMCInput.cxx:18
CbmMCInput::fBranches
std::set< TString > fBranches
Definition: CbmMCInput.h:94
CbmMCInput::GetChain
TChain * GetChain() const
Pointer to chain @value Pointer to TChain object.
Definition: CbmMCInput.h:54
CbmDefs.h