12#include "GaudiKernel/Bootstrap.h"
13#include "GaudiKernel/ISvcLocator.h"
19 RecEmcFractionMap::const_iterator cit;
27 ISvcLocator* svcLocator = Gaudi::svcLocator();
28 StatusCode sc = svcLocator->service(
"EmcRecGeoSvc",iGeoSvc);
29 if(sc!=StatusCode::SUCCESS) {
34 for(cit=aShower.
Begin();cit!=aShower.
End();cit++){
35 etot+=(cit->second.getEnergy()*cit->second.getFraction());
39 for(cit=aShower.
Begin();cit!=aShower.
End();cit++){
40 w=(cit->second.getEnergy()*cit->second.getFraction());
48 cout<<
"[[[[[[[[[[[[[[["<<wsum;
63 unsigned int theModule;
65 theModule = 43 - thetaModule;
67 posCorr.setZ(-posCorr.z());
69 theModule = thetaModule;
73 double IRShift, parTheta[5];
76 double par[5] = { 1.698, -1.553, 0.9384, 0.1193, -0.01916 };
77 for(
int i=0;i<5;i++) {
80 }
else if(theModule==20) {
82 double par[5] = { 1.593, -1.582, 0.8881, 0.3298, -0.08856 };
83 for(
int i=0;i<5;i++) {
88 double par[5] = { 1.605, -1.702, 0.8433, 0.3072, -0.1809 };
89 for(
int i=0;i<5;i++) {
100 double theta01,theta23,
length,d;
101 theta01 = (center01-IR).theta();
102 theta23 = (center23-IR).theta();
103 length = (center01-IR).mag();
108 double xIn,xOut,deltaTheta;
109 xIn =
length*
tan(theta01-(posCorr-IR).theta())-d/2;
110 xOut = xIn-(parTheta[0]*atan(xIn*parTheta[1]-parTheta[4])+parTheta[2]*xIn+parTheta[3]);
111 deltaTheta = atan((xOut+d/2)/
length)-atan((xIn+d/2)/
length);
114 double parPhi1[5] = { 0.7185, -2.539, 0.6759, 0.3472, -0.3108 };
115 double parPhi2[5] = { 0.5781, -2.917, 0.5516, -0.5745, 0.3777 };
117 for(
int i=0;i<5;i++) {
118 parPhi[i] = (parPhi1[i]+parPhi2[i])/2;
121 double yIn,yOut,deltaPhi;
122 yIn = posCorr.phi() < 0 ? posCorr.phi()*180./CLHEP::pi+360.-phiModule*3.-1.1537
123 : posCorr.phi()*180./CLHEP::pi-phiModule*3.-1.1537;
124 yOut = parPhi[0]*atan(yIn*parPhi[1]-parPhi[4])+parPhi[2]*yIn+parPhi[3];
125 deltaPhi = yOut*CLHEP::pi/180.;
129 rotateVector.rotateZ(posCorr.phi());
130 posCorr.setZ(posCorr.z()-IRShift);
131 posCorr.rotate(-deltaTheta,rotateVector);
132 posCorr.setZ(posCorr.z()+IRShift);
134 posCorr.rotateZ(-0.002994);
138 posCorr.setZ(-posCorr.z());
145 if(aShower.
energy()<1e-5)
return;
148 double dtheta,dphi,dx,dy,dz;
151 theta = posCorr.theta();
179 HepSymMatrix matrix(3);
181 matrix[1][1]=dtheta*dtheta;
182 matrix[2][2]=dphi*dphi;
188 HepMatrix matrix1(3,3),matrix2(3,3);
189 matrix1[0][0]=
sin(theta)*
cos(phi);
190 matrix1[0][1]=r*
cos(theta)*
cos(phi);
191 matrix1[0][2]=-r*
sin(theta)*
sin(phi);
192 matrix1[1][0]=
sin(theta)*
sin(phi);
193 matrix1[1][1]=r*
cos(theta)*
sin(phi);
194 matrix1[1][2]=r*
sin(theta)*
cos(phi);
195 matrix1[2][0]=
cos(theta);
196 matrix1[2][1]=-r*
sin(theta);
200 for(
int i=0;i<3;i++) {
201 for(
int j=0;j<3;j++) {
202 matrix2[i][j]=matrix1[j][i];
207 HepMatrix matrix4(3,3);
208 matrix4=matrix1*matrix*matrix2;
211 HepSymMatrix matrix5(3);
212 for(
int i=0;i<3;i++) {
213 for(
int j=0;j<=i;j++) {
214 matrix5[i][j]=matrix4[i][j];
double tan(const BesAngle a)
double sin(const BesAngle a)
double cos(const BesAngle a)
void setDtheta(double dt)
void setPosition(const HepPoint3D &pos)
void setErrorMatrix(const HepSymMatrix &error)
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 barrel_ec(const Identifier &id)
Values of different levels (failure returns 0)
static unsigned int theta_module(const Identifier &id)
static unsigned int phi_module(const Identifier &id)
static EmcRecParameter & GetInstance()
double SigTheta(int n) const
double SigPhi(int n) const
virtual void Position(RecEmcShower &aShower)
virtual double GetBarrelR() const =0
virtual HepPoint3D GetCFrontCenter(const Identifier &id) const =0
virtual HepPoint3D GetCrystalPoint(const Identifier &id, const int i) const =0
RecEmcFractionMap::const_iterator End() const
RecEmcID getShowerId() const
RecEmcFractionMap::const_iterator Begin() const