StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
RunChargedPion.C
1 // $Id: RunChargedPion.C,v 1.2 2008/12/29 16:12:49 kocolosk Exp $
2 
3 /*****************************************************************************
4  * @author Adam Kocoloski
5  *
6  * main macro to generate StChargedPionEvent trees, both data and simu
7  *****************************************************************************/
8 
9 void RunChargedPion(const char *muPath,
10  const char *outName,
11  const char *jetPath = NULL,
12  bool simu = true,
13  int year = 2005,
14  int nevents = 99999)
15 {
16  gROOT->Macro("LoadLogger.C");
17  gROOT->Macro("$STAR/StRoot/StSpinPool/StChargedPionAnalysisMaker/macros/LoadLibs.C");
18 
19  double pi = atan(1.0)*4.0;
20 
21  StChain chain;
22 
23  if(simu) {
24  StIOMaker ioMk;
25  TString muString(muPath);
26  TString geantString(muString.ReplaceAll("MuDst", "geant"));
27  ioMk.SetFile(geantString.Data());
28  ioMk.SetIOMode("r");
29  ioMk.SetBranch("*", 0, "0");
30  ioMk.SetBranch("geantBranch", 0, "r");
31 
32  StMcEventMaker mcEventMk;
33  }
34 
35  StMuDstMaker muMk(0, 0, "", muPath, "", 1e6);
36 
37  if(!simu) {
38  StTriggerFilterMaker filterMk;
39  filterMk.addTrigger(96011);
40  filterMk.addTrigger(96201);
41  filterMk.addTrigger(96211);
42  filterMk.addTrigger(96221);
43  filterMk.addTrigger(96233);
44 
45  filterMk.addTrigger(5);
46  filterMk.addTrigger(8);
47  filterMk.addTrigger(117001); // mb
48  filterMk.addTrigger(117300); // zb
49  filterMk.addTrigger(117402); // muon
50  filterMk.addTrigger(137213); // bemc-ht2-mb-emul
51  filterMk.addTrigger(137221); // bemc-jp1-mb
52  filterMk.addTrigger(137222); // bemc-jp1-mb
53  filterMk.addTrigger(137271); // eemc-jp1-mb
54  filterMk.addTrigger(137272); // eemc-jp1-mb
55  filterMk.addTrigger(137273); // eemc-jp1-mb
56  filterMk.addTrigger(137501); // bemc-jp0-mb
57  filterMk.addTrigger(137551); // eemc-jp0-mb
58  filterMk.addTrigger(137571); // bemc-jp1
59  filterMk.addTrigger(137575); // bemc-jp0-etot
60  filterMk.addTrigger(137580); // eemc-http
61  filterMk.addTrigger(137581); // eemc-http
62  filterMk.addTrigger(137585); // bemc-jp2
63  filterMk.addTrigger(137586); // bemc-http
64  filterMk.addTrigger(137611); // bemc-http-mb-l2gamma
65  filterMk.addTrigger(137622); // bemc-jp0-etot-mb-L2jet
66  filterMk.addTrigger(137641); // eemc-http-mb-L2gamma
67  filterMk.addTrigger(137652); // eemc-jp0-etot-mb-L2jet
68  }
69 
70  St_db_Maker dbMk("StarDb", "MySQL:StarDb", "$STAR/StarDb");
71  if(simu) {
72  switch(year) {
73  case 2005:
74  dbMk.SetDateTime(20050506,214129);
75  break;
76 
77  case 2006:
78  dbMk.SetDateTime(20060522, 055000); // Alan's timestamp R7142018
79  // dbMk.SetDateTime(20060522, 1128112); //R7142025 -- obviously wrong
80  // dbMk.SetDateTime(20060603, 204549); //R7154063
81  break;
82  }
83  }
84 
85  if(!simu) {
86  StSpinDbMaker spDbMk("spinDb");
87  }
88 
89  StEEmcDbMaker eemcDbMk("eemcDb");
90 
91  if(simu) {
92  StEmcSimulatorMaker emcSimMk;
93  emcSimMk.setCalibSpread(kBarrelEmcTowerId, 0.15);
94  }
95  else
96  StEmcADCtoEMaker adcMk;
97 
98 
99  if(year == 2005) {
100  StEmcTriggerMaker emcTrgMk("bemctrigger");
101  }
102  else {
103  StTriggerSimuMaker trgSimuMk;
104  trgSimuMk.setMC(simu);
105  trgSimuMk.useBbc();
106  trgSimuMk.useBemc();
107  trgSimuMk.bemc->setConfig(StBemcTriggerSimu::kOffline);
108 
109  if(year == 2006) {
110  StL2_2006EmulatorMaker simL2Mk;
111  simL2Mk.setSetupPath("/afs/rhic.bnl.gov/star/users/kocolosk/public/StarTrigSimuSetup/");
112  simL2Mk.setOutPath("./outL2");
113  trgSimuMk.useL2(&simL2Mk);
114  }
115  }
116 
117 
118  if(simu) StMCAsymMaker asymMk("MCAsym");
119 
120  if(simu) StPythiaFourPMaker pythia4pMk("StPythiaFourPMaker", &asymMk, &mcEventMk);
121 
122  bool doTowerSwapFix = true;
123  StBET4pMaker bet4pMk("BET4pMaker", &muMk, doTowerSwapFix);
124  switch(year) {
125  case 2005:
126  bet4pMk.setUse2005Cuts(true);
127  break;
128 
129  case 2006:
130  bet4pMk.setUseEndcap(true);
131  bet4pMk.setUse2006Cuts(true);
132  break;
133  }
134 
135  StJetMaker emcJetMk("emcJetMaker", &muMk, "blah.jet.root");
136 
137  StppAnaPars anapars;
138  switch(year) {
139  case 2005:
140  anapars.setFlagMin(0);
141  anapars.setNhits(20);
142  anapars.setAbsEtaMax(1.6);
143  if(simu) anapars.setJetPtMin(3.0);
144  else anapars.setJetPtMin(5.0);
145  break;
146 
147  case 2006:
148  anapars.setFlagMin(0);
149  anapars.setNhits(12);
150  anapars.setAbsEtaMax(2.0);
151  if(simu) anapars.setJetPtMin(3.5);
152  else anapars.setJetPtMin(5.0);
153  break;
154  }
155  anapars.setCutPtMin(0.2);
156  anapars.setJetEtaMax(100.0);
157  anapars.setJetEtaMin(0);
158  anapars.setJetNmin(0);
159 
160  StppAnaPars pypars;
161  switch(year) {
162  case 2005:
163  case 2006:
164  pypars.setFlagMin(0);
165  pypars.setNhits(0);
166  pypars.setCutPtMin(0.0001);
167  pypars.setAbsEtaMax(5.0);
168  pypars.setJetPtMin(3.0);
169  pypars.setJetEtaMax(5.0);
170  pypars.setJetEtaMin(0);
171  pypars.setJetNmin(0);
172  break;
173  }
174 
175  StConePars cpars;
176  switch(year) {
177  case 2005:
178  cpars.setGridSpacing(56, -1.6, 1.6, 120, -pi, pi);
179  cpars.setConeRadius(0.4);
180  break;
181 
182  case 2006:
183  cpars.setGridSpacing(105, -3.0, 3.0, 120, -pi, pi);
184  cpars.setConeRadius(0.7);
185  break;
186  }
187  cpars.setSeedEtMin(0.5);
188  cpars.setAssocEtMin(0.1);
189  cpars.setSplitFraction(0.5);
190  cpars.setPerformMinimization(true);
191  cpars.setAddMidpoints(true);
192  cpars.setRequireStableMidpoints(true);
193  cpars.setDoSplitMerge(true);
194  cpars.setDebug(false);
195 
196  switch(year) {
197  case 2005:
198  emcJetMk.addAnalyzer(&anapars, &cpars, &bet4pMk, "ConeJets");
199  break;
200 
201  case 2006:
202  anapars.setNhits(5);
203  emcJetMk.addAnalyzer(&anapars, &cpars, &bet4pMk, "ConeJets5");
204 
205  anapars.setNhits(12);
206  emcJetMk.addAnalyzer(&anapars, &cpars, &bet4pMk, "ConeJets12");
207 
208  anapars.setNhits(10000000);
209  emcJetMk.addAnalyzer(&anapars, &cpars, &bet4pMk, "ConeJetsEMC");
210  break;
211  }
212 
213  if(simu) {
214  StConePars pycpars(cpars);
215  if(year == 2005) pycpars.setGridSpacing(200, -5.0, 5.0, 120, -pi, pi);
216  emcJetMk.addAnalyzer(&pypars, &pycpars, &pythia4pMk, "PythiaConeJets");
217  }
218 
219  StChargedPionMaker cpMk("chargedPionMaker", outName);
220  if(simu) {
221  switch(year) {
222  case 2005:
223  cpMk.addTrigger(96011);
224  cpMk.addTrigger(96201);
225  cpMk.addTrigger(96211);
226  cpMk.addTrigger(96221);
227  cpMk.addTrigger(96233);
228  break;
229 
230  case 2006:
231  cpMk.addTrigger(5);
232  cpMk.addTrigger(8);
233  cpMk.addTrigger(117001); // mb
234  cpMk.addTrigger(117300); // zb
235  cpMk.addTrigger(117402); // muon
236  cpMk.addTrigger(137213); // bemc-ht2-mb-emul
237  cpMk.addTrigger(137221); // bemc-jp1-mb
238  cpMk.addTrigger(137222); // bemc-jp1-mb
239  cpMk.addTrigger(137271); // eemc-jp1-mb
240  cpMk.addTrigger(137272); // eemc-jp1-mb
241  cpMk.addTrigger(137273); // eemc-jp1-mb
242  cpMk.addTrigger(137501); // bemc-jp0-mb
243  cpMk.addTrigger(137551); // eemc-jp0-mb
244  cpMk.addTrigger(137571); // bemc-jp1
245  cpMk.addTrigger(137575); // bemc-jp0-etot
246  cpMk.addTrigger(137580); // eemc-http
247  cpMk.addTrigger(137581); // eemc-http
248  cpMk.addTrigger(137585); // bemc-jp2
249  cpMk.addTrigger(137586); // bemc-http
250  cpMk.addTrigger(137611); // bemc-http-mb-l2gamma
251  cpMk.addTrigger(137622); // bemc-jp0-etot-mb-L2jet
252  cpMk.addTrigger(137641); // eemc-http-mb-L2gamma
253  cpMk.addTrigger(137652); // eemc-jp0-etot-mb-L2jet
254  break;
255  }
256  }
257 
258  TStopwatch total;
259  TStopwatch timer;
260  TMemStat memory;
261 
262  chain.Init();
263 
264  int i=0;
265  while(i<nevents && chain.Make()==kStOk) {
266  if(i % 500 == 0) {
267  cout << "done with event " << i
268  << "\tcpu: " << timer.CpuTime()
269  << "\treal: " << timer.RealTime()
270  << "\tratio: " << timer.CpuTime()/timer.RealTime() << endl;
271  timer.Start();
272  memory.PrintMem(NULL);
273  }
274  ++i;
275  chain.Clear();
276  }
277 
278  chain.Finish();
279  cout << "my macro processed " << i << " events"
280  << "\tcpu: " << total.CpuTime()
281  << "\treal: " << total.RealTime()
282  << "\tratio: " << total.CpuTime()/total.RealTime() << endl;
283 }
284 
285 /*****************************************************************************
286  * $Log: RunChargedPion.C,v $
287  * Revision 1.2 2008/12/29 16:12:49 kocolosk
288  * added $Id$/$Log$ as needed
289  *
290  * Revision 1.1 2008/07/17 17:07:02 kocolosk
291  * cleanup all those old macros and XML files
292  *
293  *****************************************************************************/
void setConeRadius(double v)
Set cone radius:
Definition: StConePars.h:65
void setAddMidpoints(bool v)
Add seeds at midpoints?
Definition: StConePars.h:56
virtual void SetIOMode(Option_t *iomode="w")
number of transactions
Definition: StIOInterFace.h:35
virtual void Clear(Option_t *option="")
User defined functions.
Definition: StChain.cxx:77
void setSplitFraction(double v)
split jets if E_shared/E_neighbor&gt;splitFraction
Definition: StConePars.h:50
void setGridSpacing(int nEta, double etaMin, double etaMax, int nPhi, double phiMin, double phiMax)
Set the grid spacing:
Definition: StConePars.h:36
virtual Int_t Finish()
Definition: StChain.cxx:85
void setDoSplitMerge(bool v)
Do Split/Merge step?
Definition: StConePars.h:59
void setDebug(bool v)
Toggle debug streams on/off.
Definition: StConePars.h:68
Filling of all StMcEvent classes from g2t tables Transform all the data in the g2t tables into the co...
void setSeedEtMin(double v)
minimum et threshold to be considered a seed
Definition: StConePars.h:44
virtual Int_t Make()
Definition: StChain.cxx:110
void setAssocEtMin(double v)
minimum et threshold to be considered for addition to the seed
Definition: StConePars.h:47
void setRequireStableMidpoints(bool v)
Require stable midpoints?
Definition: StConePars.h:62
Definition: Stypes.h:41
void setCalibSpread(StDetectorId det, float spread)
smear simulator calibration coefficients using Gaussian with this RMS.
void setPerformMinimization(bool v)
Let jet wander to minimum?
Definition: StConePars.h:53