CbmRoot
CbmMCDataArray.h
Go to the documentation of this file.
1 
5 #ifndef CBMMCDATAARRAY_H
6 #define CBMMCDATAARRAY_H
7 
8 #include <Rtypes.h> // for THashConsistencyHolder, ClassDef
9 #include <RtypesCore.h> // for Int_t, Long64_t
10 #include <TString.h> // for TString
11 
12 #include <list> // for list
13 #include <map> // for map
14 #include <vector> // for vector
15 
16 #include "CbmLink.h" // for CbmLink
17 
18 class TChain;
19 class TClonesArray;
20 class TObject;
21 
36  friend class CbmMCDataManager;
37 
38 public:
40  virtual ~CbmMCDataArray() {}
41 
42 
47  TObject* Get(const CbmLink* lnk) {
48  return Get(lnk->GetFile(), lnk->GetEntry(), lnk->GetIndex());
49  }
50 
51 
56  TObject* Get(const CbmLink& lnk) {
57  return Get(lnk.GetFile(), lnk.GetEntry(), lnk.GetIndex());
58  }
59 
60 
67  TObject* Get(Int_t fileNumber, Int_t eventNumber, Int_t index);
68 
74  Int_t Size(Int_t fileNumber, Int_t eventNumber);
75 
80  Int_t Size(const CbmLink& lnk) { return Size(lnk.GetFile(), lnk.GetEntry()); }
81 
86  Int_t Size(const CbmLink* lnk) {
87  return Size(lnk->GetFile(), lnk->GetEntry());
88  }
89 
90 private:
93  : fLegacy(0)
94  , fLegacyArray(nullptr)
95  , fBranchName()
96  , fSize(0)
97  , fChains()
98  , fTArr()
99  , fN(0)
100  , fArrays() {}
101 
106  CbmMCDataArray(const char* branchName,
107  const std::vector<std::list<TString>>& fileList);
108 
112  CbmMCDataArray(const char* branchName);
113 
114 
117 
118 
120  void Done();
121 
122 
124  void FinishEvent();
125 
130  void AddFriend(Int_t chainNum1, Int_t chainNum2);
131 
132 
139  TObject* LegacyGet(Int_t fileNumber, Int_t eventNumber, Int_t index);
140 
141 
142  //---- Private data members -------
143  Int_t fLegacy;
144  TClonesArray* fLegacyArray;
145  TString fBranchName;
146  Int_t fSize;
147  std::vector<TChain*> fChains;
148  std::vector<TClonesArray*>
150  std::vector<Long64_t> fN;
151 
155  std::vector<std::map<Int_t, TClonesArray*>> fArrays;
156 
158 
160 };
161 
162 #endif
CbmMCDataArray::fArrays
std::vector< std::map< Int_t, TClonesArray * > > fArrays
Number of entries in chains.
Definition: CbmMCDataArray.h:155
CbmMCDataArray::Size
Int_t Size(const CbmLink *lnk)
Definition: CbmMCDataArray.h:86
CbmMCDataArray::Size
Int_t Size(const CbmLink &lnk)
Definition: CbmMCDataArray.h:80
CbmMCDataArray::Done
void Done()
Definition: CbmMCDataArray.cxx:169
CbmMCDataArray::LegacyGet
TObject * LegacyGet(Int_t fileNumber, Int_t eventNumber, Int_t index)
Definition: CbmMCDataArray.cxx:101
CbmMCDataArray::operator=
CbmMCDataArray & operator=(const CbmMCDataArray &)
CbmMCDataArray::Size
Int_t Size(Int_t fileNumber, Int_t eventNumber)
Definition: CbmMCDataArray.cxx:133
CbmMCDataArray::fLegacyArray
TClonesArray * fLegacyArray
If true, run in legacy mode.
Definition: CbmMCDataArray.h:144
CbmMCDataArray::CbmMCDataArray
CbmMCDataArray(const CbmMCDataArray &)
CbmMCDataArray::AddFriend
void AddFriend(Int_t chainNum1, Int_t chainNum2)
Definition: CbmMCDataArray.cxx:56
CbmMCDataArray
Access to a MC data branch for time-based analysis.
Definition: CbmMCDataArray.h:35
CbmMCDataArray::FinishEvent
void FinishEvent()
Definition: CbmMCDataArray.cxx:154
CbmMCDataArray::fLegacy
Int_t fLegacy
Definition: CbmMCDataArray.h:143
CbmMCDataArray::fTArr
std::vector< TClonesArray * > fTArr
Arrays of chains (one per input source)
Definition: CbmMCDataArray.h:149
CbmMCDataArray::fSize
Int_t fSize
Name of the data branch.
Definition: CbmMCDataArray.h:146
CbmMCDataArray::Get
TObject * Get(const CbmLink &lnk)
Definition: CbmMCDataArray.h:56
CbmMCDataArray::Get
TObject * Get(const CbmLink *lnk)
Definition: CbmMCDataArray.h:47
CbmMCDataArray::fBranchName
TString fBranchName
Pointer to TClonesArray for legacy mode.
Definition: CbmMCDataArray.h:145
CbmMCDataArray::CbmMCDataArray
CbmMCDataArray()
Definition: CbmMCDataArray.h:92
CbmMCDataArray::~CbmMCDataArray
virtual ~CbmMCDataArray()
Definition: CbmMCDataArray.h:40
CbmMCDataManager
Task class creating and managing CbmMCDataArray objects.
Definition: CbmMCDataManager.h:27
CbmMCDataArray::ClassDef
ClassDef(CbmMCDataArray, 1)
eventNumber
Int_t eventNumber
Definition: riplet/Lx.cxx:78
CbmMCDataArray::fChains
std::vector< TChain * > fChains
Number of input file lists (one per source)
Definition: CbmMCDataArray.h:147
CbmMCDataArray::fN
std::vector< Long64_t > fN
Data arrays from chains (one per input source)
Definition: CbmMCDataArray.h:150