00001 00002 // 00003 // $Id: doFlowEvents.C,v 1.3 2006/08/15 21:42:07 jeromel Exp $ 00004 // 00005 // Description: 00006 // Chain to read events from files into StFlowEvent and analyze. 00007 // what it does: reads dst.root or pico files to fill StFlowEvent 00008 // 00009 // Environment: 00010 // Software developed for the STAR Detector at Brookhaven National Laboratory 00011 // 00012 // Ways to run: 00013 // If you specify a path, all DST files below that path will be 00014 // found, and 'nevents' events will be analyzed. 00015 // The type of DST files searched for is taken from the 'file' parameter. 00016 // If 'file' ends in '.dst.root', ROOT DSTs are searched for. 00017 // If 'file' ends in '.event.root' a StEvent file is used. 00018 // If 'file' ends in 'flowpicoevent.root' a StFlowPicoEvent file is used. 00019 // 00020 // inputs: 00021 // nevents = # events to process 00022 // path = a. directory you want files from 00023 // b. "-" to get just the one file you want 00024 // file = a. file names in directory (takes all files) 00025 // b. the 1 particular full file name (with directory) you want 00026 // qaflag = "off" - doesn't do anything now 00027 // wrStEOut = flag to turn on=1, off=0 writing of output test.event.root 00028 // file --- set to off by default 00029 // 00030 // Usage: 00031 // doFlowEvents.C(nevents, "-", "some_directory/some_dst_file.root") 00032 // doFlowEvents.C(nevents, "some_directory", "*.dst.root/*.event.root") 00033 // doFlowEvents.C(nevents) 00034 // doFlowEvents.C() // 2 events 00035 // 00036 // A parameter, RunType, may be passed from the calling LSF shell script 00037 // (see pdsf:: ~posk/doFlowEvents.csh): 00038 // root4star -b << eof >& $LOG 00039 // Int_t RunType = $runNo ; 00040 // .L $doFile 00041 // doFlowEvents.C 00042 // .q 00043 //eof 00044 // 00045 // Author List: Torre Wenaus, BNL 2/99 00046 // Victor Perevoztchikov 00047 // Art Poskanzer 00048 // 00050 gROOT->Reset(); 00051 00052 00053 00054 class StChain; 00055 StChain *chain = 0; 00056 TBrowser *b = 0; 00057 Int_t RunType; 00058 00059 const char *dstFile = 0; 00060 const char *fileList[] = {dstFile, 0}; 00061 00062 void doFlowEvents(Int_t, const Char_t **, const char *qaflag = "", 00063 const Int_t wrStEOut = 0); 00064 void doFlowEvents(Int_t, const Char_t *, const Char_t *, 00065 const char *qaflag = "off", const Int_t wrStEOut = 0); 00066 void doFlowEvents(Int_t nevents = 2); 00067 00068 00069 // ------------------ Here is the actual method ---------------------------------- 00070 void doFlowEvents(Int_t nevents, const Char_t **fileList, const char *qaflag, 00071 const Int_t wrStEOut) 00072 { 00073 cout << endl << endl <<" doFlowEvents - input # events = " << nevents << endl; 00074 Int_t ilist = 0; 00075 while (fileList[ilist]){ 00076 cout << " doFlowEvents - input fileList = " << fileList[ilist] << endl; 00077 ilist++; 00078 } 00079 cout << " doFlowEvents - input qaflag = " << qaflag << endl; 00080 cout << " doFlowEvents - input wrStEOut = " << wrStEOut << endl << endl << endl; 00081 00082 // 00083 // First load some shared libraries we need 00084 // (Do it in this order) 00085 // 00086 gSystem->Load("St_base"); 00087 gSystem->Load("StChain"); 00088 00089 gSystem->Load("libgen_Tables"); 00090 gSystem->Load("libsim_Tables"); 00091 gSystem->Load("libglobal_Tables"); 00092 00093 gSystem->Load("StUtilities"); 00094 gSystem->Load("StIOMaker"); 00095 gSystem->Load("StTreeMaker"); 00096 gSystem->Load("StarClassLibrary"); 00097 gSystem->Load("StEvent"); 00098 gSystem->Load("StEventUtilities"); 00099 gSystem->Load("StMagF"); 00100 00101 gSystem->Load("StFlowMaker"); 00102 gSystem->Load("PIDFitter"); 00103 00104 gSystem->Load("StStrangeMuDstMaker"); 00105 gSystem->Load("StMuDSTMaker"); 00106 00107 // Make a chain with a file list 00108 chain = new StChain("StChain"); 00109 //chain->SetDebug(); 00110 00111 StFileI *setFiles = 0; 00112 if (fileList) { //Normal case 00113 setFiles = new StFile(fileList); 00114 } else { //Grand Challenge 00115 gSystem->Load("StChallenger"); 00116 setFiles = StChallenger::Challenge(); 00117 setFiles->SetDebug(); 00118 const char *Argv[]= { 00119 "-s","dst runco", // list of components needed 00120 "-q","n_trk_tpc[0]>1000 && n_trk_tpc[1]>1000", // example of user query 00121 "-c","/afs/rhic.bnl.gov/star/incoming/GCA/daq/stacs.rc" // GC servers for daq 00122 }; 00123 Int_t Argc=sizeof(Argv)/4; 00124 setFiles->Init(Argc,Argv); 00125 } 00126 00127 // 00128 // Make Selection objects and instantiate FlowMaker 00129 // 00130 char makerName[30]; 00131 //StFlowSelection flowSelect; 00132 // particles: pi+, pi-, pi, k+, k-, e-, e+, pbar, proton, d and dbar 00133 //flowSelect->SetPidPart("pi"); // for parts. wrt plane 00134 //flowSelect->SetPtPart(0.1, 1.); // for parts. wrt plane 00135 //flowSelect->SetPPart(0.15, 5.); // for parts. wrt plane 00136 //flowSelect->SetEtaPart(0., 0.); // for parts. wrt plane 00137 //flowSelect->SetFitPtsPart(20, 50); // for parts. wrt plane 00138 //flowSelect->SetFitOverMaxPtsPart(0.52, 1.); // for parts. wrt plane 00139 //flowSelect->SetChiSqPart(0.1, 1.3); // for parts. wrt plane 00140 //flowSelect->SetDcaPart(0., 0.8); // for parts. wrt plane 00141 //flowSelect->SetDcaGlobalPart(0., 0.8); // for parts. wrt plane 00142 //flowSelect->SetYPart(-0.5, 0.5); // for parts. wrt plane 00143 00144 // uncomment next line if you make a selection object 00145 //sprintf(makerName, "Flow"); 00146 00147 if (strstr(fileList[0], ".dst.root")) { 00148 // Read raw events and make StEvent 00149 //cout << "dst file" << endl; 00150 gSystem->Load("StEventMaker"); 00151 TString mainBranch; 00152 if (fileList && fileList[0] && strstr(fileList[0],".root")) { 00153 mainBranch = fileList[0]; 00154 mainBranch.ReplaceAll(".root",""); 00155 int idot = strrchr((char*)mainBranch,'.') - mainBranch.Data(); 00156 mainBranch.Replace(0,idot+1,""); 00157 mainBranch+="Branch"; 00158 } 00159 StIOMaker *IOMk = new StIOMaker("IO", "r", setFiles, "bfcTree"); 00160 IOMk->SetIOMode("r"); 00161 IOMk->SetBranch("*", 0, "0"); //deactivate all branches 00162 if (!mainBranch.IsNull()) IOMk->SetBranch(mainBranch,0,"r"); 00163 //IOMk->SetBranch("dstBranch", 0, "r"); 00164 //IOMk->SetBranch("runcoBranch", 0, "r"); 00165 //IOMk->SetDebug(); 00166 StEventMaker *readerMaker = new StEventMaker("events", "title"); 00167 if (makerName[0]=='\0') { StFlowMaker* flowMaker = new StFlowMaker(); 00168 } else { 00169 StFlowMaker* flowMaker = new StFlowMaker(makerName, flowSelect); 00170 } 00171 if (wrStEOut) { 00172 // Write out StEvent 00173 cout << "doFlowEvents - will write out .event.root file" << endl << endl; 00174 StTreeMaker *outMk = new StTreeMaker("EvOut", "", "bfcTree"); 00175 outMk->SetIOMode("w"); 00176 outMk->SetBranch("eventBranch", "test.event.root", "w"); 00177 outMk->IntoBranch("eventBranch", "StEvent"); 00178 } 00179 00180 } else if (strstr(fileList[0], "picoevent.root")) { 00181 //Read pico-DST 00182 //cout << "pico file" << endl; 00183 if (makerName[0]=='\0') { StFlowMaker* flowMaker = new StFlowMaker(); 00184 } else { 00185 StFlowMaker* flowMaker = new StFlowMaker(makerName, flowSelect); 00186 } 00187 flowMaker->PicoEventRead(kTRUE); 00188 flowMaker->SetPicoEventFileName(setFiles); 00189 00190 } else if (strstr(fileList[0], "MuDst.root")) { 00191 //Read mu-DST 00192 //cout << "##### doFlowEvents: MuDST file" << endl; 00193 if (makerName[0]=='\0') { 00194 StFlowMaker* flowMaker = new StFlowMaker(); 00195 } else { 00196 StFlowMaker* flowMaker = new StFlowMaker(makerName, flowSelect); 00197 } 00198 flowMaker->MuEventRead(kTRUE); 00199 flowMaker->SetMuEventFileName(setFiles); 00200 00201 00202 } else if (strstr(fileList[0], ".event.root")) { 00203 // Read StEvent files 00204 //cout << "StEvent file" << endl; 00205 StIOMaker *IOMk = new StIOMaker("IO", "r", setFiles, "bfcTree"); 00206 IOMk->SetIOMode("r"); 00207 IOMk->SetBranch("*", 0, "0"); //deactivate all branches 00208 IOMk->SetBranch("eventBranch", 0, "r"); 00209 //IOMk->SetBranch("runcoBranch", 0, "r"); 00210 //IOMk->SetDebug(); 00211 if (makerName[0]=='\0') { StFlowMaker* flowMaker = new StFlowMaker(); 00212 } else { 00213 StFlowMaker* flowMaker = new StFlowMaker(makerName, flowSelect); 00214 } 00215 00216 } else { 00217 cout << " doFlowEvents - unknown file name = " << fileList[0] << endl; 00218 } 00219 00221 // Flow Makers 00222 // Use of the TagMaker is optional. 00223 // The AnalysisMaker may be used with a selection object. 00224 00225 //StFlowTagMaker* flowTagMaker = new StFlowTagMaker(); 00226 00227 00228 00229 if (makerName[0]=='\0') { 00230 StPidAmpMaker* pidAmpMaker = new StPidAmpMaker(); 00231 } else { 00232 sprintf(makerName, "PidAmp"); 00233 StPidAmpMaker* pidAmpMaker = new StPidAmpMaker(makerName, flowSelect); 00234 } 00235 00236 pidAmpMaker->SetMultBinNumber(0); 00237 00238 00239 00240 // 00241 // Initialize chain 00242 // 00243 Int_t iInit = chain->Init(); 00244 if (iInit) chain->Fatal(iInit, "on init"); 00245 chain->PrintInfo(); 00246 if (iInit) goto END; 00247 00248 // 00249 // Set the parameters 00250 // 00251 00252 // Get centrality from RunType 00253 00254 /* 00255 if (RunType) { 00256 Int_t centrality = RunType % 10 ; 00257 StFlowCutEvent::SetCent(centrality, centrality); 00258 } 00259 */ 00260 00261 // Set the event cuts // 1-26% <=>1-4, 26%-10% <=> 5-6, >10% <=> 7-8 00262 // StFlowCutEvent::SetCent(5, 6); 00263 00264 //for year 2, I changed the StFlowCutEvent so that it cuts on Nch instead of OrigMult. 00265 //year 2 data, 1-26% <=> 10<Nch<250, 26%-10% <=> 250<Nch<409, >10% <=> Nch>409 00266 00267 StFlowCutEvent::SetMult(10, 250); 00268 00269 00270 00271 00272 00273 00274 // StFlowCutEvent::SetVertexX(0., 0.); 00275 // StFlowCutEvent::SetVertexY(0., 0.); 00276 // StFlowCutEvent::SetVertexZ(0., 0.); 00277 // StFlowCutEvent::SetEtaSym(0., 0.); 00278 00279 // Set the track cuts 00280 StFlowCutTrack::SetFitPtsTpc(0, 0); 00281 StFlowCutTrack::SetFitPtsFtpc(0, 0); 00282 StFlowCutTrack::SetFitOverMaxPts(0., 0.); 00283 StFlowCutTrack::SetChiSqTpc(0., 0.); 00284 // StFlowCutTrack::SetChiSqFtpc(0., 0.); 00285 // StFlowCutTrack::SetDcaTpc(0., 0.); 00286 // StFlowCutTrack::SetDcaFtpc(0., 0.); 00287 // StFlowCutTrack::SetPtTpc(0., 0.); 00288 // StFlowCutTrack::SetPtFtpc(0., 0.); 00289 // StFlowCutTrack::SetEtaTpc(0., 0.); 00290 // StFlowCutTrack::SetEtaFtpc(0., 0., 0., 0.); 00291 00292 00293 // Set the event plane selections 00294 //StFlowEvent::SetEtaTpcCut(0.05, 1., 0, 0); // harmonic 1, selection 1 00295 //StFlowEvent::SetEtaTpcCut(0.05, 1., 1, 0); // harmonic 2, selection 1 00296 //StFlowEvent::SetEtaTpcCut(0.05, 1., 2, 0); // harmonic 3, selection 1 00297 //StFlowEvent::SetEtaTpcCut(0.05, 1., 1, 1); // harmonic 2, selection 2 00298 //StFlowEvent::SetEtaFtpcCut(0.05, 1., 1, 1); // harmonic 2, selection 2 00299 //StFlowEvent::SetPtTpcCut(0.0, 1., 1, 1); // harmonic 2, selection 2 00300 //StFlowEvent::SetPtFtpcCut(0.0, 1., 1, 1); // harmonic 2, selection 2 00301 00302 //StFlowEvent::SetDcaGlobalCut(0., 1.); // for event plane 00303 00304 // particles: pi+, pi-, pi, k+, k-, e-, e+, pbar, proton, d and dbar 00305 //StFlowEvent::SetPid("pi"); // for event plane 00306 00307 // Make Eta subevents 00308 // StFlowEvent::SetEtaSubs(); 00309 00310 // Use a Pt weight in the event plane calcualtion 00311 // StFlowEvent::SetPtWgt(kTRUE); 00312 00313 // Use Aihong's probability PID method 00314 // StFlowEvent::SetProbPid(); 00315 00316 // Set the PID deviant windows 00317 // StFlowEvent::SetPiPlusCut(-3., 3.); 00318 // StFlowEvent::SetPiMinusCut(-3., 3.); 00319 // StFlowEvent::SetProtonCut(-3., 3.); 00320 // StFlowEvent::SetAntiProtonCut(-3., 3.); 00321 // StFlowEvent::SetKPlusCut(-3., 3.); 00322 // StFlowEvent::SetKMinusCut(-3., 3.); 00323 // StFlowEvent::SetDeuteronCut(-3., 3.); 00324 // StFlowEvent::SetAntiDeuteronCut(-3., 3.); 00325 // StFlowEvent::SetElectronCut(-3., 3.); 00326 // StFlowEvent::SetPositronCut(-3., 3.); 00327 00328 TTable *tabl=0; 00329 TDataSet *obj=0; 00330 TDataSet *ddb=0; 00331 TDataSet *ddstBranch=0; 00332 00333 // 00334 // Event loop 00335 // 00336 int istat = 0, i = 1; 00337 EventLoop: if (i <= nevents && istat != 2) { 00338 00339 cout << endl << "============================ Event " << i 00340 << " start ============================" << endl; 00341 00342 chain->Clear(); 00343 istat = chain->Make(i); 00344 if (istat == 2) 00345 {cout << "Last event processed. Status = " << istat << endl;} 00346 if (istat == 3) 00347 {cout << "Error event processed. Status = " << istat << endl;} 00348 00349 // if (!istat) { 00350 // ddstBranch=chain->GetDataSet("dstBranch"); 00351 // TDataSetIter dstbranchIter(ddstBranch); 00352 // if (ddstBranch) { 00353 // cout << endl << " QAInfo: in dstBranch " << endl; 00354 // while (ddb=dstbranchIter.Next()) { 00355 // cout << " QAInfo: found object: " << ddb->GetName() << endl; 00356 // TString dsName = ddb->GetName(); 00357 // if (ddb->InheritsFrom("TTable")) { 00358 // tabl = (TTable *)ddb; 00359 // cout << " QAInfo: it's a table with #rows = " 00360 // << tabl->GetNRows() << endl; 00361 // if (dsName == "BfcStatus") { 00362 // // Now print out contents of BfcStatus for QA purposes 00363 // TDataSetIter bfcstatiter(ddb); 00364 // St_dst_bfc_status *bfcstat = 00365 // (St_dst_bfc_status *) bfcstatiter.Find("BfcStatus"); 00366 // dst_bfc_status_st *bth = bfcstat->GetTable(); 00367 // // loop over all rows in table BfcStatus: 00368 // Int_t ij = 0; 00369 // for (ij=0; ij< bfcstat->GetNRows(); ij++) 00370 // { 00371 // cout << " QAInfo: BfcStatus table -- row " << ij << 00372 // ", Maker: " << bth[ij]->maker_name << 00373 // " has istat = " << bth[ij]->status << endl; 00374 // } // for bfcstat 00375 // } // if dsName 00376 // } // if ddb 00377 // } // while obj Next 00378 // } // if dstBranch 00379 // } // if !istat 00380 00381 i++; 00382 goto EventLoop; 00383 } 00384 00385 i--; 00386 cout << endl << "============================ Event " << i 00387 << " finish ============================" << endl; 00388 00389 // 00390 // Chain Finish 00391 // 00392 if (nevents > 1) { 00393 chain->Clear(); 00394 chain->Finish(); 00395 delete chain; 00396 } 00397 else { 00398 if (!b) { 00399 b = new TBrowser; 00400 } 00401 } 00402 00403 END: 00404 } 00405 00406 // ----------- This concatenates the path and the file name --------------------- 00407 void doFlowEvents(const Int_t nevents, const Char_t *path, const Char_t *file, const char *qaflag, const Int_t wrStEOut) 00408 { 00409 const char *fileListQQ[] = {0,0}; 00410 if (strncmp(path, "GC", 2) == 0) { 00411 fileListQQ = 0; 00412 } else if (path[0] == '-') { 00413 fileListQQ[0] = file; 00414 } else { 00415 fileListQQ[0] = gSystem->ConcatFileName(path,file); 00416 } 00417 00418 doFlowEvents(nevents, fileListQQ, qaflag, wrStEOut); 00419 } 00420 00421 // ----------- This sets default path and file names --------------------------- 00422 void doFlowEvents(const Int_t nevents) 00423 { 00424 // Commit to cvs with these defaults: 00425 const Char_t *filePath="-"; 00426 const Char_t *fileExt="/afs/rhic.bnl.gov/star/data/samples/gstar.dst.root"; 00427 00428 // BNL 00429 //Char_t* filePath="/star/rcf/scratch/posk/P00hg3"; 00430 //Char_t* fileExt="*.flowpicoevent.root"; 00431 //Char_t* fileExt="st_physics_1229055_raw_0013.dst.root.flowpicoevent.root"; 00432 00433 //Char_t* filePath="../Data/FtpcSim/Markus/"; 00434 //Char_t* fileExt="*flowpicoevent.root"; 00435 00436 //Char_t* filePath="./"; 00437 //Char_t* fileExt="*.event.root"; 00438 00439 // LBNL 00440 // Char_t* filePath="/auto/pdsfdv08/starspec/pDST/P00hm/minbias/"; 00441 // if (nevents < 250) { 00442 // Char_t* fileExt="st_physics_1244014_raw_0001.event.root.flowpicoevent.root"; 00443 // } else { 00444 // Char_t* fileExt="*.flowpicoevent.root"; 00445 // } 00446 00447 doFlowEvents(nevents, filePath, fileExt); 00448 } 00449 00451 // 00452 // $Log: doFlowEvents.C,v $ 00453 // Revision 1.3 2006/08/15 21:42:07 jeromel 00454 // Fix rhic -> rhic.bnl.gov 00455 // 00456 // Revision 1.2 2002/09/30 20:29:39 aihong 00457 // to make it read in MuDst 00458 // 00459 // Revision 1.1 2002/02/14 21:25:55 aihong 00460 // re-install the new version 00461 // 00462 // Revision 1.32 2001/06/07 20:12:12 posk 00463 // Added global dca cut for event plane particles. 00464 // Changed SePtWgt() to SetPtWgt(Bool_t). 00465 // 00466 // Revision 1.31 2001/05/22 19:58:42 posk 00467 // Can take centrality from the shell script. 00468 // Removed multiple instances feature. 00469 // 00470 // Revision 1.30 2000/12/12 18:49:18 posk 00471 // Moved log comments to the end of the file. 00472 // 00473 // Revision 1.29 2000/12/08 17:04:36 oldi 00474 // Phi weights for both FTPCs included. 00475 // 00476 // Revision 1.27 2000/11/15 14:41:51 posk 00477 // Protected against running Finish() twice. 00478 // 00479 // Revision 1.26 2000/11/13 01:32:35 snelling 00480 // load StEventUtilities 00481 // 00482 // Revision 1.25 2000/11/09 17:39:14 snelling 00483 // Added switch for probability pid 00484 // 00485 // Revision 1.24 2000/09/16 22:21:15 snelling 00486 // Added lines to set selection on P and global DCA 00487 // 00488 // Revision 1.23 2000/09/15 22:54:44 posk 00489 // Added Pt weighting for event plane calculation. 00490 // 00491 // Revision 1.22 2000/09/15 01:22:27 snelling 00492 // Added the new selection options to the macro 00493 // 00494 // Revision 1.21 2000/09/05 16:29:43 snelling 00495 // Added cuts for new particles 00496 // 00497 // Revision 1.18 2000/08/28 16:15:50 snelling 00498 // Added Pt and Eta cuts to macro 00499 // 00500 // Revision 1.17 2000/08/26 21:39:51 snelling 00501 // Modified IO for multiple pico events 00502 // 00503 // Revision 1.15 2000/06/30 14:57:34 posk 00504 // Updated to latest doEvents.C . 00505 // 00506 // Revision 1.11 2000/05/17 16:20:59 kathy 00507 // add some print stmts and also run some IOMaker methods in order to get default input files that are softlinks to other files working correctly 00508 // 00509 // Revision 1.10 2000/05/16 20:57:31 posk 00510 // Voloshin's flownanoevent.root added. 00511 // 00512 // Revision 1.9 2000/05/11 00:22:28 posk 00513 // Can read StEvent files which have extention .event.root . 00514 // 00515 // Revision 1.8 2000/05/09 19:38:22 kathy 00516 // update to use standard default input files and only process few events by default - to make it easy to run in automatic macro testing script 00517 // 00518 // Revision 1.6 2000/04/13 21:46:34 kathy 00519 // remove loading of libtpc_Tables since l3Track table is now dst_track type from global 00520 // 00521 // Revision 1.5 2000/04/12 15:06:53 kathy 00522 // changed all macros that read DSTs to load Tables from libraries: gen,sim,global,dst instead of ALL Tables (previously loaded St_Tables); currently, if you are using DEV to read a DST in NEW,PRO, you must comment out the loading of libtpc_Tables because of a mismatch with tpt_track table 00523 // 00524 // Revision 1.4 2000/03/28 23:26:46 posk 00525 // Allow multiple instances of the AnalysisMaker. 00526 // 00527 // Revision 1.3 2000/03/15 23:33:54 posk 00528 // Added StFlowSelection. 00529 // 00530 // Revision 1.2 2000/03/07 17:51:23 snelling 00531 // Added switch for Nano DST 00532 // 00533 // Revision 1.1 2000/03/02 23:49:11 posk 00534 // Version of doEvents.C for flow analysis which can set cut parameters. 00535 //
1.5.9