00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 void RedoSpaceCharge(const int firstEvt,
00025 const int NEvts,
00026 const Bool_t redo,
00027 const char* inputFiles);
00028 void RedoSpaceCharge(const int NEvts,
00029 const Bool_t redo,
00030 const char* inputFiles);
00031 void RedoSpaceCharge(const int NEvts=10000000,
00032 const char* inputFiles=0);
00033 void help();
00034 void load();
00035 void run(const int firstEvt,
00036 const int NEvts,
00037 const Bool_t redo,
00038 const char* inputFiles,
00039 const char* outDir=0);
00040
00041
00042
00043 const Char_t *defaultFiles = "@o1.lis";
00044 const Char_t *defaultOutDir = "./";
00045
00046
00047
00049 void help() {
00050 cout << "Usage:\n" <<
00051 " RedoSpaceCharge.C" <<
00052 "(firstEvt,NEvts,redo,\"some_directory/some_file.event.root\")\n" <<
00053 " RedoSpaceCharge.C" <<
00054 "(NEvts,redo,\"some_directory/some_file.event.root\")\n" <<
00055 " RedoSpaceCharge.C" <<
00056 "(NEvts,\"some_directory/some_file.event.root\")\n" <<
00057 endl;
00058 cout << "where redo=kTRUE to redo using new SpaceCharge,\n" <<
00059 " redo=kFALSE to use the current tracks as they are,\n" <<
00060 " and the new SpaceCharge is used if redo is omitted." << endl;
00061 }
00062
00063
00064 void load() {
00065 gSystem->Load("libTable");
00066 gSystem->Load("libPhysics");
00067 gSystem->Load("St_base");
00068 gSystem->Load("StUtilities");
00069 gSystem->Load("StChain");
00070 gSystem->Load("StTreeMaker");
00071 gSystem->Load("St_Tables");
00072 gSystem->Load("StIOMaker");
00073 gSystem->Load("StarClassLibrary");
00074 gSystem->Load("StTriggerDataMaker");
00075 gSystem->Load("StBichsel");
00076 gSystem->Load("StEvent");
00077 gSystem->Load("StSecondaryVertexMaker");
00078 gSystem->Load("StarMagField");
00079 gSystem->Load("StMagF");
00080 gSystem->Load("StDbLib.so");
00081 gSystem->Load("StDbBroker.so");
00082 gSystem->Load("libglobal_Tables.so");
00083 gSystem->Load("St_db_Maker.so");
00084 gSystem->Load("StDetectorDbMaker");
00085 gSystem->Load("StTpcDb");
00086 gSystem->Load("StDbUtilities");
00087 gSystem->Load("StEventUtilities");
00088 gSystem->Load("StStrangeMuDstMaker");
00089 gSystem->Load("StEmcUtil");
00090 gSystem->Load("StMuDSTMaker");
00091 }
00092
00093 void run(const int firstEvt,
00094 const int NEvts,
00095 const Bool_t redo,
00096 const char* inputFiles,
00097 const char* outDir) {
00098
00099
00100 const Char_t *file = ( (inputFiles) ? inputFiles : defaultFiles );
00101 const Char_t *dir = ( (outDir) ? outDir : defaultOutDir );
00102 StFile *files = new StFile();
00103 files->AddFile(file);
00104
00105
00106 StChain chain("myChain");
00107
00108
00109 StIOMaker IOMaker("IOMaker","r",files,"bfcTree");
00110 St_db_Maker dbMaker("db","MySQL:StarDb","$STAR/StarDb","StarDb");
00111 StMagFMaker magfMk;
00112 StTpcDbMaker tpcDbMk("tpcDb");
00113 StDetectorDbMaker detDbMk;
00114 StRedoTracks redoMk;
00115 StV0FinderMaker secondaryFinder;
00116 StStrangeMuDstMaker strangeDst("strangeMuDst");
00117 StMuDstMaker commonDst(1,1,dir);
00118
00119
00120 IOMaker.SetBranch("*",0,"0");
00121 IOMaker.SetBranch("eventBranch",0,"r");
00122 IOMaker.SetBranch("runcoBranch",0,"r");
00123 IOMaker.SetBranch("emcBranch",0,"r");
00124
00125
00126 strangeDst.DoV0();
00127 strangeDst.DoXi();
00128 strangeDst.DoKink();
00129 strangeDst.SetNoKeep();
00130
00131
00132 commonDst.setProbabilityPidFile();
00133 StMuL3Filter* l3Filter = new StMuL3Filter();
00134 commonDst.setL3TrackFilter(l3Filter);
00135 StMuFilter* filter = new StMuFilter();
00136 commonDst.setTrackFilter(filter);
00137
00138
00139 if (!redo) redoMk.DontDo();
00140
00141
00142 Int_t istatus = chain.Init();
00143 if( istatus ) { chain.Fatal(istatus,"on init"); return; }
00144
00145 IOMaker.Skip(firstEvt);
00146
00147
00148 for( Int_t i=0; (i<NEvts) && (istatus!=2); i++ ) {
00149 chain.Clear();
00150 switch (istatus = chain.Make()) {
00151 case 0: break;
00152 case 2: { gMessMgr->Info("Last event from input."); break; }
00153 case 3: { gMessMgr->Error() << "Event " << i << " had error " <<
00154 istatus << ". Now skipping event."; gMessMgr->Print(); break; }
00155 default: { gMessMgr->Warning() << "Event " << i << " returned status " <<
00156 istatus << ". Continuing."; gMessMgr->Print(); }
00157 }
00158 gMessMgr->Info() << "*** Finished processing event " << i;
00159 gMessMgr->Print();
00160 }
00161
00162
00163 if( NEvts >= 1 ) chain.Finish();
00164 }
00165
00166 void RedoSpaceCharge(const int firstEvt,
00167 const int NEvts,
00168 const Bool_t redo,
00169 const char* inputFiles) {
00170 load();
00171 run(firstEvt,NEvts,redo,inputFiles,defaultOutDir);
00172 }
00173
00174 void RedoSpaceCharge(const int NEvts,
00175 const Bool_t redo,
00176 const char* inputFiles) {
00177 RedoSpaceCharge(0,NEvts,redo,inputFiles);
00178 }
00179
00180 void RedoSpaceCharge(const int NEvts,
00181 const char* inputFiles) {
00182 RedoSpaceCharge(0,NEvts,kTRUE,inputFiles);
00183 }
00184
00185
00186
00187
00188
00189
00190
00191
00192
00193
00194
00195
00196
00197
00198