28 std::vector<const TreeAccessor*>
accessors;
32 cout <<
"Skipping invalid file " <<
fileName << endl;
47 cout <<
"file " <<
fileList <<
" not accessible" << endl;
54 std::vector<const TreeAccessor*>
accessors;
59 cout <<
"Skipping invalid file " <<
fileName << endl;
62 cout << std::setw(2) << ++
i <<
" - " <<
fileName << endl;
77 std::vector<const TreeAccessor*>
accessors;
83 cout <<
"Skipping invalid file " <<
fileName << endl;
86 cout << std::setw(2) <<
i+1 <<
" - " <<
fileName <<
" , nEvents = " <<
accessor->nEvents() <<
", nRuns = " <<
accessor->nRuns() << endl;
95 MultiTreeAccessor::~MultiTreeAccessor()
102 const EventData* MultiTreeAccessor::eventData(
unsigned int i)
const
104 unsigned int nEventsSoFar = 0;
107 if (
i < nEventsSoFar +
n)
return accessor->eventData(
i - nEventsSoFar);
114 const RunData* MultiTreeAccessor::runData(
unsigned int i)
const
116 unsigned int nRunsSoFar = 0;
119 if (
i < nRunsSoFar +
n)
return accessor->runData(
i - nRunsSoFar);
135 unsigned int MultiTreeAccessor::nRuns()
const
144 unsigned int MultiTreeAccessor::historySize(
unsigned int i)
const
147 unsigned int size = 0;
155 unsigned int MultiTreeAccessor::historySizeSC(
unsigned int i)
const
158 unsigned int size = 0;
167 const History* MultiTreeAccessor::getCellHistory(
unsigned int i)
const
170 std::vector<const Data*> allData;
171 std::vector<const EventData*> allEventData;
174 if (!thisHistory)
continue;
178 const std::vector<const EventData*>& thisEventData = thisHistory->
eventData();
179 std::map<const EventData*, const EventData*> eventMap;
181 if (eventMap.find(
event) != eventMap.end())
continue;
183 eventMap[
event] = newED;
184 allEventData.push_back(newED);
187 for (
unsigned int j = 0; j < thisHistory->
nData(); j++) {
188 allData.push_back(
new Data(*thisHistory->
data(j), eventMap[thisHistory->
data(j)->
eventData()],
nullptr, -1));
197 auto *
h = cellInfo ?
new History(allData, *cellInfo, allEventData,
i):
nullptr;
202 const History* MultiTreeAccessor::getSCHistory(
unsigned int i)
const
204 std::unique_ptr<CellInfo> cellInfo{};
205 std::vector<const Data*> allData;
206 std::vector<const EventData*> allEventData;
211 if (!thisHistory)
continue;
213 cellInfo = std::make_unique<CellInfo>(*thisHistory->
cellInfo());
217 const std::vector<const EventData*>& thisEventData = thisHistory->
eventData();
218 std::map<const EventData*, const EventData*> eventMap;
220 if (eventMap.find(
event) != eventMap.end())
continue;
222 eventMap[
event] = newED;
223 allEventData.push_back(newED);
227 for (
unsigned int ii = 0; ii < thisHistory->
nData(); ii++) {
229 allData.push_back(
new Data(*thisHistory->
data(ii), eventMap[thisHistory->
data(ii)->
eventData()],
nullptr, -1));
231 if (!cellInfo->shape(thisHistory->
data(ii)->
gain())) {
233 cellInfo->setShape(thisHistory->
data(ii)->
gain(), thisShape ?
new ShapeInfo(*thisShape) :
nullptr);
241 return (cellInfo ?
new History(allData, *cellInfo, allEventData,
i) :
nullptr);
245 const CellInfo* MultiTreeAccessor::getCellInfo(
unsigned int i)
const
259 for (
unsigned int i = 0;
i < m_accessors.size();
i++)
261 cout <<
"Merging data..." << endl;
263 if (!singleContainer)
return false;
264 delete singleContainer;
271 std::vector< std::vector<const TreeAccessor*> > filteredAccessors(filterList.
size());
273 for (
unsigned int i = 0;
i < nAccessors();
i++) {
275 cout <<
"Processing data " <<
i <<
" of " << nAccessors();
276 if (treeAcc) cout <<
" (fileName = " << treeAcc->
fileName() <<
")";
280 for (
unsigned int f = 0;
f < filterList.
size();
f++) {
281 std::string pathname = (string)filterList.
fileName(
f);
282 if( pathname.find(
"eos/atlas/") < pathname.length() ){
283 int nslashes = 0, slpos = 0;
284 for(
int k1 = 0; k1 < (
int)pathname.length(); k1++ ){
285 if( nslashes > 2 )
break;
286 if( pathname[k1] !=
'/' )
continue;
290 pathname.resize( slpos );
292 TString thisFN = Form(
"%s_filter%d.root", pathname.c_str(),
i );
296 if (filteredTreeAccs.size() != filterList.
size()) {
297 cout <<
"Filtering failed, exiting" << endl;
298 return std::vector<MultiTreeAccessor*>();
300 for (
unsigned int f = 0;
f < filteredTreeAccs.size();
f++) filteredAccessors[
f].push_back(filteredTreeAccs[
f]);
303 std::vector<MultiTreeAccessor*>
result;