BOSS 8.0.0
BESIII Offline Software System
Loading...
Searching...
No Matches
Muc/MucGeomSvc/include/MucGeomSvc/MucGeoGeneral.h
Go to the documentation of this file.
1//$id$
2//
3//$log$
4
5/*
6 * 2003/08/30 Zhengyun You Peking University
7 *
8 * 2004/09/09 Zhengyun You Peking University
9 * transplanted to Gaudi framework
10 */
11
12#ifndef MUC_GEO_GENERAL_H
13#define MUC_GEO_GENERAL_H
14
15#include <CLHEP/Geometry/Plane3D.h>
16#include <CLHEP/Geometry/Point3D.h>
17#include <CLHEP/Vector/Rotation.h>
18#include <CLHEP/Vector/ThreeVector.h>
19#include <map>
20#include <math.h>
21#include <stdlib.h>
22#include <vector>
23
24#include "Identifier/Identifier.h"
25#include "Identifier/MucID.h"
26#include "MucGeomSvc/MucGeoGap.h"
27#include "MucGeomSvc/MucGeoStrip.h"
28
29#ifndef ENABLE_BACKWARDS_COMPATIBILITY
30typedef HepGeom::Point3D<double> HepPoint3D;
31#endif
32#ifndef ENABLE_BACKWARDS_COMPATIBILITY
33typedef HepGeom::Vector3D<double> HepVector3D;
34#endif
35
36using namespace std;
37using namespace CLHEP;
38
39// class MucGeoGap;
40// class MucGeoStrip;
41
42/**
43 * Class MucGeoGeneral contains all of the objects necessary to describe the
44 * muon chamber geometry.
45 *
46 * @author Zhengyun You \URL{mailto:youzy@hep.pku.cn}
47 *
48 */
49
50class MucGeoGeneral {
51public:
52 /// Constructor.
54
55 /// Assignment constructor.
57
58 /// Copy constructor.
60
61 /// Destructor.
63
64 /// Initialize the instance of MucGeoGeneral.
65 void Init();
66
67 /// Initialize from database.
69
70 /// Initialize form ASCII.
72
73 /// Initialize from xml.
75
76 /// Destroy the single instance of MucGeoGeneral.
77 void Destroy();
78
79 /// Get a pointer to the single instance of MucGeoGeneral.
81
82 /// Get a pointer to the gap identified by (part,seg,gap).
83 MucGeoGap* GetGap( const int part, const int seg, const int gap ) const;
84
85 /// Get a pointer to the gap identified by Indentifier.
86 MucGeoGap* GetGap( const Identifier id ) const;
87
88 /// Get a pointer to the strip identified by (part,seg,gap,strip).
89 MucGeoStrip* GetStrip( const int part, const int seg, const int gap, const int strip ) const;
90
91 /// Get a pointer to the strip identified by Indentifier.
92 MucGeoStrip* GetStrip( const Identifier id ) const;
93
94 int GetStripNumInGap( const int part, const int seg, const int gap ) {
95 return m_StripNumInGap[part][seg][gap];
96 }
97
98 /// Get total number of strips.
100
101 /// Find the intersect gap of a trajectory with the given part and gap.
102 /// The trajectory is given by the position and direction in global coordinate.
103 vector<Identifier> FindIntersectGaps( const int part, const int gap, const HepPoint3D gPoint,
104 const Hep3Vector gDirection );
105
106 /// Find the intersect strip of a trajectory with the given part and gap.
107 /// The trajectory is given by the position and direction in global coordinate.
108 vector<Identifier> FindIntersectStrips( const int part, const int gap,
109 const HepPoint3D gPoint,
110 const Hep3Vector gDirection );
111
112 vector<Identifier> FindIntersectStrips( const int part, const int gap,
113 const HepPoint3D gPoint, const Hep3Vector gDirection,
114 vector<int>& padID, vector<float>& intersection_x,
115 vector<float>& intersection_y,
116 vector<float>& intersection_z );
117
118 /// Find the intersection position of a trajectory with the given part and gap.
119 /// The trajectory is given by the position and direction in global coordinate.
120 vector<HepPoint3D> FindIntersections( const int part, const int gap, const HepPoint3D gPoint,
121 const Hep3Vector gDirection );
122
123 /// Find the intersection position of a trajectory with the given gap.
124 /// The trajectory is given by unit vector (vx,vy,vz) and intercept (x0,y0,z0)
125 /// in global coordinates, such that (x-x0)/vx = (y-y0)/vy = (z-z0)/vz .
126 /// If more than one seg lies along the trajectory, take the first one
127 /// intersect with the trajectory.
128 void FindIntersection( const int part, const int seg, const int gap, const float vx,
129 const float vy, const float vz, const float x0, const float y0,
130 const float z0, const float sigmaVx, const float sigmaVy,
131 const float sigmaVz, const float sigmaX0, const float sigmaY0,
132 const float sigmaZ0, float& x, float& y, float& z, float& sigmaX,
133 float& sigmaY, float& sigmaZ );
134
135 void FindIntersectionQuadLocal( const int part, const int seg, const int gap, const float a,
136 const float b, const float c,
137 const int whichhalf, // help to emit one solution.
138 float& x1, float& y1, float& z1, float& x2, float& y2,
139 float& z2, float& sigmaX, float& sigmaY, float& sigmaZ );
140
141 /// Find the intersection position of a trajectory with the given gap.
142 /// The trajectory is given by a parabola and a line in global coordinates,
143 /// If more than one seg lies along the trajectory, take the first one
144 /// whichhalf help to judge which intersection position is better, x1,y1,z1 return the
145 /// better one . now reserver x2,y2,z2 temp.
146 void FindIntersection( const int part, const int seg, const int gap, const float vy,
147 const float x0, const float y0, const float z0, const float a,
148 const float b, const float c,
149 const int whichhalf, // help to emit one solution.
150 const float sigmaVx, const float sigmaVy, const float sigmaVz,
151 const float sigmaX0, const float sigmaY0, const float sigmaZ0,
152 float& x1, float& y1, float& z1, float& x2, float& y2, float& z2,
153 float& sigmaX, float& sigmaY, float& sigmaZ );
154
155 void FindIntersectionSurface( const int part, const int seg, const int gap, const float vx,
156 const float vy, const float vz, const float x0, const float y0,
157 const float z0, const float sigmaVx, const float sigmaVy,
158 const float sigmaVz, const float sigmaX0, const float sigmaY0,
159 const float sigmaZ0, float& x1, float& y1, float& z1,
160 float& x2, float& y2, float& z2, float& sigmaX1,
161 float& sigmaY1, float& sigmaZ1, float& sigmaX2, float& sigmaY2,
162 float& sigmaZ2 );
163
164 /// Find the intersection position of a trajectory with two surfaces of the given gap.
165 /// The trajectory is given by a parabola and a line in global coordinates,
166 /// If more than one seg lies along the trajectory, take the first one
167 /// whichhalf help to judge which intersection position is better,and return the better one
168 /// only. x1,y1,z1 is the intersection position with inner surface and x2,y2,z2 be the outer!
169 void FindIntersectionSurface( const int part, const int seg, const int gap, const float vy,
170 const float x0, const float y0, const float z0, const float a,
171 const float b, const float c,
172 const int whichhalf, // help to emit one solution.
173 const float sigmaVx, const float sigmaVy, const float sigmaVz,
174 const float sigmaX0, const float sigmaY0, const float sigmaZ0,
175 float& x1, float& y1, float& z1, float& x2, float& y2,
176 float& z2, float& sigmaX, float& sigmaY, float& sigmaZ );
177
178 /// Clear the fgpMucGeoGap and fgpMucGeoStrip vector containers.
179 void Clear();
180
181private:
182 // Have we initialize the geometry.
183 static int m_gGeometryInit;
184 // Pointer to the instance of MucGeoGeneral.
185 static MucGeoGeneral* m_gpMucGeoGeneral;
186
187 // map containing the pointers to gaps.
188 static map<Identifier, MucGeoGap*> m_gpMucGeoGap;
189 // map containing the pointers to strips.
190 static map<Identifier, MucGeoStrip*> m_gpMucGeoStrip;
191
192 static const int m_kPartNum = 3;
193 static const int m_kSegMax = 8;
194 static const int m_kGapMax = 9;
195 static const int m_kStripMax = 112;
196
197 // number of strips on each gap.
198 // int m_StripNumInGap[MucID::getPartNum()][MucID::getSegMax()][MucID::getGapMax()];
199 int m_StripNumInGap[m_kPartNum][m_kSegMax][m_kGapMax];
200};
201
202ostream& operator<<( ostream& s, const MucGeoGeneral& geom );
203
204#endif /* MUC_GEO_GENERAL_H */
HepGeom::Vector3D< double > HepVector3D
HepGeom::Point3D< double > HepPoint3D
XmlRpcServer s
HepGeom::Point3D< double > HepPoint3D
ostream & operator<<(ostream &s, const MucGeoGeneral &geom)
int GetStripNumTotal()
Get total number of strips.
void FindIntersectionQuadLocal(const int part, const int seg, const int gap, const float a, const float b, const float c, const int whichhalf, float &x1, float &y1, float &z1, float &x2, float &y2, float &z2, float &sigmaX, float &sigmaY, float &sigmaZ)
static MucGeoGeneral * Instance()
Get a pointer to the single instance of MucGeoGeneral.
MucGeoGap * GetGap(const Identifier id) const
Get a pointer to the gap identified by Indentifier.
vector< Identifier > FindIntersectStrips(const int part, const int gap, const HepPoint3D gPoint, const Hep3Vector gDirection, vector< int > &padID, vector< float > &intersection_x, vector< float > &intersection_y, vector< float > &intersection_z)
void Init()
Initialize the instance of MucGeoGeneral.
MucGeoStrip * GetStrip(const int part, const int seg, const int gap, const int strip) const
Get a pointer to the strip identified by (part,seg,gap,strip).
vector< HepPoint3D > FindIntersections(const int part, const int gap, const HepPoint3D gPoint, const Hep3Vector gDirection)
void InitFromXML()
Initialize from xml.
void InitFromASCII()
Initialize form ASCII.
int GetStripNumInGap(const int part, const int seg, const int gap)
MucGeoGap * GetGap(const int part, const int seg, const int gap) const
Get a pointer to the gap identified by (part,seg,gap).
MucGeoGeneral()
Constructor.
MucGeoStrip * GetStrip(const Identifier id) const
Get a pointer to the strip identified by Indentifier.
~MucGeoGeneral()
Destructor.
vector< Identifier > FindIntersectGaps(const int part, const int gap, const HepPoint3D gPoint, const Hep3Vector gDirection)
vector< Identifier > FindIntersectStrips(const int part, const int gap, const HepPoint3D gPoint, const Hep3Vector gDirection)
void FindIntersectionSurface(const int part, const int seg, const int gap, const float vy, const float x0, const float y0, const float z0, const float a, const float b, const float c, const int whichhalf, const float sigmaVx, const float sigmaVy, const float sigmaVz, const float sigmaX0, const float sigmaY0, const float sigmaZ0, float &x1, float &y1, float &z1, float &x2, float &y2, float &z2, float &sigmaX, float &sigmaY, float &sigmaZ)
void FindIntersection(const int part, const int seg, const int gap, const float vy, const float x0, const float y0, const float z0, const float a, const float b, const float c, const int whichhalf, const float sigmaVx, const float sigmaVy, const float sigmaVz, const float sigmaX0, const float sigmaY0, const float sigmaZ0, float &x1, float &y1, float &z1, float &x2, float &y2, float &z2, float &sigmaX, float &sigmaY, float &sigmaZ)
void FindIntersectionSurface(const int part, const int seg, const int gap, const float vx, const float vy, const float vz, const float x0, const float y0, const float z0, const float sigmaVx, const float sigmaVy, const float sigmaVz, const float sigmaX0, const float sigmaY0, const float sigmaZ0, float &x1, float &y1, float &z1, float &x2, float &y2, float &z2, float &sigmaX1, float &sigmaY1, float &sigmaZ1, float &sigmaX2, float &sigmaY2, float &sigmaZ2)
void Clear()
Clear the fgpMucGeoGap and fgpMucGeoStrip vector containers.
void Destroy()
Destroy the single instance of MucGeoGeneral.
MucGeoGeneral & operator=(const MucGeoGeneral &orig)
Assignment constructor.
MucGeoGeneral(const MucGeoGeneral &orig)
Copy constructor.
void InitFromDatabase()
Initialize from database.
void FindIntersection(const int part, const int seg, const int gap, const float vx, const float vy, const float vz, const float x0, const float y0, const float z0, const float sigmaVx, const float sigmaVy, const float sigmaVz, const float sigmaX0, const float sigmaY0, const float sigmaZ0, float &x, float &y, float &z, float &sigmaX, float &sigmaY, float &sigmaZ)