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