21 RecEmcFractionMap::const_iterator cit;
22 HepPoint3D pos( 0, 0, 0 );
23 HepPoint3D posMax( 0, 0, 0 );
24 HepPoint3D possum( 0, 0, 0 );
31 ISvcLocator* svcLocator = Gaudi::svcLocator();
32 StatusCode sc = svcLocator->service(
"EmcRecGeoSvc", iGeoSvc );
33 if ( sc != StatusCode::SUCCESS )
40 for ( cit = aShower.
Begin(); cit != aShower.
End(); cit++ )
42 etot += ( cit->second.getEnergy() * cit->second.getFraction() );
47 double etota = aShower.
getEAll();
48 double ltot = ( log( etota / 0.0145 ) + 0.5 ) * 1.86;
49 double e55 = aShower.
e5x5();
50 double len55 = ( log( etota / 0.0145 ) + 0.5 ) * 1.86;
55 for ( cit = aShower.
Begin(); cit != aShower.
End(); cit++ )
57 w = ( cit->second.getEnergy() * cit->second.getFraction() );
59 HepPoint3D hitPoint( iGeoSvc->
GetCFrontCenter( cit->second.getCellId() ) );
62 double theDistance = 0;
63 if ( cit->second.getCellId() == seedID )
66 theDistance = ( seedPoint.mag() + ltot );
70 theDistance = ( seedPoint.mag() + ltot ) /
cos( seedPoint.angle( hitPoint ) );
78 posMax = ( theDistance / pos.mag() ) * pos;
83 if ( wsum <= 0 ) { cout <<
"[[[[[[[[[[[[[[[" << wsum; }
96 HepPoint3D posCorr( pos );
100 unsigned int theModule;
101 if ( thetaModule > 21 )
103 theModule = 43 - thetaModule;
105 posCorr.setZ( -posCorr.z() );
107 else { theModule = thetaModule; }
109 double IRShift, parTheta[5], parPhi[5];
110 if ( theModule == 21 ) { IRShift = 0; }
111 else if ( theModule == 20 ) { IRShift = 2.5; }
112 else { IRShift = 5.; }
116 for (
int i = 0; i < 5; i++ )
120 else if ( e55 <= 1.0 && e55 > 0.5 )
125 else if ( e55 <= 1.0 && e55 > 0.5 ) parPhi[i] = Para.
BarrShLinPhiPara( 1, i );
129 HepPoint3D IR( 0, 0, IRShift );
130 HepPoint3D center01, center23;
134 double theta01, theta23, length, d;
135 theta01 = ( center01 - IR ).theta();
136 theta23 = ( center23 - IR ).theta();
137 length = ( center01 - IR ).mag();
138 d = length *
tan( theta01 - theta23 );
140 double xIn, xOut, deltaTheta;
141 xIn = length *
tan( theta01 - ( posCorr - IR ).theta() ) - d / 2;
142 xOut = xIn - ( parTheta[0] * atan( xIn * parTheta[1] - parTheta[4] ) + parTheta[2] * xIn +
144 deltaTheta = atan( ( xOut + d / 2 ) / length ) - atan( ( xIn + d / 2 ) / length );
149 double yIn, yOut, deltaPhi;
151 if ( phiModule == 0 && posCorr.phi() < 0 )
152 { yIn = posCorr.phi() * 180. / CLHEP::pi + 360. - 119 * 3 - 1.843; }
153 else if ( phiModule == 119 && posCorr.phi() > 0 )
154 { yIn = posCorr.phi() * 180. / CLHEP::pi - 1.843; }
158 yIn = posCorr.phi() < 0
159 ? posCorr.phi() * 180. / CLHEP::pi + 360. - phiModule * 3. - 1.843
160 : posCorr.phi() * 180. / CLHEP::pi - phiModule * 3. - 1.843;
162 yOut = parPhi[0] * atan( yIn * parPhi[1] - parPhi[4] ) + parPhi[2] * yIn + parPhi[3];
167 deltaPhi = yOut * CLHEP::pi / 180.;
169 HepPoint3D rotateVector( 0, 1, 0 );
170 rotateVector.rotateZ( center01.phi() );
171 posCorr.setZ( posCorr.z() - IRShift );
172 posCorr.rotate( -deltaTheta, rotateVector );
173 posCorr.setZ( posCorr.z() + IRShift );
176 posCorr.rotateZ( -deltaPhi );
178 if ( thetaModule > 21 ) { posCorr.setZ( -posCorr.z() ); }
180 posCorr = ( ( posCorr.mag() - len55 ) / posCorr.mag() ) * posCorr;
185 if ( aShower.
energy() < 1e-5 )
return;
187 double r, theta, phi;
188 double dtheta, dphi, dx, dy, dz;
191 theta = posCorr.theta();
195 if ( aShower.
energy() > 0 )
210 dz = fabs( iGeoSvc->
GetBarrelR() * dtheta / (
sin( theta ) *
sin( theta ) ) );
219 HepSymMatrix matrix( 3 );
221 matrix[1][1] = dtheta * dtheta;
222 matrix[2][2] = dphi * dphi;
228 HepMatrix matrix1( 3, 3 ), matrix2( 3, 3 );
229 matrix1[0][0] =
sin( theta ) *
cos( phi );
230 matrix1[0][1] = r *
cos( theta ) *
cos( phi );
231 matrix1[0][2] = -r *
sin( theta ) *
sin( phi );
232 matrix1[1][0] =
sin( theta ) *
sin( phi );
233 matrix1[1][1] = r *
cos( theta ) *
sin( phi );
234 matrix1[1][2] = r *
sin( theta ) *
cos( phi );
235 matrix1[2][0] =
cos( theta );
236 matrix1[2][1] = -r *
sin( theta );
240 for (
int i = 0; i < 3; i++ )
242 for (
int j = 0; j < 3; j++ ) { matrix2[i][j] = matrix1[j][i]; }
246 HepMatrix matrix4( 3, 3 );
247 matrix4 = matrix1 * matrix * matrix2;
250 HepSymMatrix matrix5( 3 );
251 for (
int i = 0; i < 3; i++ )
253 for (
int j = 0; j <= i; j++ ) { matrix5[i][j] = matrix4[i][j]; }
259 if ( matrix5[0][0] > 0 ) dx = sqrt( matrix5[0][0] );
260 if ( matrix5[1][1] > 0 ) dy = sqrt( matrix5[1][1] );
261 if ( matrix5[2][2] > 0 ) dz = sqrt( matrix5[2][2] );