00001 #include <iostream>
00002
00003 Bool_t doProfile = false;
00004 Int_t usePath = 0;
00005 Int_t nFile = 0;
00006 TString thePath;
00007 TString theFileName;
00008 TString originalPath;
00009 class StChain;
00010 StChain *chain=0;
00011 class StEventDisplayMaker;
00012 StEventDisplayMaker *dsMaker = 0;
00013 TBrowser *b=0;
00014
00015 const char *dstFile = 0;
00016 const char *xdfFile = 0;
00017 const char *mdcFile = 0;
00018 const char *fileList[] = {dstFile,xdfFile,mdcFile,0};
00019
00020 void Help()
00021 {
00022 cout << "Usage: doEvents.C(nevents,\"-\",\"some_directory/some_dst_file.xdf\")" << endl;
00023 cout << " doEvents.C(nevents,\"-\",\"some_directory/some_dst_file.root\")" << endl;
00024 cout << " doEvents.C(nevents,\"some_directory\",\"*.dst.root\")" << endl;
00025 }
00026
00027
00028 void RunStiMaker2(Int_t, const Char_t **, const Char_t *qaflag = "");
00029
00030
00031 void RunStiMaker2(Int_t nevents=1,
00032
00033 const Char_t *path = "/star/data22/ITTF/data/simple_geant/DEV_10_8_01/",
00034
00035
00036
00037 const Char_t *file= "muon_10_neg.event.root",
00038
00039 const Char_t *qaflag = "off",
00040 const Int_t wrStEOut = 0);
00041
00042
00043 void RunStiMaker2(Int_t nevents, const Char_t **fileList, const Char_t *qaflag, const Int_t wrStEOut)
00044 {
00045 Int_t theRunNumber=0;
00046 bool simulated = true;
00047 bool doFit = false;
00048 bool optimized = false;
00049 char* outfile = "Evaluation.root";
00050
00051 cout << endl << endl <<" doEvents - input # events = " << nevents << endl;
00052 Int_t ilist=0;
00053 while(fileList[ilist]){
00054 cout << " doEvents - input fileList = " << fileList[ilist] << endl;
00055 ilist++;
00056 }
00057 cout << " doEvents - input qaflag = " << qaflag << endl;
00058 cout << " doEvents - input wrStEOut = " << wrStEOut << endl << endl << endl;
00059
00060
00061
00062
00063
00064 gSystem->Load("St_base");
00065 gSystem->Load("StUtilities");
00066 gSystem->Load("StChain");
00067 gSystem->Load("StBFChain");
00068 gSystem->Load("St_Tables");
00069
00070 gSystem->Load("libgen_Tables");
00071 gSystem->Load("libsim_Tables");
00072 gSystem->Load("libglobal_Tables");
00073 gSystem->Load("geometry");
00074
00075 gSystem->Load("St_g2t");
00076 gSystem->Load("St_geant_Maker");
00077
00078 gSystem->Load("StIOMaker");
00079 gSystem->Load("StTreeMaker");
00080 gSystem->Load("StarClassLibrary");
00081
00082 gSystem->Load("St_db_Maker");
00083 gSystem->Load("StDbLib");
00084 gSystem->Load("StDbBroker");
00085 gSystem->Load("StSvtDbMaker");
00086 gSystem->Load("StDbUtilities");
00087 gSystem->Load("StTpcDb");
00088 gSystem->Load("StEvent");
00089 gSystem->Load("StEventMaker");
00090 gSystem->Load("StEmcUtil");
00091 gSystem->Load("StMcEvent");
00092 gSystem->Load("StMcEventMaker");
00093 gSystem->Load("StAssociationMaker");
00094 gSystem->Load("StDaqLib");
00095 gSystem->Load("StDAQMaker");
00096
00097 gSystem->Load("StDetectorDbMaker");
00098
00099 gSystem->Load("StSvtClassLibrary");
00100 gSystem->Load("StSvtDaqMaker");
00101 gSystem->Load("StSvtSimulationMaker");
00102 gSystem->Load("StSvtCalibMaker");
00103 gSystem->Load("StSvtSeqAdjMaker");
00104
00105 gSystem->Load("StSvtClusterMaker");
00106
00107
00108
00109
00110
00111
00112
00113 cout <<"Loading Sti"<<endl;
00114 gSystem->Load("Sti");
00115
00116 cout <<"Loading StiGui"<<endl;
00117 gSystem->Load("StiGui");
00118
00119 cout <<"Loading StiEvaluator"<<endl;
00120 gSystem->Load("StiEvaluator");
00121
00122
00123 cout <<"Loading libGui"<<endl;
00124 gSystem->Load("libGui");
00125
00126 cout <<"Loading StiMaker"<<endl;
00127 gSystem->Load("StiMaker");
00128
00129 if(doProfile){
00130 cout <<"Loading Jprof"<<endl;
00131 gSystem->Setenv("JPROF_FLAGS", "JP_START JP_PERIOD=0.001");
00132 gSystem->Load("libJprof");
00133 }
00134
00135
00136
00137
00138 chain = new StChain("StChain");
00139
00140 StFileI *setFiles =0;
00141 if (fileList) {
00142 setFiles= new StFile(fileList);
00143 } else {
00144 gSystem->Load("StChallenger");
00145 setFiles = StChallenger::Challenge();
00146 setFiles->SetDebug();
00147 const char *Argv[]= {
00148 "-s","daq",
00149 "-q","mRunNumber=1228023",
00150 "-c","/afs/rhic.bnl.gov/star/incoming/GCA/daq/stacs.rc"
00151 };
00152 Int_t Argc=sizeof(Argv)/4;
00153 setFiles->Init(Argc,Argv);
00154 }
00155
00156 StIOMaker *IOMk = new StIOMaker("inputStream","r",setFiles);
00157
00158
00159
00160 IOMk->SetBranch("eventBranch",0,"r");
00161 if (simulated) {
00162 IOMk->SetBranch("geantBranch",0,"r");
00163 }
00164 IOMk->SetDebug();
00165
00166 St_geant_Maker *geantMk = new St_geant_Maker("geant");
00167 geantMk->SetActive(kFALSE);
00168
00169
00170
00171
00172
00173
00174
00175
00176
00177
00178
00179 dbaseMk = new St_db_Maker("db","MySQL:StarDb","$STAR/StarDb");
00180
00181
00182 dbaseMk-> SetDateTime(20010801,000000);
00183
00184
00185
00186
00187 tpcDbMk = new StTpcDbMaker("tpcDb");
00188
00189
00190
00191
00192 svtDbMk = new StSvtDbMaker("svtDb");
00193
00194
00195
00196
00197 detDbMk = new StDetectorDbMaker("detDb");
00198
00199
00200 StMcEventMaker* mcEventReader = 0;
00201
00202 StAssociationMaker* assocMaker = 0;
00203
00204 if (simulated) {
00205
00206 mcEventReader = new StMcEventMaker();
00207 assocMaker = new StAssociationMaker();
00208 }
00209
00210
00211 StiMaker* anaMk = StiMaker::instance();
00212
00213 cout <<"\n --- Setup StiIOBroker ---\n"<<endl;
00214
00215
00216 StiRootIOBroker* stiIO = anaMk->getIOBroker();
00217
00218 stiIO->setTPHFMinPadrow(1);
00219 stiIO->setTPHFMaxPadrow(45);
00220 stiIO->setETSFLowerBound(5);
00221 stiIO->setETSFMaxHits(6);
00222
00223 stiIO->setDoTrackFit(doFit);
00224
00225
00226 stiIO->setKTFMcsCalculated(false);
00227 stiIO->setKTFElossCalculated(false);
00228 stiIO->setKTFMaxChi2ForSelection(50);
00229 stiIO->setKTFBField(.5);
00230 stiIO->setKTFMassHypothesis(.1395);
00231 stiIO->setKTFMinContiguousHitCount(2);
00232 stiIO->setKTFMaxNullCount(40);
00233 stiIO->setKTFMaxContiguousNullCount(25);
00234 stiIO->setKTFMinSearchRadius(.5);
00235 stiIO->setKTFMaxSearchRadius(4.);
00236 stiIO->setKTFSearchWindowScale(5.);
00237
00238
00239 stiIO->setLTSFZWindow(5.);
00240 stiIO->setLTSFYWindow(2.);
00241 stiIO->setLTSFSeedLength(2);
00242
00243 stiIO->setLTSFDoHelixFit(true);
00244 stiIO->setLTSFExtrapYWindow(1.);
00245 stiIO->setLTSFExtrapZWindow(2.);
00246 stiIO->setLTSFExtrapMaxSkipped(2);
00247 stiIO->setLTSFExtrapMinLength(4);
00248 stiIO->setLTSFExtrapMaxLength(5);
00249 stiIO->setLTSFUseVertex(true);
00250
00251 stiIO->setLTMDeltaR(1.);
00252
00253
00254 for (unsigned int sector=1; sector<=12; ++sector) {
00255 stiIO->addLTSFSector(sector);
00256 }
00257
00258
00259 for (unsigned int padrow=6; padrow<=45; padrow+=1) {
00260 stiIO->addLTSFPadrow(padrow);
00261 }
00262
00263
00264 enum SeedFinderType {kUndefined=0, kComposite=1, kEvaluable=2};
00265
00266 stiIO->setSeedFinderType(kComposite);
00267
00268
00269 enum FilterType {kPtFilter=0, kEtaFilter=1, kChi2Filter=2, kNptsFilter=3, kNFitPtsFilter=4,
00270 kNGapsFilter=5, kFitPointRatioFilter=6, kPrimaryDcaFilter=7};
00271
00272 stiIO->addFilterType(kPtFilter);
00273 stiIO->setFilterPtMin(.1);
00274 stiIO->setFilterPtMax(50.);
00275
00276 stiIO->addFilterType(kEtaFilter);
00277 stiIO->setFilterEtaMin(-2.);
00278 stiIO->setFilterEtaMax(2.);
00279
00280 stiIO->addFilterType(kChi2Filter);
00281 stiIO->setFilterChi2Max(10.);
00282
00283 stiIO->addFilterType(kNptsFilter);
00284 stiIO->setFilterNptsMin(8);
00285
00286 stiIO->addFilterType(kNFitPtsFilter);
00287 stiIO->setFilterNFitPtsMin(5);
00288
00289 stiIO->addFilterType(kNGapsFilter);
00290 stiIO->setFilterNGapsMax(20);
00291
00292
00293
00294
00295 stiIO->addFilterType(kPrimaryDcaFilter);
00296 stiIO->setFilterPrimaryDcaMax(100.);
00297
00298 stiIO->setSimulated(simulated);
00299 anaMk->setEvaluationFileName(outfile);
00300
00301 if (simulated) {
00302 anaMk->setMcEventMaker(mcEventReader);
00303 anaMk->setAssociationMaker(assocMaker);
00304 }
00305
00306
00307 MainFrame* sti=0;
00308 StiGuiIOBroker* guiIO=0;
00309
00310 if (gROOT->IsBatch()==false) {
00311
00312 cout <<"No batch option detected. Run Integrated Tracker in Gui Mode."<<endl;
00313
00314 sti = new MainFrame(gClient->GetRoot(), 400, 220);
00315
00316 sti->setStChain(chain);
00317 sti->setIoMaker(IOMk);
00318
00319
00320 stiIO->setUseGui(true);
00321
00322
00323 guiIO = StiGuiIOBroker::instance();
00324
00325
00326 guiIO->setUnMarkedHitSize(.3);
00327 guiIO->setUnMarkedHitColor(4);
00328 guiIO->setUnMarkedHitStyle(8);
00329 guiIO->setUpdateEachTrack(false);
00330
00331
00332 guiIO->setMarkedHitSize(.3);
00333 guiIO->setMarkedHitColor(2);
00334 guiIO->setMarkedHitStyle(3);
00335 }
00336 else {
00337 cout <<"Batch option detector. Run Integrated Tracker in non-Gui Mode."<<endl;
00338 stiIO->setUseGui(false);
00339 }
00340
00341 cout <<"\n --- Done setting up StiIOBroker --- \n"<<endl;
00342
00343
00344 if (wrStEOut) {
00345 cout << "!!!! doEvents: will write out .event.root file !!" << endl << endl;
00346 StTreeMaker *outMk = new StTreeMaker("EvOut","","bfcTree");
00347 outMk->SetIOMode("w");
00348 outMk->SetBranch("eventBranch","test.event.root","w");
00349 outMk->IntoBranch("eventBranch","StEvent");
00350 }
00351
00352
00353
00354
00355
00356
00357
00358
00359
00360
00361
00362
00363
00364
00365 Int_t iInit = chain->Init();
00366 if (iInit) chain->Fatal(iInit,"on init");
00367
00368 chain->InitRun(theRunNumber);
00369
00370
00371
00372
00373 int istat=0,i=1;
00374 EventLoop: if (i <= nevents && istat!=2) {
00375
00376 cout << endl << "============================ Event " << i
00377 << " start ============================" << endl;
00378
00379 chain->Clear();
00380 istat = chain->Make(i);
00381
00382 if (istat==2)
00383 {cout << "Last event processed. Status = " << istat << endl;}
00384 if (istat==3)
00385 {cout << "Error event processed. Status = " << istat << endl;}
00386
00387 i++;
00388 goto EventLoop;
00389 }
00390
00391
00392
00393 i--;
00394 cout << endl << "============================ Event " << i
00395 << " finish ============================" << endl;
00396
00397 }
00398
00399
00400
00401 void RunStiMaker2(const Int_t nevents, const Char_t *path, const Char_t *file,
00402 const Char_t *qaflag, const Int_t wrStEOut)
00403 {
00404 if (nevents==-1) { Help(); return;}
00405
00406 const char *fileListQQ[]={0,0};
00407 if (strncmp(path,"GC",2)==0) {
00408 fileListQQ=0;
00409 } else if (path[0]=='-') {
00410 fileListQQ[0]=file;
00411 } else if (!file[0]) {
00412 fileListQQ[0]=path;
00413 } else {
00414 fileListQQ[0] = gSystem->ConcatFileName(path,file);
00415 }
00416
00417
00418
00419
00420
00421
00422
00423
00424 RunStiMaker2(nevents,fileListQQ,qaflag,wrStEOut);
00425 }
00426
00427