BOSS 7.0.9
BESIII Offline Software System
Loading...
Searching...
No Matches
EmcRecShowerShape.cxx
Go to the documentation of this file.
1
4
5#include "EmcRec/EmcRecParameter.h" //
6
7#include <vector>
8#include <complex>
9
11{
12
13 SecondMoment(aShower);
14 LatMoment(aShower);
15 A20Moment(aShower);
16 A42Moment(aShower);
17}
18
20{
21 double etot=0;
22 double sum=0;
23 HepPoint3D center(aShower.position());
24 RecEmcFractionMap fracMap=aShower.getFractionMap5x5();
25
26 RecEmcFractionMap::const_iterator it;
27 for(it=fracMap.begin();
28 it!=fracMap.end();
29 it++){
30 HepPoint3D pos(it->second.getFrontCenter()); //digi front center
31
32 //////////////////////////
34 if(Para.DataMode()==1) {
35
36 RecEmcID id = it->second.getCellId();
37 const unsigned int module = EmcID::barrel_ec(id);
38 const unsigned int thetaModule = EmcID::theta_module(id);
39 const unsigned int phiModule = EmcID::phi_module(id);
40 double lengthemc;//
41 lengthemc = abs(pos.z()/cos(pos.theta()));//
42 double posDataCorPar;
43 if(module==1) posDataCorPar=Para.BarrPosDataCor(thetaModule,phiModule);
44 if(module==0) posDataCorPar=Para.EastPosDataCor(thetaModule,phiModule);
45 if(module==2) posDataCorPar=Para.WestPosDataCor(thetaModule,phiModule);
46 // cout<<module<<"\t"<<thetaModule<<"\t"<<phiModule<< " "<< posDataCorPar<<endl;
47 pos.setTheta(pos.theta()-posDataCorPar/lengthemc);
48 // cout<<"poscor"<<pos<< " "<<endl;
49 }
50
51 ///////////////////////////////////
52
53 etot+=it->second.getEnergy()*it->second.getFraction();
54 sum+=it->second.getEnergy()*it->second.getFraction()*pos.distance2(center);
55 }
56
57 if(etot>0) {
58 sum/=etot;
59 }
60
61 aShower.setSecondMoment(sum);
62}
63
65{
66 RecEmcFractionMap fracMap=aShower.getFractionMap5x5();
67 if(fracMap.size()<2) {
68 aShower.setLatMoment(0);
69 return;
70 }
71
72 vector<RecEmcFraction> aFractionVec;
73 RecEmcFractionMap::const_iterator it;
74 for(it=fracMap.begin();
75 it!=fracMap.end();
76 it++){
77 aFractionVec.push_back(it->second);
78 }
79
80 //find the largest 2 energy
81 partial_sort(aFractionVec.begin(),
82 aFractionVec.begin()+2,
83 aFractionVec.end(),
84 greater<RecEmcFraction>());
85
86 //caculate LAT
87 vector<RecEmcFraction>::iterator iVec;
88 double numerator=0;
89 double denominator=0;
90 int n=0;
91 for(iVec=aFractionVec.begin();
92 iVec!=aFractionVec.end();
93 iVec++) {
94 n++;
95 HepPoint3D pos((*iVec).getFrontCenter()); //digi front center
96
97 //////////////////////////
99 if(Para.DataMode()==1) {
100
101 RecEmcID id = (*iVec).getCellId();
102 const unsigned int module = EmcID::barrel_ec(id);
103 const unsigned int thetaModule = EmcID::theta_module(id);
104 const unsigned int phiModule = EmcID::phi_module(id);
105 double lengthemc;//
106 lengthemc = abs(pos.z()/cos(pos.theta()));//
107 double posDataCorPar;
108 if(module==1) posDataCorPar=Para.BarrPosDataCor(thetaModule,phiModule);
109 if(module==0) posDataCorPar=Para.EastPosDataCor(thetaModule,phiModule);
110 if(module==2) posDataCorPar=Para.WestPosDataCor(thetaModule,phiModule);
111 // cout<<module<<"\t"<<thetaModule<<"\t"<<phiModule<< " "<< posDataCorPar<<endl;
112 pos.setTheta(pos.theta()-posDataCorPar/lengthemc);
113 // cout<<"poscor"<<pos<< " "<<endl;
114 }
115
116 ///////////////////////////////////
117
118 double r=pos.mag()*sin(aShower.position().angle(pos));
119
120 double energy=(*iVec).getEnergy()*(*iVec).getFraction();
121 if(n<3) {
122 denominator+=5.2*5.2*energy;
123 } else {
124 numerator+=r*r*energy;
125 denominator+=r*r*energy;
126 }
127 }
128 double lat=-99;
129 if(denominator>0) lat=numerator/denominator;
130
131 aShower.setLatMoment(lat);
132
133}
134
136{
137 double a20=0;
138 const double R0=15.6;
139 Hep3Vector r0(aShower.position()); //shower center
140 RecEmcFractionMap fracMap=aShower.getFractionMap5x5();
141 RecEmcFractionMap::const_iterator it;
142 for(it=fracMap.begin();
143 it!=fracMap.end();
144 it++){
145 double energy=it->second.getEnergy()*it->second.getFraction();
146 HepPoint3D pos(it->second.getFrontCenter()); //digi front center
147
148 Hep3Vector r=pos-r0;
149 r=r-r.dot(r0)*r0/(r0.mag()*r0.mag());
150
151 a20+=(energy/aShower.e5x5())*(2*pow(r.mag()/R0,2.)-1);
152 }
153
154 aShower.setA20Moment(fabs(a20));
155}
156
158{
159 complex<double> a42(0.,0.);
160 const double R0=15.6;
161 Hep3Vector r0(aShower.position()); //shower center
162 RecEmcFractionMap fracMap=aShower.getFractionMap5x5();
163 RecEmcFractionMap::const_iterator it;
164 for(it=fracMap.begin();
165 it!=fracMap.end();
166 it++){
167 double energy=it->second.getEnergy()*it->second.getFraction();
168 HepPoint3D pos(it->second.getFrontCenter()); //digi front center
169
170 Hep3Vector r=pos-r0;
171 r=r-r.dot(r0)*r0/(r0.mag()*r0.mag());
172
173 complex<double> a(0.,2.*r.phi());
174
175 a42+=(energy/aShower.e5x5())*(4.*pow(r.mag()/R0,4.)-3.*pow(r.mag()/R0,2.))*exp(a);
176 }
177
178 aShower.setA42Moment(abs(a42));
179}
double sin(const BesAngle a)
Definition: BesAngle.h:210
double cos(const BesAngle a)
Definition: BesAngle.h:213
const Int_t n
Double_t etot
************Class m_ypar INTEGER m_KeyWgt INTEGER m_KeyIHVP INTEGER m_KeyGPS INTEGER m_IsBeamPolarized INTEGER m_EvtGenInterface DOUBLE PRECISION m_Emin DOUBLE PRECISION m_sphot DOUBLE PRECISION m_Xenph DOUBLE PRECISION m_q2 DOUBLE PRECISION m_PolBeam2 DOUBLE PRECISION m_xErrPb *COMMON c_KK2f $ !CMS energy average $ !Spin Polarization vector first beam $ !Spin Polarization vector second beam $ !Beam energy spread[GeV] $ !minimum hadronization energy[GeV] $ !input READ never touch them !$ !debug facility $ !maximum weight $ !inverse alfaQED $ !minimum real photon energy
Definition: KK2f.h:50
map< RecEmcID, RecEmcFraction, less< RecEmcID > > RecEmcFractionMap
EvtComplex exp(const EvtComplex &c)
HepPoint3D position() const
Definition: DstEmcShower.h:34
double e5x5() const
Definition: DstEmcShower.h:49
void setSecondMoment(double secondMoment)
Definition: DstEmcShower.h:71
void setA20Moment(double a20Moment)
Definition: DstEmcShower.h:73
void setA42Moment(double a42Moment)
Definition: DstEmcShower.h:74
void setLatMoment(double latMoment)
Definition: DstEmcShower.h:72
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
static unsigned int phi_module(const Identifier &id)
Definition: EmcID.cxx:48
static EmcRecParameter & GetInstance()
double EastPosDataCor(int ntheta, int nphi) const
double WestPosDataCor(int ntheta, int nphi) const
double BarrPosDataCor(int ntheta, int nphi) const
double DataMode() const
void SecondMoment(RecEmcShower &aShower) const
void CalculateMoment(RecEmcShower &aShower) const
void LatMoment(RecEmcShower &aShower) const
void A20Moment(RecEmcShower &aShower) const
void A42Moment(RecEmcShower &aShower) const
RecEmcFractionMap getFractionMap5x5() const