9 #ifndef _ST_FGT_GEOM_H_
10 #define _ST_FGT_GEOM_H_
20 #include "StRoot/StFgtUtil/StFgtConsts.h"
36 static Double_t getDiscZ(
int iDisc);
43 static Int_t encodeGeoId( Int_t disc, Int_t quadrant,
44 Char_t layer, Int_t strip );
45 static Int_t decodeGeoId( Int_t geoId, Short_t & disc,
46 Short_t & quadrant, Char_t & layer,
51 static std::string encodeGeoName( Int_t disc, Int_t quadrant,
52 Char_t layer, Int_t strip );
53 static Int_t decodeGeoName(
const std::string & geoName, Short_t & disc,
54 Short_t & quadrant, Char_t & layer,
56 static std::string translateGeoIdToGeoName( Int_t geoId );
57 static Int_t translateGeoNameToGeoId(
const std::string & geoName );
62 static Int_t getPhysicalCoordinate( Int_t geoId, Short_t & disc,
63 Short_t & quadrant, Char_t & layer,
66 Double_t & upperSpan );
73 static Int_t getPhysicalCoordinate(
const std::string & geoName,
74 Short_t & disc, Short_t & quadrant,
75 Char_t & layer, Double_t & ordinate,
77 Double_t & upperSpan );
82 static Int_t getGlobalPhysicalCoordinate( Int_t geoId, Short_t & disc,
83 Short_t & quadrant, Char_t & layer,
86 Double_t & upperSpan );
90 static Int_t getGlobalPhysicalCoordinate(
const std::string & geoName,
91 Short_t & disc, Short_t & quadrant,
92 Char_t & layer, Double_t & ordinate,
94 Double_t & upperSpan );
98 static void getQuadCenterXYZ(Short_t disc, Short_t quad, TVector3 &xyz);
113 static Int_t encodeElectronicId( Int_t rdo, Int_t arm,
114 Int_t apv, Int_t channel );
116 static Int_t decodeElectronicId( Int_t elecId, Int_t &rdo, Int_t &arm,
117 Int_t &apv, Int_t &channel );
118 static Int_t getElectIdFromElecCoord( Int_t rdo, Int_t arm,
119 Int_t apv, Int_t ch );
120 static Int_t getElecCoordFromElectId( Int_t eID, Int_t& rdo, Int_t& arm,
121 Int_t& apv, Int_t& ch );
124 static Char_t getOctant( Char_t layer, Int_t strip );
127 static Char_t getOctant( Int_t apv );
131 static Int_t getOctant( Double_t phi);
133 static Int_t getNaiveGeoIdFromElecCoord( Int_t rdo, Int_t arm,
134 Int_t apv, Int_t channel );
135 static Int_t getNaiveElecCoordFromGeoId( Int_t geoId, Int_t& rdo,
136 Int_t& arm, Int_t& apv,
138 static std::string getNaiveGeoNameFromElecCoord( Int_t rdo, Int_t arm,
141 static Int_t getNaivePhysCoordFromElecCoord( Int_t rdo, Int_t arm,
142 Int_t apv, Int_t channel,
147 Double_t & lowerSpan,
148 Double_t & upperSpan );
154 static Double_t getNaiveMapping( Int_t rdo, Int_t arm,
155 Int_t apv, Int_t channel );
156 static bool isNaiveR( Int_t rdo, Int_t arm, Int_t apv, Int_t channel );
161 static double rIn() {
return kFgtRin; }
162 static double rMid() {
return kFgtRmid; }
163 static double rOut() {
return kFgtRout; }
164 static double rFirst() {
return kFgtRfirst; }
165 static double rLast() {
return kFgtRlast;}
166 static double pFirst() {
return kFgtPfirst; }
167 static double pLast() {
return kFgtPlast;}
169 static double radStrip_pitch() {
return kFgtRadPitch; }
170 static double phiStrip_pitch() {
return kFgtPhiAnglePitch; }
172 static double yLimit() {
return kFgtRout; }
175 static double deadQuadEdge() {
return kFgtDeadQuadEdge; }
177 static double radStripOff() {
return mRadStripOff; }
178 static double phiStripOff() {
return mPhiStripOff; }
180 static double phiQuadXaxis(
int iquad);
181 static bool inDisc( TVector3 rLab );
182 static bool belowFlat( TVector3 rLoc );
183 static int getQuad(
double phiLab );
190 static int rad2LocalStripId(
double rad,
double phi,
192 static int phi2LocalStripId(
double rad,
double phi,
195 static double rStrip_Phi_High(
int rindex);
196 static double rStrip_Phi_Low(
int rindex);
197 static double pHistrip_R_Low(
int pindex);
198 static double pHistrip_R_High(
int pindex);
216 static double mHalfPi;
217 static double mRadStripOff;
218 static double mPhiStripOff;
219 static int mRadStripLOCId_number;
220 static int mPhiStripLOCId_number;
227 static Int_t mNaiveMapping[ kFgtNumChannels*kFgtApvsPerQuad ];
230 static Bool_t mReverseNaiveMappingValid;
231 static Int_t mReverseNaiveMapping[ 2*kFgtNumStrips ];
232 static void makeReverseNaiveMappingValid();
239 static Int_t computeGlobalPhysicalCoordinate(Short_t & quadrant, Char_t & layer,
240 Double_t & ordinate, Double_t & lowerSpan,
241 Double_t & upperSpan, Short_t & strip);
244 inline Int_t StFgtGeom::getElectIdFromElecCoord
246 Int_t rdo, Int_t arm, Int_t apv, Int_t ch
249 return encodeElectronicId(rdo,arm,apv,ch);
252 inline Int_t StFgtGeom::getElecCoordFromElectId
255 Int_t& rdo, Int_t& arm, Int_t& apv, Int_t& ch
258 return decodeElectronicId(eID,rdo,arm,apv,ch);
262 inline Int_t StFgtGeom::getOctant( Double_t phi )
264 double phiDeg= 75 - ((phi*180)/mPi);
265 while ( phiDeg < 0 ) phiDeg+=360;
266 while ( phiDeg > 360 ) phiDeg-=360;
271 inline std::string StFgtGeom::getNaiveGeoNameFromElecCoord
273 Int_t rdo, Int_t arm, Int_t apv, Int_t channel
277 translateGeoIdToGeoName(
278 getNaiveGeoIdFromElecCoord( rdo, arm, apv, channel )
282 inline Int_t StFgtGeom::getNaivePhysCoordFromElecCoord
284 Int_t rdo, Int_t arm, Int_t apv, Int_t channel,
285 Short_t & disc, Short_t & quadrant, Char_t & layer,
286 Double_t & ordinate, Double_t & lowerSpan, Double_t & upperSpan
289 return getPhysicalCoordinate(
290 getNaiveGeoIdFromElecCoord( rdo, arm, apv, channel ),
291 disc, quadrant, layer, ordinate, lowerSpan, upperSpan