00001 00002 // $Id: StMiniHijing.C,v 1.7 2006/07/24 19:25:26 calderon Exp $ 00003 // owner: Manuel Calderon de la Barca Sanchez 00004 // 00005 // what it does: reads .geant.root file from hijing data, produces minimc.root file 00006 // runs a chain with the makers: 00007 // StMcEventMaker,StAssociationMaker, 00008 // StMiniMcEventMaker 00009 // $Log: StMiniHijing.C,v $ 00010 // Revision 1.7 2006/07/24 19:25:26 calderon 00011 // Load EEmcUtil, needed by StMcEvent. 00012 // 00013 // Revision 1.6 2004/03/30 03:16:15 calderon 00014 // Modifications for running in bfc. 00015 // - Changed to use StiIOInterface (IOMaker in normal mode, TreeMaker in bfc) 00016 // - Cleaned up Init(), InitRun() to handle the changing file names. 00017 // - Initialize lots of variables and pointers in constructor. 00018 // - Delete some pointers in Finish (deleting the TTree causes a seg fault, though.) 00019 // - Note that currently the StHits in the ITTF chain don't have a usedInFit() flag, 00020 // so there will be many messages complaining about this. 00021 // - Removed the mDebug data member, every Maker already has one, so change 00022 // to use that throughout the package. 00023 // 00024 // Revision 1.5 2003/07/09 01:07:23 calderon 00025 // Addition of FTPC reference multiplicity 00026 // Addition of other multiplicity values for StMiniMcEvent 00027 // Changes to reflect the use of the setters and getters, no longer 00028 // access the data members directly. 00029 // 00030 // Revision 1.4 2002/06/28 22:15:12 calderon 00031 // Changes to deal with seg. faults in the file name handling: 00032 // Conventions: 00033 // StMiniMcMaker looks for the input file from the IO maker to figure out 00034 // if the file has changed. This is done using TString::Contains() in Make(). 00035 // Usually we will run one file at a time, but in order not to break Bum's scheme of being 00036 // able to process several files in one go, this is left as is. However, for 00037 // embedding, the file name is not enough, in Eric's new scheme there are repeated 00038 // file names. This is resolved by adding a prefix to the output file name. However, 00039 // this prefix should not be overwritten, so the current code only replaces the 00040 // string inside the output file name pertaining to the input file name, and leaves 00041 // the prefix of the output file intact. This was done for embedding looking for 00042 // st_physics, and here is where the problem arose: hijing files begin with a different 00043 // prefix. To solve this problem, the input file name prefix is now an input parameter 00044 // in the macro. 00045 // 00046 // StMiniEmbed.C and StMiniHijing.C now conform to this convention. StMiniEmbed.C 00047 // did not change its prototype, because all embedding files have st_phyics as prefix. 00048 // StMiniHijing.C changed its prototype, now it takes as an input argument the prefix, 00049 // but in order not to break Jenn's scripts if she was already using this macro, 00050 // this parameter was added at the end and defaults to "rcf", which is appropriate 00051 // for hijing files reconstructed in rcf. 00052 // 00053 // Revision 1.3 2002/06/07 02:21:59 calderon 00054 // Protection against empty vector in findFirstLastHit 00055 // $Log: StMiniHijing.C,v $ 00056 // Revision 1.7 2006/07/24 19:25:26 calderon 00057 // Load EEmcUtil, needed by StMcEvent. 00058 // 00059 // Revision 1.6 2004/03/30 03:16:15 calderon 00060 // Modifications for running in bfc. 00061 // - Changed to use StiIOInterface (IOMaker in normal mode, TreeMaker in bfc) 00062 // - Cleaned up Init(), InitRun() to handle the changing file names. 00063 // - Initialize lots of variables and pointers in constructor. 00064 // - Delete some pointers in Finish (deleting the TTree causes a seg fault, though.) 00065 // - Note that currently the StHits in the ITTF chain don't have a usedInFit() flag, 00066 // so there will be many messages complaining about this. 00067 // - Removed the mDebug data member, every Maker already has one, so change 00068 // to use that throughout the package. 00069 // 00070 // Revision 1.5 2003/07/09 01:07:23 calderon 00071 // Addition of FTPC reference multiplicity 00072 // Addition of other multiplicity values for StMiniMcEvent 00073 // Changes to reflect the use of the setters and getters, no longer 00074 // access the data members directly. 00075 // 00076 // Revision 1.4 2002/06/28 22:15:12 calderon 00077 // Changes to deal with seg. faults in the file name handling: 00078 // 00080 00081 class StChain; 00082 StChain *chain=0; 00083 00084 void StMiniHijing(Int_t nevents=3, 00085 const char* MainFile= 00086 "hijing_b0_3/rcf0147_01*geant.root", 00087 const char* outDir = "./", 00088 int commonHits=3, 00089 TString filePrefix="rcf") 00090 { 00091 00092 // Dynamically link needed shared libs 00093 //gSystem->Load("StarRoot"); 00094 gSystem->Load("St_base"); 00095 gSystem->Load("StChain"); 00096 00097 gSystem->Load("St_Tables"); 00098 gSystem->Load("StUtilities"); 00099 gSystem->Load("StIOMaker"); 00100 gSystem->Load("StarClassLibrary"); 00101 00102 gSystem->Load("StDetectorDbMaker"); 00103 gSystem->Load("StTpcDb"); 00104 gSystem->Load("StEvent"); 00105 gSystem->Load("StEventMaker"); 00106 gSystem->Load("StEmcUtil"); 00107 gSystem->Load("StEEmcUtil"); 00108 gSystem->Load("StMcEvent"); 00109 gSystem->Load("StMcEventMaker"); 00110 gSystem->Load("StAssociationMaker"); 00111 gSystem->Load("StMcAnalysisMaker"); 00112 00113 gSystem->Load("StMiniMcEvent"); 00114 gSystem->Load("StMiniMcMaker"); 00115 // gSystem->Load("Common"); 00116 00117 chain = new StChain("StChain"); 00118 chain->SetDebug(); 00119 00120 // Now we add Makers to the chain... 00121 00122 StIOMaker* ioMaker = new StIOMaker("IO","r",MainFile,"bfcTree"); 00123 ioMaker->SetDebug(); 00124 ioMaker->SetIOMode("r"); 00125 ioMaker->SetBranch("*",0,"0"); //deactivate all branches 00126 ioMaker->SetBranch("geantBranch",0,"r"); //activate geant Branch 00127 ioMaker->SetBranch("eventBranch",0,"r"); //activate Event Branch 00128 // ioMaker->SetBranch("runcoBranch",0,"r"); //activate runco Branch 00129 00130 // const char *mainDB = "MySQL:Geometry_tpc"; 00131 // St_db_Maker *dbMk = new St_db_Maker("Geometry",mainDB); 00132 // dbMk->SetDebug(); 00133 00134 // const char *calibDB = "MySQL:Calibrations_tpc"; 00135 // St_db_Maker *calibMk = new St_db_Maker("Calibrations",calibDB); 00136 // calibMk->SetDebug(); 00137 00138 // StTpcDbMaker *tpcDbMk = new StTpcDbMaker("tpcDb"); 00139 00140 // Note, the title "events" is used in the Association Maker, so don't change it. 00141 // StEventMaker* eventReader = new StEventMaker("events","title"); 00142 // eventReader->doPrintMemoryInfo = kFALSE; 00143 00144 StMcEventMaker* mcEventReader = new StMcEventMaker; // Make an instance... 00145 // mcEventReader->doPrintMemoryInfo = kFALSE; 00146 // mcEventReader->doUseTpc = kTRUE; 00147 // mcEventReader->doUseSvt = kTRUE; 00148 // mcEventReader->doUseFtpc = kTRUE; 00149 // mcEventReader->doUseRich = kTRUE; 00150 StAssociationMaker* associator = new StAssociationMaker; 00151 //associator->doPrintMemoryInfo = kTRUE; 00152 00153 // 00154 // mdst of association stuff 00155 // 00156 00157 TString filename = MainFile; 00158 int fileBeginIndex = filename.Index(filePrefix,0); 00159 filename.Remove(0,fileBeginIndex); 00160 00161 00162 StMiniMcMaker *krap = new StMiniMcMaker; 00163 krap->SetDebug(1); 00164 krap->setGhost(); 00165 krap->setOutDir(outDir); 00166 krap->setPtCut(0.); 00167 krap->setFileName(filename); 00168 krap->setFilePrefix(filePrefix); 00169 00170 // Define the cuts for the Associations 00171 00172 StMcParameterDB* parameterDB = StMcParameterDB::instance(); 00173 // TPC 00174 parameterDB->setXCutTpc(.5); // 5 mm 00175 parameterDB->setYCutTpc(.5); // 5 mm 00176 parameterDB->setZCutTpc(.5); // 5 mm 00177 parameterDB->setReqCommonHitsTpc(commonHits); // Require 3 hits in common for tracks to be associated 00178 // FTPC 00179 parameterDB->setRCutFtpc(.3); // 3 mm 00180 parameterDB->setPhiCutFtpc(5*(3.1415927/180.0)); // 5 degrees 00181 parameterDB->setReqCommonHitsFtpc(3); // Require 3 hits in common for tracks to be associated 00182 // SVT 00183 parameterDB->setXCutSvt(.08); // 800 um 00184 parameterDB->setYCutSvt(.08); // 800 um 00185 parameterDB->setZCutSvt(.08); // 800 um 00186 parameterDB->setReqCommonHitsSvt(1); // Require 1 hits in common for tracks to be associated 00187 00188 00189 // now execute the chain member functions 00190 00191 //chain->PrintInfo(); 00192 Int_t initStat = chain->Init(); // This should call the Init() method in ALL makers 00193 if (initStat) chain->Fatal(initStat, "during Init()"); 00194 00195 int istat=0,iev=1; 00196 EventLoop: if (iev<=nevents && istat!=2) { 00197 chain->Clear(); 00198 cout << "---------------------- Processing Event : " << iev << " ----------------------" << endl; 00199 istat = chain->Make(iev); // This should call the Make() method in ALL makers 00200 if (istat == 2) { cout << "Last Event Processed. Status = " << istat << endl; } 00201 if (istat == 3) { cout << "Error Event Processed. Status = " << istat << endl; } 00202 iev++; goto EventLoop; 00203 } // Event Loop 00204 00205 chain->Finish(); 00206 00207 } 00208
1.5.9