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