28 std::vector<const TreeAccessor*> accessors;
29 for (
const TString& fileName :
files) {
32 cout <<
"Skipping invalid file " << fileName << endl;
38 if (accessors.empty())
return nullptr;
45 std::ifstream f(fileList);
47 cout <<
"file " << fileList <<
" not accessible" << endl;
54 std::vector<const TreeAccessor*> accessors;
56 while (f >> fileName) {
59 cout <<
"Skipping invalid file " << fileName << endl;
62 cout << std::setw(2) << ++i <<
" - " << fileName << endl;
66 if (accessors.empty())
return nullptr;
77 std::vector<const TreeAccessor*> accessors;
79 for (
int i = 0; i < chain.GetListOfFiles()->
GetEntries(); i++) {
80 std::string fileName = chain.GetListOfFiles()->At(i)->GetTitle();
83 cout <<
"Skipping invalid file " << fileName << endl;
86 cout << std::setw(2) << i+1 <<
" - " << fileName <<
" , nEvents = " <<
accessor->nEvents() <<
", nRuns = " <<
accessor->nRuns() << endl;
90 if (accessors.empty())
return nullptr;
104 unsigned int nEventsSoFar = 0;
106 unsigned int n =
accessor->nEvents();
107 if (i < nEventsSoFar + n)
return accessor->eventData(i - nEventsSoFar);
116 unsigned int nRunsSoFar = 0;
119 if (i < nRunsSoFar + n)
return accessor->runData(i - nRunsSoFar);
147 unsigned int size = 0;
158 unsigned int size = 0;
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;
180 for (
const EventData* event : thisEventData) {
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));
204 std::unique_ptr<CellInfo>
cellInfo{};
205 std::vector<const Data*> allData;
206 std::vector<const EventData*> allEventData;
211 if (!thisHistory)
continue;
217 const std::vector<const EventData*>& thisEventData = thisHistory->
eventData();
218 std::map<const EventData*, const EventData*> eventMap;
219 for (
const EventData* event : thisEventData) {
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));
258 std::vector<const Accessor*> accessors;
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;
304 for (
unsigned int f = 0; f < filteredAccessors.size(); f++)
result.push_back(
new MultiTreeAccessor(filteredAccessors[f]));
TGraphErrors * GetEntries(TH2F *histo)
virtual void resetCache() const
virtual const CellInfo * cellInfo(unsigned int i) const
const ShapeInfo * shape(CaloGain::CaloGain gain) const
const EventData * eventData() const
CaloGain::CaloGain gain() const
void add(const FilterParams ¶ms, const TString &fileName)
unsigned int size() const
const FilterParams & filterParams(unsigned int i) const
const TString & fileName(unsigned int i) const
const CellInfo * cellInfo() const
unsigned int nDataContainers() const
const std::vector< const EventData * > & eventData() const
const CellInfo * cellInfo() const
const Data * data(unsigned int i) const
unsigned int nData() const
unsigned int nEvents() const
static MultiTreeAccessor * openList(const TString &fileList)
unsigned int historySize(unsigned int i) const
const History * getSCHistory(unsigned int i) const
const EventData * eventData(unsigned int i) const
unsigned int historySizeSC(unsigned int i) const
std::vector< MultiTreeAccessor * > filterComponents(const FilterList &filterList, const DataTweaker &tweaker) const
unsigned int nRuns() const
unsigned int nAccessors() const
const History * getCellHistory(unsigned int i) const
MultiTreeAccessor(const std::vector< const TreeAccessor * > &accessors)
Constructor.
const TreeAccessor & accessor(unsigned int i) const
const RunData * runData(unsigned int i) const
std::vector< const TreeAccessor * > m_accessors
const CellInfo * getCellInfo(unsigned int i) const
virtual ~MultiTreeAccessor()
bool writeToFile(const TString &fileName) const
static MultiTreeAccessor * open(const std::vector< TString > &files)
static MultiTreeAccessor * openWild(const TString &wcName)
static TreeAccessor * filter(const Accessor &accessor, const FilterParams &filterParams, const TString &fileName, const DataTweaker &tweaker)
static TreeAccessor * merge(const std::vector< const Accessor * > &accessors, const TString &fileName="")
static TreeAccessor * open(const TString &fileName)
std::vector< std::string > files
file names and file pointers