BOSS 7.0.2
BESIII Offline Software System
Loading...
Searching...
No Matches
InstallArea/include/MucGeomSvc/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 <stdlib.h>
16#include <math.h>
17#include <vector>
18#include <map>
19#include <CLHEP/Vector/ThreeVector.h>
20#include <CLHEP/Geometry/Point3D.h>
21#include <CLHEP/Geometry/Plane3D.h>
22#include <CLHEP/Vector/Rotation.h>
23
24#include "Identifier/Identifier.h"
25#include "Identifier/MucID.h"
26#include "MucGeomSvc/MucGeoStrip.h"
27#include "MucGeomSvc/MucGeoGap.h"
28
29#ifndef ENABLE_BACKWARDS_COMPATIBILITY
31#endif
32#ifndef ENABLE_BACKWARDS_COMPATIBILITY
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:[email protected]}
47 *
48 */
49
51{
52 public:
53
54 /// Constructor.
56
57 /// Assignment constructor.
59
60 /// Copy constructor.
62
63 /// Destructor.
65
66 /// Initialize the instance of MucGeoGeneral.
67 void Init();
68
69 /// Initialize from database.
71
72 /// Initialize form ASCII.
73 void InitFromASCII();
74
75 /// Initialize from xml.
76 void InitFromXML();
77
78 /// Destroy the single instance of MucGeoGeneral.
79 void Destroy();
80
81 /// Get a pointer to the single instance of MucGeoGeneral.
82 static MucGeoGeneral *Instance();
83
84 /// Get a pointer to the gap identified by (part,seg,gap).
85 MucGeoGap *GetGap(const int part, const int seg, const int gap) const;
86
87 /// Get a pointer to the gap identified by Indentifier.
88 MucGeoGap *GetGap(const Identifier id) const;
89
90 /// Get a pointer to the strip identified by (part,seg,gap,strip).
91 MucGeoStrip* GetStrip(const int part, const int seg, const int gap, const int strip) const;
92
93 /// Get a pointer to the strip identified by Indentifier.
94 MucGeoStrip* GetStrip(const Identifier id) const;
95
96 int GetStripNumInGap(const int part, const int seg, const int gap)
97 { return m_StripNumInGap[part][seg][gap]; }
98
99 /// Get total number of strips.
100 int GetStripNumTotal();
101
102 /// Find the intersect gap of a trajectory with the given part and gap.
103 /// The trajectory is given by the position and direction in global coordinate.
104 vector<Identifier> FindIntersectGaps(const int part, const int gap,
105 const HepPoint3D gPoint, const Hep3Vector gDirection);
106
107 /// Find the intersect strip of a trajectory with the given part and gap.
108 /// The trajectory is given by the position and direction in global coordinate.
109 vector<Identifier> FindIntersectStrips(const int part, const int gap,
110 const HepPoint3D gPoint, 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,vector<float> &intersection_z);
116
117 /// Find the intersection position of a trajectory with the given part and gap.
118 /// The trajectory is given by the position and direction in global coordinate.
119 vector<HepPoint3D> FindIntersections(const int part, const int gap,
120 const HepPoint3D gPoint, const Hep3Vector gDirection);
121
122 /// Find the intersection position of a trajectory with the given gap.
123 /// The trajectory is given by unit vector (vx,vy,vz) and intercept (x0,y0,z0)
124 /// in global coordinates, such that (x-x0)/vx = (y-y0)/vy = (z-z0)/vz .
125 /// If more than one seg lies along the trajectory, take the first one
126 /// intersect with the trajectory.
127 void FindIntersection(const int part, const int seg, const int gap,
128 const float vx, const float vy, const float vz,
129 const float x0, const float y0, const float z0,
130 const float sigmaVx, const float sigmaVy, const float sigmaVz,
131 const float sigmaX0, const float sigmaY0, const float sigmaZ0,
132 float& x, float& y, float& z,
133 float& sigmaX, float& sigmaY, float& sigmaZ);
134
135
136 void FindIntersectionQuadLocal(const int part, const int seg, const int gap,
137 const float a, const float b, const float c,
138 const int whichhalf, //help to emit one solution.
139 float& x1, float& y1, float& z1,
140 float& x2, float& y2, float& z2,
141 float& sigmaX, float& sigmaY, float& sigmaZ);
142
143
144
145
146 /// Find the intersection position of a trajectory with the given gap.
147 /// The trajectory is given by a parabola and a line in global coordinates,
148 /// If more than one seg lies along the trajectory, take the first one
149 /// whichhalf help to judge which intersection position is better, x1,y1,z1 return the
150 /// better one . now reserver x2,y2,z2 temp.
151 void FindIntersection(const int part, const int seg, const int gap,
152 const float vy,
153 const float x0, const float y0, const float z0,
154 const float a, const float b, const float c,
155 const int whichhalf, //help to emit one solution.
156 const float sigmaVx, const float sigmaVy, const float sigmaVz,
157 const float sigmaX0, const float sigmaY0, const float sigmaZ0,
158 float& x1, float& y1, float& z1,
159 float& x2, float& y2, float& z2,
160 float& sigmaX, float& sigmaY, float& sigmaZ);
161
162
163 void FindIntersectionSurface(const int part, const int seg, const int gap,
164 const float vx, const float vy, const float vz,
165 const float x0, const float y0, const float z0,
166 const float sigmaVx, const float sigmaVy, const float sigmaVz,
167 const float sigmaX0, const float sigmaY0, const float sigmaZ0,
168 float& x1, float& y1, float& z1,
169 float& x2, float& y2, float& z2,
170 float& sigmaX1, float& sigmaY1, float& sigmaZ1,
171 float& sigmaX2, float& sigmaY2, float& sigmaZ2);
172
173 /// Find the intersection position of a trajectory with two surfaces of the given gap.
174 /// The trajectory is given by a parabola and a line in global coordinates,
175 /// If more than one seg lies along the trajectory, take the first one
176 /// whichhalf help to judge which intersection position is better,and return the better one
177 /// only. x1,y1,z1 is the intersection position with inner surface and x2,y2,z2 be the outer!
178 void FindIntersectionSurface(const int part, const int seg, const int gap,
179 const float vy,
180 const float x0, const float y0, const float z0,
181 const float a, const float b, const float c,
182 const int whichhalf, //help to emit one solution.
183 const float sigmaVx, const float sigmaVy, const float sigmaVz,
184 const float sigmaX0, const float sigmaY0, const float sigmaZ0,
185 float& x1, float& y1, float& z1,
186 float& x2, float& y2, float& z2,
187 float& sigmaX, float& sigmaY, float& sigmaZ);
188
189
190 /// Clear the fgpMucGeoGap and fgpMucGeoStrip vector containers.
191 void Clear();
192
193 private:
194
195 // Have we initialize the geometry.
196 static int m_gGeometryInit;
197 // Pointer to the instance of MucGeoGeneral.
198 static MucGeoGeneral *m_gpMucGeoGeneral;
199
200 // map containing the pointers to gaps.
201 static map<Identifier, MucGeoGap*> m_gpMucGeoGap;
202 // map containing the pointers to strips.
203 static map<Identifier, MucGeoStrip*> m_gpMucGeoStrip;
204
205 static const int m_kPartNum = 3;
206 static const int m_kSegMax = 8;
207 static const int m_kGapMax = 9;
208 static const int m_kStripMax = 112;
209
210 // number of strips on each gap.
211 //int m_StripNumInGap[MucID::getPartNum()][MucID::getSegMax()][MucID::getGapMax()];
212 int m_StripNumInGap[m_kPartNum][m_kSegMax][m_kGapMax];
213};
214
215ostream& operator << (ostream& s, const MucGeoGeneral& geom);
216
217#endif /* MUC_GEO_GENERAL_H */
XmlRpcServer s
Definition: HelloServer.cpp:11
HepGeom::Point3D< double > HepPoint3D
HepGeom::Vector3D< double > HepVector3D
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)
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.
~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 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.
static MucGeoGeneral * Instance()
Get a pointer to the single instance of MucGeoGeneral.
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)