StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
StPythiaEvent.h
1 // -*- mode: C++ -*-
2 // $Id: StPythiaEvent.h,v 1.14 2012/12/10 21:52:46 pibero Exp $
3 
4 // Pibero Djawotho <pibero@indiana.edu>
5 // Indiana University
6 // 12 July 2007
7 //
8 // $Log: StPythiaEvent.h,v $
9 // Revision 1.14 2012/12/10 21:52:46 pibero
10 // More simplifications...
11 //
12 // Revision 1.13 2012/12/10 21:40:06 pibero
13 // Simplify code
14 //
15 // Revision 1.12 2012/12/06 20:45:41 pibero
16 // const correctess
17 //
18 // Revision 1.11 2012/12/06 20:37:26 pibero
19 // Print PYTHIA record
20 //
21 // Revision 1.10 2012/11/25 21:56:58 pibero
22 // small bug fix
23 //
24 // Revision 1.9 2012/11/24 17:16:03 pibero
25 // small bug fix
26 //
27 // Revision 1.8 2012/11/24 03:12:43 pibero
28 // Add LSS2010 and BB2010
29 //
30 // Revision 1.7 2012/01/18 18:11:36 pibero
31 // Added PYTHIA variables: MSTU(72), MSTU(73), and MSTP(111)
32 //
33 // Revision 1.6 2011/09/13 20:03:51 pibero
34 // DSSV2009 -> DSSV2009a
35 //
36 // Revision 1.5 2011/09/13 16:24:21 pibero
37 // Added DSSV2009 grid
38 //
39 // Revision 1.4 2010/10/04 19:18:29 pibero
40 // Fix copy constructor and assignment operator. Thanks, Alice!
41 //
42 // Revision 1.3 2009/12/14 01:22:47 pibero
43 // const correctness
44 //
45 // Revision 1.2 2009/12/08 15:14:24 pibero
46 // Added Pythia tune per Helen Caines request.
47 //
48 // Revision 1.1 2008/06/01 05:31:42 tai
49 // moved StPythiaEvent to StSpinPool/StJetSkimEvent
50 //
51 // Revision 1.9 2008/06/01 04:59:22 tai
52 // removed the dependency of StPythiaEvent on St_particle_Table.h
53 //
54 // Revision 1.8 2008/06/01 04:33:33 tai
55 // *** empty log message ***
56 //
57 // Revision 1.7 2008/05/02 02:36:48 rfatemi
58 // update ClassDef
59 //
60 // Revision 1.6 2008/05/01 01:36:39 rfatemi
61 // check in D. Staszak modifications - additional grids
62 //
63 // Revision 1.5 2008/02/03 01:27:17 rfatemi
64 // Included Gehrmann-Stirling PDFs
65 //
66 // Revision 1.4 2007/11/17 20:11:33 kocolosk
67 // remove printf
68 //
69 // Revision 1.3 2007/11/01 02:48:38 rfatemi
70 // Dave Staszak update with additional GRSV grids
71 //
72 // Revision 1.2 2007/08/06 17:06:05 rfatemi
73 // set default GRSV to standard
74 //
75 // Revision 1.1 2007/07/19 01:40:41 kocolosk
76 // use Pibero's StPythiaEvent class to supply mcAsymMaker results to user
77 //
78 
79 #ifndef ST_PYTHIA_EVENT
80 #define ST_PYTHIA_EVENT
81 
82 #include <cstdio>
83 #include <algorithm>
84 #include "TParticle.h"
85 #include "TClonesArray.h"
86 
87 using std::fill;
88 
89 class StPythiaEvent : public TObject {
90 public:
91  StPythiaEvent();
92  virtual ~StPythiaEvent();
93  StPythiaEvent(const StPythiaEvent& other);
94  StPythiaEvent& operator=(const StPythiaEvent& rhs);
95  enum { NPDF=34 };
96  enum PDF { LO=0, NLO=1, STD=1, ZERO=2, MAX=3, MIN=4, M015=5, M030=6, M045=7, M060=8, M075=9, M090=10, M105=11, P030=12, P045=13, P060=14, P070=15, GS_NLOA=16, GS_NLOB=17, GS_NLOC=18, DSSV=19, LSS1=20, LSS2=21, LSS3=22, AAC1=23, AAC2=24, AAC3=25, BB1=26, BB2=27, DNS1=28, DNS2=29, DSSV2009a=30, LSS2010_delGpos=31, LSS2010_chsign_delG=32, BB2010=33 };
97  int runId() const;
98  int eventId() const;
99  int processId() const;
100  int tune() const;
101  const TVector3& vertex() const;
102  float s() const;
103  float t() const;
104  float u() const;
105  float pt() const;
106  float cosTheta() const;
107  float x1() const;
108  float x2() const;
109  int mstu72() const;
110  int mstu73() const;
111  int mstp111() const;
112  float Q2() const;
113  float partonALL() const;
114  float dF1(PDF scenario = STD) const;
115  float dF2(PDF scenario = STD) const;
116  float f1(PDF scenario = STD) const;
117  float f2(PDF scenario = STD) const;
118  float ALL(PDF scenario = STD) const;
119 
120  const TClonesArray* particles() const;
121  int numberOfParticles() const;
122  const TParticle* particle(int i) const;
123 
124  void Clear(Option_t* option = "");
125  void setRunId(int id);
126  void setEventId(int id);
127  void setProcessId(int id);
128  void setTune(int tune);
129  void setVertex(const TVector3& v);
130  void setS(float s);
131  void setT(float t);
132  void setU(float u);
133  void setPt(float pt);
134  void setCosTheta(float cosTheta);
135  void setX1(float x1);
136  void setX2(float x2);
137  void setMstu72(int mstu72);
138  void setMstu73(int mstu73);
139  void setMstp111(int mstp111);
140  void setPartonALL(float a);
141  void setDF1(PDF scenario, float val);
142  void setDF2(PDF scenario, float val);
143  void setF1(PDF scenario, float val);
144  void setF2(PDF scenario, float val);
145 
146  void addParticle(const TParticle& particle);
147  void print() const;
148  void printHelper(int first, int last) const;
149 
150 private:
151  int mRunId;
152  int mEventId;
153  int mProcessId;
154  int mTune;
155  TVector3 mVertex;
156  float mS;
157  float mT;
158  float mU;
159  float mPt;
160  float mCosTheta;
161  float mX1;
162  float mX2;
163  int mMstu72;
164  int mMstu73;
165  int mMstp111;
166  float mPartonALL;
167  float mDF1[NPDF]; //[LO][NLO][ZERO][MAX][MIN][M015][M030][M045][M060][M075][M090][M105][P030][P045][P060][P070][NLOA][NLOB][NLOC][DSSV][LSS1][LSS2][LSS3][AAC1][AAC2][AAC3][BB1][BB2][DNS1][DNS2][DSSV2009a][LSS2010_delGpos][LSS2010_chsign_delG][BB2010]
168  float mDF2[NPDF]; //[LO][NLO][ZERO][MAX][MIN][M015][M030][M045][M060][M075][M090][M105][P030][P045][P060][P070][NLOA][NLOB][NLOC][DSSV][LSS1][LSS2][LSS3][AAC1][AAC2][AAC3][BB1][BB2][DNS1][DNS2][DSSV2009a][LSS2010_delGpos][LSS2010_chsign_delG][BB2010]
169  float mF1[2]; //[LO][NLO]
170  float mF2[2]; //[LO][NLO]
171 
172  TClonesArray* mParticles;
173 
174  ClassDef(StPythiaEvent,7);
175 };
176 
177 inline int StPythiaEvent::runId() const { return mRunId; }
178 inline int StPythiaEvent::eventId() const { return mEventId; }
179 inline int StPythiaEvent::processId() const { return mProcessId; }
180 inline int StPythiaEvent::tune() const { return mTune; }
181 inline const TVector3& StPythiaEvent::vertex() const { return mVertex; }
182 inline float StPythiaEvent::s() const { return mS; }
183 inline float StPythiaEvent::t() const { return mT; }
184 inline float StPythiaEvent::u() const { return mU; }
185 inline float StPythiaEvent::pt() const { return mPt; }
186 inline float StPythiaEvent::cosTheta() const { return mCosTheta; }
187 inline float StPythiaEvent::x1() const { return mX1; }
188 inline float StPythiaEvent::x2() const { return mX2; }
189 inline int StPythiaEvent::mstu72() const { return mMstu72; }
190 inline int StPythiaEvent::mstu73() const { return mMstu73; }
191 inline int StPythiaEvent::mstp111() const { return mMstp111; }
192 inline float StPythiaEvent::Q2() const { return mPt * mPt; }
193 inline float StPythiaEvent::partonALL() const { return mPartonALL; }
194 inline float StPythiaEvent::dF1(PDF scenario) const { return mDF1[scenario]; }
195 inline float StPythiaEvent::dF2(PDF scenario) const { return mDF2[scenario]; }
196 
197 inline float StPythiaEvent::f1(PDF scenario) const
198 {
199  return (scenario == LO) ? mF1[LO] : mF1[NLO];
200 }
201 
202 inline float StPythiaEvent::f2(PDF scenario) const
203 {
204  return (scenario == LO) ? mF2[LO] : mF2[NLO];
205 }
206 
207 inline float StPythiaEvent::ALL(PDF scenario) const
208 {
209  return (dF1(scenario)*dF2(scenario)*partonALL())/(f1(scenario)*f2(scenario));
210 }
211 
212 inline const TClonesArray* StPythiaEvent::particles() const { return mParticles; }
213 inline int StPythiaEvent::numberOfParticles() const { return mParticles->GetEntriesFast(); }
214 inline const TParticle* StPythiaEvent::particle(int i) const { return (TParticle*)mParticles->At(i); }
215 
216 inline void StPythiaEvent::addParticle(const TParticle& particle)
217 {
218  new ((*mParticles)[mParticles->GetEntriesFast()]) TParticle(particle);
219 }
220 
221 inline void StPythiaEvent::Clear(Option_t* option)
222 {
223  mRunId = 0;
224  mEventId = 0;
225  mProcessId = 0;
226  mTune = 0;
227  mVertex.SetXYZ(0, 0, 0);
228  mS = 0;
229  mT = 0;
230  mU = 0;
231  mPt = 0;
232  mCosTheta = 0;
233  mX1 = 0;
234  mX2 = 0;
235  mMstu72 = 0;
236  mMstu73 = 0;
237  mMstp111 = 0;
238  mPartonALL = 0;
239  fill(mDF1,mDF1+NPDF,0);
240  fill(mDF2,mDF2+NPDF,0);
241  mF1[0] = 0; mF1[1] = 0;
242  mF2[0] = 0; mF2[1] = 0;
243 
244  if (mParticles) mParticles->Clear(option);
245 }
246 
247 inline void StPythiaEvent::setRunId(int id) { mRunId = id; }
248 inline void StPythiaEvent::setEventId(int id) { mEventId = id; }
249 inline void StPythiaEvent::setProcessId(int id) { mProcessId = id; }
250 inline void StPythiaEvent::setTune(int tune) { mTune = tune; }
251 inline void StPythiaEvent::setVertex(const TVector3& v) { mVertex = v; }
252 inline void StPythiaEvent::setS(float s) { mS = s; }
253 inline void StPythiaEvent::setT(float t) { mT = t; }
254 inline void StPythiaEvent::setU(float u) { mU = u; }
255 inline void StPythiaEvent::setPt(float pt) { mPt = pt; }
256 inline void StPythiaEvent::setCosTheta(float cosTheta) { mCosTheta = cosTheta; }
257 inline void StPythiaEvent::setX1(float x1) { mX1 = x1; }
258 inline void StPythiaEvent::setX2(float x2) { mX2 = x2; }
259 inline void StPythiaEvent::setMstu72(int mstu72) { mMstu72 = mstu72; }
260 inline void StPythiaEvent::setMstu73(int mstu73) { mMstu73 = mstu73; }
261 inline void StPythiaEvent::setMstp111(int mstp111) { mMstp111 = mstp111; }
262 inline void StPythiaEvent::setPartonALL(float a) { mPartonALL = a; }
263 inline void StPythiaEvent::setDF1(PDF scenario, float val) { mDF1[scenario] = val; }
264 inline void StPythiaEvent::setDF2(PDF scenario, float val) { mDF2[scenario] = val; }
265 
266 inline void StPythiaEvent::setF1(PDF scenario, float val)
267 {
268  if(scenario == LO) mF1[0] = val;
269  mF1[1] = val;
270 }
271 
272 inline void StPythiaEvent::setF2(PDF scenario, float val)
273 {
274  if(scenario == LO) mF2[0] = val;
275  mF2[1] = val;
276 }
277 
278 
279 inline void StPythiaEvent::print() const
280 {
281  // Header
282  puts(" Event listing (standard)\n");
283  puts(" I particle/jet K(I,1) K(I,2) K(I,3) K(I,4) K(I,5) P(I,1) P(I,2) P(I,3) P(I,4) P(I,5)\n");
284 
285  // Colliding protons
286  printHelper(0,2);
287  puts(" ==================================================================================================================================");
288 
289  // Hard collision
290  printHelper(2,mstu72());
291  puts(" ==================================================================================================================================");
292 
293  // Fragmentation
294  printHelper(mstu72(),mstu73());
295  puts(" ==================================================================================================================================");
296 
297  // Hadronization
298  printHelper(mstu73(),numberOfParticles());
299  puts(" ==================================================================================================================================");
300 }
301 
302 inline void StPythiaEvent::printHelper(int first, int last) const
303 {
304  for (int i = first; i < last; ++i) {
305  const TParticle* part = particle(i);
306  TLorentzVector mom;
307  part->Momentum(mom);
308  printf("%5d%14s%8d%9d%7d%11d%12d%13f%13f%13f%13f%13f\n",i+1,part->GetName(),part->GetStatusCode(),part->GetPdgCode(),part->GetFirstMother(),part->GetFirstDaughter(),part->GetLastDaughter(),mom.Px(),mom.Py(),mom.Pz(),mom.E(),mom.M());
309  }
310 }
311 
312 #endif