19 RecEmcFractionMap::const_iterator cit;
27 ISvcLocator* svcLocator = Gaudi::svcLocator();
28 StatusCode sc = svcLocator->service(
"EmcRecGeoSvc",iGeoSvc);
29 if(sc!=StatusCode::SUCCESS) {
35 double e5x5 = aShower.
e5x5();
39 for(cit=aShower.
Begin();cit!=aShower.
End();cit++){
40 etot+=(cit->second.getEnergy()*cit->second.getFraction());
43 for(cit=aShower.
Begin();cit!=aShower.
End();cit++){
44 w=(cit->second.getEnergy()*cit->second.getFraction());
51 cout<<
"[[[[[[[[[[[[[[["<<wsum;
71 unsigned int theModule;
73 theModule = 43 - thetaModule;
75 posCorr.setZ(-posCorr.z());
77 theModule = thetaModule;
82 double IRShift, parTheta[5],parPhi[5];
87 }
else if(theModule==20) {
99 double par[5] = { 1.698, -1.553, 0.9384, 0.1193, -0.01916 };
100 parTheta[i] = par[i];
101 }
else if(theModule==20){
102 double par[5] = { 1.593, -1.582, 0.8881, 0.3298, -0.08856 };
103 parTheta[i] = par[i];
105 double par[5] = { 1.605, -1.702, 0.8433, 0.3072, -0.1809 };
106 parTheta[i] = par[i];
112 for(
int i=0;i<5;i++){
115 else if(e5x5<=1.0 && e5x5>0.5) parTheta[i] = Para.
BarrLinThetaPara(theModule+22,i);
119 else if(e5x5<=1.0 && e5x5>0.5) parPhi[i] = Para.
BarrLinPhiPara(1,i);
133 double theta01,theta23,length,d;
134 theta01 = (center01-IR).theta();
135 theta23 = (center23-IR).theta();
136 length = (center01-IR).mag();
137 d = length*
tan(theta01-theta23);
141 double xIn,xOut,deltaTheta;
142 xIn = length*
tan(theta01-(posCorr-IR).theta())-d/2;
143 xOut = xIn-(parTheta[0]*atan(xIn*parTheta[1]-parTheta[4])+parTheta[2]*xIn+parTheta[3]);
144 deltaTheta = atan((xOut+d/2)/length)-atan((xIn+d/2)/length);
147 double parPhi1[5] = { 0.7185, -2.539, 0.6759, 0.3472, -0.3108 };
148 double parPhi2[5] = { 0.5781, -2.917, 0.5516, -0.5745, 0.3777 };
156 double yIn,yOut,deltaPhi;
159 if(phiModule==0&&posCorr.phi()<0){
161 yIn = posCorr.phi()*180./CLHEP::pi+360.-119*3-1.843;
163 }
else if (phiModule==119&&posCorr.phi()>0){
165 yIn = posCorr.phi()*180./CLHEP::pi-1.843;
169 yIn = posCorr.phi() < 0 ? posCorr.phi()*180./CLHEP::pi+360.-phiModule*3.-1.843
170 : posCorr.phi()*180./CLHEP::pi-phiModule*3.-1.843;
174 yOut = parPhi[0]*atan(yIn*parPhi[1]-parPhi[4])+parPhi[2]*yIn+parPhi[3];
175 deltaPhi = yOut*CLHEP::pi/180.;
179 rotateVector.rotateZ(posCorr.phi());
180 posCorr.setZ(posCorr.z()-IRShift);
181 posCorr.rotate(-deltaTheta,rotateVector);
182 posCorr.setZ(posCorr.z()+IRShift);
184 posCorr.rotateZ(-0.002994);
186 posCorr.rotateZ(-deltaPhi);
190 posCorr.setZ(-posCorr.z());
200 double theta12=-9999,theta03=-9999,theta23=-9999,theta14=-9999,
delta=-9999;
201 double phi=-9999,phi01=-9999,phi23=-9999,phi12=-9999,phi34=-9999,deltaphi=-9999;
202 double xIn,xOut,deltaTheta,yIn,yOut,deltaPhi;
203 double posphi=posCorr.phi();
205 double parTheta[5],parPhi[5];
207 HepPoint3D point0 ,point1 ,point2 ,point3 ,point4 ;
214 HepPoint3D center,center01, center23, center12,center03,center34,center14;
215 center01 = (point0+point1)/2;
216 center23 = (point2+point3)/2;
217 center12 = (point1+point2)/2;
218 center34 = (point3+point4)/2;
219 center03 = (point0+point3)/2;
220 center14 = (point1+point4)/2;
222 phi01 = center01.phi();
223 phi23 = center23.phi();
224 phi12 = center12.phi();
225 phi34 = center34.phi();
228 if( (thetaModule==1&&((phiModule+3)%4 == 0||(phiModule+2)%4 == 0))
229 ||(thetaModule==3&&((phiModule+4)%5 == 0||(phiModule+3)%5 == 0||(phiModule+2)%5 == 0)))
243 }
else if( ((thetaModule==0||thetaModule==1)&&phiModule==63)
244 ||((thetaModule==2||thetaModule==3)&&phiModule==79)
245 ||((thetaModule==4||thetaModule==5)&&phiModule==95)
248 posphi = posphi+2*CLHEP::pi;
251 posphi = posphi < 0 ? posphi+2*CLHEP::pi : posphi;
254 phi01 = phi01 <0 ? phi01+2*CLHEP::pi : phi01;
255 phi23 = phi23 <0 ? phi23+2*CLHEP::pi : phi23;
263 for(
int i=0;i<5;i++) {
268 }
else if (module==2){
274 for(
int i=0;i<5;i++){
281 theta12 = (center12 - IR).theta();
282 theta03 = (center03 - IR).theta();
283 delta = theta03 - theta12;
284 xIn = (((posCorr-IR).theta() - theta12) -
delta*0.5)/
delta;
285 xOut = parTheta[0]*atan(xIn*parTheta[1]-parTheta[4]) + parTheta[2]*xIn + parTheta[3] ;
286 deltaTheta = xOut*
delta;
288 deltaphi = fabs(phi23 - phi01);
289 yIn = ((posphi - phi) - deltaphi*0.5)/deltaphi;
290 yOut = parPhi[0]*atan(yIn*parPhi[1]-parPhi[4]) + parPhi[2]*yIn + parPhi[3] ;
291 deltaPhi = yOut*deltaphi;
294 rotateVector.rotateZ(center.phi());
295 posCorr.setZ(posCorr.z()-IRShift);
296 posCorr.rotate(-deltaTheta,rotateVector);
297 posCorr.setZ(posCorr.z()+IRShift);
298 posCorr.rotateZ(-deltaPhi);
307 if(aShower.
energy()<1e-5)
return;
310 double dtheta,dphi,dx,dy,dz;
313 theta = posCorr.theta();
341 HepSymMatrix matrix(3);
343 matrix[1][1]=dtheta*dtheta;
344 matrix[2][2]=dphi*dphi;
350 HepMatrix matrix1(3,3),matrix2(3,3);
351 matrix1[0][0]=
sin(theta)*
cos(phi);
352 matrix1[0][1]=r*
cos(theta)*
cos(phi);
353 matrix1[0][2]=-r*
sin(theta)*
sin(phi);
354 matrix1[1][0]=
sin(theta)*
sin(phi);
355 matrix1[1][1]=r*
cos(theta)*
sin(phi);
356 matrix1[1][2]=r*
sin(theta)*
cos(phi);
357 matrix1[2][0]=
cos(theta);
358 matrix1[2][1]=-r*
sin(theta);
362 for(
int i=0;i<3;i++) {
363 for(
int j=0;j<3;j++) {
364 matrix2[i][j]=matrix1[j][i];
369 HepMatrix matrix4(3,3);
370 matrix4=matrix1*matrix*matrix2;
373 HepSymMatrix matrix5(3);
374 for(
int i=0;i<3;i++) {
375 for(
int j=0;j<=i;j++) {
376 matrix5[i][j]=matrix4[i][j];