StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
bfcMixer_v4_noFTPC.C
1 //
3 // Macro for running chain with different inputs
4 //
5 // Owner: Yuri Fisyak
6 //
7 // $Id: bfcMixer_v4_noFTPC.C,v 1.7 2013/04/28 14:41:31 fisyak Exp $
8 //
10 
11 //TBrowser *b = 0;
12 class StBFChain;
13 StBFChain *chain=0;
14 class StMaker;
15 StMaker *treeMk=0;
16 StBFChain *chain1, *chain2, *chain3;
17 class StEvent;
18 StEvent *Event;
19 class St_geant_Maker;
20 class StIOMaker;
21 class StEventDisplayMaker; StEventDisplayMaker *dsMk = 0;
22 class StEventMaker; StEventMaker *evMk = 0;
23 //class StFtpcMixerMaker;
24 class StEvtHddr;
25 //_____________________________________________________________________
26 void Load(){
27  gSystem->Load("St_base");
28  gSystem->Load("StChain");
29  gSystem->Load("StUtilities");
30  gSystem->Load("StBFChain");
31  //Extra things to load for the acceptance filter
32  // gSystem->Load("StarClassLibrary");
33  gSystem->Load("StAnalysisUtilities");
34  // gSystem->Load("StV0AccMaker.so");
35 
36  if (chain) delete chain;
37 }
38 //_____________________________________________________________________
39 void bfcMixer_v4_noFTPC(const Int_t Nevents=10,
40  // const Char_t *file1="/auto/pdsfdv08/starprod/daq/2004/production62GeV/ReversedFullField/st_physics_adc_5090009_raw_2060002.daq",
41  const Char_t *file1="/star/data03/daq/2004/090/st_physics_adc_5090009_raw_2060002.daq",
42  // const Char_t *file2="/home/starofl/embedding/GSTAR/gtest.fz",
43  const Char_t *file2="./gtest.fz",
44  // const Char_t *file3="/home/starofl/embedding/GSTAR/st_physics_2270008_raw_0030.vertices.dat",
45  // const Char_t *file3="/home/starofl/embedding/GSTAR/st_physics_2270008_raw_0030.vertices.dat",
46  const Char_t *file3="./st_physics_adc_5090009_raw_2060002.vertices.dat",
47  const Float_t zvertex_low=-175.0,
48  const Float_t zvertex_high=175.0,
49  const Char_t *mode="strange",
50  const Char_t *acc_mode="off" )
51 {
52  // Dynamically link some shared libs
53  if (gClassTable->GetID("StBFChain") < 0) Load();
54 
55  // Create the main chain object
56  chain = new StBFChain("Embedding");
57 
58  StMaker *saveMk = 0;
59  chain->SetFlags("-ittf,NoDefault");
60  // Create chain1 object
61  chain1 = new StBFChain("One");
62 
63  saveMk = chain1->cd();
64  // chain1->SetFlags("in NoDefault");
65  // chain1->SetFlags("in alltrigger NoDefault");
66  // chain1->SetFlags("in Physics DbV20020226 NoDefault");
67  chain1->SetFlags("in Physics DbV20060421 NoDefault -ittf");
68  chain1->Set_IO_Files(file1);
69  chain1->Load();
70  chain1->Instantiate();
71 
72  saveMk->cd();
73 
74  // Create chain2 object
75  chain2 = new StBFChain("Two");
76  saveMk = chain2->cd();
77  // chain2->SetFlags("fzin DbV20020226 gen_T geomT sim_T tpc trs -tcl -tpt -PreVtx -tpc_daq"); //
78  chain2->SetFlags("fzin DbV20060421 gen_T geomT sim_T tpc trs -tcl -tpt -PreVtx -tpc_daq -ittf"); //
79  chain2->Set_IO_Files(file2);
80  chain2->Load();
81  chain2->Instantiate();
82  St_geant_Maker *geantMk = chain2->GetMaker("geant");
83  if (geantMk) geantMk->SetMode(1); // Mixer mode - do not modify EvtHddr
84 
85  if (chain2->GetOption("TRS")){
86  StTrsMaker *trsMk = (StTrsMaker *) chain2->GetMaker("Trs");
87  trsMk->setNormalFactor(1.25);
88  }
89 
90  // Add the acceptance filter maker before TRS
91  if (!strcmp(mode,"strange")){
92  if (!strcmp(acc_mode,"on")){
93 
94  Char_t *extraMaker = "StV0AccMaker";
95  if (gClassTable->GetID(extraMaker) < 0) gSystem->Load(extraMaker);
96  StMaker *extraMk = (StMaker *)chain1->GetMaker(extraMaker);
97  if(extraMk) delete extraMk;
98  extraMk = chain->New(extraMaker,"before");
99  if (extraMk) {
100  Char_t *before = "Trs";
101  StMaker *trsmk = chain1->GetMaker(before);
102  if (trsmk) chain1->AddBefore(before,extraMk);
103  StV0AccCuts *cuts = ((StV0AccMaker *)extraMk)->GetCutsPtr();
104  cuts->SetFilter();
105  cuts->SetV0MinDecayLen(0.);
106  cuts->SetV0DaughterMinImpact(0);
107  cuts->SetV0DaughterMinHit(10.);
108  cuts->SetXiV0MaxImpact(5);
109  cuts->SetXiMinDecayLen(2.);
110  cuts->SetXiV0PiMinImpact(0.);
111  cuts->SetXiDaughterMinHit(10.);
112  cuts->SetKinkMinDecayRad(128.);
113  cuts->SetKinkMaxDecayRad(184.);
114  }
115  }
116  }
117  // end additional maker code
118 
119  saveMk->cd();
120  // gSystem->Load("StFtpcMixerMaker");
121  // StFtpcMixerMaker *ftpcmixer = new StFtpcMixerMaker("FtpcMixer","daq","trs");
122 
123  // Create chain3 object
124  chain3 = new StBFChain("Three");
125  saveMk = chain3->cd();
126 
127  // Base CuCu chain, fails. ELH: standard P06ib cucu options:
128  //chain3->SetFlags("Simu NoDefault NoInput onlraw -onlcl P2005 DbV20060421 useCDV ITTF tofDat -SvtIT SCEbyE OGridLeak OShortR OSpaceZ2");
129 
130 // use Simu NoDefault NoInput onlraw -onlcl and standard chain options
131 // expand P2005, get rid of corrections and ftpc:
132 chain3->SetFlags("TpcMixer 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 EmbeddingShortCut");
133 //chain3->SetFlags("Simu NoDefault NoInput onlraw -onlcl B2005 l3onl fcf emcDY2 fpd trgd ZDCvtx DbV20060421 useCDV ITTF tofDat -SvtIT SCEbyE EmbeddingShortCut");
134 
135 //chain3->SetFlags("Simu NoDefault NoInput onlraw -onlcl ry2005b,tpc_daq,tpc_T, globT tls db tpcDB,svt_daq,SvtD,Physics,Idst,l0,tags,Tree,evout l3onl fcf emcDY2 fpd trgd ZDCvtx DbV20060421 useCDV ITTF tofDat -SvtIT MuDST -trg VFMinuit GeantOut EmbeddingShortCut");
136  chain3->SetFlags("Simu NoDefault NoInput onlraw -onlcl ry2005b,tpc_daq,tpcI,svt_daq,SvtD,Physics,Idst,l0,Tree,evout l3onl fcf emcDY2 fpd trgd ZDCvtx DbV20060421 useCDV ITTF tofDat -SvtIT MuDST -trg VFMinuit GeantOut EmbeddingShortCut");
137 
138 
139 
140  // StRTSClientFCF *fcfMk = (StRTSClientFCF *) chain3->GetMaker("");
141  // fcfMk->SetMode("0x1");
142 
143 
144  TString OutputFileName(gSystem->BaseName(file1));
145  OutputFileName.ReplaceAll("*","");
146  OutputFileName.ReplaceAll(".daq","");
147  OutputFileName.Append(".root");
148  cout <<"AAR - Setting file output to: " <<OutputFileName.Data()<<endl;
149 
150  chain3->Set_IO_Files(0,OutputFileName.Data());
151  chain3->Load();
152  chain3->Instantiate();
153  St_geant_Maker *geantMk = (St_geant_Maker *) chain->GetMaker("geant");
154  geantMk->SetActive(kTRUE);
155  // StMaker *ftpccluMk = chain3->GetMaker("ftpc_hits");
156  // ftpccluMk->SetInput("ftpc_raw","FtpcMixer");
157  cout <<"AAR - going to file"<<endl;
158 
159  saveMk->cd();
160  {
161  TDatime t;
162  printf ("QAInfo:Run is started at Date/Time%i/%i\n",t.GetDate(),t.GetTime());
163  }
164  printf ("QAInfo:Run on %s in %s\n",
165  gSystem->HostName(),
166  gSystem->WorkingDirectory());
167  printf ("QAInfo: with %s\n", chain->GetCVS());
168 
169  // Init the chain and all its makers
170  cout <<"AAR - initializing the chain"<<endl;
171 
172  chain->SetDEBUG(0);
173  if (Nevents >= 0) {
174  Int_t iInit = chain->Init();
175  }
176 
177  // chain->SetDEBUG();
178  treeMk = chain->GetMaker("tree");
179  TBenchmark evnt;
180  Int_t iMake = 0, i = 1, iBad = 0;
181 
182 
183  StIOMaker *inpMk = (StIOMaker *)chain1->GetMaker("inputStream");
184  FILE *fp = fopen(file3,"r");
185  Float_t x, y, z;
186  Int_t ncols, eventnumber, mult, skip=0, oldskip = 0, skiptest=0;
187  printf("zvertex_low = %f zvertex_high = %f\n",zvertex_low, zvertex_high);
188 
189  // vtxMk = (StVertexMaker*) chain3->GetMaker("vertex");
190 
191 
192  cout <<"AAR - Entering Event Loop"<<endl;
193 EventLoop: if (i <= Nevents && iMake != kStEOF && iMake != kStFatal) {
194  evnt.Reset();
195  evnt.Start("QAInfo:");
196  printf ("ELH3\n");
197  chain->Clear();
198  printf ("ELH4\n");
199 
200  ncols = fscanf(fp,"%d %d %d %f %f %f",&eventnumber,&skip,&mult,&x,&y,&z);
201  if(ncols<0) break;
202 
203  printf("\nEvent number: %d Multiplicity = %d\n",eventnumber,mult);
204  printf("vertex in bfcMixer: %16f %16f %16f\n",x,y,z);
205 
206  // skip events in chain1 (daq file) only.
207  // fz file does not have these events.
208  // strange initialization due to details of inpMk->Skip
209  // ...not well understood. elh
210 
211  printf ("bfcMixer: i = %i\n",i);
212  printf ("bfcMixer: skip = %i\n",skip);
213  printf ("bfcMixer: oldskip = %i\n",oldskip);
214  if (inpMk && skip>0) {
215  if(i == 1) {skip++;}
216  skiptest = inpMk->Skip(skip-oldskip-1);
217  printf("bfcMixer: skiptest1 = %i\n",skiptest);
218  skiptest = inpMk->Skip();
219  printf("bfcMixer: skiptest2 = %i\n",skiptest);
220  if(i == 1) {skip--;}
221  }
222  oldskip = skip;
223 
224  use this to force the vertex position to match:
225  // vtxMk->FixVertex(x,y,z);
226 
227  iMake = chain->Make(i);
228  if (treeMk && iMake == kStErr) {treeMk->Make(i); iBad++;}
229  StEvtHddr *fEvtHddr = (StEvtHddr*)chain->GetDataSet("EvtHddr");
230  StEvtHddr *fEvtHddrDaq = (StEvtHddr*)chain1->GetDataSet("EvtHddr");
231  *fEvtHddr = *fEvtHddrDaq;
232  // gSystem->Exec("ps ux");
233  evnt.Stop("QAInfo:");
234  // evnt->Show("QAInfo:");
235  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(),
236  iMake,evnt.GetRealTime("QAInfo:"),evnt.GetCpuTime("QAInfo:"));
237 
238 
239  // Be sure to get the same event from daq and fz files... elh
240  if(eventnumber == chain->GetEventNumber()){
241  printf("bfcMixer: Event number %d found in both .fz file and .daq file\n",eventnumber);
242  }else{
243  printf("bfcMixer: Error! Event number from .fz file: %d\n",eventnumber);
244  printf("bfcMixer: Error! Event number from .daq file: %d\n",chain->GetEventNumber());
245  printf("bfcMixer: Error! Events are out-of-sync, exiting!\n");
246  break;
247  }
248  i++;
249  goto EventLoop;
250  }
251 
252  fflush(stdout);
253  printf ("QAInfo:Run completed ");
254  gSystem->Exec("date");
255  if (evMk) Event = (StEvent *) chain->GetInputDS("StEvent");
256  {
257  TDatime t;
258  printf ("\nQAInfo:Run is finished at Date/Time%i/%i\n",t.GetDate(),t.GetTime());
259  }
260 }
261 
virtual Int_t Instantiate()
Maker-instantiation handler.
Definition: StBFChain.cxx:214
virtual void Clear(Option_t *option="")
User defined functions.
Definition: StChain.cxx:77
void SetFlags(const Char_t *Chain="gstar tfs")
Scan all flags, check if they are correct, manipulate the comment if necessary.
Definition: StBFChain.cxx:1512
virtual Int_t Make()
Definition: StMaker.cxx:898
Definition: Stypes.h:43
virtual Int_t GetRunNumber() const
Returns the current RunNumber.
Definition: StMaker.cxx:1054
Definition: AgUStep.h:26
virtual Int_t Load()
Routine handling library loading depending on chain options.
Definition: StBFChain.cxx:117
virtual void SetActive(Bool_t k=kTRUE)
Setters for flags and switches.
Definition: StMaker.h:208
Definition: Stypes.h:44