9#include "EmcRecGeoSvc/EmcRecBarrelGeo.h"
12 ParameterInitialize();
13 CalculateStandardCrystal();
21 fCFrontCenter.clear();
24void EmcRecBarrelGeo::ParameterInitialize() {
51 fBarrelNThetaMax = 22;
53 fBarrelAlpha = twopi / fBarrelNPhiMax;
57 fCFrontCenter.clear();
60void EmcRecBarrelGeo::CalculateStandardCrystal() {
62 EmcRecCrystal pre, now;
71 R1 = 2 * fBarrelR *
sin( fBarrelAlpha / 2 ) /
sin( fBarrelAlpha );
72 R2 = 2 * fBarrelR *
sin( fBarrelAlpha / 2 ) *
73 (
tan( fBarrelAlpha ) + 1 /
tan( fBarrelAlpha ) );
74 a = 2 * fBarrelR *
sin( fBarrelAlpha / 2 ) /
cos( fBarrelAlpha );
84 EmcRecCrystal Crystal1;
86 Crystal1.
Set( 0, M4 );
87 Crystal1.
Set( 1, A1 );
88 Crystal1.
Set( 2, A1 );
89 Crystal1.
SetZ( 2, A1.z() + fBarrelh1 );
90 Crystal1.
Set( 3, M4 );
91 Crystal1.
SetZ( 3, M4.z() + fBarrelh1 );
93 Crystal1.
Set( 4, M4 );
94 Crystal1.
SetY( 4, M4.y() + fBarrelL );
95 dx = a * ( R1 + fBarrelL ) / R1;
96 Crystal1.
Set( 5, Crystal1.
Get( 4 ) );
97 Crystal1.
SetX( 5, dx );
98 dz = fBarrelOffset1 + ( fBarrelh1 - fBarrelOffset1 ) * ( R1 + fBarrelL ) / R1;
99 Crystal1.
Set( 6, Crystal1.
Get( 5 ) );
100 Crystal1.
SetZ( 6, Crystal1.
Get( 5 ).z() + dz );
101 Crystal1.
Set( 7, Crystal1.
Get( 4 ) );
102 Crystal1.
SetZ( 7, Crystal1.
Get( 4 ).z() + dz );
104 fStandard.push_back( Crystal1 );
108 EmcRecCrystal Crystal2;
109 double sin_gamma, cos_gamma, tan_gamma;
111 tan_gamma = R1 / ( fBarrelh1 - fBarrelOffset1 );
112 sin_gamma = tan_gamma / ( sqrt( 1 + tan_gamma * tan_gamma ) );
113 cos_gamma = 1 / ( sqrt( 1 + tan_gamma * tan_gamma ) );
116 aa = fBarrelh1 / sin_gamma;
117 bb = fBarrelh1 / tan_gamma;
119 Crystal2.
Set( 0, pre.
Get( 3 ) );
120 Crystal2.
SetZ( 0, pre.
Get( 3 ).z() + bb * cos_gamma );
121 Crystal2.
SetY( 0, pre.
Get( 3 ).y() + bb * sin_gamma );
123 dx = a * ( Rp + bb ) / Rp;
124 Crystal2.
Set( 1, Crystal2.
Get( 0 ) );
125 Crystal2.
SetX( 1, dx );
126 Crystal2.
Set( 3, pre.
Get( 3 ) );
127 Crystal2.
SetZ( 3, pre.
Get( 3 ).z() + aa );
128 Crystal2.
Set( 2, Crystal2.
Get( 3 ) );
129 Crystal2.
SetX( 2, a );
131 dz = ( fBarrelL + bb ) * cos_gamma;
132 dy = ( fBarrelL + bb ) * sin_gamma;
133 Crystal2.
Set( 4, pre.
Get( 3 ) );
134 Crystal2.
SetZ( 4, pre.
Get( 3 ).z() + dz );
135 Crystal2.
SetY( 4, pre.
Get( 3 ).y() + dy );
136 dx = a * ( Rp + bb + fBarrelL ) / Rp;
137 Crystal2.
Set( 5, Crystal2.
Get( 4 ) );
138 Crystal2.
SetX( 5, dx );
139 double gam2, gam3, Lp, Rpp;
140 t1 = pre.
Get( 3 ) - Crystal2.
Get( 3 );
141 t2 = O3 - Crystal2.
Get( 3 );
142 gam2 = acos( t1 * t2 / ( t1.mag() * t2.mag() ) );
143 gam3 = acos( cos_gamma ) - gam2;
144 Lp = fBarrelL /
cos( gam3 );
145 dz = Lp *
cos( gam2 );
146 dy = Lp *
sin( gam2 );
147 Crystal2.
Set( 7, Crystal2.
Get( 3 ) );
148 Crystal2.
SetZ( 7, Crystal2.
Get( 3 ).z() + dz );
149 Crystal2.
SetY( 7, Crystal2.
Get( 3 ).y() + dy );
150 Rpp = R1 /
sin( gam2 );
151 dx = a * ( Rpp + Lp ) / Rpp;
152 Crystal2.
Set( 6, Crystal2.
Get( 7 ) );
153 Crystal2.
SetX( 6, dx );
155 fStandard.push_back( Crystal2 );
158 for (
int i = 3; i <= fBarrelNThetaMax; i++ )
160 pre = fStandard[i - 2];
162 if ( i < fBarrelNThetaMax )
173 tan_gamma = R1 / ( pre.
Get( 3 ).z() - fBarrelOffset2 );
174 sin_gamma = tan_gamma / ( sqrt( 1 + tan_gamma * tan_gamma ) );
175 cos_gamma = 1 / ( sqrt( 1 + tan_gamma * tan_gamma ) );
180 now.
Set( 3, pre.
Get( 3 ) );
181 now.
SetZ( 3, pre.
Get( 3 ).z() + aa );
182 now.
Set( 0, pre.
Get( 3 ) );
183 now.
SetZ( 0, pre.
Get( 3 ).z() + bb * cos_gamma );
184 now.
SetY( 0, pre.
Get( 3 ).y() + bb * sin_gamma );
186 now.
Set( 4, pre.
Get( 3 ) );
187 now.
SetZ( 4, pre.
Get( 3 ).z() + ( L + bb ) * cos_gamma );
188 now.
SetY( 4, pre.
Get( 3 ).y() + ( L + bb ) * sin_gamma );
190 gam2 = atan( R1 / ( now.
Get( 3 ).z() - fBarrelOffset2 ) );
191 gam3 = acos( cos_gamma ) - gam2;
193 Lp = L /
cos( gam3 );
194 dz = Lp *
cos( gam2 );
195 dy = Lp *
sin( gam2 );
197 now.
Set( 7, now.
Get( 3 ) );
198 now.
SetZ( 7, now.
Get( 3 ).z() + dz );
199 now.
SetY( 7, now.
Get( 3 ).y() + dy );
202 dx = a * ( Rp + bb ) / Rp;
203 now.
Set( 1, now.
Get( 0 ) );
205 dx = a * ( Rp + bb + L ) / Rp;
206 now.
Set( 5, now.
Get( 4 ) );
209 now.
Set( 2, now.
Get( 3 ) );
212 Rpp = R1 /
sin( gam2 );
213 dx = a * ( Rpp + Lp ) / Rpp;
214 now.
Set( 6, now.
Get( 7 ) );
217 fStandard.push_back( now );
229void EmcRecBarrelGeo::Transform2Column1()
232 fBarrelR *
cos( fBarrelAlpha / 2 ) -
233 2 * fBarrelR *
sin( fBarrelAlpha / 2 ) /
tan( fBarrelAlpha ),
237 double phi = (
R.rotateZ( fBarrelAlpha ) + O1 ).phi();
239 for (
int i = 1; i <= fBarrelNThetaMax; i++ )
241 for (
int m = 0; m < 8; m++ )
244 fStandard[i - 1].Set( m, fStandard[i - 1].Get( m ).rotateZ( fBarrelAlpha ) );
245 fStandard[i - 1].Set( m, fStandard[i - 1].Get( m ) + O1 );
246 fStandard[i - 1].Set( m, fStandard[i - 1].Get( m ).rotateZ( -phi ) );
256void EmcRecBarrelGeo::FillCCenterVector() {
262 for ( theta = 0; theta < 2 * fBarrelNThetaMax; ++theta )
264 for ( phi = 0; phi < fBarrelNPhiMax; ++phi )
269 fCCenter.push_back( aCenter );
270 fCFrontCenter.push_back( aFrontCenter );
284 double dphi = phi * fBarrelAlpha;
286 if ( (
int)theta >= fBarrelNThetaMax )
288 cry = fStandard[theta - fBarrelNThetaMax];
289 for (
int m = 0; m < 8; ++m ) { cry.
SetZ( m, -cry.
Get( m ).z() ); }
291 else { cry = fStandard[fBarrelNThetaMax - theta - 1]; }
293 for (
int m = 0; m < 8; ++m ) { cry.
Set( m, cry.
Get( m ).rotateZ( dphi ) ); }
302 return fCCenter[theta * fBarrelNPhiMax + phi];
309 return fCFrontCenter[theta * fBarrelNPhiMax + phi];
double tan(const BesAngle a)
double sin(const BesAngle a)
double cos(const BesAngle a)
HepGeom::Point3D< double > HepPoint3D
static Identifier crystal_id(const unsigned int barrel_ec, const unsigned int theta_module, const unsigned int phi_module)
For a single crystal.
static unsigned int getBARREL()
static unsigned int theta_module(const Identifier &id)
static unsigned int phi_module(const Identifier &id)
EmcRecCrystal GetCrystal(const Identifier &id) const
HepPoint3D GetCFrontCenter(const Identifier &id) const
HepPoint3D GetCCenter(const Identifier &id) const
HepPoint3D Center() const
void SetY(int index, double value)
HepPoint3D Get(int index) const
void SetX(int index, double value)
HepPoint3D FrontCenter() const
void SetZ(int index, double value)
void Set(int index, const HepPoint3D &aPoint)
complex_t R(double Q2, double M2, double G, double Mp2, double Mm2)