6 #include <FairLogger.h>
7 #include <FairRootManager.h>
10 #include <TClonesArray.h>
20 const std::vector<std::list<TString>>& fileList)
22 , fLegacyArray(nullptr)
23 , fBranchName(branchname)
29 list<TString>::const_iterator p;
31 Int_t s = fileList.size();
38 for (
i = 0;
i < s;
i++) {
42 if (fileList[
i].size() == 0)
continue;
44 for (p = fileList[
i].begin(); p != fileList[
i].end(); ++p)
51 for (
i = 0;
i < s;
i++)
58 LOG(error) <<
"AddFriend method should not be called in legacy mode";
61 if (chainNum1 < 0 || chainNum1 >=
static_cast<Int_t
>(
fChains.size())
62 ||
fChains[chainNum1] ==
nullptr) {
63 LOG(error) <<
"chainNum1=" << chainNum1
64 <<
" is not a correct chain number.";
67 if (chainNum2 < 0 || chainNum2 >=
static_cast<Int_t
>(
fChains.size())
68 ||
fChains[chainNum2] ==
nullptr) {
69 LOG(error) <<
"chainNum2=" << chainNum2
70 <<
" is not a correct chain number.";
79 , fLegacyArray(nullptr)
80 , fBranchName(branchname)
86 FairRootManager* fManager = FairRootManager::Instance();
88 LOG(fatal) <<
"CbmMCDataArray(): Can't find a Root Manager.";
91 fLegacyArray = (TClonesArray*) fManager->GetObject(branchname);
93 LOG(fatal) <<
"CbmMCDataArray(): Can't find " <<
fBranchName
103 LOG(debug1) <<
"LegacyGet: Trying to get object with fileNum="
105 <<
" in legacy mode.";
106 if (index < 0)
return 0;
114 if (fileNumber < 0 || fileNumber >=
fSize)
return nullptr;
115 if (eventNumber < 0 || eventNumber >=
fN[fileNumber])
return nullptr;
116 if (index < 0)
return nullptr;
119 map<Int_t, TClonesArray*>& arr =
fArrays[fileNumber];
125 TChain* ch =
fChains[fileNumber];
135 if (fileNumber < 0 || fileNumber >=
fSize)
return -1111;
136 if (eventNumber < 0 || eventNumber >=
fN[fileNumber])
return -1111;
139 map<Int_t, TClonesArray*>& arr =
fArrays[fileNumber];
146 TChain* ch =
fChains[fileNumber];
149 return fTArr[fileNumber]->GetEntriesFast();
158 map<Int_t, TClonesArray*>::const_iterator p;