00001 #ifndef __CINT__
00002 #include "TSystem.h"
00003 #include "TBrowser.h"
00004 #include "TBenchmark.h"
00005 #include "TClassTable.h"
00006 #include "StBFChain.h"
00007 #include "St_tcl_Maker/St_tcl_Maker.h"
00008 #include "St_tpt_Maker/St_tpt_Maker.h"
00009 #include "StEvent.h"
00010 #include "St_geant_Maker/St_geant_Maker.h"
00011 #include "StIOMaker/StIOMaker.h"
00012 #include "StEventDisplayMaker/StEventDisplayMaker.h"
00013 #include "StEventMaker/StEventMaker.h"
00014 #include "StAssociationMaker/StMcParameterDB.h"
00015 #include "St_dst_Maker/StV0Maker.h"
00016 #include "xdf2root/St_XDFFile.h"
00017 #include "StTpcT0Maker/StTpcT0Maker.h"
00018
00019 gSystem->Load("StDetectorDbMaker");
00020
00021 void Usage();
00022 void Load();
00023
00024 #else
00025
00026 class StMaker;
00027 class StBFChain;
00028 class StEvent;
00029 class St_geant_Maker;
00030 class StIOMaker;
00031 class St_XDFFile;
00032 class StEventDisplayMaker;
00033 class StEventMaker;
00034 class StTpcT0Maker;
00035 class StChain;
00036 class StAssociationMaker;
00037 class StMcAnalysisMaker;
00038
00039 #endif
00040
00041 #include <string>
00042 class St_DataSet;
00043 St_DataSet *Event;
00044 StChain *chain;
00045 TBrowser *brow=0;
00046
00047
00048
00049
00050 void simM2Maker (
00051 const char *MainFile="/star/institutions/rice/geurts/sim/tof/pythia_0.geant.root",
00052 Int_t nevents=10,
00053 const char *outFileName="test.root"
00054 )
00055 {
00056
00057 gSystem->Load("StarRoot");
00058 gSystem->Load("St_base");
00059 gSystem->Load("StChain");
00060 gSystem->Load("libglobal_Tables");
00061 gSystem->Load("libgen_Tables");
00062 gSystem->Load("libsim_Tables");
00063 gSystem->Load("StUtilities");
00064 gSystem->Load("StIOMaker");
00065 gSystem->Load("StarClassLibrary");
00066 gSystem->Load("StDbLib.so");
00067 gSystem->Load("StDbBroker.so");
00068 gSystem->Load("libStDb_Tables.so");
00069 gSystem->Load("St_db_Maker.so");
00070 gROOT->Macro("loadMuDst.C");
00071 gSystem->Load("StTpcDb");
00072 gSystem->Load("StDetectorDbMaker");
00073 gSystem->Load("StDbUtilities");
00074 gSystem->Load("StBFChain");
00075 gSystem->Load("StChallenger");
00076 gSystem->Load("StEvent");
00077 gSystem->Load("StEventMaker");
00078 gSystem->Load("StIOMaker");
00079 gSystem->Load("StBTofUtil");
00080 gSystem->Load("St_Tables");
00081 gSystem->Load("StEmcUtil");
00082 gSystem->Load("StAssociationMaker");
00083 gSystem->Load("StMcAnalysisMaker");
00084 gSystem->Load("StMcEvent");
00085 gSystem->Load("StMcEventMaker");
00086 gSystem->Load("St_g2t");
00087 gSystem->Load("geometry");
00088 gSystem->Load("St_geant_Maker");
00089 gSystem->Load("StTableUtilities");
00090 gSystem->Load("StBTofSimMaker");
00091 gSystem->Load("StBTofMatchMaker");
00092 gSystem->Load("StTofCalibMaker");
00093
00094 chain = new StChain("BTofSim");
00095
00096
00097 St_geant_Maker *geantMk = new St_geant_Maker();
00098 geantMk->LoadGeometry("detp geometry y2009");
00099
00100 geantMk->SetActive(kFALSE);
00101
00102 StIOMaker *IOMk = new StIOMaker("bfc");
00103 IOMk->SetFile(MainFile);
00104 IOMk->SetIOMode("r");
00105 IOMk->SetBranch("*",0,"0");
00106 IOMk->SetBranch("geantBranch",0,"r");
00107 IOMk->SetBranch("eventBranch",0,"r");
00108
00109 StMcEventMaker *mcEventReader = new StMcEventMaker;
00110 mcEventReader->doPrintEventInfo = false;
00111 mcEventReader->doPrintMemoryInfo = false;
00112 mcEventReader->doUseTpc = true;
00113 mcEventReader->doUseBemc = false;
00114 mcEventReader->doUseBsmd = false;
00115 mcEventReader->doUseFtpc = false;
00116 mcEventReader->doUseSvt = false;
00117 mcEventReader->doUseRich = false;
00118 mcEventReader->doUseEemc = false;
00119 mcEventReader->doUseTof = true;
00120 mcEventReader->SetDebug(1);
00121
00122
00123 St_db_Maker *dbMk = new St_db_Maker("StarDb", "MySQL:StarDb", "MySQL:StarDb", "$STAR/StarDb");
00124 dbMk->SetDateTime(20090401,214129);
00125 cout << " DbMaker loading done " << endl;
00126
00127
00128
00129 string filename=outFileName;
00130 StBTofSimMaker *simMaker = new StBTofSimMaker;
00131 simMaker->setBookHist(kTRUE);
00132 simMaker->setHistFileName(filename);
00133 simMaker->writeStEvent(kTRUE);
00134
00135 StBTofMatchMaker *matchMaker = new StBTofMatchMaker;
00136 matchMaker->setIdealGeometry();
00137 matchMaker->SetDebug(1);
00138
00139
00140 StMuDstMaker* makeMu=new StMuDstMaker("makeMu");
00141
00142
00143
00144
00145
00146 int totalProcessedTofPoints=0;
00147
00148 chain->Init();
00149 chain->PrintInfo();
00150 int total=0;
00151 for (Int_t iev=0;iev<nevents; iev++) {
00152 cout << "****************************************** " << endl;
00153 cout << "Working on eventNumber " << iev << endl;
00154 cout << "****************************************** " << endl;
00155 chain->Clear();
00156 int iret = chain->Make(iev);
00157
00158 if (iret) { cout << "Bad return code!" << endl; break;}
00159
00160 total++;
00161
00162 StMuDst* temp=makeMu->muDst();
00163 int nTofs=temp->numberOfBTofHit();
00164 cout<<"MUDSTOUTPUT-- BTofHits "<<nTofs<<endl;
00165
00166
00167 }
00168
00169
00170 cout << "****************************************** " << endl;
00171 cout << "Work done... now its time to close up shop!"<< endl;
00172 cout << "****************************************** " << endl;
00173 chain->Finish();
00174 cout << "****************************************** " << endl;
00175 cout << "total number of events " << total << endl;
00176 cout << "****************************************** " << endl;
00177
00178 cout<<endl<<endl;
00179 cout<<"Total Tof Hits Processed in MuDst: "<<totalProcessedTofPoints<<endl;
00180
00181
00182 }