00001 #include "TFile.h"
00002 #include "TTree.h"
00003
00004 #include "AccessZebra_MultiRun.C"
00005
00006
00007 class ZebraAcc_Appl1: public TZebraAccess{
00008
00009 private:
00010 TTree *fTofTree;
00011
00012 public:
00013 ZebraAcc_Appl1();
00014 ~ZebraAcc_Appl1();
00015
00016 void InitTrees();
00017 void SaveTrees(const TString &fnam);
00018
00019 void Pre_Run_Operation();
00020 void Post_Run_Operation();
00021
00022 void UseProcessRec_GES();
00023 void UseProcessRec_DST();
00024
00025 ClassDef(ZebraAcc_Appl1,1)
00026 };
00027
00028 ClassImp(ZebraAcc_Appl1)
00029
00030
00031 ZebraAcc_Appl1::ZebraAcc_Appl1():
00032 fTofTree()
00033 {
00034
00035 cout << "ZebraAcc_Appl1 constructor called" << endl;
00036
00037 }
00038
00039
00040 ZebraAcc_Appl1::~ZebraAcc_Appl1(){
00041
00042 }
00043
00044
00045 void ZebraAcc_Appl1::InitTrees(){
00046 fTofTree = new TTree("TofTree","TOF tree");
00047 }
00048
00049
00050 void ZebraAcc_Appl1::SaveTrees(const TString &fnam){
00051
00052 TFile fout(fnam,"RECREATE");
00053 fout.cd();
00054 fTofTree->Write();
00055
00056 fout.Purge();
00057 fout.Close();
00058 }
00059
00060
00061 void ZebraAcc_Appl1::Pre_Run_Operation(){
00062
00063 cout << "Performing pre-run operation for run " << fCurrentRun << endl;
00064 fTofTree->Reset();
00065
00066 }
00067
00068
00069 void ZebraAcc_Appl1::Post_Run_Operation(){
00070
00071 cout << "Performing post-run operation for run " << fCurrentRun << endl;
00072
00073 TString fnam;
00074 fnam.Form("%s-%d.test.root",fRunType.Data(),fCurrentRun);
00075
00076 SaveTrees(fnam);
00077 }
00078
00079
00080 void ZebraAcc_Appl1::UseProcessRec_GES(){
00081
00082
00083
00084
00085
00086
00087
00088
00089
00090
00091
00092
00093
00094
00095
00096
00097
00098
00099
00100 }
00101
00102
00103 void ZebraAcc_Appl1::UseProcessRec_DST(){
00104
00105 Int_t JFDST = fPrec->GetJFDST();
00106 if(!JFDST) return;
00107 Int_t trigbit = fPrec->GetIQ(JFDST+3);
00108 Int_t rnum = fPrec->GetIQ(JFDST+1);
00109 Int_t evnum = fPrec->GetIQ(JFDST+2);
00110 cout << "JFDST = " << JFDST
00111 << " ---> trig: " << trigbit
00112 << "; rnum: " << rnum
00113 << "; evnum: " << evnum << endl;
00114
00115
00116
00117
00118
00119 fTofTree->Fill();
00120 }
00121
00122
00123
00124
00125
00126 void AccessZebra_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){
00127
00128 ZebraAcc_Appl1 *zac = new ZebraAcc_Appl1();
00129 Int_t debug_lev = 0;
00130
00131 zac->InitTrees();
00132 zac->SetFillDst(1);
00133 zac->Init("$MSQL_DB_HOST","$RDT",run_type,first_run,last_run,n_evs_run,n_evs_tot,debug_lev);
00134
00135 zac->RunLoop();
00136
00137 zac->SaveTrees("test.root");
00138 delete zac;
00139 }