StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
StTofGeometry.h
1 /*******************************************************************
2  *
3  * $Id: StTofGeometry.h,v 1.8 2006/08/15 21:42:13 jeromel Exp $
4  *
5  * Author: Frank Geurts
6  *****************************************************************
7  *
8  * Description: Interface to TOFp database
9  *
10  *****************************************************************
11  *
12  * $Log: StTofGeometry.h,v $
13  * Revision 1.8 2006/08/15 21:42:13 jeromel
14  * Fix rhic -> rhic.bnl.gov
15  *
16  * Revision 1.7 2005/07/06 19:25:55 fisyak
17  * Use templated StThreeVector and StPhysicalHelix
18  *
19  * Revision 1.6 2004/06/10 15:53:50 dongx
20  * -head file "StHelixD.hh" included
21  * -simplify the macro definition
22  *
23  * Revision 1.5 2004/06/09 21:26:32 dongx
24  * add function projTrayVector(..) to increase the matching speed
25  *
26  * Revision 1.4 2003/07/02 20:55:03 geurts
27  * changed all InitXXX() methods from private to public
28  *
29  * Revision 1.3 2003/04/15 03:24:18 geurts
30  * many, many changes:
31  * . updated and extended StructSlatHit, introduced tofSlatHitVector and Iterator
32  * . generalize (2+1)-D slat model from 3 layers to n layers, default n=5
33  * . introduced new member functions which identify 3x3 and 5x5 neighbours
34  * . introduced SetDebug() option.
35  * . minor updates in mTofParam parameters
36  *
37  * Revision 1.2 2002/01/22 04:57:03 geurts
38  * STAR dBase access routine, bugfixes and doxygenized
39  *
40  * Revision 1.1 2001/09/28 19:09:40 llope
41  * first version
42  *
43  *******************************************************************/
44 #ifndef STTOFGEOMETRY_H
45 #define STTOFGEOMETRY_H
46 #include "tofSlatGeom.h"
47 #include "Rtypes.h"
48 #include "StHelixD.hh"
49 
50 #include <vector>
51 #ifndef ST_NO_NAMESPACES
52 using std::vector;
53 #endif
54 
55 class StMaker;
56 #include "StThreeVectorD.hh"
57 #include "StPhysicalHelixD.hh"
58 
60  int ieta;
61  float cosang;
62  float eta;
63  float eta_max;
64  float eta_min;
65  float r;
66  float z;
67  float z_min;
68  float z_max;
69 };
70 
71 
73  int iphi;
74  float phi;
75  float phi_max;
76  float phi_min;
77 };
78 
79 
81  //int detector;
82  int i_eta_max,i_eta_min;
83  int i_phi_max,i_phi_min;
84  int n_counter_eta, n_counter_phi;
85  int n_tray_eta, n_tray_phi;
86  float counter_thickness, counter_width;
87  float r;
88  float tray_height, tray_width, tray_length, tray_phi_zero;
89 };
90 
91 #ifndef ST_NO_TEMPLATE_DEF_ARGS
92 typedef vector<Int_t> idVector;
93 typedef idVector::iterator idVectorIter;
94 #else
95 typedef vector<Int_t,allocator<Int_t> > idVector;
96 typedef idVector::iterator idVectorIter;
97 #endif
98 
99 
101  Int_t slatIndex;
102  StThreeVectorD hitPosition;
103  idVector trackIdVec;
104  Int_t hitProfile;
105  Float_t s;
106  Float_t theta_xy;
107  Float_t theta_zr;
108  vector<StThreeVector<double> > layerHitPositions;
109  Int_t matchFlag;
110 };
111 
112 
113 #ifndef ST_NO_TEMPLATE_DEF_ARGS
114 typedef vector<tofSlatGeom_st> slatGeomVector;
115 typedef vector<StructTofSlatEta> tofSlatEtaVector;
116 typedef vector<StructTofSlatPhi> tofSlatPhiVector;
117 typedef vector<StructSlatHit> tofSlatHitVector;
118 #else
119 typedef vector<tofSlatGeom_st,allocator<tofSlatGeom_st> > slatGeomVector;
120 typedef vector<StructTofSlatEta,allocator<StructTofSlatEta> > tofSlatEtaVector;
121 typedef vector<StructTofSlatPhi,allocator<StructTofSlatPhi> > tofSlatPhiVector;
122 typedef vector<SructSlatHit,allocator<StructSlatHit> > tofSlatHitVector;
123 #endif
124 typedef slatGeomVector::iterator slatGeomIter;
125 typedef vector<StructSlatHit>::iterator tofSlatHitVectorIter;
126 
127 
129  private:
130  bool mDebug;
131  StructTofParam mTofParam;
132  tofSlatEtaVector mTofSlatEtaVec;
133  tofSlatPhiVector mTofSlatPhiVec;
134  slatGeomVector mTofSlatVec;
135  unsigned short mTofDaqMap[48];
136  unsigned short mTofSlatMap[42];
137 
138  int calcSlatId(const int iphi, const int ieta) const;
139  public:
140  StTofGeometry();
141  ~StTofGeometry();
142 
143  void SetDebug();
144  bool Debug();
145  void init(); // init the dbase and get the data from it
146  void init(StMaker*); // init the dbase and get the data from it
147  void initGeomFromXdf(const Char_t* =
148  "/afs/rhic.bnl.gov/star/users/geurts/public/dbase/ctg_pars.xdf");
149  void initGeomFromDbase(StMaker*);
150  void initDaqMap();
151  StructTofParam tofParam() const; // geometry access member
152 
153  // return slat geometry of slatId
154  tofSlatGeom_st tofSlat(const Int_t slatId) const;
155 
156  // function to calculate the normal vector to a slat
157  StThreeVectorD tofSlatNormPoint(const Int_t slatId) const;
158 
159  // function to calculate the normal vector to a slats-plane
160  StThreeVectorD tofPlaneNormPoint(const Int_t slatId) const;
161 
162  // print out stuff
163  void printGeo(ostream& os = cout) const;
164  void printSlat(const Int_t slatId, ostream& os = cout) const;
165 
166  // tofCross members (note return value of tofSlatCross changed from Bool_t)
167  int tofSlatCross(const StThreeVectorD& point, const tofSlatGeom_st tofSlat) const;
168  int tofSlatCrossId(const StThreeVectorD& point) const;
169  int tofSlatCrossId(const int volumeId) const;
170 
171  static const unsigned int mMaxSlatLayers;
172  tofSlatHitVector tofHelixToArray(const StPhysicalHelixD& helix,
173  idVector slatIdVec);
174 
175  float slatHitPosition(StThreeVectorD*); // calculate local hit position on slat
176  float slatPhiPosition(StThreeVectorD*); // calculate local hit position on slat
177  unsigned short daqToSlatId(const int) const;
178  int slatIdToDaq(const Int_t) const;
179  idVector slatNeighbours(const int);
180  idVector slatNeighboursWide(const int);
181 
182  Bool_t projTrayVector(const StHelixD &helix, idVector &trayVec) const;
183 
184 };
185 
186 inline StructTofParam StTofGeometry::tofParam()
187  const {return mTofParam;}
188 inline unsigned short StTofGeometry::daqToSlatId(const int daqId)
189  const {return mTofDaqMap[daqId];}
190 inline int StTofGeometry::slatIdToDaq(const Int_t slatId)
191  const {return mTofSlatMap[slatId];}
192 inline void StTofGeometry::SetDebug(){mDebug = true;}
193 inline bool StTofGeometry::Debug(){return mDebug;}
194 
195 const unsigned int StTofGeometry::mMaxSlatLayers(5);
196 #endif
tofSlatGeom_st tofSlat(const Int_t slatId) const
return slat geometry structure for slatId
idVector slatNeighbours(const int)
returns idVector of 3x3 (max) neighbouring slatIds
void printGeo(ostream &os=cout) const
print global geometry parameters
idVector slatNeighboursWide(const int)
returns idVector of 5x5 (max) neighbouring slatIds
void initDaqMap()
set-up the default Daq-to-SlatId and Slat-to-DaqId mappings
void initGeomFromXdf(const Char_t *="/afs/rhic.bnl.gov/star/users/geurts/public/dbase/ctg_pars.xdf")
initialize TOF Slat parameters from XDF file
tofSlatHitVector tofHelixToArray(const StPhysicalHelixD &helix, idVector slatIdVec)
finds slats in an array of trays which are crossed by a track-helix.
float slatPhiPosition(StThreeVectorD *)
returns the local Phi angle of a track inside a slat
Time-of-Flight Geometry Utilities.
float slatHitPosition(StThreeVectorD *)
returns 1-D hit position on the TOFp slat (Zhit)
StThreeVectorD tofSlatNormPoint(const Int_t slatId) const
calculate the normal vector &lt;r&gt; to a slat
~StTofGeometry()
default empty destructor
StThreeVectorD tofPlaneNormPoint(const Int_t slatId) const
calculate the normal vector to a slats-plane
int tofSlatCross(const StThreeVectorD &point, const tofSlatGeom_st tofSlat) const
check if a point is in a slat
void printSlat(const Int_t slatId, ostream &os=cout) const
print slat-specific geometry parameters
int tofSlatCrossId(const StThreeVectorD &point) const
return the index of a slat if the point is in the slat
void initGeomFromDbase(StMaker *)
initialize TOF Slat parameters from STAR dBase
StTofGeometry()
defaulty constructor
void init()
initialize geometry class from XDF file and set-up DAQ/Slat mappings