10 #if !defined(__CINT__) || defined(__MAKECINT__)
13 #include "TClassTable.h"
14 #include "TApplication.h"
15 #include "TInterpreter.h"
16 #include "TBenchmark.h"
17 #include "StBFChain.h"
20 #include "StIOMaker/StIOMaker.h"
22 #include "StMixerMaker/StMixerMaker.h"
23 #include "StEvtHddr.h"
24 #include "StTrsMaker/StTrsMaker.h"
46 gSystem->Load(
"St_base");
47 Bool_t needLogger = gSystem->Load(
"liblog4cxx.so") <= 0;
49 gSystem->Load(
"StStarLogger.so");
51 gROOT->ProcessLine(
"StLoggerManager::StarLoggerInit();");
53 gSystem->Load(
"StChain");
54 gSystem->Load(
"StUtilities");
55 gSystem->Load(
"StBFChain");
58 gSystem->Load(
"StarClassLibrary");
60 gSystem->Load(
"StAnalysisUtilities");
62 if (chain)
delete chain;
65 void bfcMixer(
const Int_t Nevents=100,
66 const Char_t *file1=
"/star/data03/daq/2004/090/st_physics_adc_5090009_raw_2060002.daq",
67 const Char_t *file2=
"./gtest.fz",
68 const Char_t *file3=
"./st_physics_adc_5090009_raw_2060002.vertices.dat",
69 const Float_t zvertex_low=-175.0,
70 const Float_t zvertex_high=175.0,
71 const Char_t *mode=
"strange",
72 const Char_t *acc_mode=
"off" )
75 if (gClassTable->GetID(
"StBFChain") < 0) Load();
77 if (! strcmp(mode,
"strange") && !strcmp(acc_mode,
"on") && gSystem->DynamicPathName(
"StV0AccMaker",1)) {
78 gSystem->Load(
"StV0AccMaker.so");
82 chain =
new StChain(
"Embedding");
88 saveMk = chain1->cd();
92 chain1->
SetFlags(
"in Physics DbV20050515 MagF NoDefault");
93 chain1->Set_IO_Files(file1);
101 saveMk = chain2->cd();
103 chain2->
SetFlags(
"fzin DbV20050515 gen_T geomT sim_T trs -tpc_daq");
104 chain2->Set_IO_Files(file2);
107 StMaker *geantMk = chain2->GetMaker(
"geant");
108 if (geantMk) geantMk->SetMode(1);
110 if (chain2->GetOption(
"TRS")){
112 trsMk->setNormalFactor(1.22);
116 Char_t *extraMaker =
"StV0AccMaker";
117 if (gClassTable->GetID(extraMaker) < 0) gSystem->Load(extraMaker);
119 if(extraMk)
delete extraMk;
120 extraMk = chain->New(extraMaker,
"before");
122 Char_t *before =
"Trs";
123 StMaker *trsmk = chain1->GetMaker(before);
124 if (trsmk) chain1->AddBefore(before,extraMk);
125 StV0AccCuts *cuts = ((StV0AccMaker *)extraMk)->GetCutsPtr();
127 cuts->SetV0MinDecayLen(0.);
128 cuts->SetV0DaughterMinImpact(0);
129 cuts->SetV0DaughterMinHit(10.);
130 cuts->SetXiV0MaxImpact(5);
131 cuts->SetXiMinDecayLen(2.);
132 cuts->SetXiV0PiMinImpact(0.);
133 cuts->SetXiDaughterMinHit(10.);
134 cuts->SetKinkMinDecayRad(128.);
135 cuts->SetKinkMaxDecayRad(184.);
143 gSystem->Load(
"StMixerMaker");
144 StMixerMaker *mixer =
new StMixerMaker(
"Mixer",
"daq",
"trs");
145 chain1->SetInput(
"Input1",
"StDAQReader");
146 chain2->SetInput(
"Input2",
"Event");
147 mixer->writeFile(
"mixer.trs",Nevents);
154 saveMk = chain3->cd();
164 chain3->
SetFlags(
"Simu NoDefault NoInput onlraw -onlcl DbV20050515 ry2005b tpc_daq tpc emcDY2 global dst Kalman event evout QA Tree GeantOut fcf ctf -Prevtx -nohits CMuDST ZDCvtx tofDat Xi2 Kink2 EST ToF svt_daq SvtD svtdEdx xiSvt l3onl fpd eemcD pmdRaw analysis ");
170 TString OutputFileName(gSystem->BaseName(file1));
171 OutputFileName.ReplaceAll(
"*",
"");
172 OutputFileName.ReplaceAll(
".daq",
"");
173 OutputFileName.Append(
".root");
174 chain3->Set_IO_Files(0,OutputFileName.Data());
178 geantMk = chain->GetMaker(
"geant");
181 StMaker *tpcdaqMk = chain3->GetMaker(
"tpc_raw");
182 tpcdaqMk->SetMode(1);
183 tpcdaqMk->SetInput(
"Event",
"MixerEvent");
191 printf (
"QAInfo:Run is started at Date/Time%i/%i\n",t.GetDate(),t.GetTime());
193 printf (
"QAInfo:Run on %s in %s\n",
195 gSystem->WorkingDirectory());
196 printf (
"QAInfo: with %s\n", chain->GetCVS());
203 treeMk = chain->GetMaker(
"tree");
205 Int_t iMake = 0, i = 1, iBad = 0;
208 FILE *fp = fopen(file3,
"r");
210 Int_t ncols, eventnumber, mult, skip=0, oldskip = 0, skiptest=0;
211 printf(
"zvertex_low = %f zvertex_high = %f\n",zvertex_low, zvertex_high);
215 EventLoop:
if (i <= Nevents && iMake !=
kStEOF && iMake !=
kStFatal) {
217 evnt.Start(
"QAInfo:");
222 ncols = fscanf(fp,
"%d %d %d %f %f %f",&eventnumber,&skip,&mult,&x,&y,&z);
223 if(ncols<0)
goto EndLoop;;
225 printf(
"\nEvent number: %d Multiplicity = %d\n",eventnumber,mult);
226 printf(
"vertex in bfcMixer: %16f %16f %16f\n",x,y,z);
233 printf (
"bfcMixer: i = %i\n",i);
234 printf (
"bfcMixer: skip = %i\n",skip);
235 printf (
"bfcMixer: oldskip = %i\n",oldskip);
236 if (inpMk && skip>0) {
238 skiptest = inpMk->Skip(skip-oldskip-1);
239 printf(
"bfcMixer: skiptest1 = %i\n",skiptest);
240 skiptest = inpMk->Skip();
241 printf(
"bfcMixer: skiptest2 = %i\n",skiptest);
249 iMake = chain->
Make(i);
250 if (treeMk && iMake ==
kStErr) {treeMk->
Make(); iBad++;}
253 *fEvtHddr = *fEvtHddrDaq;
255 evnt.Stop(
"QAInfo:");
257 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", i,chain->
GetRunNumber(),chain->GetEventNumber(),chain->GetDate(), chain->GetTime(),
258 iMake,evnt.GetRealTime(
"QAInfo:"),evnt.GetCpuTime(
"QAInfo:"));
262 if(eventnumber == chain->GetEventNumber()){
263 printf(
"bfcMixer: Event number %d found in both .fz file and .daq file\n",eventnumber);
265 printf(
"bfcMixer: Error! Event number from .fz file: %d\n",eventnumber);
266 printf(
"bfcMixer: Error! Event number from .daq file: %d\n",chain->GetEventNumber());
267 printf(
"bfcMixer: Error! Events are out-of-sync, exiting!\n");
275 printf (
"QAInfo:Run completed ");
276 gSystem->Exec(
"date");
280 printf (
"\nQAInfo:Run is finished at Date/Time%i/%i\n",t.GetDate(),t.GetTime());
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.
virtual void SetActive(Bool_t k=kTRUE)
Setters for flags and switches.