Base class to loop over all the keys in several ROOT files.
More...
#include <TMultiFileLooper.h>
Base class to loop over all the keys in several ROOT files.
- Author
- Frank Winklmeier
Same as TFileLooper but can loop over multiple ROOT files.
Definition at line 28 of file TMultiFileLooper.h.
◆ TMultiFileLooper()
| TMultiFileLooper::TMultiFileLooper |
( |
| ) |
|
|
inline |
◆ ~TMultiFileLooper()
| virtual TMultiFileLooper::~TMultiFileLooper |
( |
| ) |
|
|
virtualdefault |
◆ addFailRegexp()
| void TFileLooper::addFailRegexp |
( |
const char * | regexp | ) |
|
|
inherited |
Skip keys that match this regexp.
Definition at line 160 of file TFileLooper.cxx.
161{
162 if (regexp) {
164 }
165}
std::vector< TPRegexp > m_failRE
◆ addFile()
| void TMultiFileLooper::addFile |
( |
const char * | filename | ) |
|
◆ addPassRegexp()
| void TFileLooper::addPassRegexp |
( |
const char * | regexp | ) |
|
|
inherited |
Never skip keys that match this regexp.
Definition at line 169 of file TFileLooper.cxx.
170{
171 if (regexp) {
173 }
174}
std::vector< TPRegexp > m_passRE
◆ afterDir()
| virtual void TFileLooper::afterDir |
( |
| ) |
|
|
inlinevirtualinherited |
◆ afterFile()
| virtual void TFileLooper::afterFile |
( |
| ) |
|
|
inlinevirtualinherited |
◆ afterObj()
| virtual void TFileLooper::afterObj |
( |
| ) |
|
|
inlinevirtualinherited |
◆ beforeDir()
| virtual void TFileLooper::beforeDir |
( |
| ) |
|
|
inlinevirtualinherited |
◆ beforeFile()
| virtual void TFileLooper::beforeFile |
( |
| ) |
|
|
inlinevirtualinherited |
◆ beforeObj()
| virtual void TFileLooper::beforeObj |
( |
| ) |
|
|
inlinevirtualinherited |
◆ beginJob()
| virtual void TFileLooper::beginJob |
( |
| ) |
|
|
inlinevirtualinherited |
◆ endJob()
| virtual void TFileLooper::endJob |
( |
| ) |
|
|
inlinevirtualinherited |
◆ file()
| const TFile * TFileLooper::file |
( |
| ) |
const |
|
inlineinherited |
◆ getDrawOptions()
| TString TFileLooper::getDrawOptions |
( |
const TH1 & | h | ) |
|
|
protectedinherited |
◆ getKeyPath()
| TString TFileLooper::getKeyPath |
( |
const TDirectory & | dir, |
|
|
const TKey & | key ) |
|
protectedinherited |
Definition at line 188 of file TFileLooper.cxx.
189{
190 TString
s(
dir.GetPath()+TString(
"/")+
key.GetName());
191
192 s.Replace(0,
s.First(
":")+2,0);
193
195}
◆ getPathFromDir()
| TString TFileLooper::getPathFromDir |
( |
const TDirectory & | dir | ) |
|
|
protectedinherited |
Definition at line 178 of file TFileLooper.cxx.
179{
180 TString
s(
dir.GetPath());
181 if (
s.Index(
"../")==0)
s.Remove(0,3);
182 s.ReplaceAll(
":",
"");
184}
◆ passBeforeFailRegexp()
| void TFileLooper::passBeforeFailRegexp |
( |
Bool_t | passBeforeFail = kTRUE | ) |
|
|
inlineinherited |
Reverse pass/fail logic. First check on pass then on fail.
Definition at line 74 of file TFileLooper.h.
◆ processDir()
| void TFileLooper::processDir |
( |
TDirectory & | dir | ) |
|
|
protectedinherited |
Definition at line 73 of file TFileLooper.cxx.
74{
76
78 cout <<
"Skipping " <<
s << endl;
79 return;
80 }
81
82 if (
m_verbose) cout <<
"Reading directory "<<
dir.GetPath() << endl;
83
84
85 TList* dirList =
dir.GetListOfKeys();
86 dirList->Sort();
87
90 while ((key = (TKey*)
next())) {
91
92
93 TString className(
key->GetClassName());
94 if (className=="TDirectoryFile" || className=="TDirectory") {
99 }
100 else {
103 continue;
104 }
106 }
107 }
108}
std::vector< std::string > m_skippedObjects
void processDir(TDirectory &dir)
TString getKeyPath(const TDirectory &dir, const TKey &key)
Bool_t skipObject(const char *name)
Bool_t skipDir(const TDirectory &dir)
TString getPathFromDir(const TDirectory &dir)
virtual void processKey(TDirectory &dir, TKey &key)
Method called for every key.
◆ processFile()
| void TFileLooper::processFile |
( |
const char * | filename, |
|
|
const char * | rootDir = 0 ) |
|
protectedinherited |
Definition at line 44 of file TFileLooper.cxx.
45{
46 m_file =
new TFile(filename);
48 cout <<
"Cannot open "<<
filename << endl;
51 return;
52 }
53
56 cout <<
"Cannot change to directory " <<
rootDir << endl;
58 return;
59 }
61 }
63
67
69}
TString rootDir() const
Current directory.
virtual void beforeFile()
◆ processKey()
| void TFileLooper::processKey |
( |
TDirectory & | dir, |
|
|
TKey & | key ) |
|
virtualinherited |
Method called for every key.
Only dummy implementation. Needs to be implemented in derived classes.
Reimplemented in TRootCompare.
Definition at line 110 of file TFileLooper.cxx.
111{
112 cout <<
"--- processKey: " <<
key.GetName()
113 <<
" in directory " <<
dir.GetPath() << endl;
114}
◆ rootDir()
| TString TFileLooper::rootDir |
( |
| ) |
const |
|
inlineinherited |
◆ run() [1/2]
| Int_t TMultiFileLooper::run |
( |
| ) |
|
Definition at line 48 of file TMultiFileLooper.cxx.
49{
52
53 vector<TString>::iterator
iter;
56 }
57
60}
void processFile(const char *filename, const char *rootDir=0)
◆ run() [2/2]
| Int_t TMultiFileLooper::run |
( |
const char * | filename, |
|
|
const char * | rootDir = 0 ) |
|
virtual |
Start processing.
Reimplemented from TFileLooper.
Definition at line 20 of file TMultiFileLooper.cxx.
21{
23
24 if (fileListName==0) {
25 cout << "Invalid file list (0)" << endl;
28 }
29
30 ifstream ifs;
31 ifs.open(fileListName);
32 if (!ifs) {
33 cout << "Cannot open file " << fileListName << endl;
36 }
37
38 while (!ifs.eof()) {
42 }
43
45}
void addFile(const char *filename)
◆ setDirsToSkip()
| void TFileLooper::setDirsToSkip |
( |
const char * | skipDirs | ) |
|
|
inlineinherited |
Skip this comma separated list of directories.
Definition at line 65 of file TFileLooper.h.
◆ setVerbose()
| void TFileLooper::setVerbose |
( |
Bool_t | verbose = kTRUE | ) |
|
|
inlineinherited |
Set verbose mode.
Definition at line 77 of file TFileLooper.h.
Bool_t verbose() const
Query verbose mode.
◆ skipDir()
| Bool_t TFileLooper::skipDir |
( |
const TDirectory & | dir | ) |
|
|
protectedinherited |
◆ skipObject()
| Bool_t TFileLooper::skipObject |
( |
const char * | name | ) |
|
|
protectedinherited |
Definition at line 129 of file TFileLooper.cxx.
130{
131 Bool_t failMatch(kFALSE);
132 Bool_t passMatch(kFALSE);
133
135 if (
re.Match(name)>0) {
136 failMatch = kTRUE;
137 break;
138 }
139 }
140
141
143 if (
re.Match(name)>0) {
144 passMatch = kTRUE;
145 break;
146 }
147 }
148
151 else result = (failMatch && !passMatch);
152
153 if (
m_verbose && result) cout <<
"Skipping " <<
name << endl;
155
156}
const boost::regex re(r_e)
◆ verbose()
| Bool_t TFileLooper::verbose |
( |
| ) |
const |
|
inlineinherited |
◆ m_errorCode
| Int_t TFileLooper::m_errorCode {0} |
|
protectedinherited |
◆ m_failRE
| std::vector<TPRegexp> TFileLooper::m_failRE |
|
protectedinherited |
◆ m_file
| TFile* TFileLooper::m_file {nullptr} |
|
protectedinherited |
◆ m_fileList
| std::vector<TString> TMultiFileLooper::m_fileList |
|
private |
◆ m_passBeforeFail
| Bool_t TFileLooper::m_passBeforeFail {kFALSE} |
|
protectedinherited |
◆ m_passRE
| std::vector<TPRegexp> TFileLooper::m_passRE |
|
protectedinherited |
◆ m_rootDir
| TString TFileLooper::m_rootDir |
|
protectedinherited |
◆ m_skipDirs
| TString TFileLooper::m_skipDirs |
|
protectedinherited |
◆ m_skippedObjects
| std::vector<std::string> TFileLooper::m_skippedObjects |
|
protectedinherited |
◆ m_verbose
| Bool_t TFileLooper::m_verbose {kFALSE} |
|
protectedinherited |
The documentation for this class was generated from the following files: