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