13 {
14 RecEmcShowerMap::iterator iShowerMap;
15 for ( iShowerMap = aShowerMap.begin(); iShowerMap != aShowerMap.end(); iShowerMap++ )
16 {
17
18
19 double eShower = iShowerMap->second.e5x5();
20 double matWindow = 0;
21 if ( eShower > 0 ) { matWindow = 0.01277 + 0.004268 / sqrt( eShower ); }
22
23 double phi = iShowerMap->second.phi();
24 phi = phi < 0 ? phi + CLHEP::twopi : phi;
25
26 int nphi1 = (int)( phi * 88. / CLHEP::twopi );
27 int nphi2 = (int)( phi * 88. / CLHEP::twopi + 0.5 );
28 nphi2 += 88;
29
30
31 int nphi1max = nphi1;
32 double emax = tofHitMap[nphi1].Energy();
33 if ( tofHitMap[nphi1 - 1].Energy() > emax )
34 {
35 emax = tofHitMap[nphi1 - 1].Energy();
36 nphi1max = nphi1 - 1;
37 }
38 if ( tofHitMap[nphi1 + 1].Energy() > emax )
39 {
40 emax = tofHitMap[nphi1 + 1].Energy();
41 nphi1max = nphi1 + 1;
42 }
43 nphi1 = nphi1max;
44
45 int nphi2max = nphi2;
46 emax = tofHitMap[nphi2].Energy();
47 if ( tofHitMap[nphi2 - 1].Energy() > emax )
48 {
49 emax = tofHitMap[nphi2 - 1].Energy();
50 nphi2max = nphi2 - 1;
51 }
52 if ( tofHitMap[nphi2 + 1].Energy() > emax )
53 {
54 emax = tofHitMap[nphi2 + 1].Energy();
55 nphi2max = nphi2 + 1;
56 }
57 nphi2 = nphi2max;
58
59 double etof2x1 = 0;
60 double etof2x3 = 0;
61 int nphi[6] = { nphi1 - 1, nphi1, nphi1 + 1, nphi2 - 1, nphi2, nphi2 + 1 };
62
63 for ( int i = 0; i < 6; i++ )
64 {
65
66 if ( tofHitMap[nphi[i]].Energy() <= 0 ) continue;
67
68 HepPoint3D pos = tofHitMap[nphi[i]].Position();
69
70
71
72
73
74
75
76
77
78 if ( fabs( pos.theta() - iShowerMap->second.theta() ) < 3 * matWindow )
79 {
80 etof2x3 += tofHitMap[nphi[i]].Energy();
81 if ( i == 1 || i == 4 ) { etof2x1 += tofHitMap[nphi[i]].Energy(); }
82 }
83
84 tofHitMap[nphi[i]].Energy( 0 );
85 }
86
87 double ecorr = iShowerMap->second.e5x5() + etof2x3 / GeV;
88
89 iShowerMap->second.ETof2x3( etof2x3 / GeV );
90 iShowerMap->second.ETof2x1( etof2x1 / GeV );
91 iShowerMap->second.setEnergy(
ECorrection( ecorr ) );
92 }
93}
HepGeom::Point3D< double > HepPoint3D
RecEmcEnergy ECorrection(const RecEmcEnergy eIn)