00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044 #ifndef STTOFGEOMETRY_H
00045 #define STTOFGEOMETRY_H
00046 #include "tofSlatGeom.h"
00047 #include "Rtypes.h"
00048 #include "StHelixD.hh"
00049
00050 #include <vector>
00051 #ifndef ST_NO_NAMESPACES
00052 using std::vector;
00053 #endif
00054
00055 class StMaker;
00056 #include "StThreeVectorD.hh"
00057 #include "StPhysicalHelixD.hh"
00058
00059 struct StructTofSlatEta{
00060 int ieta;
00061 float cosang;
00062 float eta;
00063 float eta_max;
00064 float eta_min;
00065 float r;
00066 float z;
00067 float z_min;
00068 float z_max;
00069 };
00070
00071
00072 struct StructTofSlatPhi{
00073 int iphi;
00074 float phi;
00075 float phi_max;
00076 float phi_min;
00077 };
00078
00079
00080 struct StructTofParam {
00081
00082 int i_eta_max,i_eta_min;
00083 int i_phi_max,i_phi_min;
00084 int n_counter_eta, n_counter_phi;
00085 int n_tray_eta, n_tray_phi;
00086 float counter_thickness, counter_width;
00087 float r;
00088 float tray_height, tray_width, tray_length, tray_phi_zero;
00089 };
00090
00091 #ifndef ST_NO_TEMPLATE_DEF_ARGS
00092 typedef vector<Int_t> idVector;
00093 typedef idVector::iterator idVectorIter;
00094 #else
00095 typedef vector<Int_t,allocator<Int_t> > idVector;
00096 typedef idVector::iterator idVectorIter;
00097 #endif
00098
00099
00100 struct StructSlatHit {
00101 Int_t slatIndex;
00102 StThreeVectorD hitPosition;
00103 idVector trackIdVec;
00104 Int_t hitProfile;
00105 Float_t s;
00106 Float_t theta_xy;
00107 Float_t theta_zr;
00108 vector<StThreeVector<double> > layerHitPositions;
00109 Int_t matchFlag;
00110 };
00111
00112
00113 #ifndef ST_NO_TEMPLATE_DEF_ARGS
00114 typedef vector<tofSlatGeom_st> slatGeomVector;
00115 typedef vector<StructTofSlatEta> tofSlatEtaVector;
00116 typedef vector<StructTofSlatPhi> tofSlatPhiVector;
00117 typedef vector<StructSlatHit> tofSlatHitVector;
00118 #else
00119 typedef vector<tofSlatGeom_st,allocator<tofSlatGeom_st> > slatGeomVector;
00120 typedef vector<StructTofSlatEta,allocator<StructTofSlatEta> > tofSlatEtaVector;
00121 typedef vector<StructTofSlatPhi,allocator<StructTofSlatPhi> > tofSlatPhiVector;
00122 typedef vector<SructSlatHit,allocator<StructSlatHit> > tofSlatHitVector;
00123 #endif
00124 typedef slatGeomVector::iterator slatGeomIter;
00125 typedef vector<StructSlatHit>::iterator tofSlatHitVectorIter;
00126
00127
00128 class StTofGeometry{
00129 private:
00130 bool mDebug;
00131 StructTofParam mTofParam;
00132 tofSlatEtaVector mTofSlatEtaVec;
00133 tofSlatPhiVector mTofSlatPhiVec;
00134 slatGeomVector mTofSlatVec;
00135 unsigned short mTofDaqMap[48];
00136 unsigned short mTofSlatMap[42];
00137
00138 int calcSlatId(const int iphi, const int ieta) const;
00139 public:
00140 StTofGeometry();
00141 ~StTofGeometry();
00142
00143 void SetDebug();
00144 bool Debug();
00145 void init();
00146 void init(StMaker*);
00147 void initGeomFromXdf(const Char_t* =
00148 "/afs/rhic.bnl.gov/star/users/geurts/public/dbase/ctg_pars.xdf");
00149 void initGeomFromDbase(StMaker*);
00150 void initDaqMap();
00151 StructTofParam tofParam() const;
00152
00153
00154 tofSlatGeom_st tofSlat(const Int_t slatId) const;
00155
00156
00157 StThreeVectorD tofSlatNormPoint(const Int_t slatId) const;
00158
00159
00160 StThreeVectorD tofPlaneNormPoint(const Int_t slatId) const;
00161
00162
00163 void printGeo(ostream& os = cout) const;
00164 void printSlat(const Int_t slatId, ostream& os = cout) const;
00165
00166
00167 int tofSlatCross(const StThreeVectorD& point, const tofSlatGeom_st tofSlat) const;
00168 int tofSlatCrossId(const StThreeVectorD& point) const;
00169 int tofSlatCrossId(const int volumeId) const;
00170
00171 static const unsigned int mMaxSlatLayers;
00172 tofSlatHitVector tofHelixToArray(const StPhysicalHelixD& helix,
00173 idVector slatIdVec);
00174
00175 float slatHitPosition(StThreeVectorD*);
00176 float slatPhiPosition(StThreeVectorD*);
00177 unsigned short daqToSlatId(const int) const;
00178 int slatIdToDaq(const Int_t) const;
00179 idVector slatNeighbours(const int);
00180 idVector slatNeighboursWide(const int);
00181
00182 Bool_t projTrayVector(const StHelixD &helix, idVector &trayVec) const;
00183
00184 };
00185
00186 inline StructTofParam StTofGeometry::tofParam()
00187 const {return mTofParam;}
00188 inline unsigned short StTofGeometry::daqToSlatId(const int daqId)
00189 const {return mTofDaqMap[daqId];}
00190 inline int StTofGeometry::slatIdToDaq(const Int_t slatId)
00191 const {return mTofSlatMap[slatId];}
00192 inline void StTofGeometry::SetDebug(){mDebug = true;}
00193 inline bool StTofGeometry::Debug(){return mDebug;}
00194
00195 const unsigned int StTofGeometry::mMaxSlatLayers(5);
00196 #endif