StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
bfcMixer_TpcOnly.C
1 //
3 // Macro for running chain with different inputs
4 //
5 // Owner: Yuri Fisyak
6 //
7 // $Id: bfcMixer_TpcOnly.C,v 1.7 2015/02/12 13:39:18 zhux Exp $
8 //
10 
11 class StChain;
12 StChain *Chain=0;
13 class StBFChain;
14 StBFChain *chain1, *chain2, *chain3;
15 //_____________________________________________________________________
16 void bfcMixer_TpcOnly(Int_t Nevents=100,
17  const Char_t *daqfile="/star/rcf/test/daq/2005/051/st_physics_adc_6051006_raw_1050001.daq",
18  const Char_t *tagfile="/star/rcf/test/embedding/cuProductionMinBias/FullField/P07ic/2005/051/st_physics_adc_6051006_raw_1050001.tags.root",
19  Double_t pt_low=0.1,
20  Double_t pt_high=5.0,
21  Double_t eta_low=-1.3,
22  Double_t eta_high=1.3,
23  Double_t vzlow = -175.0,
24  Double_t vzhigh = 175.0,
25  Double_t vr = 100.0,
26  Int_t pid=8,
27  Double_t mult=0.05,
28  std::vector<Int_t> triggers = 0,
29  const Char_t *prodName = "P07ib",
30  const Char_t* type = "FlatPt",
31  const bool bPythia = false,
32  const Char_t *fzdfile="test.fzd"
33  ){
34  // production chain for P07ib
35  TString prodP07ib("P2005b DbV20070518 MakeEvent ITTF Iana ToF ssddat spt SsdIt SvtIt pmdRaw SCEbyE OGridLeak OShortR OSpaceZ2");// KeepSvtHit hitfilt skip1row");
36  TString geomP07ib("ry2005f");
37 
38  // production chains for P12ia - run6 p+p 62.4 GeV
39  TString prodP12iapp62("DbV20060915,pp2006b,ITTF,DbV20081215_EMC_Calibrations,DbV20081215_EEMC_Calibrations -hitfilt");
40 
41  TString geomP12iapp62("ry2006h");
42 
43  TString chain1Opt("in,magF,tpcDb,NoDefault,-ittf,NoOutput");
44  TString chain2Opt("gen_T,geomT,sim_T,trs,-ittf,-tpc_daq,nodefault");
45  if(bPythia){
46  chain2Opt += ",fzin";
47  }
48  else {
49  chain2Opt += ",NoInput,PrepEmbed";
50  }
51  chain2Opt += " ";
52 
53  TString chain3Opt("");
54  if (prodName == "P12iapp62") { chain3Opt = prodP12iapp62; chain2Opt += geomP12iapp62;}
55  else if (prodName == "P07ib") { chain3Opt = prodP07ib; chain2Opt += geomP07ib;}
56  else {
57  cout << "Choice prodName " << prodName << " does not correspond to known chain. Processing impossible. " << endl;
58  return;
59  }
60  chain3Opt += ",TpcMixer,bbcSim,Embedding,onlraw,GeantOut,MiniMcMk,McAna,-in,NoInput,useInTracker,EmbeddingShortCut";
61 
62  // Dynamically link some shared libs
63  gROOT->LoadMacro("bfc.C");
64  if (gClassTable->GetID("StBFChain") < 0) Load();
65  //______________Create the main chain object______________________________________
66  Chain = new StChain("Embedding");
67  //________________________________________________________________________________
68  bfc(-1,chain1Opt,daqfile);
69  chain1 = chain;
70  chain1->SetName("One");
71  Chain->cd();
72  //________________________________________________________________________________
73  if(bPythia){
74  bfc(-1,chain2Opt,fzdfile);
75  }
76  else {
77  bfc(-1,chain2Opt);
78  }
79  chain2 = chain;
80  chain2->SetName("Two");
81  Chain->cd();
82  if (chain2->GetOption("TRS")){
83  StTrsMaker *trsMk = (StTrsMaker *) chain2->GetMaker("Trs");
84  if (! trsMk) {
85  cout << "Cannot find Trs in chain2" << endl;
86  return;
87  }
88  trsMk->setNormalFactor(2.67);
89  trsMk->SetMode(0);
90  }
91  //________________________________________________________________________________
92  // gSystem->Load("StFtpcMixerMaker");
93  // StFtpcMixerMaker *ftpcmixer = new StFtpcMixerMaker("FtpcMixer","daq","trs");
94  //________________________________________________________________________________
95  TString OutputFileName(gSystem->BaseName(daqfile));
96  OutputFileName.ReplaceAll("*","");
97  OutputFileName.ReplaceAll(".daq","");
98  // OutputFileName.Append("_emb.root");
99  OutputFileName.Append(".root");
100  bfc(-1,chain3Opt,0,OutputFileName);
101  chain3 = chain;
102  chain3->SetName("Three");
103  Chain->cd();
104  Chain->cd();
105 
106  //............. begin of EMC embedding makers................
107 
108  //.............. Add BEmc stuff here ....................
109  gSystem->Load("StEmcSimulatorMaker");
110  gSystem->Load("StEmcMixerMaker");
111  gSystem->Load("StEEmcSimulatorMaker");
112 
113  StMcEventMaker* mcEventMaker = new StMcEventMaker();
114  StEmcSimulatorMaker *bemcSim = new StEmcSimulatorMaker();
115  StEmcMixerMaker *bemcMixer = new StEmcMixerMaker();
116  chain3->AddAfter("emcRaw",bemcMixer);
117  chain3->AddAfter("emcRaw",bemcSim);
118  chain3->AddAfter("emcRaw",mcEventMaker);
119  bemcMixer->SetDebug(0); // set it to 1 for more printouts
120  // note, Barrel slow sim is always ON, said Adam
121 
122  //........... Add EEmc Stuff ( Simu, and Mixer) here ..............
123  StEEmcFastMaker *eemcFastSim = new StEEmcFastMaker();
124  StEEmcMixerMaker *eemcMixer = new StEEmcMixerMaker();
125 
126  /* position B+E EMC makers in the chain
127  (order is reverse because 'After' is used - looks funny but is right)
128  */
129  chain3->AddAfter("emcRaw",eemcMixer);
130  chain3->AddAfter("emcRaw",eemcFastSim);
131 
132  eemcFastSim->SetEmbeddingMode();
133  // eemcFastSim->SetDebug();
134  // eemcMixer->SetDebug();
135 
136  bool useEndcapSlowSim = true;
137  if(useEndcapSlowSim) { // turn Endcap slow simu On/Off
138  StEEmcSlowMaker *slowSim=new StEEmcSlowMaker();
139  chain3->AddAfter("EEmcFastSim",slowSim);
140  slowSim->setEmbeddingMode();
141  }
142 
143  //________________________________________________________________________________
144  {
145  TDatime t;
146  gMessMgr->QAInfo() << Form("Run is started at Date/Time %i/%i",t.GetDate(),t.GetTime()) << endm;
147  }
148  gMessMgr->QAInfo() << Form("Run on %s in %s",gSystem->HostName(),gSystem->WorkingDirectory()) << endm;
149  gMessMgr->QAInfo() << Form("with %s", Chain->GetCVS()) << endm;
150  // embedded particle set
151  if(!bPythia){
152  StPrepEmbedMaker *embMk = (StPrepEmbedMaker *) Chain->Maker("PrepEmbed");
153  if (! embMk) return;
154  cout << "bfcMixer: Setting PID: "<<pid<<endl;
155  embMk->SetTagFile(tagfile);
156  // pTlow,ptHigh,etaLow,etaHigh,phiLow,phiHigh
157  embMk->SetOpt( pt_low, pt_high, eta_low, eta_high, 0., 6.283185, type);
158  // pid, mult
159  embMk->SetPartOpt( pid,mult);
160 
161  // Default is no event selections
162  embMk->SetSkipMode(kTRUE);
163 
164  // Make trigger and z-vertex cuts (only if SkipMode is true)
165  // Trigger cut
166  // Can put multiple trigger id's
167  if ( !triggers.empty() ){
168  for(std::vector<Int_t>::iterator iter = triggers.begin(); iter != triggers.end(); iter++){
169  embMk->SetTrgOpt((*iter)) ;
170  }
171  }
172  // z-vertex cuts
173  embMk->SetZVertexCut(vzlow, vzhigh) ;
174  // vr = sqrt{vx^2 + vy^2} cut
175  embMk->SetVrCut(vr);
176 
177  //embMk->SetPVRankCutMode(kTRUE) ;
178  //embMk->SetPVRankCut(0) ;
179  }
180 
181  TAttr::SetDebug(0);
182  Chain->SetAttr(".Privilege",0,"*" ); //All makers are NOT priviliged
183  Chain->SetAttr(".Privilege",1,"StBFChain::*" ); //StBFChain is priviliged
184  Chain->SetAttr(".Privilege",1,"StIOInterFace::*" ); //All IO makers are priviliged
185  Chain->SetAttr(".Privilege",1,"St_geant_Maker::*"); //It is also IO maker
186  if(!bPythia)Chain->SetAttr(".Privilege",1,"StPrepEmbedMaker::*"); //It is also IO maker
187  // Chain->SetDEBUG(0);
188  if (Nevents < 0) return;
189  Int_t iInit = Chain->Init();
190  if (iInit >= kStEOF) {Chain->FatalErr(iInit,"on init"); return;}
191  StMaker *treeMk = Chain->GetMaker("outputStream");
192  Chain->EventLoop(Nevents,treeMk);
193  gMessMgr->QAInfo() << "Run completed " << endm;
194  gSystem->Exec("date");
195 }
196 //________________________________________________________________________________
197 void bfcMixer_TpcOnly(Int_t Nevents, const Char_t *daqfile, Char_t *tagfile,
198  Double_t pt_low, Double_t pt_high, Double_t eta_low, Double_t eta_high,
199  Double_t vzlow, Double_t vzhigh, Double_t vr, Int_t pid, Double_t mult,
200  const Char_t *triggersC, const Char_t *prodName, const Char_t* type) {
201  std::vector<Int_t> triggers;
202  if (triggersC) {
203  TPMERegexp pm(":");
204  Int_t N = pm.Split(triggersC);
205  for (Int_t i = 0; i < N; i++) {
206  TString num(pm[i]);
207  triggers.push_back(num.Atoi());
208  }
209  }
210  bfcMixer_TpcOnly(Nevents, daqfile, tagfile, pt_low, pt_high, eta_low, eta_high, vzlow, vzhigh, vr, pid, mult, triggers, prodName, type);
211 }
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
void SetOpt(const Double_t ptlow, const Double_t pthigh, const Double_t etalow, const Double_t etahigh, const Double_t philow, const Double_t phihigh, const TString type="FlatPt")
Set geantid(pid) and multiplicity.
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.