QGFileHandler.hh

Go to the documentation of this file.
00001 #ifndef _QG_FILE_HANDLER_HH_
00002 #define _QG_FILE_HANDLER_HH_
00003 
00011 #include <map>
00012 #include <set>
00013 #include <string>
00014 
00015 #ifndef WIN32
00016     #include <time.h>
00017 #endif
00018 
00019 #include <vector>
00020 #include "QSampleInfoR.hh"
00021 #include "QVectorR.hh"
00022 #include <TCut.h>
00023 #include <TEventList.h>
00024 
00025 class QBaseEventR;
00026 class QChain;
00027 class QRunDataR;
00028 class TFile;
00029 
00030 class QGFileHandler { 
00031 public: 
00033     QGFileHandler(); 
00034 
00036     virtual ~QGFileHandler();
00037     
00039     bool CheckForModifiedFiles();
00040     
00042     void CloseFiles();
00043     
00045     const QBaseEventR *GetEvent(const Long64_t eventNumber);
00046     
00048     TEventList GetEventList(TCut cuts);
00049     
00051     std::vector<std::string> GetFilenames() {return fFilenames;}
00052     
00054     const QSampleInfoR& GetMasterSample(const Long64_t eventNumber);
00055     
00057     const QVectorR& GetPulse(const Long64_t eventNumber);
00058     
00060     const QRunDataR* GetRunData(const Long64_t eventNumber);
00061     
00063     QChain *GetQChain() {return fQChain;}
00064     
00066     std::set<std::string> GetSetOfAliases();
00067     
00069     std::set<std::string> GetSetOfLeaves();
00070     
00072     const std::vector<QSampleInfoR>& GetSignificantSamples(const Long64_t eventNumber);
00073     
00075     std::string GetTreeClass() {return fTreeClass;}
00076     
00078     bool IsFileOpen() {return fFileOpen;}
00079     
00081     void ListOpenFiles();
00082     
00084     void OpenFile();
00085 
00087     void OpenFile(std::string filename);
00088     
00090     void OpenFiles(const std::vector<std::string>& files);
00091     
00093     void ParseFileList(const std::string& filename);
00094     
00095 protected:
00096 
00097 #ifndef WIN32
00098 
00099     time_t ModificationTime(const std::string& filename);
00100 #else
00101     int ModificationTime(const std::string& filename)
00102         {return 0;}
00103 #endif
00104 
00106     void ReopenFiles();
00107     
00109     void SetLowestStartTimeUnix(const std::string& treeName);
00110     
00112     void SetUpChain();
00113     
00115     void SetUpNumericTypes();
00116     
00118     std::string fDataDirectory;
00119     
00121     TEventList fEventList;
00122     
00124     TFile *fFile;
00125     
00127     std::vector<std::string> fFilenames;
00128     
00130     bool fFileOpen;
00131 
00133     double fLowestStartTimeUnix;
00134 
00135 #ifndef WIN32
00136 
00137     std::map<std::string, time_t> fModificationTime;
00138 #else
00139     std::map<std::string, int> fModificationTime;
00140 #endif
00141     
00143     std::set<std::string> fNumericTypes;
00144     
00146     QVectorR fPulse;
00147     
00149     QBaseEventR *fQBaseEvent;
00150 
00152     QChain *fQChain;
00153 
00155     std::string fTreeClass;
00156     
00157     ClassDef(QGFileHandler, 0)
00158 };
00159 
00160 #endif

Generated on Tue Nov 16 10:49:56 2010 for CUORE Software by  doxygen 1.5.6