StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
bfcMixer_TpxAuAu200.C
1 //
3 // Macro for running chain with different inputs
4 //
5 // Owner: Yuri Fisyak
6 //
7 // $Id: bfcMixer_TpxAuAu200.C,v 1.2 2012/02/17 20:47:36 fisyak Exp $
8 //
10 
11 class StChain;
12 StChain *Chain=0;
13 class StBFChain;
14 StBFChain *chain1, *chain2, *chain3;
15 //_____________________________________________________________________
16 void bfcMixer_TpxAuAu200(const Int_t Nevents=100,
17  const Char_t *daqfile="/star/rcf/test/daq/2010/embed/auau200_prod/st_physics_adc_11035021_raw_4420002.daq",
18  const Char_t *tagfile="/star/rcf/test/daq/2010/embed/auau200_prod/st_physics_adc_11035021_raw_4420002.tags.root",
19  const Double_t pt_low=0.1,
20  const Double_t pt_high=5.0,
21  const Double_t eta_low=-1.5,
22  const Double_t eta_high=1.5,
23  const Double_t vzlow = -150.0,
24  const Double_t vzhigh = 150.0,
25  const Int_t pid=9,
26  const Double_t mult=100,
27  const std::vector<Int_t> triggers = 0,
28  const Char_t *prodName = "P10ihAuAu200",
29  const Char_t* type = "FlatPt"){
30  // production chains for P08ic - p+p, Au+Au 9 GeV and d+Au
31  TString prodP08iepp("DbV20081117 B2008a ITTF IAna ppOpt l3onl emcDY2 fpd ftpc trgd ZDCvtx NosvtIT NossdIT Corr4 OSpaceZ2 OGridLeak3D VFMCE -hitfilt");
32 // TString prodP08icpp("DbV20080712,pp2008,ITTF,OSpaceZ2,OGridLeak3D,beamLine,VFMCE,TpxClu -VFPPV -hitfilt");
33 // TString prodP08icAuAu9("DbV20080709 P2008 ITTF VFMCE -hitfilt");
34 // TString prodP08icAuAu200("DbV20070101 P2008 ITTF VFMCE -hitfilt");
35 // TString prodP08icdAu("DbV20080712 P2008 ITTF OSpaceZ2 OGridLeak3D beamLine, VFMCE TpxClu -VFMinuit -hitfilt");
36  TString prodP08iedAu("DbV20090213 P2008 ITTF OSpaceZ2 OGridLeak3D beamLine VFMCE TpxClu -VFMinuit -hitfilt");
37  TString prodP10iapp("DbV20091001 pp2009c TpcRS ITTF OSpaceZ2 OGridLeak3D beamLine, VFMCE TpcRS -VFMinuit -hitfilt");
38 
39  // BES Run10 chains
40  TString prodP10ihAuAu39("DbV20100909 P2010a,btof,BEmcChkStat,Corr4,OSpaceZ2,OGridLeak3D,VFMCE TpxClu -VFMinuit -hitfilt");
41  TString prodP10ihAuAu11("DbV20100821 P2010a,btof,BEmcChkStat,Corr4,OSpaceZ2,OGridLeak3D,VFMCE TpxClu -VFMinuit -hitfilt");
42  TString prodP10ihAuAu7("DbV20100821 P2010a,btof,BEmcChkStat,Corr4,OSpaceZ2,OGridLeak3D,VFMCE TpxClu -VFMinuit -hitfilt");
43  TString prodP10ihAuAu200("DbV20101106 P2010a,btof,BEmcChkStat,Corr4,OSpaceZ2,OGridLeak3D,VFMCE TpxClu -VFMinuit -hitfilt");
44 
45  TString geomP08ic("ry2008");
46  TString geomP10ih("ry2010");
47  TString chain1Opt("in,magF,tpcDb,NoDefault,TpxRaw,-ittf,NoOutput");
48  TString chain2Opt("NoInput,PrepEmbed,gen_T,geomT,sim_T,TpcRS,-ittf,-tpc_daq,nodefault");
49 // TString chain2Opt("NoInput,PrepEmbed,gen_T,geomT,sim_T,trs,-ittf,-tpc_daq,nodefault");
50  chain2Opt += " ";
51 
52  TString chain3Opt("");
53  if (prodName == "P08icpp") { chain3Opt = prodP08icpp; chain2Opt += geomP08ic; }
54  else if (prodName == "P08iepp") { chain3Opt = prodP08iepp; chain2Opt += geomP08ic; }
55  else if (prodName == "P08icAuAu9") { chain3Opt = prodP08icAuAu9; chain2Opt += geomP08ic; }
56  else if (prodName == "P08icdAu") { chain3Opt = prodP08icdAu; chain2Opt += geomP08ic; }
57  else if (prodName == "P08iedAu") { chain3Opt = prodP08iedAu; chain2Opt += geomP08ic; }
58  else if (prodName == "P08icAuAu200") { chain3Opt = prodP08icAuAu200; chain2Opt += geomP08ic; }
59  else if (prodName == "P10iapp") { chain3Opt = prodP10iapp; chain2Opt += geomP10ih; }
60  else if (prodName == "P10ihAuAu39") { chain3Opt = prodP10ihAuAu39; chain2Opt += geomP10ih; }
61  else if (prodName == "P10ihAuAu11") { chain3Opt = prodP10ihAuAu11; chain2Opt += geomP10ih; }
62  else if (prodName == "P10ihAuAu7") { chain3Opt = prodP10ihAuAu7; chain2Opt += geomP10ih; }
63  else if (prodName == "P10ihAuAu200") { chain3Opt = prodP10ihAuAu200; chain2Opt += geomP10ih; }
64  else {
65  cout << "Choice prodName " << prodName << " does not correspond to known chain. Processing impossible. " << endl;
66  return;
67  }
68  chain3Opt += ",Embedding,TpcMixer,GeantOut,MiniMcMk,McAna,-in,NoInput,useInTracker";
69  chain3Opt += ",";
70 
71  if (prodName == "P08icpp") { chain3Opt += geomP08ic; }
72  else if (prodName == "P08iepp") { chain3Opt += geomP08ic; }
73  else if (prodName == "P08icAuAu9") { chain3Opt += geomP08ic; }
74  else if (prodName == "P08icdAu") { chain3Opt += geomP08ic; }
75  else if (prodName == "P08iedAu") { chain3Opt += geomP08ic; }
76  else if (prodName == "P08icAuAu200") { chain3Opt += geomP08ic; }
77  else if (prodName == "P10iapp") { chain3Opt += geomP10ih; }
78  else if (prodName == "P10ihAuAu39") { chain3Opt += geomP10ih; }
79  else if (prodName == "P10ihAuAu11") { chain3Opt += geomP10ih; }
80  else if (prodName == "P10ihAuAu7") { chain3Opt += geomP10ih; }
81  else if (prodName == "P10ihAuAu200") { chain3Opt += geomP10ih; }
82  else {
83  cout << "Choice prodName " << prodName << " does not correspond to known chain. Processing impossible. " << endl;
84  return;
85  }
86 
87  // Dynamically link some shared libs
88  gROOT->LoadMacro("bfc.C");
89  if (gClassTable->GetID("StBFChain") < 0) Load();
90  //______________Create the main chain object______________________________________
91  Chain = new StChain("Embedding");
92  //________________________________________________________________________________
93  bfc(-1,chain1Opt,daqfile);
94  chain1 = chain;
95  chain1->SetName("One");
96  Chain->cd();
97  //________________________________________________________________________________
98  bfc(-1,chain2Opt);
99  chain2 = chain;
100  chain2->SetName("Two");
101  Chain->cd();
102 #if 0
103  if (chain2->GetOption("TRS")){
104  StTrsMaker *trsMk = (StTrsMaker *) chain2->GetMaker("Trs");
105  if (! trsMk) {
106  cout << "Cannot find Trs in chain2" << endl;
107  return;
108  }
109  trsMk->setNormalFactor(1.32);
110  trsMk->SetMode(0);
111  }
112 #endif
113  //________________________________________________________________________________
114  // gSystem->Load("StFtpcMixerMaker");
115  // StFtpcMixerMaker *ftpcmixer = new StFtpcMixerMaker("FtpcMixer","daq","trs");
116  //________________________________________________________________________________
117  TString OutputFileName(gSystem->BaseName(daqfile));
118  OutputFileName.ReplaceAll("*","");
119  OutputFileName.ReplaceAll(".daq","");
120  // OutputFileName.Append("_emb.root");
121  OutputFileName.Append(".root");
122  bfc(-1,chain3Opt,0,OutputFileName);
123  chain3 = chain;
124  chain3->SetName("Three");
125  Chain->cd();
126  //________________________________________________________________________________
127  StTpcMixerMaker *mixer = (StTpcMixerMaker *) chain3->Maker("TpcMixer");
128  if( prodName == "P08icAuAu200")
129  {
130  mixer->SetInput("Input1","MixerEvent");
131  }
132  else
133  {
134  mixer->SetInput("Input1","TpxRaw/.data/Event");
135  }
136  // mixer->SetInput("Input2","Trs/.const/Event");
137 
138  if (chain2Opt.Contains("TpcRS",TString::kIgnoreCase)) {
139  mixer->SetInput("Input2","TpcRS/Event");
140  }else {
141  mixer->SetInput("Input2","Trs/.const/Event");
142  }
143 
144  Chain->cd();
145 
146  //............. begin of EMC embedding makers................
147 
148  //.............. Add BEmc stuff here ....................
149  gSystem->Load("StEmcSimulatorMaker");
150  gSystem->Load("StEmcMixerMaker");
151  gSystem->Load("StEEmcSimulatorMaker");
152 
153  StMcEventMaker* mcEventMaker = new StMcEventMaker();
154  StEmcSimulatorMaker *bemcSim = new StEmcSimulatorMaker();
155  StEmcMixerMaker *bemcMixer = new StEmcMixerMaker();
156  chain3->AddAfter("emcRaw",bemcMixer);
157  chain3->AddAfter("emcRaw",bemcSim);
158  chain3->AddAfter("emcRaw",mcEventMaker);
159  bemcMixer->SetDebug(0); // set it to 1 for more printouts
160  // note, Barrel slow sim is always ON, said Adam
161 
162  //........... Add EEmc Stuff ( Simu, and Mixer) here ..............
163  StEEmcFastMaker *eemcFastSim = new StEEmcFastMaker();
164  StEEmcMixerMaker *eemcMixer = new StEEmcMixerMaker();
165 
166  /* position B+E EMC makers in the chain
167  (order is reverse because 'After' is used - looks funny but is right)
168  */
169  chain3->AddAfter("emcRaw",eemcMixer);
170  chain3->AddAfter("emcRaw",eemcFastSim);
171 
172  eemcFastSim->SetEmbeddingMode();
173  // eemcFastSim->SetDebug();
174  // eemcMixer->SetDebug();
175 
176  bool useEndcapSlowSim = true;
177  if(useEndcapSlowSim) { // turn Endcap slow simu On/Off
178  StEEmcSlowMaker *slowSim=new StEEmcSlowMaker();
179  chain3->AddAfter("EEmcFastSim",slowSim);
180  slowSim->setEmbeddingMode();
181  }
182 
183 
184 
185  //________________________________________________________________________________
186  {
187  TDatime t;
188  gMessMgr->QAInfo() << Form("Run is started at Date/Time %i/%i",t.GetDate(),t.GetTime()) << endm;
189  }
190  gMessMgr->QAInfo() << Form("Run on %s in %s",gSystem->HostName(),gSystem->WorkingDirectory()) << endm;
191  gMessMgr->QAInfo() << Form("with %s", Chain->GetCVS()) << endm;
192  // embedded particle set
193  StPrepEmbedMaker *embMk = (StPrepEmbedMaker *) Chain->Maker("PrepEmbed");
194  if (! embMk) return;
195  cout << "bfcMixer: Setting PID: "<<pid<<endl;
196  embMk->SetTagFile(tagfile);
197  // pTlow,ptHigh,etaLow,etaHigh,phiLow,phiHigh
198  embMk->SetOpt( pt_low, pt_high, eta_low, eta_high, 0., 6.283185, type);
199  // pid, mult
200  embMk->SetPartOpt( pid,mult);
201 
202  // Default is no event selections
203  embMk->SetSkipMode(kFALSE);
204 
205  // Make trigger and z-vertex cuts (only if SkipMode is true)
206  // Trigger cut
207  // Can put multiple trigger id's
208  if ( !triggers.empty() ){
209  for(std::vector<Int_t>::iterator iter = triggers.begin(); iter != triggers.end(); iter++){
210  embMk->SetTrgOpt((*iter)) ;
211  }
212  }
213 
214  // z-vertex cuts
215  embMk->SetZVertexCut(vzlow, vzhigh) ;
216 
217  TAttr::SetDebug(0);
218  Chain->SetAttr(".Privilege",0,"*" ); //All makers are NOT priviliged
219  Chain->SetAttr(".Privilege",1,"StBFChain::*" ); //StBFChain is priviliged
220  Chain->SetAttr(".Privilege",1,"StIOInterFace::*" ); //All IO makers are priviliged
221  Chain->SetAttr(".Privilege",1,"St_geant_Maker::*"); //It is also IO maker
222  Chain->SetAttr(".Privilege",1,"StPrepEmbedMaker::*"); //It is also IO maker
223  // Chain->SetDEBUG(0);
224  if (Nevents < 0) return;
225  Int_t iInit = Chain->Init();
226  if (iInit >= kStEOF) {Chain->FatalErr(iInit,"on init"); return;}
227  StMaker *treeMk = Chain->GetMaker("outputStream");
228  Chain->EventLoop(Nevents,treeMk);
229  gMessMgr->QAInfo() << "Run completed " << endm;
230  gSystem->Exec("date");
231 }
232 
233 //$LOG$
Prepare GEANT Maker with input from embedding settings and DAQ event.
Filling of all StMcEvent classes from g2t tables Transform all the data in the g2t tables into the co...
Definition: Stypes.h:43
virtual Int_t Load()
Routine handling library loading depending on chain options.
Definition: StBFChain.cxx:117
void setEmbeddingMode(Bool_t e=true)
Sets all switches required to perform embedding.
Slow simulator for EEMC.