11 #include "TBenchmark.h"
12 #include "TClassTable.h"
13 #include "StBFChain.h"
14 #include "St_tcl_Maker/St_tcl_Maker.h"
15 #include "St_tpt_Maker/St_tpt_Maker.h"
17 #include "St_geant_Maker/St_geant_Maker.h"
18 #include "StIOMaker/StIOMaker.h"
19 #include "StEventDisplayMaker/StEventDisplayMaker.h"
20 #include "StEventMaker/StEventMaker.h"
21 #include "StAssociationMaker/StMcParameterDB.h"
22 #include "St_dst_Maker/StV0Maker.h"
23 #include "xdf2root/St_XDFFile.h"
24 #include "StPass0CalibMaker/StTpcT0Maker.h"
34 class StEventDisplayMaker;
43 StEventDisplayMaker *dsMk = 0;
45 StTpcT0Maker *t0mk = 0;
48 if (gClassTable->GetID(
"TTable") < 0) gSystem->Load(
"libTable");
49 gSystem->Load(
"St_base");
50 gSystem->Load(
"StChain");
51 gSystem->Load(
"StUtilities");
52 gSystem->Load(
"StBFChain");
53 gSystem->Load(
"StChallenger");
56 void bfcS(
const Int_t First,
58 const Char_t *Chain=
"gstar Cy2b tfs -NoHits",
59 const Char_t *infile=0,
60 const Char_t *outfile=0,
61 const Char_t *TreeFile=0)
69 if (gClassTable->GetID(
"StBFChain") < 0) Load();
70 if (chain)
delete chain;
72 if (!chain) gSystem->Exit(1);
74 if (TreeFile) chain->SetTFile(
new TFile(TreeFile,
"RECREATE"));
75 printf (
"QAInfo:Process [First=%6i/Last=%6i/Total=%6i] Events\n",First,Last,Last-First+1);
76 chain->Set_IO_Files(infile,outfile);
78 {printf(
"Error:Problems with loading of shared library(ies)\n"); gSystem->Exit(1);}
79 if (Last < -1)
return;
81 {printf(
"Error:Problems with instantiation of Maker(s)\n"); gSystem->Exit(1);}
83 if (chain->GetOption(
"DISPLAY")) dsMk = (StEventDisplayMaker *) chain->GetMaker(
"EventDisplay");
86 Char_t *myMaker =
"StTpcHitFilterMaker";
87 if (gClassTable->GetID(myMaker) < 0) gSystem->Load(myMaker);
88 StMaker *myMk = chain->GetMaker(myMaker);
89 if (myMk)
delete myMk;
91 myMk = chain->New(myMaker,
"tpc_hit_filter");
93 Char_t *after =
"tpc_tracks";
94 StMaker *tclmk = chain->GetMaker(after);
95 if (tclmk) chain->AddAfter(after,myMk);
97 StTpcHitFilterMaker* filter = (StTpcHitFilterMaker*)myMk;
98 filter->RidiculousErrorsInner();
99 filter->DoNotDeleteHits();
102 if (chain->GetOption(
"TCL") && chain->GetOption(
"Eval")) {
103 St_tcl_Maker *tclMk= (St_tcl_Maker *) chain->GetMaker(
"tpc_hits");
105 tclMk->tclPixTransOn();
109 if (chain->GetOption(
"TPT")) {
110 St_tpt_Maker *tptMk = (St_tpt_Maker *) chain->GetMaker(
"tpc_tracks");
111 if (tptMk && chain->GetOption(
"MINIDAQ")) tptMk->Set_final(kTRUE);
112 if (tptMk && chain->GetOption(
"Eval")) {
117 if (chain->GetOption(
"TpcT0")) {
118 StTpcT0Maker *t0mk = (StTpcT0Maker *) chain->GetMaker(
"TpcT0");
119 if (t0mk) t0mk->SetDesiredEntries(10);
121 if (chain->GetOption(
"McAss")) {
126 parameterDB->setXCutTpc(.5);
127 parameterDB->setYCutTpc(.5);
128 parameterDB->setZCutTpc(.2);
129 parameterDB->setReqCommonHitsTpc(3);
131 parameterDB->setRCutFtpc(.3);
132 parameterDB->setPhiCutFtpc(5*(3.1415927/180.0));
133 parameterDB->setReqCommonHitsFtpc(3);
135 parameterDB->setXCutSvt(.1);
136 parameterDB->setYCutSvt(.1);
137 parameterDB->setZCutSvt(.1);
138 parameterDB->setReqCommonHitsSvt(1);
140 if (chain->GetOption(
"V0") && chain->GetOption(
"Eval")) {
141 StV0Maker *v0Mk = (StV0Maker *) chain->GetMaker(
"v0");
142 if (v0Mk) v0Mk->ev0EvalOn();
147 printf (
"QAInfo:Run is started at Date/Time %i/%i\n",t.GetDate(),t.GetTime());
149 printf (
"QAInfo:Run on %s in %s\n",
151 gSystem->WorkingDirectory());
152 printf (
"QAInfo: with %s\n", chain->GetCVS());
155 Int_t iTotal = 0, iBad = 0;
156 St_XDFFile *xdf_out = 0;
158 Int_t iMake = 0, i = First;
160 Int_t iInit = chain->Init();
162 chain->Fatal(iInit,
"on init");
166 if (hd) hd->SetRunNumber(-2);
169 if (chain->GetOption(
"fzin")) {
172 if (geant->IsActive()) geant->Skip(First-1);
177 if (inpMk) {printf (
"Skip %i Events\n",First-1);inpMk->Skip(First-1);}
181 xdf_out = chain->GetXdfOut();
182 if (chain->GetOption(
"Event")) evMk = (
StEventMaker *) chain->GetMaker(
"StEventMaker");
183 treeMk = chain->GetMaker(
"OutputStream");
184 EventLoop:
if (i <= Last && iMake !=
kStEOF && iMake !=
kStFatal) {
186 evnt.Start(
"QAInfo:");
188 iMake = chain->Make(i);
191 St_DataSet *dstSet = chain->GetInputDS(
"dst");
192 if (dstSet) xdf_out->NextEventPut(dstSet);
195 if (treeMk && iMake ==
kStErr) {treeMk->
Make(i); iBad++;}
197 evnt.Stop(
"QAInfo:");
199 printf (
"QAInfo: Done with Event [no. %d/run %d/evt. %d/Date.Time %d.%d/sta %d] Real Time = %10.2f seconds Cpu Time = %10.2f seconds \n",
200 i,chain->
GetRunNumber(),chain->GetEventNumber(),chain->GetDate(), chain->GetTime(),
201 iMake,evnt.GetRealTime(
"QAInfo:"),evnt.GetCpuTime(
"QAInfo:"));
207 printf (
"QAInfo:Run completed ");
208 gSystem->Exec(
"date");
209 if (evMk) Event = (
StEvent *) chain->GetInputDS(
"StEvent");
212 printf (
"\nQAInfo:Run is finished at Date/Time %i/%i; Total events processed :%i and not completed: %i\n",
213 t.GetDate(),t.GetTime(),iTotal,iBad);
217 void bfcS (
const Int_t Last,
218 const Char_t *Chain=
"gstar Cy2b tfs evout -NoHits",
219 const Char_t *infile=0,
220 const Char_t *outfile=0,
221 const Char_t *TreeFile=0)
223 bfcS(1,Last,Chain,infile,outfile,TreeFile);
226 void bfcS (
const Char_t *Chain=
"",
227 const Char_t *infile=0,
228 const Char_t *outfile=0,
229 const Char_t *TreeFile=0)
231 if (!Chain || !strlen(Chain)) {
238 printf (
"============= \tImportant two changes:\n"
239 " \tIt is required exact matching in Chain definition\n"
240 " \tAll Chain options set in supplyed order\n");
242 if (gClassTable->GetID(
"StBFChain") < 0) Load();
245 printf (
"============= \t U S A G E =============\n");
246 printf (
"bfc(Int_t First, Int_t Last, Char_t *Chain, Char_t *infile, Char_t *outfile,, Char_t *TreeFile)\n");
247 printf (
"bfc(Int_t Last, Char_t *Chain, Char_t *infile, Char_t *outfile, Char_t *TreeFile)\n");
248 printf (
"bfc(Char_t *Chain, Char_t *infile, Char_t *outfile)\n");
250 printf (
" First \t- First event to process \t(Default = 1)\n");
251 printf (
" Last \t- Last event to process \t(Default = 1)\n");
252 printf (
" Chain \t- Chain specification \t(without First & Last: Default is \"\" which gives this message)\n");
253 printf (
" \t \t with First || Last: Default is \"gstar tfs\")\n");
254 printf (
" infile \t- Name of Input file \t(Default = 0, i.e. use preset file names depending on Chain)\n");
255 printf (
" outfile \t- Name of Output file \t(Default = 0, i.e. define Output file name from Input one)\n");
256 printf (
"Examples:\n");
257 printf (
" root4star bfc.C \t// Create this message\n");
258 printf (
" root4star 'bfc.C(1)' \t// Run one event with default Chain=\"gstar tfs\"\n");
259 printf (
" root4star 'bfc.C(1,1)' \t// the same\n");
260 printf (
"\n root4star 'bfc.C(1,\"off tdaq tpc HalfField global dst display\",\"/star/rcf/daq/1999/12/st_cluster2_0351027_raw_0001.daq\")'\n");
261 printf (
" \t// create a DST by processing a DAQ data from <st_cluster2_0351027_raw_0001.daq>\n\n");
262 printf (
" root4star 'bfc.C(2,40,\"Cy1b fzin\")'\t// run for configuration year_1b, \n");
263 printf (
" \t// reading /star/rcf/disk1/star/test/psc0050_01_40evts.fzd\n");
264 printf (
" \t// skipping the 1-st event and processing the remaining 39 events\n");
265 printf (
" root4star 'bfc.C(40,\"Cy1b fzin\",\"/star/rcf/disk1/star/test/psc0050_01_40evts.fzd\")'\n");
266 printf (
" root4star 'bfc.C(40,\"Cy1b fzin\")'\t// the same as above\n");
267 printf (
" root4star 'bfc.C(2,40,\"Cy1b fzin -l3t\")'//the as above but remove L3T from chain\n");
268 printf (
" root4star 'bfc.C(40,\"Cy2a fzin\",\"/star/rcf/disk0/star/test/venus412/b0_3/year_2a/psc0208_01_40evts.fz\")'\n");
269 printf (
" root4star 'bfc.C(40,\"Cy2a fzin\")'\t// the same as above\n");
270 printf (
" root4star 'bfc.C(5,10,\"Cy1b in xout\",\"/afs/rhic.bnl.gov/star/tpc/data/tpc_s18e_981105_03h_cos_t22_f1.xdf\")'\n");
271 printf (
" \t// skipping the 4 events and processing the remaining 6 events\n");
272 printf (
" root4star 'bfc.C(1,\"off in tpc FieldOff sd97 eval\",\"Mini_Daq.xdf\")'\t// the same as Chain=\"minidaq\"\n");
273 printf (
" root4star 'bfc.C(1,\"gstar Cy1a tfs allevent\")' \t// run gstar and write all event into file branches\n");
274 printf (
" root4star 'bfc.C(1,\"off in Cy1a l3t\",\"gtrack.tpc_hits.root\")'\t// run l3t only with prepaired file\n");
275 printf (
" root4star 'bfc.C(1,\"tdaq display\",\"/star/rcf/disk1/star/daq/990727.3002.01.daq\")' \n");
276 printf (
" \t//Cosmics (56) events with full magnetic field, TPC only \n");
277 printf (
" root4star 'bfc.C(1,\"tdaq FieldOn\",\"/star/rcf/disk1/star/daq/990624.306.daq\")' \n");
278 printf (
" \t//Cosmics (56) events with full magnetic field \n");
279 printf (
" root4star 'bfc.C(1,\"tdaq HalfField\",\"/star/rcf/disk1/star/daq/990630.602.daq\")' \n");
280 printf (
" \t//Laser (10) events with half magnetic field \n");
281 printf (
" root4star 'bfc.C(1,\"tdaq FieldOff\",\"/star/rcf/disk1/star/daq/990701.614.daq\")' \n");
282 printf (
" \t//Laser (12) events with no magnetic field \n");
virtual Int_t Instantiate()
Maker-instantiation handler.
virtual void Clear(Option_t *option="")
User defined functions.
void SetFlags(const Char_t *Chain="gstar tfs")
Scan all flags, check if they are correct, manipulate the comment if necessary.
virtual Int_t GetRunNumber() const
Returns the current RunNumber.
virtual Int_t Load()
Routine handling library loading depending on chain options.