CbmRoot
Loading...
Searching...
No Matches
CbmMCDataArray.h
Go to the documentation of this file.
1/* Copyright (C) 2015-2020 GSI Helmholtzzentrum fuer Schwerionenforschung, Darmstadt
2 SPDX-License-Identifier: GPL-3.0-only
3 Authors: Mikhail Prokudin, Volker Friese [committer], Florian Uhlig */
4
9#ifndef CBMMCDATAARRAY_H
10#define CBMMCDATAARRAY_H
11
12#include "CbmLink.h" // for CbmLink
13
14#include <Rtypes.h> // for THashConsistencyHolder, ClassDef
15#include <RtypesCore.h> // for Int_t, Long64_t
16#include <TString.h> // for TString
17
18#include <list> // for list
19#include <map> // for map
20#include <vector> // for vector
21
22class TChain;
23class TClonesArray;
24class TObject;
25
40 friend class CbmMCDataManager;
41
42public:
44 virtual ~CbmMCDataArray() {}
45
46
51 TObject* Get(const CbmLink* lnk) { return Get(lnk->GetFile(), lnk->GetEntry(), lnk->GetIndex()); }
52
53
58 TObject* Get(const CbmLink& lnk) { return Get(lnk.GetFile(), lnk.GetEntry(), lnk.GetIndex()); }
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) { return Size(lnk->GetFile(), lnk->GetEntry()); }
87
88private:
90 CbmMCDataArray() : fLegacy(0), fLegacyArray(nullptr), fBranchName(), fSize(0), fChains(), fTArr(), fN(0), fArrays() {}
91
96 CbmMCDataArray(const char* branchName, const std::vector<std::list<TString>>& fileList);
97
101 CbmMCDataArray(const char* branchName);
102
103
106
107
109 void Done();
110
111
113 void FinishEvent();
114
119 void AddFriend(Int_t chainNum1, Int_t chainNum2);
120
121
128 TObject* LegacyGet(Int_t fileNumber, Int_t eventNumber, Int_t index);
129
130
131 //---- Private data members -------
132 Int_t fLegacy;
133 TClonesArray* fLegacyArray;
134 TString fBranchName;
135 Int_t fSize;
136 std::vector<TChain*> fChains;
137 std::vector<TClonesArray*> fTArr;
138 std::vector<Long64_t> fN;
139
143 std::vector<std::map<Int_t, TClonesArray*>> fArrays;
144
146
148};
149
150#endif
Access to a MC data branch for time-based analysis.
TObject * Get(const CbmLink *lnk)
CbmMCDataArray(const CbmMCDataArray &)
TObject * LegacyGet(Int_t fileNumber, Int_t eventNumber, Int_t index)
std::vector< std::map< Int_t, TClonesArray * > > fArrays
Number of entries in chains.
Int_t Size(const CbmLink &lnk)
virtual ~CbmMCDataArray()
TObject * Get(const CbmLink &lnk)
Int_t fSize
Name of the data branch.
TString fBranchName
Pointer to TClonesArray for legacy mode.
ClassDef(CbmMCDataArray, 1)
std::vector< TChain * > fChains
Number of input file lists (one per source)
Int_t Size(Int_t fileNumber, Int_t eventNumber)
std::vector< Long64_t > fN
Data arrays from chains (one per input source)
CbmMCDataArray & operator=(const CbmMCDataArray &)
void AddFriend(Int_t chainNum1, Int_t chainNum2)
std::vector< TClonesArray * > fTArr
Arrays of chains (one per input source)
Int_t Size(const CbmLink *lnk)
TClonesArray * fLegacyArray
If true, run in legacy mode.
Task class creating and managing CbmMCDataArray objects.