/home/bes3soft/bes3soft/Boss/7.0.2/dist/7.0.2/Event/RootCnvSvc/RootCnvSvc-02-01-12/RootCnvSvc/RootInterface.h

Go to the documentation of this file.
00001 #ifndef ROOTINTERFACE_H
00002 #define ROOTINTERFACE_H
00003 /*
00004  *Description:Interface for all Root I/O needed by the RootCnvSvc
00005  *Based on the RootInterface of Glast.
00006  */
00007 #include "TObject.h"
00008 #include <vector>
00009 #include "GaudiKernel/MsgStream.h"
00010 #include "GaudiKernel/IService.h"
00012 
00013 class TTree;
00014 class TClonesArray;
00015 class TFile;
00016 class TList;
00017 
00018 
00019 class RootInterface {
00020 
00021  public:
00022 
00023   RootInterface (MsgStream log);
00024   virtual  ~RootInterface();
00025   virtual   StatusCode finalize();
00026 
00028 static  RootInterface* Instance(MsgStream log); 
00030  virtual bool checkEndOfTree();
00031  virtual bool getENDFILE(){ return m_ENDFILE;}
00033  virtual StatusCode addInput(const std::string& treename,const std::string& file);
00035   virtual StatusCode addOutput(const std::string& treename,const std::string& file,int splitx, int bufsize, int compression);
00037   virtual StatusCode createBranch(const std::string& tree,const std::string& branch ,const char *classname,void *addr,int & branchnr);
00038   
00040   virtual StatusCode setBranchAddress(const std::string treename, const std::string branchname, void *addr,int& nb);
00042   virtual StatusCode getBranchEntry( int nr, int entry,int& nb);
00043   
00045   virtual StatusCode getBranchEntry( int nr, int entry, void * addr, int& nb);
00046   
00047   
00049   virtual bool       getEOF() { return m_EOF;}
00051   virtual Int_t      getEntries() { return m_entries;}
00053   virtual StatusCode fillTrees();
00054 
00055   virtual std::string getCurrentFileName() { return m_currentFileName;}  
00056 
00057   virtual std::vector<int> getTotEvtNo();
00058   virtual std::string getJobOptions();
00059   virtual std::string getDecayOptions();
00060   virtual void printJobInfo(TFile* file, int level);
00061 
00062   virtual void setSelectFromTag(bool temp) {m_selectFromTag = temp;}
00063   virtual bool getSelectFromTag(){ return m_selectFromTag;}
00064 
00065   virtual int getCurrentFileNum() {return m_fileNum;}
00066   virtual int getTotalFileNum() {return m_fileNames.size();}
00067 
00068   virtual void setTagInputFile(std::vector<std::string> input); 
00069   virtual std::vector<std::string> getTagInputFile() {return m_tagInputFile;}
00070 
00071   //virtual void setTagFileFormat(int form) {m_tagFileFormat = form;}
00072   //virtual int getTagFileFormat() {return m_tagFileFormat;}
00073 
00074 
00075  private:
00077   virtual StatusCode getTreeNr(const std::string treename, unsigned int& treenr,bool doAdd=false);
00079   virtual TTree*  getTree(const std::string treename);
00081   virtual TTree*  getOtherTree(const std::string treename);
00083   virtual StatusCode createTree(unsigned int treenr, const std::string treename);
00085   
00086   
00087 
00089   std::vector<TTree *> m_otherTrees;
00091   std::vector<TFile *> inputFiles;
00093   std::vector<std::string> m_fileNames;
00094   std::string m_currentFileName;
00095   bool m_selectFromTag;
00096   std::vector<std::string> m_tagInputFile;
00097   //int m_tagFileFormat;
00098 
00100   int m_fileNum;
00102   bool m_ENDFILE;
00104   std::vector<std::string> m_treenames;  
00106   std::vector<std::string> m_inputFilenames;
00108   std::vector<std::string> m_outputFilenames;
00110   std::vector<TTree *> m_inputTrees;
00112   std::vector<TTree *> m_outputTrees;
00114   std::vector<TFile *> m_inputFiles;
00116   std::vector<TFile *> m_outputFiles;
00118   std::vector<int> m_splitModes;
00120   std::vector<int>  m_bufSizes;
00122   std::vector<int>  m_compressionLevels;
00123 
00124 
00126   TClonesArray *m_branches;
00127 
00129   TClonesArray *m_branchesRead;
00130 
00132   bool m_EOF;
00133 
00135   Int_t  m_entries;
00136 
00138   MsgStream log;
00139 
00141   static RootInterface *m_rootInterface;
00142   
00143   std::vector<std::string> m_jobOptions;
00144   std::string m_bossVer;
00145   std::string m_decayOptions;
00146   std::vector<int> m_totEvtNo;
00147 
00148   // tianhl add for besvis
00149  private:
00150   std::vector<std::string>      m_single_treenames;
00151   std::vector<std::string>      m_single_outputFileNames;
00152   std::vector<TFile *>          m_single_outputFiles;
00153   std::vector<TTree *>          m_single_outputTrees;
00154   std::vector<int>              m_single_splitModes;
00155   std::vector<int>              m_single_bufSizes;
00156   std::vector<int>              m_single_compressionLevels;
00157 
00158  public:
00159   virtual StatusCode f_addOutput(const std::string& treename,
00160                   const std::string& file,
00161                   int splitx = 1, int bufsize = 64000,
00162                   int compression = 1);
00163   virtual StatusCode f_createTree(unsigned int treenr, 
00164                   const std::string treename);
00165   virtual StatusCode f_createBranch(const std::string& treename,
00166                   const std::string& branchname,
00167                   const char *classname, 
00168                   void *addr,int & branchnr);
00169   virtual StatusCode f_getTreeNr(const std::string treename, 
00170                   unsigned int& treenr,bool doAdd=false);
00171   virtual StatusCode f_fillTrees();
00172   virtual StatusCode f_finalize();
00173 
00174 };
00175 
00176 #endif 

Generated on Tue Nov 29 22:58:37 2016 for BOSS_7.0.2 by  doxygen 1.4.7