15 using std::stringstream;
24 m_currentEvent(nullptr),
33 auto testIt = std::find(m_loadedFiles.begin(),m_loadedFiles.end(),a_filename);
35 if(testIt == m_loadedFiles.end())
40 int success = m_trees->AddFile(a_filename.c_str(),-1);
43 cout <<
"Adding an additional file to the TChain failed";
44 cout <<
" returning without doing anyting " << endl;
50 m_loadedFiles.push_back(a_filename);
60 cout <<
"creating event memory";
61 m_currentEvent =
new T();
62 cout <<
" and tchain";
63 m_trees =
new TChain(m_treeName.c_str());
64 cout <<
" with succes";
66 int success = m_trees->Add(a_filename.c_str(),-1);
69 cout <<
"Adding the first file to the TChain failed";
70 cout <<
" returning without doing anyting " << endl;
75 cout <<
"associating branch address";
76 m_trees->SetBranchAddress(m_branchName.c_str(),&m_currentEvent);
77 cout <<
" with sucess" << endl;
79 m_loadedFiles.push_back(a_filename);
87 cout <<
"Attempt to load an already loaded file. Was this intentional";
92 cout <<
"oddly reached end of add file without a hitting a return" <<endl;
101 std::vector<std::string> files;
103 std::cout <<
"Adding " << files.size() <<
" files";
104 std::cout << std::endl;
105 for(
auto && file : files)
120 m_trees->GetEntry(a_eventNumber);
128 cout <<
"no file to test is loaded" <<endl;
137 a_stream <<
"PostProcBase ";
140 a_stream <<
" has " << m_loadedFiles.size() <<
" file present";
141 a_stream << std::endl;
142 a_stream <<
"Files: ";
143 for(
auto & file : m_loadedFiles)
145 a_stream << file <<
", ";
147 a_stream << std::endl;
151 a_stream <<
" doesn't have any files loaded and won't be particularly";
152 a_stream <<
" useful" << std::endl;
165 delete m_currentEvent;
166 m_loadedFiles.clear();
172 std::cout <<
"I haven't loaded a file so clearing state is meaningless";
173 std::cout << std::endl;
181 delete m_currentEvent;
static std::vector< std::string > getFileListWithExt(std::string a_directory, std::string a_ext)
Definition: EZFileSystem.cpp:38
virtual int addFilesFromDirectory(string a_dir, string a_ext)
Definition: PostProcBase.hpp:97
PostProcBase()
defualt constructor puts class into a working state
Definition: PostProcBase.hpp:19
virtual int loadEvent(int a_eventNumber)
loads a specified event into memory
Definition: PostProcBase.hpp:114
virtual int clearFileState()
Definition: PostProcBase.hpp:160
virtual std::ostream & printState(std::ostream &a_stream=std::cout)
Definition: PostProcBase.hpp:135
virtual int fileNotLoaded()
tests if a file is loaded and prinst a message if not
Definition: PostProcBase.hpp:124
TChain * getTrees()
danger danger, use this if you know what you are doing.
Definition: PostProcBase.hpp:186
virtual ~PostProcBase()
Definition: PostProcBase.hpp:179
virtual int addFile(string a_filename)
Definition: PostProcBase.hpp:30