00001 #ifndef EVENT_LOOP_ALGS__NTUPLE_SVC_H
00002 #define EVENT_LOOP_ALGS__NTUPLE_SVC_H
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00017
00018
00019
00020 #include <EventLoopAlgs/Global.h>
00021
00022 #include <set>
00023 #include <EventLoop/Algorithm.h>
00024
00025 class TBranch;
00026 class TFile;
00027 class TTree;
00028
00029 namespace D3PDReader
00030 {
00031 class Event;
00032 }
00033
00034 namespace EL
00035 {
00043 NTupleSvc *getNTupleSvc (Worker *worker,
00044 const std::string& outputStream,
00045 const std::string& treeName = "");
00046
00047
00048
00049 class NTupleSvc : public EL::Algorithm
00050 {
00051
00052
00053
00054
00057 public:
00058 void testInvariant () const;
00059
00060
00065 public:
00066 NTupleSvc (const std::string& val_outputName = "output");
00067
00068
00071 public:
00072 ~NTupleSvc ();
00073
00074
00079 public:
00080 void copyBranch (const std::string& name);
00081
00082
00090 public:
00091 void copyBranchList (const std::string& fileName);
00092
00093
00097 public:
00098 void addWhiteFloat (const std::string& varName);
00099
00100
00104 public:
00105 void addWhiteArray (const std::string& varName);
00106
00107
00112 public:
00113 TTree *tree () const;
00114
00115
00118 public:
00119 bool getFilterPassed () const;
00120
00121
00125 public:
00126 void setFilterPassed (bool passed = true);
00127
00128
00133 public:
00134 const std::string& treeName () const;
00135 void treeName (const std::string& val_treeName);
00136
00137
00138
00139
00140
00141
00144 public:
00145 virtual const char *GetName () const;
00146
00147
00156 private:
00157 virtual StatusCode setupJob (Job& job);
00158
00159
00165 private:
00166 virtual StatusCode changeInput (bool firstFile);
00167
00168
00179 private:
00180 virtual StatusCode initialize ();
00181
00182
00187 private:
00188 virtual StatusCode execute ();
00189
00190
00198 private:
00199 virtual StatusCode postExecute ();
00200
00201
00208 private:
00209 virtual bool hasName (const std::string& name) const;
00210
00211
00212
00213
00214
00215
00216
00218 private:
00219 std::string m_outputName;
00220
00222 private:
00223 std::string m_treeName;
00224
00226 private:
00227 std::string m_tree_title;
00228
00230 private:
00231 std::set<std::string> m_copyBranches;
00232 typedef std::set<std::string>::iterator m_copyBranchesIter;
00233
00235 private:
00236 std::set<std::string> m_whiteFloat;
00237 typedef std::set<std::string>::iterator m_whiteFloatIter;
00238
00240 private:
00241 std::set<std::string> m_whiteArray;
00242 typedef std::set<std::string>::iterator m_whiteArrayIter;
00243
00245 private:
00246 TFile *m_file;
00247
00249 private:
00250 TTree *m_tree;
00251
00253 private:
00254 bool m_initialized;
00255
00257 private:
00258 bool m_taken;
00259
00262 private:
00263 bool m_connected;
00264
00266 private:
00267 D3PDReader::Event *m_d3pdreader;
00268
00270 private:
00271 WhiteBoardSvc *m_whiteboard;
00272
00274 private:
00275 struct CopyInfo
00276 {
00278 public:
00279 std::string name;
00280
00282 public:
00283 TBranch *source;
00284
00286 public:
00287 TBranch *target;
00288
00290 public:
00291 std::vector<char> buffer;
00292 };
00293 std::vector<CopyInfo> m_copyInfo;
00294 typedef std::vector<CopyInfo>::iterator copyInfoMIter;
00295
00297 private:
00298 struct WhiteInfo
00299 {
00301 public:
00302 std::string name;
00303
00305 public:
00306 bool array;
00307
00309 public:
00310 std::vector<float> buffer;
00311
00314 public:
00315 std::vector<float> *pointer;
00316 };
00317 std::vector<WhiteInfo> m_whiteInfo;
00318 typedef std::vector<WhiteInfo>::iterator whiteInfoMIter;
00319
00320
00325 private:
00326 void initBranches ();
00327
00328
00333 private:
00334 void findBranches (std::set<std::string>& branchList);
00335
00336
00345 private:
00346 void initOutput (const std::string& branchName);
00347
00348
00354 private:
00355 void initOutput (const std::set<std::string>& branchList);
00356
00357
00361 private:
00362 void copyInput ();
00363
00364
00365 ClassDef(NTupleSvc, 1);
00366 };
00367 }
00368
00369 #endif