57 Int_t iEvt=0,istat=0,nEvents=0;
60 cout <<
"Usage: doEvents.C(2) // work with default event.root file" << endl;
61 cout <<
" doEvents.C(startEvent,nEvents,\"path/somefile.event.root\")" << endl;
62 cout <<
" doEvents.C(nEvents,\"path/*.event.root\")" << endl;
63 cout <<
" doEvents.C(nEvents,\"path/file.dst.root\",\"evout\") //Write out StEvent" << endl;
64 cout <<
" doEvents.C(nEvents,\"path/file.dst.root\",\"display\") //EventDispay" << endl;
65 cout <<
" doEvents.C(nEvents,\"path/file.dst.root\",\"dbon\") //DB on" << endl;
69 void doEvents(Int_t nEvents,
const Char_t ** fileList,
const Char_t *qaflag =0);
70 void doEvents(Int_t startEvent, Int_t nEvents,
const Char_t ** fileList,
const Char_t *qaflag =0);
72 void doEvents(Int_t nEvents,
73 const Char_t *file=
"st_physics_4095050_raw_0010002.event.root",
74 const Char_t *qaflag =
"dbon");
76 void doEvents(Int_t startEvent,Int_t nEvents,
77 const Char_t *file=
"/afs/rhic.bnl.gov/star/data/samples/example.event.root",
78 const Char_t *qaflag = 0);
80 void doEvents(
const Int_t nEvents,
83 const Char_t *qaflag,
int flag);
89 void doEvents(Int_t startEvent, Int_t nEventsQQ,
const Char_t **fileList,
const Char_t *qaflag)
93 TString tflag = qaflag; tflag.ToLower();
94 int eventDisplay = tflag.Contains(
"disp");
96 cout << endl << endl <<
" doEvents - input # events = " << nEvents << endl;
98 while(fileList[ilist]){
99 cout <<
" doEvents - input fileList = " << fileList[ilist] << endl;
102 cout <<
" doEvents - input qaflag = " << qaflag << endl;
107 gSystem->Load(
"libStar");
108 gSystem->Load(
"St_base");
109 gSystem->Load(
"StChain");
111 gSystem->Load(
"libgen_Tables");
112 gSystem->Load(
"libsim_Tables");
113 gSystem->Load(
"libglobal_Tables");
115 gSystem->Load(
"StUtilities");
116 gSystem->Load(
"StIOMaker");
117 gSystem->Load(
"StTreeMaker");
118 gSystem->Load(
"StarClassLibrary");
119 gSystem->Load(
"StTriggerDataMaker");
120 gSystem->Load(
"StEvent");
121 gSystem->Load(
"StEventUtilities");
122 gSystem->Load(
"StMagF");
123 gSystem->Load(
"StAnalysisMaker");
127 if (tflag.Contains(
"dbon") || eventDisplay ) {
128 gSystem->Load(
"libtpc_Tables");
129 gSystem->Load(
"StDbLib.so");
130 gSystem->Load(
"StDbBroker.so");
131 gSystem->Load(
"libStDb_Tables.so");
132 gSystem->Load(
"St_db_Maker.so");
133 gSystem->Load(
"StTpcDb");
134 gSystem->Load(
"StDetectorDbMaker");
139 gSystem->Load(
"St_g2t");
140 gSystem->Load(
"geometry");
141 gSystem->Load(
"St_geant_Maker");
142 gSystem->Load(
"StTableUtilities");
143 gSystem->Load(
"StEventDisplayMaker");
149 chain =
new StChain(
"StChain");
152 setFiles=
new StFile(fileList);
154 gSystem->Load(
"StChallenger");
155 setFiles = StChallenger::Challenge();
156 setFiles->SetDebug();
157 const char *Argv[]= {
159 "-q",
"numberOfPrimaryTracks>1500",
160 "-c",
"/afs/rhic.bnl.gov/star/incoming/GCA/daq/stacs.rc"
162 Int_t Argc=
sizeof(Argv)/4;
163 setFiles->Init(Argc,Argv);
168 int NwGeant=5000000, IwType=0, NwPaw=0;
176 if (fileList && fileList[0]) {
177 char line[999]; strcpy(line,fileList[0]);
179 TString command(
"grep '.root' "); command += line+1;
180 FILE *pipe = gSystem->OpenPipe(command.Data(),
"r");
181 if (pipe) {fgets(line,999,pipe);line[strlen(line)-1] = 0;}
186 mainBranch.ReplaceAll(
".root",
"");
187 int idot = strrchr((
char*)mainBranch,
'.') - mainBranch.Data();
188 mainBranch.Replace(0,idot+1,
"");
189 mainBranch+=
"Branch";
190 printf(
"*** mainBranch=%s ***\n",mainBranch.Data());
195 IOMk->SetBranch(
"*",0,
"0");
196 if(!mainBranch.IsNull()) IOMk->SetBranch(mainBranch,0,
"r");
197 IOMk->SetBranch(
"evtselBranch",0,
"r");
204 if (tflag.Contains(
"dbon")) {
205 dbMk =
new St_db_Maker(
"db",
"MySQL:StarDb",
"$STAR/StarDb",
"StarDb");
211 if (mainBranch.Contains(
"dstBranch")) {
212 gSystem->Load(
"StEventMaker");
219 gSystem->Load(
"StEEmcDbMaker");
220 gSystem->Load(
"StEEmcUtil");
224 myMk1->setSectors(1,12);
225 myMk1->setTimeStampDay(20030214);
233 char *fileT=
"myOut.eeTree.root";
236 TFile f(fileT,
"RECREATE");
237 TTree t(
"fee",
"A tree with FEE events");
248 Int_t wrStEOut = tflag.Contains(
"evout");
250 cout <<
"!!!! doEvents: will write out .event.root file !!" << endl << endl;
253 outMk->IntoBranch(
"evtselBranch",
"StEvent");
254 IOMk->SetNotify(
"CloseFile",outMk);
255 IOMk->SetNotify(
"OpenFile" ,outMk);
262 StEventDisplayMaker *displayMk =
new StEventDisplayMaker();
265 displayMk->AddName(
"StEvent(Primary Tracks)");
266 displayMk->AddName(
"StEvent(Kink Tracks)");
267 displayMk->AddName(
"StEvent(V0 Tracks)");
268 displayMk->AddName(
"StEvent(Xi Tracks)");
271 displayMk->AddFilter(
new StFilterDef(
"MainFilter"));
278 Int_t iInit = chain->Init();
279 if (iInit) chain->Fatal(iInit,
"on init");
281 if (startEvent > 1) IOMk->Skip(startEvent-1);
301 if(eventCounter>=nEvents)
break;
303 stat = chain->
Make();
305 printf(
" event# %d\n", eventCounter++);
312 printf(
"\n\n============== TTree closed =========\n\n");
319 void doEvents(
const Int_t startEvent,
const Int_t nEvents,
const Char_t *file,
const Char_t *qaflag)
321 printf(
"*file = %s\n",file);
322 const char *fileListQQ[]={0,0};
323 if (strncmp(file,
"GC",2)==0) {
328 doEvents(startEvent,nEvents,fileListQQ,qaflag);
331 void doEvents(
const Int_t nEvents,
const Char_t *file,
const Char_t *qaflag)
333 doEvents(1,nEvents,file,qaflag);
337 void doEvents(
const Int_t nEvents,
const Char_t *path,
const Char_t *file,
const Char_t *qaflag,
int flag)
340 if (path && path[0] && path[0]!=
'-') F = path;
341 if (file && file[0] && file[0]!=
'-')
343 if (!F.IsNull()) F +=
"/";
346 TString opt = qaflag;
347 if (flag) opt +=
" evout";
350 doEvents(1,nEvents,F.Data(),opt.Data());
354 void doEvents(Int_t nEvents,
const Char_t **fileList,
const Char_t *qaflag)
355 { doEvents(1,nEvents,fileList,qaflag); }
virtual void SetIOMode(Option_t *iomode="w")
number of transactions
void setOutTTree(TTree *t)
TTree must be initialized externaly.
virtual void Clear(Option_t *option="")
User defined functions.
A typical Analysis Class.
virtual void SetActive(Bool_t k=kTRUE)
Setters for flags and switches.
virtual void LoadGeometry(const Char_t *option="detp geometry field_only")
Specifies GEANT3 geometry command.