BOSS 6.6.4.p01
BESIII Offline Software System
Loading...
Searching...
No Matches
EmcRecShowerShape.cxx
Go to the documentation of this file.
1
4
5#include <vector>
6#include <complex>
7
9{
10 SecondMoment(aShower);
11 LatMoment(aShower);
12 A20Moment(aShower);
13 A42Moment(aShower);
14}
15
17{
18 double etot=0;
19 double sum=0;
20 HepPoint3D center(aShower.position());
21
22 RecEmcFractionMap fracMap=aShower.getFractionMap5x5();
23 RecEmcFractionMap::const_iterator it;
24 for(it=fracMap.begin();
25 it!=fracMap.end();
26 it++){
27 HepPoint3D pos(it->second.getFrontCenter()); //digi front center
28 etot+=it->second.getEnergy()*it->second.getFraction();
29 sum+=it->second.getEnergy()*it->second.getFraction()*pos.distance2(center);
30 }
31
32 if(etot>0) {
33 sum/=etot;
34 }
35
36 aShower.setSecondMoment(sum);
37}
38
40{
41 RecEmcFractionMap fracMap=aShower.getFractionMap5x5();
42 if(fracMap.size()<2) {
43 aShower.setLatMoment(0);
44 return;
45 }
46
47 vector<RecEmcFraction> aFractionVec;
48 RecEmcFractionMap::const_iterator it;
49 for(it=fracMap.begin();
50 it!=fracMap.end();
51 it++){
52 aFractionVec.push_back(it->second);
53 }
54
55 //find the largest 2 energy
56 partial_sort(aFractionVec.begin(),
57 aFractionVec.begin()+2,
58 aFractionVec.end(),
59 greater<RecEmcFraction>());
60
61 //caculate LAT
62 vector<RecEmcFraction>::iterator iVec;
63 double numerator=0;
64 double denominator=0;
65 int n=0;
66 for(iVec=aFractionVec.begin();
67 iVec!=aFractionVec.end();
68 iVec++) {
69 n++;
70 HepPoint3D pos((*iVec).getFrontCenter()); //digi front center
71 double r=pos.mag()*sin(aShower.position().angle(pos));
72
73 double energy=(*iVec).getEnergy()*(*iVec).getFraction();
74 if(n<3) {
75 denominator+=5.2*5.2*energy;
76 } else {
77 numerator+=r*r*energy;
78 denominator+=r*r*energy;
79 }
80 }
81 double lat=-99;
82 if(denominator>0) lat=numerator/denominator;
83
84 aShower.setLatMoment(lat);
85}
86
88{
89 double a20=0;
90 const double R0=15.6;
91 Hep3Vector r0(aShower.position()); //shower center
92 RecEmcFractionMap fracMap=aShower.getFractionMap5x5();
93 RecEmcFractionMap::const_iterator it;
94 for(it=fracMap.begin();
95 it!=fracMap.end();
96 it++){
97 double energy=it->second.getEnergy()*it->second.getFraction();
98 HepPoint3D pos(it->second.getFrontCenter()); //digi front center
99
100 Hep3Vector r=pos-r0;
101 r=r-r.dot(r0)*r0/(r0.mag()*r0.mag());
102
103 a20+=(energy/aShower.e5x5())*(2*pow(r.mag()/R0,2.)-1);
104 }
105
106 aShower.setA20Moment(fabs(a20));
107}
108
110{
111 complex<double> a42(0.,0.);
112 const double R0=15.6;
113 Hep3Vector r0(aShower.position()); //shower center
114 RecEmcFractionMap fracMap=aShower.getFractionMap5x5();
115 RecEmcFractionMap::const_iterator it;
116 for(it=fracMap.begin();
117 it!=fracMap.end();
118 it++){
119 double energy=it->second.getEnergy()*it->second.getFraction();
120 HepPoint3D pos(it->second.getFrontCenter()); //digi front center
121
122 Hep3Vector r=pos-r0;
123 r=r-r.dot(r0)*r0/(r0.mag()*r0.mag());
124
125 complex<double> a(0.,2.*r.phi());
126
127 a42+=(energy/aShower.e5x5())*(4.*pow(r.mag()/R0,4.)-3.*pow(r.mag()/R0,2.))*exp(a);
128 }
129
130 aShower.setA42Moment(abs(a42));
131}
double sin(const BesAngle a)
Definition: BesAngle.h:210
const Int_t n
Double_t etot
EvtComplex exp(const EvtComplex &c)
Definition: EvtComplex.hh:252
double abs(const EvtComplex &c)
Definition: EvtComplex.hh:212
************Class m_ypar INTEGER m_KeyWgt INTEGER m_nphot 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
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
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