10#include <FairRootManager.h>
23 , fLegacyObject(nullptr)
24 , fBranchName(branchname)
31 list<TString>::const_iterator p;
33 Int_t s = fileList.size();
40 for (i = 0; i < s; i++) {
44 if (fileList[i].
size() == 0)
continue;
45 fChains[i] =
new TChain(
"cbmsim");
46 for (p = fileList[i].begin(); p != fileList[i].end(); ++p)
53 for (i = 0; i < s; i++)
61 LOG(error) <<
"AddFriend method should not be called in legacy mode";
64 if (chainNum1 < 0 || chainNum1 >=
static_cast<Int_t
>(
fChains.size()) ||
fChains[chainNum1] ==
nullptr) {
65 LOG(error) <<
"chainNum1=" << chainNum1 <<
" is not a correct chain number.";
68 if (chainNum2 < 0 || chainNum2 >=
static_cast<Int_t
>(
fChains.size()) ||
fChains[chainNum2] ==
nullptr) {
69 LOG(error) <<
"chainNum2=" << chainNum2 <<
" is not a correct chain number.";
78 , fLegacyObject(nullptr)
79 , fBranchName(branchname)
86 FairRootManager* fManager = FairRootManager::Instance();
88 LOG(fatal) <<
"CbmMCDataObject(): Can't find a Root Manager.";
93 LOG(fatal) <<
"CbmMCDataObject(): Can't find " <<
fBranchName <<
" in the system.";
101 if (fileNumber >= 0 || eventNumber >= 0)
102 LOG(debug1) <<
"LegacyGet: Trying to get object with fileNum=" << fileNumber <<
", entryNum=" << eventNumber
103 <<
" in legacy mode.";
113 if (fileNumber < 0 || fileNumber >=
fSize)
return nullptr;
114 if (eventNumber < 0 || eventNumber >=
fN[fileNumber])
return nullptr;
117 map<Int_t, TObject*>& arr =
fArrays[fileNumber];
120 if (arr.find(eventNumber) != arr.end())
return arr[eventNumber];
123 TChain* ch =
fChains[fileNumber];
124 ch->GetEntry(eventNumber);
126 arr[eventNumber] =
fTArr[fileNumber]->Clone();
128 return arr[eventNumber];
137 map<Int_t, TObject*>::const_iterator p;
139 for (i = 0; i <
fSize; i++) {
154 for (i = 0; i <
fSize; i++)
ClassImp(CbmConverterManager)
static constexpr size_t size()
Access to a MC data branch for time-based analysis.
void AddFriend(Int_t chainNum1, Int_t chainNum2)
TObject * Get(const CbmLink *lnk)
TObject * LegacyGet(Int_t fileNumber, Int_t eventNumber)
std::vector< TObject * > fTArr
Arrays of chains (one per input source)
TString fBranchName
Pointer to TObject for legacy mode.
std::vector< TChain * > fChains
Number of input file lists (one per source)
Int_t fSize
Name of the data branch.
std::vector< std::map< Int_t, TObject * > > fArrays
Number of entries in chains.
std::vector< Long64_t > fN
Data objects from chains (one per input source)
TObject * fLegacyObject
If true, run in legacy mode.