BOSS 7.0.5
BESIII Offline Software System
Loading...
Searching...
No Matches
EmcRecTofMatch.cxx
Go to the documentation of this file.
1//
2// Match Emc Shower and Tof Hit
3//
4// He Miao 2006, 9, 15
5//
6#include "EmcRec/EmcRecTofMatch.h"
7#include "EmcRec/EmcRecParameter.h"
8
10{}
11
13{}
14
16 RecEmcTofHitMap& tofHitMap)
17{
18 RecEmcShowerMap::iterator iShowerMap;
19 for(iShowerMap=aShowerMap.begin();
20 iShowerMap!=aShowerMap.end();
21 iShowerMap++) {
22
23 // calculate matching window
24 double eShower = iShowerMap->second.e5x5();
25 double matWindow = 0;
26 if(eShower>0) {
27 matWindow = 0.01277+0.004268/sqrt(eShower);
28 }
29
30 double phi = iShowerMap->second.phi();
31 phi = phi < 0 ? phi+CLHEP::twopi : phi;
32
33 int nphi1 = (int)(phi*88./CLHEP::twopi); //tof layer1 number
34 int nphi2 = (int)(phi*88./CLHEP::twopi+0.5); //tof layer2 number
35 nphi2 += 88;
36
37 //find max energy in both layer of tof
38 int nphi1max=nphi1;
39 double emax=tofHitMap[nphi1].Energy();
40 if(tofHitMap[nphi1-1].Energy() > emax) {
41 emax = tofHitMap[nphi1-1].Energy();
42 nphi1max = nphi1-1;
43 }
44 if(tofHitMap[nphi1+1].Energy() > emax) {
45 emax = tofHitMap[nphi1+1].Energy();
46 nphi1max = nphi1+1;
47 }
48 nphi1 = nphi1max;
49
50 int nphi2max=nphi2;
51 emax=tofHitMap[nphi2].Energy();
52 if(tofHitMap[nphi2-1].Energy() > emax) {
53 emax = tofHitMap[nphi2-1].Energy();
54 nphi2max = nphi2-1;
55 }
56 if(tofHitMap[nphi2+1].Energy() > emax) {
57 emax = tofHitMap[nphi2+1].Energy();
58 nphi2max = nphi2+1;
59 }
60 nphi2 = nphi2max;
61
62 double etof2x1=0;
63 double etof2x3=0;
64 int nphi[6] = { nphi1-1, nphi1, nphi1+1, nphi2-1, nphi2, nphi2+1 };
65
66 for(int i=0;i<6;i++) {
67
68 if(tofHitMap[nphi[i]].Energy()<=0) continue;
69
70 HepPoint3D pos=tofHitMap[nphi[i]].Position();
71 /*if(i<1) {
72 //tof layer1 center
73 pos = HepPoint3D(0,838.5,tofHitMap[nphi[i]].ZPosition());
74 } else {
75 //tof layer2 center
76 pos = HepPoint3D(0,895.5,tofHitMap[nphi[i]].ZPosition());
77 }*/
78
79 //matching window
80 if(fabs(pos.theta()-iShowerMap->second.theta())<3*matWindow) {
81 etof2x3 += tofHitMap[nphi[i]].Energy();
82 if( i==1 || i==4 ) {
83 etof2x1 += tofHitMap[nphi[i]].Energy();
84 }
85 }
86
87 tofHitMap[nphi[i]].Energy(0);
88 }
89
90 double ecorr = iShowerMap->second.e5x5() + etof2x3/GeV;
91
92 iShowerMap->second.ETof2x3(etof2x3/GeV);
93 iShowerMap->second.ETof2x1(etof2x1/GeV);
94 iShowerMap->second.setEnergy(ECorrection(ecorr));
95 }
96}
97
99{
101
102 RecEmcEnergy eOut=0;
103 double par[4];
104 for(int i=0;i<4;i++) {
105 par[i]=Para.ECorr(i);
106 }
107
108 eOut = eIn/(par[0]+par[1]*eIn+par[2]*eIn*eIn+par[3]*eIn*eIn*eIn);
109 return eOut;
110}
map< RecEmcID, RecEmcShower, less< RecEmcID > > RecEmcShowerMap
map< int, RecEmcTofHit, less< int > > RecEmcTofHitMap
double ECorr(int n) const
static EmcRecParameter & GetInstance()
RecEmcEnergy ECorrection(const RecEmcEnergy eIn)
void Match(RecEmcShowerMap &aShowerMap, RecEmcTofHitMap &tofHitMap)