BOSS 7.1.2
BESIII Offline Software System
Loading...
Searching...
No Matches
EmcRecShowerEnergy.cxx
Go to the documentation of this file.
1
5
7{
8 RecEmcFractionMap::const_iterator cit;
10 RecEmcEnergy e9=0;
11 RecEmcEnergy e25=0;
12 RecEmcEnergy elepton=0;
13 RecEmcEnergy eall=0;
14
16
17 RecEmcID CellId=aShower.getShowerId();
18 int module=EmcID::barrel_ec(CellId);
19 RecEmcIDVector NearCell=nhb.GetNeighbors(CellId);
20 RecEmcIDVector NextNearCell=nhb.GetNextNeighbors(CellId);
21 RecEmcIDVector tmpNearCell;
22 RecEmcIDVector tmpNextNearCell;
23 i_RecEmcIDVector pNearCell;
24 i_RecEmcIDVector pNextNearCell;
25 vector<RecEmcEnergy> eVec;
26 vector<RecEmcEnergy>::const_iterator ciVec;
27
28 tmpNearCell.push_back(CellId);
29 tmpNextNearCell.push_back(CellId);
30
31 cit=aShower.Find(CellId);
32 //int time_seed = cit->second.getTime();
33 e1=(cit->second.getEnergy())*(cit->second.getFraction());
34 e9+=(cit->second.getEnergy())*(cit->second.getFraction());
35 e25+=(cit->second.getEnergy())*(cit->second.getFraction());
36
37 //e3x3
38 for(pNearCell=NearCell.begin();
39 pNearCell!=NearCell.end();
40 pNearCell++) {
41 cit=aShower.Find(*pNearCell);
42 if(cit!=aShower.End()) {
43 tmpNearCell.push_back(*pNearCell);
44 tmpNextNearCell.push_back(*pNearCell);
45 e9+=cit->second.getEnergy()*cit->second.getFraction();
46 e25+=cit->second.getEnergy()*cit->second.getFraction();
47 }
48 }
49
50 //e5x5
51 for(pNextNearCell=NextNearCell.begin();
52 pNextNearCell!=NextNearCell.end();
53 pNextNearCell++) {
54 cit=aShower.Find(*pNextNearCell);
55 if(cit!=aShower.End()) {
56 tmpNextNearCell.push_back(*pNextNearCell);
57 e25+=cit->second.getEnergy()*cit->second.getFraction();
58 }
59 }
60
61 //eall
62 for(cit=aShower.Begin();cit!=aShower.End();++cit) {
63 eall+=(cit->second.getEnergy())*(cit->second.getFraction());
64 eVec.push_back(cit->second.getEnergy()*cit->second.getFraction());
65 }
66
67 //calculate number of hits from MC
68 int nHit,n;
70 nHit=(int)(Para.HitNb(0)*log(Para.HitNb(1)*e9+Para.HitNb(2)));
71 n=0;
72
73 //sort by energy
74 sort(eVec.begin(), eVec.end(), greater<RecEmcEnergy>());
75
76 for(ciVec=eVec.begin();ciVec!=eVec.end();ciVec++) {
77 if(n<nHit) {
78 elepton+=*ciVec;
79 n++;
80 }
81 }
82
83 //energy correction
84 //RecEmcEnergy eCorr=ECorrTheta(e25,CellId);
85 //RecEmcEnergy eCorr=ECorrection(e25);
86 int getthetaid = EmcID::theta_module(CellId);
87 int getmodule = EmcID::barrel_ec(CellId);
88 if(getthetaid>21)getthetaid=43-getthetaid;
89 if(getmodule==1)getthetaid=getthetaid+6;
90 double dthetaid=double(getthetaid);
91 double eCorr = Para.ECorrMC(e25,dthetaid);
92
93 //energy error
94 RecEmcEnergy de,de1,de2,de3;
95 de1 = Para.SigE(0)/eCorr;
96 de2 = Para.SigE(1)/pow(eCorr,0.25);
97 de3 = Para.SigE(2);
98 de = sqrt(de1*de1+de2*de2+de3*de3)*perCent*eCorr;
99
100 double err = Para.ErrMC(e25,dthetaid);
101 if(err>0) de = err*e25;
102
103 aShower.setTrackId(-1);
104 aShower.setCellId(CellId);
105 aShower.setModule(module);
106 aShower.setNumHits(aShower.getSize());
107 aShower.setDE(de);
108 aShower.CellId3x3(tmpNearCell);
109 aShower.CellId5x5(tmpNextNearCell);
110 aShower.setESeed(e1);
111 aShower.setE3x3(e9);
112 aShower.setE5x5(e25);
113 aShower.ELepton(elepton);
114 aShower.EAll(eall);
115 aShower.setEnergy(eCorr);
116
117 //cout<<"e1="<<aShower.eSeed()
118 // <<"\te9="<<aShower.e3x3()
119 // <<"\te25="<<aShower.e5x5()
120 // <<"\telepton="<<aShower.getELepton()
121 // <<"\teall="<<aShower.getEAll()
122 // <<"\tenergy="<<aShower.energy()<<endl;
123}
124
126{
127 if(eIn>3.) return eIn;
128
130
131 RecEmcEnergy eOut=0;
132 double par[4];
133 for(int i=0;i<4;i++) {
134 par[i]=Para.ECorr(i);
135 }
136
137 eOut = eIn/(par[0]+par[1]*eIn+par[2]*eIn*eIn+par[3]*eIn*eIn*eIn);
138 return eOut;
139}
140
142{
144 RecEmcEnergy eOut=eIn;
145
146 unsigned int npart = EmcID::barrel_ec(id);
147 unsigned int ntheta = EmcID::theta_module(id);
148
149 if(npart==1) {
150 eOut *= 1.843/Para.Peak(ntheta);
151 } else if(npart==0) {
152 eOut *= 1.843/Para.Peak(ntheta+44);
153 } else if(npart==2) {
154 eOut *= 1.843/Para.Peak(ntheta+50);
155 }
156
157 return eOut;
158}
const Int_t n
Double_t e1
RecEmcIDVector::iterator i_RecEmcIDVector
double RecEmcEnergy
vector< RecEmcID > RecEmcIDVector
void setE3x3(double e3x3)
void setNumHits(int hit)
void setDE(double de)
void setESeed(double eSeed)
void setModule(int mod)
void setCellId(int id)
void setTrackId(int trackId)
void setEnergy(double e)
void setE5x5(double e5x5)
static unsigned int barrel_ec(const Identifier &id)
Values of different levels (failure returns 0)
Definition EmcID.cxx:38
static unsigned int theta_module(const Identifier &id)
Definition EmcID.cxx:43
RecEmcIDVector GetNeighbors(const Identifier &id)
RecEmcIDVector GetNextNeighbors(const Identifier &id)
double ECorr(int n) const
double SigE(int n) const
double ECorrMC(double eg, double theid) const
static EmcRecParameter & GetInstance()
double HitNb(int n) const
double Peak(int n) const
double ErrMC(double eg, double theid) const
RecEmcEnergy ECorrection(const RecEmcEnergy eIn)
RecEmcEnergy ECorrTheta(const RecEmcEnergy eIn, const RecEmcID &id)
void Energy(RecEmcShower &aShower)
RecEmcFractionMap::const_iterator End() const
void CellId3x3(RecEmcIDVector &id3x3)
RecEmcEnergy EAll(RecEmcEnergy e)
RecEmcEnergy ELepton(RecEmcEnergy e)
RecEmcID getShowerId() const
RecEmcFractionMap::const_iterator Begin() const
RecEmcFractionMap::const_iterator Find(const RecEmcID &CellId) const
unsigned int getSize() const
void CellId5x5(RecEmcIDVector &id5x5)