00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012 #ifndef MUC_GEO_GENERAL_H
00013 #define MUC_GEO_GENERAL_H
00014
00015 #include <stdlib.h>
00016 #include <math.h>
00017 #include <vector>
00018 #include <map>
00019 #include <CLHEP/Vector/ThreeVector.h>
00020 #include <CLHEP/Geometry/Point3D.h>
00021 #include <CLHEP/Geometry/Plane3D.h>
00022 #include <CLHEP/Vector/Rotation.h>
00023
00024 #include "Identifier/Identifier.h"
00025 #include "Identifier/MucID.h"
00026 #include "MucGeomSvc/MucGeoStrip.h"
00027 #include "MucGeomSvc/MucGeoGap.h"
00028
00029 #ifndef ENABLE_BACKWARDS_COMPATIBILITY
00030 typedef HepGeom::Point3D<double> HepPoint3D;
00031 #endif
00032 #ifndef ENABLE_BACKWARDS_COMPATIBILITY
00033 typedef HepGeom::Vector3D<double> HepVector3D;
00034 #endif
00035
00036 using namespace std;
00037 using namespace CLHEP;
00038
00039
00040
00041
00050 class MucGeoGeneral
00051 {
00052 public:
00053
00055 MucGeoGeneral();
00056
00058 MucGeoGeneral& operator=(const MucGeoGeneral& orig);
00059
00061 MucGeoGeneral(const MucGeoGeneral& orig);
00062
00064 ~MucGeoGeneral();
00065
00067 void Init();
00068
00070 void InitFromDatabase();
00071
00073 void InitFromASCII();
00074
00076 void InitFromXML();
00077
00079 void Destroy();
00080
00082 static MucGeoGeneral *Instance();
00083
00085 MucGeoGap *GetGap(const int part, const int seg, const int gap) const;
00086
00088 MucGeoGap *GetGap(const Identifier id) const;
00089
00091 MucGeoStrip* GetStrip(const int part, const int seg, const int gap, const int strip) const;
00092
00094 MucGeoStrip* GetStrip(const Identifier id) const;
00095
00096 int GetStripNumInGap(const int part, const int seg, const int gap)
00097 { return m_StripNumInGap[part][seg][gap]; }
00098
00100 int GetStripNumTotal();
00101
00104 vector<Identifier> FindIntersectGaps(const int part, const int gap,
00105 const HepPoint3D gPoint, const Hep3Vector gDirection);
00106
00109 vector<Identifier> FindIntersectStrips(const int part, const int gap,
00110 const HepPoint3D gPoint, const Hep3Vector gDirection);
00111
00112 vector<Identifier> FindIntersectStrips(const int part, const int gap,
00113 const HepPoint3D gPoint, const Hep3Vector gDirection,
00114 vector<int> &padID, vector<float> &intersection_x,
00115 vector<float> &intersection_y,vector<float> &intersection_z);
00116
00119 vector<HepPoint3D> FindIntersections(const int part, const int gap,
00120 const HepPoint3D gPoint, const Hep3Vector gDirection);
00121
00127 void FindIntersection(const int part, const int seg, const int gap,
00128 const float vx, const float vy, const float vz,
00129 const float x0, const float y0, const float z0,
00130 const float sigmaVx, const float sigmaVy, const float sigmaVz,
00131 const float sigmaX0, const float sigmaY0, const float sigmaZ0,
00132 float& x, float& y, float& z,
00133 float& sigmaX, float& sigmaY, float& sigmaZ);
00134
00135
00136 void FindIntersectionQuadLocal(const int part, const int seg, const int gap,
00137 const float a, const float b, const float c,
00138 const int whichhalf,
00139 float& x1, float& y1, float& z1,
00140 float& x2, float& y2, float& z2,
00141 float& sigmaX, float& sigmaY, float& sigmaZ);
00142
00143
00144
00145
00151 void FindIntersection(const int part, const int seg, const int gap,
00152 const float vy,
00153 const float x0, const float y0, const float z0,
00154 const float a, const float b, const float c,
00155 const int whichhalf,
00156 const float sigmaVx, const float sigmaVy, const float sigmaVz,
00157 const float sigmaX0, const float sigmaY0, const float sigmaZ0,
00158 float& x1, float& y1, float& z1,
00159 float& x2, float& y2, float& z2,
00160 float& sigmaX, float& sigmaY, float& sigmaZ);
00161
00162
00163 void FindIntersectionSurface(const int part, const int seg, const int gap,
00164 const float vx, const float vy, const float vz,
00165 const float x0, const float y0, const float z0,
00166 const float sigmaVx, const float sigmaVy, const float sigmaVz,
00167 const float sigmaX0, const float sigmaY0, const float sigmaZ0,
00168 float& x1, float& y1, float& z1,
00169 float& x2, float& y2, float& z2,
00170 float& sigmaX1, float& sigmaY1, float& sigmaZ1,
00171 float& sigmaX2, float& sigmaY2, float& sigmaZ2);
00172
00178 void FindIntersectionSurface(const int part, const int seg, const int gap,
00179 const float vy,
00180 const float x0, const float y0, const float z0,
00181 const float a, const float b, const float c,
00182 const int whichhalf,
00183 const float sigmaVx, const float sigmaVy, const float sigmaVz,
00184 const float sigmaX0, const float sigmaY0, const float sigmaZ0,
00185 float& x1, float& y1, float& z1,
00186 float& x2, float& y2, float& z2,
00187 float& sigmaX, float& sigmaY, float& sigmaZ);
00188
00189
00191 void Clear();
00192
00193 private:
00194
00195
00196 static int m_gGeometryInit;
00197
00198 static MucGeoGeneral *m_gpMucGeoGeneral;
00199
00200
00201 static map<Identifier, MucGeoGap*> m_gpMucGeoGap;
00202
00203 static map<Identifier, MucGeoStrip*> m_gpMucGeoStrip;
00204
00205 static const int m_kPartNum = 3;
00206 static const int m_kSegMax = 8;
00207 static const int m_kGapMax = 9;
00208 static const int m_kStripMax = 112;
00209
00210
00211
00212 int m_StripNumInGap[m_kPartNum][m_kSegMax][m_kGapMax];
00213 };
00214
00215 ostream& operator << (ostream& s, const MucGeoGeneral& geom);
00216
00217 #endif