00001 #include "TFile.h"
00002 #include "TTree.h"
00003
00004 #include "AccessHDT_MultiRun.C"
00005
00006 class HdtAcc_Appl1: public THdtAccess{
00007
00008 private:
00009 TTree *fTofTree;
00010
00011 public:
00012 HdtAcc_Appl1();
00013 ~HdtAcc_Appl1();
00014
00015 void InitTrees();
00016 void SaveTrees(const TString &fnam);
00017
00018 void Pre_Run_Operation();
00019 void Post_Run_Operation();
00020
00021 void UseHdtEvent();
00022
00023 ClassDef(HdtAcc_Appl1,1)
00024 };
00025
00026 ClassImp(HdtAcc_Appl1)
00027
00028
00029 HdtAcc_Appl1::HdtAcc_Appl1():
00030 fTofTree()
00031 {
00032
00033
00034
00035 }
00036
00037
00038 HdtAcc_Appl1::~HdtAcc_Appl1(){
00039
00040 }
00041
00042
00043 void HdtAcc_Appl1::InitTrees(){
00044 fTofTree = new TTree("TofTree","TOF tree");
00045 }
00046
00047
00048 void HdtAcc_Appl1::SaveTrees(const TString &fnam){
00049
00050 TFile fout(fnam,"RECREATE");
00051 fout.cd();
00052 fTofTree->Write();
00053
00054 fout.Purge();
00055 fout.Close();
00056 }
00057
00058
00059 void HdtAcc_Appl1::Pre_Run_Operation(){
00060
00061
00062 fTofTree->Reset();
00063
00064 }
00065
00066
00067 void HdtAcc_Appl1::Post_Run_Operation(){
00068
00069
00070
00071 TString fnam;
00072 fnam.Form("%s-%d.test.root",fRunType.Data(),fCurrentRun);
00073
00074 SaveTrees(fnam);
00075 }
00076
00077
00078 void HdtAcc_Appl1::UseHdtEvent(){
00079
00080
00081
00082 }
00083
00084
00085
00086
00087 void AccessHDT_Appl_1(TString run_type="FINU",Int_t first_run = -1,Int_t last_run = -1,Int_t n_evs_run=-1,Int_t n_evs_tot=-1){
00088
00089 HdtAcc_Appl1 *hdtac = new HdtAcc_Appl1();
00090 Int_t debug_lev = 0;
00091
00092 hdtac->SetVerboseLevel(3);
00093 hdtac->SetUpdateEvGap(3000);
00094
00095 hdtac->InitTrees();
00096 hdtac->Init("$MSQL_DB_HOST","$RDT",run_type,first_run,last_run,n_evs_run,n_evs_tot,debug_lev);
00097
00098 hdtac->RunLoop();
00099
00100 hdtac->SaveTrees("test.root");
00101 delete hdtac;
00102
00103
00104 }