StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
StEStructFlat.h
1 /**********************************************************************
2  *
3  * $Id: StEStructFlat.h,v 1.5 2012/11/16 21:23:18 prindle Exp $
4  *
5  * Author: Jeff Porter
6  *
7  **********************************************************************
8  *
9  * Description: EStructEventReader wrapper for flat event generator
10  *
11  **********************************************************************/
12 #ifndef __STESTRUCTFLAT__H
13 #define __STESTRUCTFLAT__H
14 
15 #include <cmath>
16 #include "StEStructPool/AnalysisMaker/StEStructEventReader.h"
17 
18 #include "TROOT.h"
19 
20 class StEStructEventCuts;
21 class StEStructTrackCuts;
22 
23 
25 
26  StEStructEvent* mFlatEvent;
27  bool mInChain;
28  bool mAmDone;
29  int mCentBin;
30  int mnumTracks;
31  int mEventsToDo;
32 
33  void fillTracks(StEStructEvent* estructEvent);
34  double maxRadius(double eta, double pt, double vz);
35  bool isTrackGood(float *v, float *p, float eta);
36  int countGoodTracks();
37 
38  int mEventCount;
39  bool mgRand2Good;
40  double mgRand2;
41 
42  public:
43 
44  StEStructFlat();
46  StEStructTrackCuts* tcuts,
47  bool inChain,
48  int centBin,
49  int eventsToDo);
50 
51  virtual ~StEStructFlat(){};
52  void setSeed(int iseed);
53  bool hasGenerator();
54  bool measureable(int pid);
55  float* globalDCA(float* p, float* v);
56 
57  virtual StEStructEvent* next();
58  virtual bool done();
59  void generateEvent();
60  double gRand48();
61 
62  ClassDef(StEStructFlat,1)
63 };
64 
65 
66 inline bool StEStructFlat::done(){ return mAmDone; };
67 
68 inline bool StEStructFlat::measureable(int pid){
69  bool retVal=false;
70  if(pid<0)pid*=-1;
71 
72  switch(pid){
73 
74  case 211:
75  { // charged pion
76  retVal=true;
77  break;
78  }
79  case 321:
80  { // charged kaon
81  retVal=true;
82  break;
83  }
84  case 2212:
85  { // proton
86  retVal=true;
87  break;
88  }
89  case 11:
90  { // electron
91  retVal=true;
92  break;
93  }
94  default:
95  {
96  break;
97  }
98  }
99  return retVal;
100 }
101 
102 inline float* StEStructFlat::globalDCA(float* p, float* v){
103 
104  // assumes primaryVertex at origin
105  float* r=new float[4];
106  r[0]=r[1]=r[2]=r[3]=0;
107 
108  if(fabs(p[2])<0.01){ // then 2D
109  if(fabs(p[0])<0.01){
110  r[3]=r[1]=v[1]; // p=py only
111  return r;
112  }
113  float a = p[1]/p[0];
114  float x = -1.0*(a*v[1])/(a*a+1);
115  float y=a*x+v[1];
116  r[0]=x; r[1]=y;
117  r[3]=sqrt(x*x+y*y);
118  return r;
119  }
120  float ax = p[0]/p[2];
121  float ay = p[1]/p[2];
122  float z = -1.0*(ax*v[0]+ay*v[1])/(ax*ax+ay*ay+1);
123  float x = ax*z+v[0];
124  float y = ay*z+v[1];
125  r[0]=x; r[1]=y; r[2]=z;
126  r[3]=sqrt(x*x+y*y+z*z);
127  return r;
128 }
129 
130 
131 #endif
132 
133 /**********************************************************************
134  *
135  * $Log: StEStructFlat.h,v $
136  * Revision 1.5 2012/11/16 21:23:18 prindle
137  * EventCuts and TrackCuts were moved to EventReader. Remove that code from
138  * these readers.
139  *
140  * Revision 1.4 2006/02/22 22:05:36 prindle
141  * Removed all references to multRef (?)
142  *
143  * Revision 1.3 2005/09/23 23:37:22 prindle
144  *
145  * Starting to add vertex distribution and track acceptance dependance on
146  * number of possible hits.
147  * Make Pythia interface look like Hijing interface so it now works within
148  * my Fluctuation and Correlation framework.
149  *
150  * Revision 1.2 2005/09/07 20:22:51 prindle
151  *
152  *
153  * Flat: Random changes to eta and phi distributions (which don't have to be flat).
154  *
155  * Revision 1.1 2003/11/21 23:48:00 prindle
156  * Include my toy event generator in cvs
157  *
158  *
159  *********************************************************************/