BOSS 8.0.0
BESIII Offline Software System
Loading...
Searching...
No Matches
Emc/EmcRecGeoSvc/include/EmcRecGeoSvc/EmcRecEndCapGeo.h
Go to the documentation of this file.
1//
2// EmcRecEndCapGeo
3//
4// Dec 18, 2003, Created by Wang.Zhe
5//
6// unit: mm, radian
7//
8#ifndef EMC_REC_ENDCAP_GEO_H
9#define EMC_REC_ENDCAP_GEO_H
10
11#include <iostream>
12#include <vector>
13
14#include "CLHEP/Geometry/Normal3D.h"
15#include "CLHEP/Geometry/Plane3D.h"
16#include "CLHEP/Geometry/Point3D.h"
17#include "CLHEP/Matrix/Matrix.h"
18#include "CLHEP/Matrix/Vector.h"
19
20#ifndef ENABLE_BACKWARDS_COMPATIBILITY
21typedef HepGeom::Point3D<double> HepPoint3D;
22#endif
23#ifndef ENABLE_BACKWARDS_COMPATIBILITY
24// backwards compatibility will be enabled ONLY in CLHEP 1.9
25typedef HepGeom::Plane3D<double> HepPlane3D;
26#endif
27#ifndef ENABLE_BACKWARDS_COMPATIBILITY
28// backwards compatibility will be enabled ONLY in CLHEP 1.9
29typedef HepGeom::Normal3D<double> HepNormal3D;
30#endif
31
32#include "EmcRecGeoSvc/EmcRecCrystal.h"
33#include "Identifier/EmcID.h"
34#include "Identifier/Identifier.h"
35
36using namespace CLHEP;
37
38class EmcRecGeoPlane;
39
41public:
42 // Constructors and destructors
45
46 // private method
47private:
48 //====for EndCap EMC
49 void ParameterInitialize();
50 //====calculate one standard sector
51 void CalculateStandardSector1();
52 //====calculate the other standard sector along with y-z plane
53 void CalculateStandardSector2();
54 // Fill crystals' center vector
55 void FillCCenterVector();
56
57public:
58 // Ac_ess by others (refer to Identifier for ID arrangement)
59 EmcRecCrystal GetCrystal( const Identifier& id ) const;
60 HepPoint3D GetCCenter( const Identifier& id ) const;
61 HepPoint3D GetCFrontCenter( const Identifier& id ) const;
62
63private:
64 // Find intersection for three planes
65 void FindInt( const EmcRecGeoPlane& p1, const EmcRecGeoPlane& p2, const EmcRecGeoPlane& p3,
66 HepPoint3D& p );
67
68 // general
69 double flength;
70 double fzshift;
71 double fz;
72 double fr[7];
73
74 // for Ring5
75 double fphi5[7];
76 double fphi3[6];
77 double fphi1[5];
78
79 // for EndCap EMC (standard sector 1) (1/16 of whole ring)
80 // East, theta 5, phi 0-5. ( total 96 )
81 EmcRecCrystal fRing5[6];
82 // East, theta 4, phi 0-5. ( total 96 )
83 EmcRecCrystal fRing4[6];
84 // East, theta 3, phi 0-4. ( total 80 )
85 EmcRecCrystal fRing3[5];
86 // East, theta 2, phi 0-4. ( total 80 )
87 EmcRecCrystal fRing2[5];
88 // East, theta 1, phi 0-3. ( total 64 )
89 EmcRecCrystal fRing1[4];
90 // East, theta 0, phi 0-3. ( total 64 )
91 EmcRecCrystal fRing0[4];
92 // for EndCap EMC (gap, standard sector 2)
93 // East, theta 5, phi 24-29
94 EmcRecCrystal fRing5p[6];
95 // East, theta 4, phi 24-29
96 EmcRecCrystal fRing4p[6];
97 // East, theta 3, phi 20-24
98 EmcRecCrystal fRing3p[5];
99 // East, theta 2, phi 20-24
100 EmcRecCrystal fRing2p[5];
101 // East, theta 1, phi 16-19
102 EmcRecCrystal fRing1p[4];
103 // East, theta 1, phi 16-19
104 EmcRecCrystal fRing0p[4];
105
106 /// put them together for easy reference
107 EmcRecCrystal fCrystal[2][6][6];
108 /// vector of each crystal's center
109 vector<HepPoint3D> fCCenter;
110 vector<HepPoint3D> fCFrontCenter;
111};
112
113// ad_ three building methods for easy use.
115public:
116 /**
117 * Constructor from four numbers.
118 * The numbers are the coefficients of the equation of the plane:
119 * @code
120 * a*x+b*y+c*z+d=0
121 * @endcode
122 */
123 EmcRecGeoPlane( double a = 0, double b = 0, double c = 0, double d = 0 ) {
124 a_ = a;
125 b_ = b;
126 c_ = c;
127 d_ = d;
128 return;
129 }
130
131 /// Constructor from normal and point.
132 EmcRecGeoPlane( const HepPoint3D& n, const HepPoint3D& p ) {
133 a_ = n.x();
134 b_ = n.y();
135 c_ = n.z();
136 d_ = -n * p;
137 return;
138 }
139
140 /// Constructor from three points.
141 EmcRecGeoPlane( const HepPoint3D& p1, const HepPoint3D& p2, const HepPoint3D& p3 ) {
142 HepNormal3D n = ( p2 - p1 ).cross( p3 - p1 );
143 a_ = n.x();
144 b_ = n.y();
145 c_ = n.z();
146 d_ = -n * p1;
147 }
148
149 /// Assignment
151 if ( this != &plane )
152 {
153 a_ = plane.a_;
154 b_ = plane.b_;
155 c_ = plane.c_;
156 d_ = plane.d_;
157 }
158 return *this;
159 }
160
161 // More build functions, easy for use
162 void Build( double a = 0, double b = 0, double c = 0, double d = 0 ) {
163 a_ = a;
164 b_ = b;
165 c_ = c;
166 d_ = d;
167 return;
168 }
169
170 void Build( const HepPoint3D& n, const HepPoint3D& p ) {
171 a_ = n.x();
172 b_ = n.y();
173 c_ = n.z();
174 d_ = -n * p;
175 return;
176 }
177
178 void Build( const HepPoint3D& p1, const HepPoint3D& p2, const HepPoint3D& p3 ) {
179 HepNormal3D n = ( p2 - p1 ).cross( p3 - p1 );
180 a_ = n.x();
181 b_ = n.y();
182 c_ = n.z();
183 d_ = -n * p1;
184 return;
185 }
186};
187
188#endif /* EMC_REC_ENDCAP_GEO_H */
double p2[4]
double p1[4]
HepGeom::Point3D< double > HepPoint3D
HepGeom::Normal3D< float > HepNormal3D
const Int_t n
HepGeom::Plane3D< double > HepPlane3D
EvtVector3R cross(const EvtVector3R &p1, const EvtVector3R &p2)
EmcRecCrystal GetCrystal(const Identifier &id) const
HepPoint3D GetCCenter(const Identifier &id) const
HepPoint3D GetCFrontCenter(const Identifier &id) const
void Build(double a=0, double b=0, double c=0, double d=0)
EmcRecGeoPlane & operator=(const EmcRecGeoPlane &plane)
Assignment.
void Build(const HepPoint3D &p1, const HepPoint3D &p2, const HepPoint3D &p3)
EmcRecGeoPlane(double a=0, double b=0, double c=0, double d=0)
EmcRecGeoPlane(const HepPoint3D &p1, const HepPoint3D &p2, const HepPoint3D &p3)
Constructor from three points.
void Build(const HepPoint3D &n, const HepPoint3D &p)
EmcRecGeoPlane(const HepPoint3D &n, const HepPoint3D &p)
Constructor from normal and point.