BOSS 7.0.4
BESIII Offline Software System
Loading...
Searching...
No Matches
Event/RootCnvSvc/RootCnvSvc-02-01-13/RootCnvSvc/RootInterface.h
Go to the documentation of this file.
1#ifndef ROOTINTERFACE_H
2#define ROOTINTERFACE_H
3/*
4 *Description:Interface for all Root I/O needed by the RootCnvSvc
5 *Based on the RootInterface of Glast.
6 */
7#include "TObject.h"
8#include <vector>
9#include "GaudiKernel/MsgStream.h"
10#include "GaudiKernel/IService.h"
11/////////////////////////////////////////////////////////////////////////////
12
13class TTree;
14class TClonesArray;
15class TFile;
16class TList;
17
18
20
21 public:
22
23 RootInterface (MsgStream log);
24 virtual ~RootInterface();
25 virtual StatusCode finalize();
26
27 /// singleton behaviour
28static RootInterface* Instance(MsgStream log);
29 /// check if all the files is over 2005-11-28
30 virtual bool checkEndOfTree();
31 virtual bool getENDFILE(){ return m_ENDFILE;}
32 /// add input tree to the list
33 virtual StatusCode addInput(const std::string& treename,const std::string& file);
34 /// add output tree to the list
35 virtual StatusCode addOutput(const std::string& treename,const std::string& file,int splitx, int bufsize, int compression);
36 /// create a branch in this tree
37 virtual StatusCode createBranch(const std::string& tree,const std::string& branch ,const char *classname,void *addr,int & branchnr);
38
39 /// set branch address
40 virtual StatusCode setBranchAddress(const std::string treename, const std::string branchname, void *addr,int& nb);
41 /// get entry from this branch
42 virtual StatusCode getBranchEntry( int nr, int entry,int& nb);
43
44 /// get entry from this branch with addr
45 virtual StatusCode getBranchEntry( int nr, int entry, void * addr, int& nb);
46
47
48 /// get EOF flag
49 virtual bool getEOF() { return m_EOF;}
50 /// get nr of entries
51 virtual Int_t getEntries() { return m_entries;}
52 /// fill in all trees
53 virtual StatusCode fillTrees();
54
55 virtual std::string getCurrentFileName() { return m_currentFileName;}
56
57 virtual std::vector<int> getTotEvtNo();
58 virtual std::string getJobOptions();
59 virtual std::string getDecayOptions();
60 virtual void printJobInfo(TFile* file, int level);
61
62 virtual void setSelectFromTag(bool temp) {m_selectFromTag = temp;}
63 virtual bool getSelectFromTag(){ return m_selectFromTag;}
64
65 virtual int getCurrentFileNum() {return m_fileNum;}
66 virtual int getTotalFileNum() {return m_fileNames.size();}
67
68 virtual void setTagInputFile(std::vector<std::string> input);
69 virtual std::vector<std::string> getTagInputFile() {return m_tagInputFile;}
70
71 //virtual void setTagFileFormat(int form) {m_tagFileFormat = form;}
72 //virtual int getTagFileFormat() {return m_tagFileFormat;}
73
74
75 private:
76 /// get treenr from treename
77 virtual StatusCode getTreeNr(const std::string treename, unsigned int& treenr,bool doAdd=false);
78 /// get tree
79 virtual TTree* getTree(const std::string treename);
80 /// get tree from other files 2005-11-28
81 virtual TTree* getOtherTree(const std::string treename);
82 /// create this tree
83 virtual StatusCode createTree(unsigned int treenr, const std::string treename);
84 /// parallel vectors
85
86
87
88 /// vector of other trees created from others files 2005-11-28
89 std::vector<TTree *> m_otherTrees;
90 /// vector of input files
91 std::vector<TFile *> inputFiles;
92 ///files 2005-11-28
93 std::vector<std::string> m_fileNames;
94 std::string m_currentFileName;
95 bool m_selectFromTag;
96 std::vector<std::string> m_tagInputFile;
97 //int m_tagFileFormat;
98
99 ///the number of the using files 2005-11-29
100 int m_fileNum;
101 ///signed the tree is end 2005-11-30
102 bool m_ENDFILE;
103 /// vector of treenames used
104 std::vector<std::string> m_treenames;
105 /// vector of input filenames used
106 std::vector<std::string> m_inputFilenames;
107 /// vector of output filenames used
108 std::vector<std::string> m_outputFilenames;
109 /// vector of input trees
110 std::vector<TTree *> m_inputTrees;
111 /// vector of output trees
112 std::vector<TTree *> m_outputTrees;
113 /// vector of input files
114 std::vector<TFile *> m_inputFiles;
115 /// vector of output files
116 std::vector<TFile *> m_outputFiles;
117 /// vector of splitmodes
118 std::vector<int> m_splitModes;
119 /// vector of buffer sizes
120 std::vector<int> m_bufSizes;
121 /// vector of compression levels
122 std::vector<int> m_compressionLevels;
123
124
125 /// array of branch pointers for writing
126 TClonesArray *m_branches;
127
128 /// array of branch pointers for reading
129 TClonesArray *m_branchesRead;
130
131 /// EOF flag
132 bool m_EOF;
133
134 /// number of entries (<0 if not yet known)
135 Int_t m_entries;
136
137 /// instance of message stream transmitted at construction
138 MsgStream log;
139
140 /// static singleton pointer
141 static RootInterface *m_rootInterface;
142
143 std::vector<std::string> m_jobOptions;
144 std::string m_bossVer;
145 std::string m_decayOptions;
146 std::vector<int> m_totEvtNo;
147
148 // tianhl add for besvis
149 private:
150 std::vector<std::string> m_single_treenames;
151 std::vector<std::string> m_single_outputFileNames;
152 std::vector<TFile *> m_single_outputFiles;
153 std::vector<TTree *> m_single_outputTrees;
154 std::vector<int> m_single_splitModes;
155 std::vector<int> m_single_bufSizes;
156 std::vector<int> m_single_compressionLevels;
157
158 public:
159 virtual StatusCode f_addOutput(const std::string& treename,
160 const std::string& file,
161 int splitx = 1, int bufsize = 64000,
162 int compression = 1);
163 virtual StatusCode f_createTree(unsigned int treenr,
164 const std::string treename);
165 virtual StatusCode f_createBranch(const std::string& treename,
166 const std::string& branchname,
167 const char *classname,
168 void *addr,int & branchnr);
169 virtual StatusCode f_getTreeNr(const std::string treename,
170 unsigned int& treenr,bool doAdd=false);
171 virtual StatusCode f_fillTrees();
172 virtual StatusCode f_finalize();
173
174};
175
176#endif
char * file
Definition: DQA_TO_DB.cxx:15
virtual std::vector< int > getTotEvtNo()
virtual StatusCode f_createBranch(const std::string &treename, const std::string &branchname, const char *classname, void *addr, int &branchnr)
virtual StatusCode f_getTreeNr(const std::string treename, unsigned int &treenr, bool doAdd=false)
virtual StatusCode f_finalize()
virtual std::string getJobOptions()
virtual StatusCode getBranchEntry(int nr, int entry, int &nb)
get entry from this branch
virtual StatusCode f_fillTrees()
virtual StatusCode finalize()
virtual bool checkEndOfTree()
check if all the files is over 2005-11-28
virtual StatusCode createBranch(const std::string &tree, const std::string &branch, const char *classname, void *addr, int &branchnr)
create a branch in this tree
virtual void printJobInfo(TFile *file, int level)
virtual void setTagInputFile(std::vector< std::string > input)
virtual StatusCode setBranchAddress(const std::string treename, const std::string branchname, void *addr, int &nb)
set branch address
virtual StatusCode addInput(const std::string &treename, const std::string &file)
add input tree to the list
virtual StatusCode f_addOutput(const std::string &treename, const std::string &file, int splitx=1, int bufsize=64000, int compression=1)
virtual ~RootInterface()
static RootInterface * Instance(MsgStream log)
singleton behaviour
virtual StatusCode addOutput(const std::string &treename, const std::string &file, int splitx, int bufsize, int compression)
add output tree to the list
virtual std::vector< std::string > getTagInputFile()
virtual StatusCode fillTrees()
fill in all trees
virtual StatusCode f_createTree(unsigned int treenr, const std::string treename)
virtual std::string getDecayOptions()