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
00050 #include "iostream.h"
00051
00052 class StChain;
00053 StChain *chain=0;
00054 class St_db_Maker;
00055 St_db_Maker *dbMk =0;
00056
00057 Int_t iEvt=0,istat=0,nEvents=0;
00058 void doEvents()
00059 {
00060 cout << "Usage: doEvents.C(2) // work with default event.root file" << endl;
00061 cout << " doEvents.C(startEvent,nEvents,\"path/somefile.event.root\")" << endl;
00062 cout << " doEvents.C(nEvents,\"path/*.event.root\")" << endl;
00063 cout << " doEvents.C(nEvents,\"path/file.dst.root\",\"evout\") //Write out StEvent" << endl;
00064 cout << " doEvents.C(nEvents,\"path/file.dst.root\",\"display\") //EventDispay" << endl;
00065 cout << " doEvents.C(nEvents,\"path/file.dst.root\",\"dbon\") //DB on" << endl;
00066 }
00067
00068
00069 void doEvents(Int_t nEvents, const Char_t ** fileList, const Char_t *qaflag =0);
00070 void doEvents(Int_t startEvent, Int_t nEvents, const Char_t ** fileList, const Char_t *qaflag =0);
00071
00072 void doEvents(Int_t nEvents,
00073 const Char_t *file="st_physics_4095050_raw_0010002.event.root",
00074 const Char_t *qaflag = "dbon");
00075
00076 void doEvents(Int_t startEvent,Int_t nEvents,
00077 const Char_t *file="/afs/rhic.bnl.gov/star/data/samples/example.event.root",
00078 const Char_t *qaflag = 0);
00079
00080 void doEvents(const Int_t nEvents,
00081 const Char_t *path,
00082 const Char_t *file,
00083 const Char_t *qaflag, int flag);
00084
00085
00086
00087
00088
00089 void doEvents(Int_t startEvent, Int_t nEventsQQ, const Char_t **fileList, const Char_t *qaflag)
00090 {
00091
00092 nEvents = nEventsQQ;
00093 TString tflag = qaflag; tflag.ToLower();
00094 int eventDisplay = tflag.Contains("disp");
00095
00096 cout << endl << endl <<" doEvents - input # events = " << nEvents << endl;
00097 Int_t ilist=0;
00098 while(fileList[ilist]){
00099 cout << " doEvents - input fileList = " << fileList[ilist] << endl;
00100 ilist++;
00101 }
00102 cout << " doEvents - input qaflag = " << qaflag << endl;
00103
00104
00105
00106
00107 gSystem->Load("libStar");
00108 gSystem->Load("St_base");
00109 gSystem->Load("StChain");
00110
00111 gSystem->Load("libgen_Tables");
00112 gSystem->Load("libsim_Tables");
00113 gSystem->Load("libglobal_Tables");
00114
00115 gSystem->Load("StUtilities");
00116 gSystem->Load("StIOMaker");
00117 gSystem->Load("StTreeMaker");
00118 gSystem->Load("StarClassLibrary");
00119 gSystem->Load("StTriggerDataMaker");
00120 gSystem->Load("StEvent");
00121 gSystem->Load("StEventUtilities");
00122 gSystem->Load("StMagF");
00123 gSystem->Load("StAnalysisMaker");
00124
00125
00126
00127 if (tflag.Contains("dbon") || eventDisplay ) {
00128 gSystem->Load("libtpc_Tables");
00129 gSystem->Load("StDbLib.so");
00130 gSystem->Load("StDbBroker.so");
00131 gSystem->Load("libStDb_Tables.so");
00132 gSystem->Load("St_db_Maker.so");
00133 gSystem->Load("StTpcDb");
00134 gSystem->Load("StDetectorDbMaker");
00135 }
00136
00137
00138 if (eventDisplay) {
00139 gSystem->Load("St_g2t");
00140 gSystem->Load("geometry");
00141 gSystem->Load("St_geant_Maker");
00142 gSystem->Load("StTableUtilities");
00143 gSystem->Load("StEventDisplayMaker");
00144 }
00145
00146
00147
00148
00149 chain = new StChain("StChain");
00150 StFileI *setFiles =0;
00151 if (fileList) {
00152 setFiles= new StFile(fileList);
00153 } else {
00154 gSystem->Load("StChallenger");
00155 setFiles = StChallenger::Challenge();
00156 setFiles->SetDebug();
00157 const char *Argv[]= {
00158 "-s","dst runco",
00159 "-q","numberOfPrimaryTracks>1500",
00160 "-c","/afs/rhic.bnl.gov/star/incoming/GCA/daq/stacs.rc"
00161 };
00162 Int_t Argc=sizeof(Argv)/4;
00163 setFiles->Init(Argc,Argv);
00164 }
00165
00166
00167 if (eventDisplay) {
00168 int NwGeant=5000000, IwType=0, NwPaw=0;
00169 St_geant_Maker *geantMk = new St_geant_Maker("geant",NwGeant,NwPaw,IwType);
00170 geantMk->LoadGeometry("detp geometry year2001");
00171 geantMk->SetActive(kFALSE);
00172 }
00173
00174
00175 TString mainBranch;
00176 if (fileList && fileList[0]) {
00177 char line[999]; strcpy(line,fileList[0]);
00178 if (*line=='@') {
00179 TString command("grep '.root' "); command += line+1;
00180 FILE *pipe = gSystem->OpenPipe(command.Data(),"r");
00181 if (pipe) {fgets(line,999,pipe);line[strlen(line)-1] = 0;}
00182 fclose(pipe);
00183 }
00184 mainBranch = line;
00185
00186 mainBranch.ReplaceAll(".root","");
00187 int idot = strrchr((char*)mainBranch,'.') - mainBranch.Data();
00188 mainBranch.Replace(0,idot+1,"");
00189 mainBranch+="Branch";
00190 printf("*** mainBranch=%s ***\n",mainBranch.Data());
00191 }
00192
00193 StIOMaker *IOMk = new StIOMaker("IO","r",setFiles,"bfcTree");
00194 IOMk->SetIOMode("r");
00195 IOMk->SetBranch("*",0,"0");
00196 if(!mainBranch.IsNull()) IOMk->SetBranch(mainBranch,0,"r");
00197 IOMk->SetBranch("evtselBranch",0,"r");
00198
00199
00200 IOMk->SetDebug(1);
00201
00202
00203
00204 if (tflag.Contains("dbon")) {
00205 dbMk = new St_db_Maker("db","MySQL:StarDb","$STAR/StarDb","StarDb");
00206 }
00207
00208
00209
00210
00211 if (mainBranch.Contains("dstBranch")) {
00212 gSystem->Load("StEventMaker");
00213 StEventMaker *readerMaker = new StEventMaker("events","title");
00214 }
00215
00216
00217
00218 StAnalysisMaker *analysisMaker = new StAnalysisMaker("analysis");
00219 gSystem->Load("StEEmcDbMaker");
00220 gSystem->Load("StEEmcUtil");
00221
00222 StEEmcDbMaker *myMk1=new StEEmcDbMaker("eemcDBio");
00223
00224 myMk1->setSectors(1,12);
00225 myMk1->setTimeStampDay(20030214);
00226
00227
00228 St_db_Maker *dbMk = new St_db_Maker("StarDb","MySQL:StarDb");
00229
00230
00231 St2eemcFeeRawMaker * myMk3=new St2eemcFeeRawMaker("St2feeTTree");
00232
00233 char *fileT="myOut.eeTree.root";
00234
00235
00236 TFile f(fileT,"RECREATE");
00237 TTree t("fee","A tree with FEE events");
00238 myMk3->setOutTTree(&t);
00239
00241
00242
00243
00244
00245
00247
00248 Int_t wrStEOut = tflag.Contains("evout");
00249 if (wrStEOut) {
00250 cout << "!!!! doEvents: will write out .event.root file !!" << endl << endl;
00251 StIOMaker *outMk = new StIOMaker("EvOut","w","test.event.root","bfcTree");
00252
00253 outMk->IntoBranch("evtselBranch","StEvent");
00254 IOMk->SetNotify("CloseFile",outMk);
00255 IOMk->SetNotify("OpenFile" ,outMk);
00256 }
00257
00258
00259
00260 if (eventDisplay) {
00261
00262 StEventDisplayMaker *displayMk = new StEventDisplayMaker();
00263
00264
00265 displayMk->AddName("StEvent(Primary Tracks)");
00266 displayMk->AddName("StEvent(Kink Tracks)");
00267 displayMk->AddName("StEvent(V0 Tracks)");
00268 displayMk->AddName("StEvent(Xi Tracks)");
00269
00270
00271 displayMk->AddFilter(new StFilterDef("MainFilter"));
00272 displayMk->AddFilter(new StMuDstFilterHelper("MuL3Filter",kFALSE));
00273 }
00274
00275
00276
00277
00278 Int_t iInit = chain->Init();
00279 if (iInit) chain->Fatal(iInit,"on init");
00280 chain->PrintInfo();
00281 if (startEvent > 1) IOMk->Skip(startEvent-1);
00282
00283
00284
00285
00286 TTable *tabl=0;
00287 TDataSet *obj=0;
00288 TDataSet *ddb=0;
00289 TDataSet *ddstBranch=0;
00290
00291
00292
00293
00294
00295 istat=0,iEvt=1;
00296
00297 int eventCounter=0;
00298 int stat=0;
00299
00300 while ( stat==0 ) {
00301 if(eventCounter>=nEvents) break;
00302 chain->Clear();
00303 stat = chain->Make();
00304
00305 printf(" event# %d\n", eventCounter++);
00306
00307 }
00308
00309
00310
00311 f.Write();
00312 printf("\n\n============== TTree closed =========\n\n");
00313
00314
00315 }
00316
00317
00318
00319 void doEvents(const Int_t startEvent, const Int_t nEvents, const Char_t *file, const Char_t *qaflag)
00320 {
00321 printf("*file = %s\n",file);
00322 const char *fileListQQ[]={0,0};
00323 if (strncmp(file,"GC",2)==0) {
00324 fileListQQ=0;
00325 } else {
00326 fileListQQ[0]=file;
00327 }
00328 doEvents(startEvent,nEvents,fileListQQ,qaflag);
00329 }
00330
00331 void doEvents(const Int_t nEvents, const Char_t *file, const Char_t *qaflag)
00332 {
00333 doEvents(1,nEvents,file,qaflag);
00334 }
00335
00336
00337 void doEvents(const Int_t nEvents, const Char_t *path,const Char_t *file, const Char_t *qaflag, int flag)
00338 {
00339 TString F;
00340 if (path && path[0] && path[0]!='-') F = path;
00341 if (file && file[0] && file[0]!='-')
00342 {
00343 if (!F.IsNull()) F +="/";
00344 F += file;
00345 }
00346 TString opt = qaflag;
00347 if (flag) opt += " evout";
00348
00349
00350 doEvents(1,nEvents,F.Data(),opt.Data());
00351 }
00352
00353
00354 void doEvents(Int_t nEvents, const Char_t **fileList, const Char_t *qaflag)
00355 { doEvents(1,nEvents,fileList,qaflag); }
00356