32 #ifndef STETOFGEOMETRY_H
33 #define STETOFGEOMETRY_H
38 #include "TGeoManager.h"
40 #include "StThreeVectorD.hh"
41 #include "StHelixD.hh"
42 #include "StPhysicalHelixD.hh"
45 #include "StPicoEvent/StPicoPhysicalHelix.h"
46 #include "StPicoEvent/StPicoHelix.h"
48 #include "StETofUtil/StETofConstants.h"
77 void local2Master(
const double* local,
double* master );
78 void master2Local(
const double* master,
double* local );
80 bool isLocalPointIn(
const double* local );
82 bool isGlobalPointIn(
const TVector3& global );
86 double calcPhi(
const double& rel_local_y,
const double& rel_local_x );
87 double calcEta(
const double& rel_local_x );
93 bool helixCross(
const StPicoHelix& helix,
double& pathLength, TVector3& cross,
double& theta );
95 TGeoHMatrix* geoMatrix()
const;
96 TGeoBBox* box()
const;
97 double phiMin()
const;
98 double phiMax()
const;
99 double etaMin()
const;
100 double etaMax()
const;
104 void setSafetyMargins(
const double* margins );
105 double safetyMarginX()
const;
106 double safetyMarginY()
const;
110 bool isDebugOn()
const;
112 virtual void print(
const Option_t* opt =
"" )
const;
115 TGeoHMatrix* mGeoMatrix;
123 double mSafetyMarginX;
124 double mSafetyMarginY;
132 inline TGeoHMatrix* StETofNode::geoMatrix()
const {
return mGeoMatrix; }
133 inline TGeoBBox* StETofNode::box()
const {
return mBox; }
135 inline double StETofNode::phiMin()
const {
return mPhiMin; }
136 inline double StETofNode::phiMax()
const {
return mPhiMax; }
137 inline double StETofNode::etaMin()
const {
return mEtaMin; }
138 inline double StETofNode::etaMax()
const {
return mEtaMax; }
140 inline StThreeVectorD StETofNode::centerPos()
const {
return mCenter; }
141 inline StThreeVectorD StETofNode::xyPlaneNormal()
const {
return mNormal; }
143 inline double StETofNode::safetyMarginX()
const {
return mSafetyMarginX; };
144 inline double StETofNode::safetyMarginY()
const {
return mSafetyMarginY; };
147 inline void StETofNode::debugOn() { mDebug =
true; }
148 inline void StETofNode::debugOff() { mDebug =
false; }
150 inline bool StETofNode::isDebugOn()
const {
return mDebug; }
167 void addCounter(
const TGeoPhysicalNode& gpNode,
const int moduleId,
const int counterId );
168 void addCounter(
const TGeoPhysicalNode& gpNode,
const float& dx,
const float& dy,
const int moduleId,
const int counterId );
169 void addCounter(
const TGeoPhysicalNode& gpNode,
const float& dx,
const float& dy,
const int moduleId,
const int counterId,
const double* safetyMargins,
const StThreeVectorD alignment );
173 void clearCounters();
175 int numberOfCounters()
const;
177 int calcSector(
const int moduleId );
178 int calcPlane(
const int moduleId );
181 int moduleIndex()
const;
187 bool isDebugOn()
const;
189 virtual void print(
const Option_t* opt=
"" )
const;
196 std::vector< StETofGeomCounter* > mETofCounter;
205 inline int StETofGeomModule::numberOfCounters()
const {
return mETofCounter.size(); }
206 inline int StETofGeomModule::moduleIndex()
const {
return mModuleIndex; }
207 inline int StETofGeomModule::sector()
const {
return mSector; }
208 inline int StETofGeomModule::plane()
const {
return mPlane; }
210 inline void StETofGeomModule::debugOn() { mDebug =
true; }
211 inline void StETofGeomModule::debugOff() { mDebug =
false; }
213 inline bool StETofGeomModule::isDebugOn()
const {
return mDebug; }
228 StETofGeomCounter(
const TGeoPhysicalNode& gpNode,
const int moduleId,
const int counterId );
229 StETofGeomCounter(
const TGeoPhysicalNode& gpNode,
const float& dx,
const float& dy,
const int moduleId,
const int counterId,
const StThreeVectorD alignment );
230 void createGeomStrips();
232 int findStrip(
const double* local );
235 int calcSector(
const int moduleId );
236 int calcPlane(
const int moduleId );
239 int moduleIndex()
const;
242 int counterIndex()
const;
246 bool isDebugOn()
const;
248 virtual void print(
const Option_t *opt=
"" )
const;
256 float mStripX[ eTofConst::nStrips + 1 ];
264 inline int StETofGeomCounter::moduleIndex()
const {
return mModuleIndex; }
265 inline int StETofGeomCounter::sector()
const {
return mSector; }
266 inline int StETofGeomCounter::plane()
const {
return mPlane; }
267 inline int StETofGeomCounter::counterIndex()
const {
return mCounterIndex; }
269 inline void StETofGeomCounter::debugOn() { mDebug =
true; }
270 inline void StETofGeomCounter::debugOff() { mDebug =
false; }
272 inline bool StETofGeomCounter::isDebugOn()
const {
return mDebug; }
285 StETofGeometry(
const char* name =
"etofGeo",
const char* title =
"simplified ETOF Geometry" );
288 void init( TGeoManager* geoManager,
const double* safetyMargins = 0,
const bool useHelixSwimmer =
false );
292 bool isInitDone()
const;
293 bool setInitFlag(
const bool initFlag );
295 std::string
formTGeoPath(
const TGeoManager* geoManager,
int plane,
int sector,
int counter = -1 );
296 std::string
formTGeoPath(
const TGeoManager* geoManager,
int plane,
int sector,
int counter,
int gap );
298 int calcModuleIndex(
const int& sector,
const int& plane );
299 int calcVolumeIndex(
const int& sector,
const int& plane,
const int& counter,
const int& strip );
301 void decodeVolumeIndex(
const int& volumeId,
int& sector,
int& plane,
int& counter,
int& strip );
303 StETofNode* findETofNode(
const int moduleId,
const int counter );
305 void pointMaster2local(
const int moduleId,
const int counterId,
const double* master,
double* local );
306 void hitLocal2Master(
const int moduleId,
const int counter,
const double* local,
double* master );
313 std::vector< int > sectorAtPhi(
const double& angle );
325 std::vector< StThreeVectorD >& localVec, std::vector< double >& thetaVec, std::vector< double >& pathLenVec );
332 TVector3 helixCrossETofPlane(
const StPicoHelix& helix );
333 TVector3 helixCrossPlane(
const StPicoHelix& helix,
const double& z );
340 std::vector< TVector3 >& localVec, std::vector< double >& thetaVec );
342 void logPoint(
const char* text,
const TVector3& point );
349 TVector3 getField(
const TVector3& pos );
352 double getFieldZ(
const TVector3& pos );
353 double getFieldZ(
const double& x,
const double& y,
const double& z );
358 unsigned int nValidModules()
const;
360 void readAlignmentParameters();
361 void readAlignmentDatabase();
362 void setFileNameAlignParam(std::string FileNameAlignParam);
366 bool isDebugOn()
const;
372 unsigned int mNValidModules;
378 std::string mFileNameAlignParam;
379 std::vector<StThreeVectorD> mAlignmentParameters;
385 inline bool StETofGeometry::isInitDone()
const {
return mInitFlag; }
386 inline unsigned int StETofGeometry::nValidModules()
const {
return mNValidModules; }
388 inline bool StETofGeometry::setInitFlag(
const bool initFlag ) {
return mInitFlag = initFlag; }
391 inline void StETofGeometry::debugOn() { mDebug =
true; }
392 inline void StETofGeometry::debugOff() { mDebug =
false; }
394 inline bool StETofGeometry::isDebugOn()
const {
return mDebug; }
395 inline void StETofGeometry::setFileNameAlignParam(std::string fileNameAlignParam) {mFileNameAlignParam = fileNameAlignParam;}
void helixCrossCounter(const StPhysicalHelixD &helix, std::vector< int > &idVec, std::vector< StThreeVectorD > &crossVec, std::vector< StThreeVectorD > &localVec, std::vector< double > &thetaVec, std::vector< double > &pathLenVec)
std::string formTGeoPath(const TGeoManager *geoManager, int plane, int sector, int counter=-1)
std::vector< int > helixCrossSector(const StHelixD &helix)
Helis parametrization for the particle.
Stores eTOF hit information.
Helix parametrization that uses ROOT TVector3.