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
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00046
00047 Int_t usePath = 0;
00048 Int_t nFile = 0;
00049 TString thePath;
00050 TString theFileName;
00051 TString originalPath;
00052 class StChain;
00053 StChain *chain=0;
00054 class StEventDisplayMaker;
00055 StEventDisplayMaker *dsMaker = 0;
00056 TBrowser *b=0;
00057
00058 const char *dstFile = 0;
00059 const char *xdfFile = 0;
00060 const char *mdcFile = 0;
00061 const char *fileList[] = {dstFile,xdfFile,mdcFile,0};
00062
00063 void Help()
00064 {
00065 cout << "Usage: doHists.C(nevents,\"-\",\"some_directory/some_dst_file.xdf\")" << endl;
00066 cout << " doHists.C(nevents,\"-\",\"some_directory/some_dst_file.root\")" << endl;
00067 cout << " doHists.C(nevents,\"some_directory\",\"*.dst.root\")" << endl;
00068 }
00069
00070
00071 void doHists(Int_t, const Char_t **, const Char_t *qaflag = "");
00072
00073 void doHists(Int_t nevents=2,
00074 const Char_t *path="/afs/rhic.bnl.gov/star/data/samples/gstar.hist.root",
00075 const Char_t *file="",
00076 const Char_t *qaflag = "off",
00077 const Int_t wrStEOut = 0);
00078
00079
00080 void doHists(Int_t nevents, const Char_t **fileList, const Char_t *qaflag, const Int_t wrStEOut)
00081 {
00082
00083 cout << endl << endl <<" doHists - input # events = " << nevents << endl;
00084 Int_t ilist=0;
00085 while(fileList[ilist]){
00086 cout << " doHists - input fileList = " << fileList[ilist] << endl;
00087 ilist++;
00088 }
00089 cout << " doHists - input qaflag = " << qaflag << endl;
00090 cout << " doHists - input wrStEOut = " << wrStEOut << endl << endl << endl;
00091
00092
00093
00094
00095
00096 gSystem->Load("St_base");
00097 gSystem->Load("StChain");
00098
00099 gSystem->Load("libgen_Tables");
00100 gSystem->Load("libsim_Tables");
00101 gSystem->Load("libglobal_Tables");
00102
00103 gSystem->Load("StUtilities");
00104 gSystem->Load("StIOMaker");
00105 gSystem->Load("StTreeMaker");
00106 gSystem->Load("StAnalysisUtilities");
00107
00108
00109
00110
00111 chain = new StChain("StChain");
00112 StFileI *setFiles =0;
00113 if (fileList) {
00114 setFiles= new StFile(fileList);
00115 } else {
00116 gSystem->Load("StChallenger");
00117 setFiles = StChallenger::Challenge();
00118 setFiles->SetDebug();
00119 const char *Argv[]= {
00120 "-s","dst runco",
00121 "-q","numberOfPrimaryTracks>1500",
00122 "-c","/afs/rhic.bnl.gov/star/incoming/GCA/daq/stacs.rc"
00123 };
00124 Int_t Argc=sizeof(Argv)/4;
00125 setFiles->Init(Argc,Argv);
00126 }
00127 StIOMaker *IOMk = new StIOMaker("IO","r",setFiles,"bfcTree");
00128 IOMk->SetIOMode("r");
00129 IOMk->SetBranch("*",0,"0");
00130 IOMk->SetBranch("histBranch",0,"r");
00131 IOMk->SetMaxEvent(1);
00132 IOMk->SetDebug();
00133
00134
00135
00136
00137
00138
00139
00140
00141
00142
00143
00144 StHistCollectorMaker *histsMaker = new StHistCollectorMaker("merged");
00145
00146
00147 if (wrStEOut) {
00148 cout << "!!!! doHists: will write out .event.root file !!" << endl << endl;
00149 StTreeMaker *outMk = new StTreeMaker("mergeOut","","mergeTree");
00150 outMk->SetIOMode ("w");
00151 outMk->SetBranch ("mergeBranch","test.merge.root","w","const");
00152 outMk->IntoBranch("mergeBranch","Merged");
00153 }
00154
00155
00156
00157 Int_t iInit = chain->Init();
00158 if (iInit) chain->Fatal(iInit,"on init");
00159 chain->PrintInfo();
00160
00161
00162
00163
00164
00165 int istat=0,i=1;
00166 EventLoop: if (i <= nevents && istat!=2) {
00167
00168 cout << endl << "============================ Event " << i
00169 << " start ============================" << endl;
00170
00171 chain->Clear();
00172 istat = chain->Make(i);
00173
00174 if (istat==2)
00175 {cout << "Last event processed. Status = " << istat << endl;}
00176 if (istat==3)
00177 {cout << "Error event processed. Status = " << istat << endl;}
00178 i++;
00179 goto EventLoop;
00180 }
00181
00182 i--;
00183 cout << endl << "============================ Event " << i
00184 << " finish ============================" << endl;
00185 new TBrowser("AccumulatedHistograms",histsMaker->FindByName(".const"));
00186
00187 }
00188
00189
00190
00191 void doHists(const Int_t nevents, const Char_t *path, const Char_t *file,
00192 const Char_t *qaflag, const Int_t wrStEOut)
00193 {
00194 if (nevents==-1) { Help(); return;}
00195 const char *fileListQQ[]={0,0};
00196 if (strncmp(path,"GC",2)==0) {
00197 fileListQQ=0;
00198 } else if (path[0]=='-') {
00199 fileListQQ[0]=file;
00200 } else if (!file[0]) {
00201 fileListQQ[0]=path;
00202 } else {
00203 fileListQQ[0] = gSystem->ConcatFileName(path,file);
00204 }
00205 doHists(nevents,fileListQQ,qaflag,wrStEOut);
00206 }
00207
00209
00210
00211
00212
00213
00214
00215
00216
00217
00218
00219
00220
00221
00222
00224
00225
00226
00227
00228
00229