11#include "GaudiKernel/Bootstrap.h"
12#include "GaudiKernel/ISvcLocator.h"
18 RecEmcFractionMap::const_iterator cit;
26 ISvcLocator* svcLocator = Gaudi::svcLocator();
27 StatusCode sc = svcLocator->service(
"EmcRecGeoSvc",iGeoSvc);
28 if(sc!=StatusCode::SUCCESS) {
39 for(cit=aShower.
Begin();cit!=aShower.
End();cit++){
40 w=offset+log((cit->second.getEnergy()/
etot)*cit->second.getFraction());
48 double e3x3=aShower.
e3x3();
50 for(cit=fracMap3x3.begin();
51 cit!=fracMap3x3.end();
53 w=offset+log((cit->second.getEnergy()/e3x3)*cit->second.getFraction());
61 double e5x5=aShower.
e5x5();
63 for(cit=fracMap5x5.begin();
64 cit!=fracMap5x5.end();
66 w=offset+log((cit->second.getEnergy()/e5x5)*cit->second.getFraction());
89 unsigned int theModule;
91 theModule = 43 - thetaModule;
93 posCorr.setZ(-posCorr.z());
95 theModule = thetaModule;
98 double IRShift, parTheta[5];
101 double par[5] = { 51.97, -0.1209, 6.175, -0.1431, -0.005497 };
102 for(
int i=0;i<5;i++) {
103 parTheta[i] = par[i];
105 }
else if(theModule==20) {
107 double par[5] = { 56.31, -0.1135, 6.312, -1.216, -0.02978 };
108 for(
int i=0;i<5;i++) {
109 parTheta[i] = par[i];
113 double par[5] = { 10.65, -0.2257, 2.216, -0.1562, -0.05552 };
114 for(
int i=0;i<5;i++) {
115 parTheta[i] = par[i];
124 double theta01,theta23,length,d;
125 theta01 = (center01-IR).theta();
126 theta23 = (center23-IR).theta();
127 length = (center01-IR).mag();
128 d = length*
tan(theta01-theta23);
130 double xIn,xOut,deltaTheta;
131 xIn = length*
tan(theta01-(posCorr-IR).theta())-d/2;
132 xOut = xIn-( parTheta[0]*atan(xIn*parTheta[1]-parTheta[4])
133 + parTheta[2]*xIn + parTheta[3] );
134 deltaTheta = atan((xOut+d/2)/length)-atan((xIn+d/2)/length);
140 double parPhi[5] = { 51.1, -0.1499, 7.62, 0.1301, 0.005581 };
141 double yIn,yOut,deltaPhi;
142 yIn = posCorr.phi() < 0 ? posCorr.phi()*180./CLHEP::pi+360.-phiModule*3.-1.1537
143 : posCorr.phi()*180./CLHEP::pi-phiModule*3.-1.1537;
144 yOut = parPhi[0]*atan(yIn*parPhi[1]-parPhi[4])+parPhi[2]*yIn+parPhi[3];
145 deltaPhi = yOut*CLHEP::pi/180.;
149 rotateVector.rotateZ(center01.phi());
150 posCorr.setZ(posCorr.z()-IRShift);
151 posCorr.rotate(-deltaTheta,rotateVector);
152 posCorr.setZ(posCorr.z()+IRShift);
154 posCorr.rotateZ(-0.002994);
158 posCorr.setZ(-posCorr.z());
164 if(aShower.
energy()<1e-5)
return;
167 double dtheta,dphi,dx,dy,dz;
170 theta = posCorr.theta();
197 HepSymMatrix matrix(3);
199 matrix[1][1]=dtheta*dtheta;
200 matrix[2][2]=dphi*dphi;
206 HepMatrix matrix1(3,3),matrix2(3,3);
207 matrix1[0][0]=
sin(theta)*
cos(phi);
208 matrix1[0][1]=r*
cos(theta)*
cos(phi);
209 matrix1[0][2]=-r*
sin(theta)*
sin(phi);
210 matrix1[1][0]=
sin(theta)*
sin(phi);
211 matrix1[1][1]=r*
cos(theta)*
sin(phi);
212 matrix1[1][2]=r*
sin(theta)*
cos(phi);
213 matrix1[2][0]=
cos(theta);
214 matrix1[2][1]=-r*
sin(theta);
218 for(
int i=0;i<3;i++) {
219 for(
int j=0;j<3;j++) {
220 matrix2[i][j]=matrix1[j][i];
225 HepMatrix matrix4(3,3);
226 matrix4=matrix1*matrix*matrix2;
229 HepSymMatrix matrix5(3);
230 for(
int i=0;i<3;i++) {
231 for(
int j=0;j<=i;j++) {
232 matrix5[i][j]=matrix4[i][j];
239 if(matrix5[0][0]>0) dx=sqrt(matrix5[0][0]);
240 if(matrix5[1][1]>0) dy=sqrt(matrix5[1][1]);
241 if(matrix5[2][2]>0) dz=sqrt(matrix5[2][2]);
double tan(const BesAngle a)
double sin(const BesAngle a)
double cos(const BesAngle a)
map< RecEmcID, RecEmcFraction, less< RecEmcID > > RecEmcFractionMap
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)
double LogPosOffset() const
static EmcRecParameter & GetInstance()
std::string PositionMode2() const
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
RecEmcFractionMap getFractionMap5x5() const
RecEmcID getShowerId() const
RecEmcFractionMap::const_iterator Begin() const
RecEmcEnergy getEAll() const
RecEmcFractionMap getFractionMap3x3() const