Berkeley Nuclear Data Software
PostProcBase.h
Go to the documentation of this file.
1 #ifndef _POST_PROC_BASE_H_
2 #define _POST_PROC_BASE_H_
3 //started by Josh Brown (brown.ja1@gmail.com)
4 //july 2019
5 //project includes
6 #include "EZFileSystem.h"
7 //root includes
8 #include "TChain.h"
9 //c++ includes
10 #include <vector>
11 #include <string>
12 #include <iostream>
13 
14 using std::vector;
15 using std::string;
16 
19 template <class T>
21 {
22 public:
24  PostProcBase();
25 
30  virtual int addFile(string a_filename);
33  virtual int addFilesFromDirectory(string a_dir,
34  string a_ext
35  );
37  virtual int loadEvent(int a_eventNumber);
39  virtual int fileNotLoaded();
40 
43  virtual int clearFileState();
44  virtual std::ostream& printState(std::ostream& a_stream = std::cout);
45 
46  virtual ~PostProcBase();
47 
49  TChain* getTrees();
50 protected:
52  TChain* m_trees;
54  string m_treeName;
56  string m_branchName;
60  vector<string> m_loadedFiles;
61 
63  bool m_hasFile;
64 
66  virtual void setTreeName() = 0;
67 
69  virtual void setBranchName() = 0;
70 
71 };
72 //implementation of templated functions
73 #include "PostProcBase.hpp"
74 
75 #endif
Definition: PostProcBase.h:21
TChain * m_trees
for associating the trees from files
Definition: PostProcBase.h:52
string m_treeName
for storing the name of the tree
Definition: PostProcBase.h:54
virtual int addFilesFromDirectory(string a_dir, string a_ext)
Definition: PostProcBase.hpp:97
virtual void setTreeName()=0
enforces that a tree name function can be set in a child class
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
bool m_hasFile
flag for wheter a file has been loaded
Definition: PostProcBase.h:63
virtual int clearFileState()
Definition: PostProcBase.hpp:160
vector< string > m_loadedFiles
for storing a list of loaded files
Definition: PostProcBase.h:60
virtual std::ostream & printState(std::ostream &a_stream=std::cout)
Definition: PostProcBase.hpp:135
string m_branchName
for storing the name of the branch
Definition: PostProcBase.h:56
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
T * m_currentEvent
for storing the current event
Definition: PostProcBase.h:58
virtual int addFile(string a_filename)
Definition: PostProcBase.hpp:30
virtual void setBranchName()=0
enforces that a branch name function can be set in a child class