StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
StEStructRQMD.h
1 /**********************************************************************
2  *
3  * $Id: StEStructRQMD.h,v 1.4 2012/11/16 21:23:19 prindle Exp $
4  *
5  * Author: Jeff Porter
6  *
7  **********************************************************************
8  *
9  * Description: EStructEventReader wrapper for flat event generator
10  *
11  **********************************************************************/
12 #ifndef __STESTRUCTRQMD__H
13 #define __STESTRUCTRQMD__H
14 
15 #include <cmath>
16 #include <Stiostream.h>
17 #include "StEStructPool/AnalysisMaker/StEStructEventReader.h"
18 
19 #include "TROOT.h"
20 
22 
23  int meventCount;
24  int meventsToDo;
25  bool mAmDone;
26 
27  void fillTracks(StEStructEvent* estructEvent);
28 
29  public:
30 
31  int mnumTracks;
32  int mNFile;
33  int mIFile;
34  int mLine;
35  int mMaxFiles;
36  const char *mFileDir;
37  ifstream *mFile;
38 
39  StEStructRQMD();
40  StEStructRQMD(int nevents, StEStructEventCuts* ecuts, StEStructTrackCuts* tcuts);
41 
42  virtual ~StEStructRQMD(){};
43  bool hasGenerator();
44  float* globalDCA(float* p, float* v);
45  float getRapidity(float E, float pz);
46  float getPseudoRapidity(float pt, float pz);
47 
48  virtual StEStructEvent* next();
49  virtual bool done();
50  virtual StEStructEvent* generateEvent();
51 
52  ClassDef(StEStructRQMD,1)
53 };
54 
55 
56 inline bool StEStructRQMD::done(){ return mAmDone; };
57 
58 inline float* StEStructRQMD::globalDCA(float* p, float* v){
59 
60  // assumes primaryVertex at origin
61  float* r=new float[4];
62  r[0]=r[1]=r[2]=r[3]=0;
63 
64  if(fabs(p[2])<0.01){ // then 2D
65  if(fabs(p[0])<0.01){
66  r[3]=r[1]=v[1]; // p=py only
67  return r;
68  }
69  float a = p[1]/p[0];
70  float x = -1.0*(a*v[1])/(a*a+1);
71  float y=a*x+v[1];
72  r[0]=x; r[1]=y;
73  r[3]=sqrt(x*x+y*y);
74  return r;
75  }
76  float ax = p[0]/p[2];
77  float ay = p[1]/p[2];
78  float z = -1.0*(ax*v[0]+ay*v[1])/(ax*ax+ay*ay+1);
79  float x = ax*z+v[0];
80  float y = ay*z+v[1];
81  r[0]=x; r[1]=y; r[2]=z;
82  r[3]=sqrt(x*x+y*y+z*z);
83  return r;
84 }
85 
86 
87 #endif
88 
89 /**********************************************************************
90  *
91  * $Log: StEStructRQMD.h,v $
92  * Revision 1.4 2012/11/16 21:23:19 prindle
93  * EventCuts and TrackCuts were moved to EventReader. Remove that code from
94  * these readers.
95  *
96  * Revision 1.3 2009/11/09 21:32:58 prindle
97  * Fix warnings about casting char * to a const char * by redeclaring as const char *.
98  *
99  * Revision 1.2 2006/02/22 22:05:43 prindle
100  * Removed all references to multRef (?)
101  *
102  * Revision 1.1 2004/03/02 21:51:02 prindle
103  *
104  * I forgot to cvs add my EventGenerator readers.
105  *
106  * Revision 1.1 2003/11/21 23:48:00 prindle
107  * Include my toy event generator in cvs
108  *
109  *
110  *********************************************************************/