00001 #include "iostream.h"
00002
00003 class StChain;
00004 StChain *chain=0;
00005 class St_db_Maker;
00006 St_db_Maker *dbMk =0;
00007
00008 Int_t iEvt=0,istat=0,nEvents=0;
00009 void doEvents(const Char_t *inname = "/star/institutions/lbl/dongx/tof/Run8/prod/9054010/reco/st_toftpx_9054010_raw_1370001.event.root",
00010 const Char_t *histname = "test.hist.root",
00011 const Char_t *ntuplename = "test.ntuple.root");
00012
00013 void doEvents(const Char_t *inname, const Char_t *histname, const Char_t *ntuplename)
00014 {
00015 Int_t nEvents = 10;
00016 Int_t nfiles = 100;
00017
00018
00019
00020
00021 if (gClassTable->GetID("TTable") < 0) {
00022 gSystem->Load("libStar");
00023 gSystem->Load("libPhysics");
00024 }
00025 gROOT->LoadMacro("$STAR/StRoot/StMuDSTMaker/COMMON/macros/loadSharedLibraries.C");
00026 loadSharedLibraries();
00027 gSystem->Load("StarMagField");
00028 gSystem->Load("StMagF");
00029 gSystem->Load("StTpcDb");
00030
00031 gSystem->Load("StDaqLib");
00032 gSystem->Load("StDbBroker");
00033 gSystem->Load("StDetectorDbMaker");
00034 gSystem->Load("StDbUtilities");
00035 gSystem->Load("St_db_Maker");
00036
00037 gSystem->Load("StEvent");
00038 gSystem->Load("StEventMaker");
00039 gSystem->Load("StarMagField");
00040 gSystem->Load("StTofUtil");
00041 gSystem->Load("StTofMaker");
00042
00043 gSystem->Load("libtpc_Tables");
00044 gSystem->Load("libGeom");
00045 gSystem->Load("St_g2t");
00046 gSystem->Load("geometry");
00047 gSystem->Load("St_geant_Maker");
00048
00049 gSystem->Load("StTofrMatchMaker");
00050
00051
00052
00053 gSystem->Load("StTofrNtupleMaker");
00054
00055
00056
00057 chain = new StChain("StChain");
00058
00059 StIOMaker* ioMaker = new StIOMaker();
00060 ioMaker->SetFile(inname);
00061 ioMaker->SetIOMode("r");
00062 ioMaker->SetBranch("*",0,"0");
00063 ioMaker->SetBranch("eventBranch",0,"r");
00064 ioMaker->SetDebug(0);
00065
00066 int NwGeant=5000000, IwType=0, NwPaw=0;
00067 St_geant_Maker *geantMk = new St_geant_Maker("geant",NwGeant,NwPaw,IwType);
00068 geantMk->LoadGeometry("detp geometry y2008");
00069 geantMk->SetActive(kFALSE);
00070
00071 cout<<endl<<"============ Data Base ========="<<endl;
00072 dbMk = new St_db_Maker("db","MySQL:StarDb","$STAR/StarDb","StarDb");
00073
00074 StTofrMatchMaker *matchMaker = new StTofrMatchMaker("tofrMatch");
00075 matchMaker->SetDebug(0);
00076 matchMaker->SetMode(1);
00077 matchMaker->setSaveGeometry(kTRUE);
00078 matchMaker->setCreateHistoFlag(kTRUE);
00079 matchMaker->setCreateTreeFlag(kTRUE);
00080 matchMaker->setHistoFileName(histname);
00081
00082 StTofrNtupleMaker *tofrNtuple = new StTofrNtupleMaker("tofrNtuple", ntuplename);
00083 tofrNtuple->SetDebug(0);
00084 tofrNtuple->setInitGeomFromOther(kTRUE);
00085
00086
00087
00088
00089 Int_t iInit = chain->Init();
00090 if (iInit) chain->Fatal(iInit,"on init");
00091 chain->PrintInfo();
00092
00093
00094
00095 int istat = 0, i = 1;
00096 EventLoop: if (i <= nEvents && istat != 2) {
00097
00098 cout << endl << "============================ Event " << i
00099 << " start ============================" << endl;
00100
00101 chain->Clear();
00102 istat = chain->Make(i);
00103 if (istat == 2)
00104 {cout << "Last event processed. Status = " << istat << endl;}
00105 if (istat == 3)
00106 {cout << "Error event processed. Status = " << istat << endl;}
00107
00108
00109 i++;
00110 goto EventLoop;
00111 }
00112
00113 i--;
00114 cout<<endl<<"============================ Event "<<i<<" finish ============================"<<endl;
00115
00116
00117
00118
00119 if (nEvents > 1) {
00120 chain->Finish();
00121 }
00122
00123
00124 }