9#include "EmcRecGeoSvc/EmcRecBarrelGeo.h"
13 ParameterInitialize();
14 CalculateStandardCrystal();
23 fCFrontCenter.clear();
26void EmcRecBarrelGeo::ParameterInitialize()
56 fBarrelAlpha=twopi/fBarrelNPhiMax;
60 fCFrontCenter.clear();
63void EmcRecBarrelGeo::CalculateStandardCrystal()
75 R1=2*fBarrelR*
sin(fBarrelAlpha/2)/
sin(fBarrelAlpha);
76 R2=2*fBarrelR*
sin(fBarrelAlpha/2)*(
tan(fBarrelAlpha)+1/
tan(fBarrelAlpha));
77 a=2*fBarrelR*
sin(fBarrelAlpha/2)/
cos(fBarrelAlpha);
91 Crystal1.
Set(2,A1); Crystal1.
SetZ(2,A1.z()+fBarrelh1);
92 Crystal1.
Set(3,M4); Crystal1.
SetZ(3,M4.z()+fBarrelh1);
94 Crystal1.
Set(4,M4); Crystal1.
SetY(4,M4.y()+fBarrelL);
95 dx=a*(R1+fBarrelL)/R1;
96 Crystal1.
Set(5,Crystal1.
Get(4)); Crystal1.
SetX(5,dx);
97 dz=fBarrelOffset1+(fBarrelh1-fBarrelOffset1)*(R1+fBarrelL)/R1;
98 Crystal1.
Set(6,Crystal1.
Get(5)); Crystal1.
SetZ(6,Crystal1.
Get(5).z()+dz);
99 Crystal1.
Set(7,Crystal1.
Get(4)); Crystal1.
SetZ(7,Crystal1.
Get(4).z()+dz);
101 fStandard.push_back(Crystal1);
106 double sin_gamma,cos_gamma,tan_gamma;
108 tan_gamma=R1/(fBarrelh1-fBarrelOffset1);
109 sin_gamma=tan_gamma/(sqrt(1+tan_gamma*tan_gamma));
110 cos_gamma=1/(sqrt(1+tan_gamma*tan_gamma));
113 aa=fBarrelh1/sin_gamma;
114 bb=fBarrelh1/tan_gamma;
116 Crystal2.
Set(0,pre.
Get(3)); Crystal2.
SetZ(0,pre.
Get(3).z()+bb*cos_gamma);
117 Crystal2.
SetY(0,pre.
Get(3).y()+bb*sin_gamma);
120 Crystal2.
Set(1,Crystal2.
Get(0)); Crystal2.
SetX(1,dx);
121 Crystal2.
Set(3,pre.
Get(3)); Crystal2.
SetZ(3,pre.
Get(3).z()+aa);
122 Crystal2.
Set(2,Crystal2.
Get(3)); Crystal2.
SetX(2,a);
124 dz=(fBarrelL+bb)*cos_gamma;
125 dy=(fBarrelL+bb)*sin_gamma;
126 Crystal2.
Set(4,pre.
Get(3)); Crystal2.
SetZ(4,pre.
Get(3).z()+dz);
127 Crystal2.
SetY(4,pre.
Get(3).y()+dy);
128 dx=a*(Rp+bb+fBarrelL)/Rp;
129 Crystal2.
Set(5,Crystal2.
Get(4)); Crystal2.
SetX(5,dx);
130 double gam2,gam3,Lp,Rpp;
131 t1=pre.
Get(3)-Crystal2.
Get(3);
132 t2=O3-Crystal2.
Get(3);
133 gam2=acos(t1*t2/(t1.mag()*t2.mag()));
134 gam3=acos(cos_gamma)-gam2;
135 Lp=fBarrelL/
cos(gam3);
138 Crystal2.
Set(7,Crystal2.
Get(3)); Crystal2.
SetZ(7,Crystal2.
Get(3).z()+dz);
139 Crystal2.
SetY(7,Crystal2.
Get(3).y()+dy);
142 Crystal2.
Set(6,Crystal2.
Get(7)); Crystal2.
SetX(6,dx);
144 fStandard.push_back(Crystal2);
147 for(
int i=3; i<=fBarrelNThetaMax; i++) {
150 if(i<fBarrelNThetaMax) {
159 tan_gamma=R1/(pre.
Get(3).z()-fBarrelOffset2);
160 sin_gamma=tan_gamma/(sqrt(1+tan_gamma*tan_gamma));
161 cos_gamma=1/(sqrt(1+tan_gamma*tan_gamma));
167 now.
Set(0,pre.
Get(3)); now.
SetZ(0,pre.
Get(3).z()+bb*cos_gamma);
168 now.
SetY(0,pre.
Get(3).y()+bb*sin_gamma);
170 now.
Set(4,pre.
Get(3)); now.
SetZ(4,pre.
Get(3).z()+(L+bb)*cos_gamma);
171 now.
SetY(4,pre.
Get(3).y()+(L+bb)*sin_gamma);
173 gam2=atan(R1/(now.
Get(3).z()-fBarrelOffset2));
174 gam3=acos(cos_gamma)-gam2;
195 fStandard.push_back(now);
207void EmcRecBarrelGeo::Transform2Column1()
210 fBarrelR*
cos(fBarrelAlpha/2)-2*fBarrelR*
sin(fBarrelAlpha/2)/
tan(fBarrelAlpha),
214 double phi=(
R.rotateZ(fBarrelAlpha)+O1).phi();
216 for(
int i=1; i<=fBarrelNThetaMax; i++) {
220 fStandard[i-1].Set(m,fStandard[i-1].Get(m).rotateZ(fBarrelAlpha));
221 fStandard[i-1].Set(m,fStandard[i-1].Get(m)+O1);
222 fStandard[i-1].Set(m,fStandard[i-1].Get(m).rotateZ(-phi));
232void EmcRecBarrelGeo::FillCCenterVector()
239 for(theta=0;theta<2*fBarrelNThetaMax;++theta) {
240 for(phi=0;phi<fBarrelNPhiMax;++phi) {
244 fCCenter.push_back(aCenter);
245 fCFrontCenter.push_back(aFrontCenter);
261 double dphi=phi*fBarrelAlpha;
263 if((
int)theta>=fBarrelNThetaMax) {
264 cry=fStandard[theta-fBarrelNThetaMax];
271 cry=fStandard[fBarrelNThetaMax-theta-1];
276 cry.
Set(m,cry.
Get(m).rotateZ(dphi));
287 return fCCenter[theta*fBarrelNPhiMax+phi];
295 return fCFrontCenter[theta*fBarrelNPhiMax+phi];
double tan(const BesAngle a)
double sin(const BesAngle a)
double cos(const BesAngle a)
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)