00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00049 Int_t debug=1;
00050 Int_t doIt=1;
00051 Int_t usePath = 0;
00052 Int_t nFile = 0;
00053 TString thePath;
00054 TString theFileName;
00055 TString originalPath;
00056 class StChain;
00057 StChain *chain=0;
00058 class StEventDisplayMaker;
00059 StEventDisplayMaker *dsMaker = 0;
00060 TBrowser *b=0;
00061
00062 const char *dstFile = 0;
00063 const char *xdfFile = 0;
00064 const char *mdcFile = 0;
00065 const char *fileList[] = {dstFile,xdfFile,mdcFile,0};
00066
00067 void Help()
00068 {
00069 cout << "Usage: doEvents.C(nevents,\"-\",\"some_directory/some_dst_file.xdf\")" << endl;
00070 cout << " doEvents.C(nevents,\"-\",\"some_directory/some_dst_file.root\")" << endl;
00071 cout << " doEvents.C(nevents,\"some_directory\",\"*.dst.root\")" << endl;
00072 }
00073
00074
00075 void doEvents(Int_t, const Char_t **, const Char_t *qaflag = "");
00076
00077 void doEvents(Int_t nevents=5,
00078 const Char_t *path=
00079 "links/P02gc.productionCentral.FullField.2001.313.dst/",
00080 const Char_t *file=
00081 "st_physics_2313048_raw_0237.event.root",
00082 const Char_t* outDir = "./",
00083 const Char_t *qaflag = "off",
00084 const Int_t wrStEOut = 0);
00085
00086
00087 void doEvents(Int_t nevents, const Char_t **fileList,const Char_t* outDir,
00088 const Char_t *qaflag, const Int_t wrStEOut)
00089 {
00090
00091 cout << endl << endl <<" doEvents - input # events = " << nevents << endl;
00092 Int_t ilist=0;
00093 while(fileList[ilist]){
00094 cout << " doEvents - input fileList = " << fileList[ilist] << endl;
00095 ilist++;
00096 }
00097 cout << " doEvents - input qaflag = " << qaflag << endl;
00098 cout << " doEvents - input wrStEOut = " << wrStEOut << endl << endl << endl;
00099
00100
00101
00102
00103
00104 gSystem->Load("St_base");
00105 gSystem->Load("StChain");
00106
00107
00108 gSystem->Load("libgen_Tables");
00109 gSystem->Load("libsim_Tables");
00110 gSystem->Load("libglobal_Tables");
00111
00112 gSystem->Load("StUtilities");
00113 gSystem->Load("StarClassLibrary");
00114
00115 gSystem->Load("StTpcDb");
00116 gSystem->Load("StEvent");
00117 gSystem->Load("StEventMaker");
00118
00119 gSystem->Load("StIOMaker");
00120 gSystem->Load("StHiMicroEvent");
00121 gSystem->Load("StHiMicroMaker");
00122
00123
00124 chain = new StChain("StChain");
00125 chain->SetDebug();
00126
00127 StFileI *setFiles = new StFile(fileList);
00128
00129 TString mainBranch;
00130 if(fileList && fileList[0] && strstr(fileList[0],".root")){
00131 mainBranch = fileList[0];
00132 mainBranch.ReplaceAll(".root","");
00133 int idot = strrchr((char*)mainBranch,'.') - mainBranch.Data();
00134 mainBranch.Replace(0,idot+1,"");
00135 mainBranch+="Branch";
00136 }
00137
00138
00139 StIOMaker* ioMaker = new StIOMaker("IO","r",setFiles,"bfcTree");
00140 cout << "\t created" << endl;
00141 ioMaker->SetDebug();
00142 ioMaker->SetIOMode("r");
00143 ioMaker->SetBranch("*",0,"0");
00144
00145
00146
00147 if(!mainBranch.IsNull()) ioMaker->SetBranch(mainBranch,0,"r");
00148
00149 if(mainBranch=="dstBranch"){
00150 cout << "Creating event.root" << endl;
00151 StEventMaker* eventReader = new StEventMaker("events","title");
00152 eventReader->doPrintEventInfo = 0;
00153 }
00154
00155
00156 StHiMicroMaker* hiPt = new StHiMicroMaker;
00157 hiPt->setOutDir(outDir);
00158 hiPt->setDebug(debug);
00159 hiPt->setHitLoop(doIt);
00160
00161
00162
00163
00164
00165
00166 Int_t iInit = chain->Init();
00167 if (iInit) chain->Fatal(iInit,"on init");
00168 chain->PrintInfo();
00169
00170
00171
00172
00173
00174 int istat=0,i=1;
00175 EventLoop: if (i <= nevents && istat!=2) {
00176
00177 cout << endl << "============================ Event " << i
00178 << " start ============================" << endl;
00179
00180 chain->Clear();
00181 istat = chain->Make(i);
00182
00183 if (istat==2)
00184 {cout << "Last event processed. Status = " << istat << endl;}
00185 if (istat==3)
00186 {cout << "Error event processed. Status = " << istat << endl;}
00187
00188
00189
00190
00191 i++;
00192 goto EventLoop;
00193 }
00194
00195 i--;
00196 cout << endl << "============================ Event " << i
00197 << " finish ============================" << endl;
00198
00199 }
00200
00201
00202
00203 void doEvents(const Int_t nevents, const Char_t *path, const Char_t *file,
00204 const Char_t *outDir,
00205 const Char_t *qaflag, const Int_t wrStEOut)
00206 {
00207 if (nevents==-1) { Help(); return;}
00208 const char *fileListQQ[]={0,0};
00209 if (strncmp(path,"GC",2)==0) {
00210 fileListQQ=0;
00211 } else if (path[0]=='-') {
00212 fileListQQ[0]=file;
00213 } else if (!file[0]) {
00214 fileListQQ[0]=path;
00215 } else {
00216 fileListQQ[0] = gSystem->ConcatFileName(path,file);
00217 }
00218 doEvents(nevents,fileListQQ,outDir,qaflag,wrStEOut);
00219 }
00220