ATLAS Offline Software
Loading...
Searching...
No Matches
TMultiFileLooper.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration
3*/
4
12
14#include "TString.h"
15
16#include <iostream>
17
18using namespace std;
19
20Int_t TMultiFileLooper::run(const char* fileListName, const char* /*rootDir*/)
21{
22 m_errorCode = 0;
23
24 if (fileListName==0) {
25 cout << "Invalid file list (0)" << endl;
26 m_errorCode = 1;
27 return m_errorCode;
28 }
29
30 ifstream ifs;
31 ifs.open(fileListName);
32 if (!ifs) {
33 cout << "Cannot open file " << fileListName << endl;
34 m_errorCode = 1;
35 return m_errorCode;
36 }
37
38 while (!ifs.eof()) {
39 string filename;
40 ifs >> filename;
41 if (filename!="") addFile(filename.c_str());
42 }
43
44 return run();
45}
46
47
49{
50 m_errorCode = 0;
51 beginJob();
52
53 vector<TString>::iterator iter;
54 for (iter=m_fileList.begin(); iter!=m_fileList.end(); ++iter) {
55 processFile(*iter);
56 }
57
58 endJob();
59 return m_errorCode;
60}
61
62void TMultiFileLooper::addFile(const char*filename)
63{
64 if (filename) m_fileList.push_back(TString(filename));
65}
TMultiFileLooper class.
virtual void beginJob()
Definition TFileLooper.h:54
virtual void endJob()
Definition TFileLooper.h:55
Int_t m_errorCode
Definition TFileLooper.h:94
void processFile(const char *filename, const char *rootDir=0)
std::vector< TString > m_fileList
void addFile(const char *filename)
STL namespace.