BOSS 7.1.0
BESIII Offline Software System
Loading...
Searching...
No Matches
WTrackParameter.cxx
Go to the documentation of this file.
2
4{
5 m_w = HepVector(7, 0);
6 m_Ew = HepSymMatrix(7, 0);
7 m_charge = 0;
8 m_type = 1;
9 m_mass = 0;
10 m_massInvariable = true;
11}
12
14{
15 m_charge = wtrk.m_charge;
16 m_w = wtrk.m_w;
17 m_Ew = wtrk.m_Ew;
18 m_type = wtrk.m_type;
19 m_plmp = wtrk.m_plmp;
20 m_Vplm = wtrk.m_Vplm;
21 m_mass = wtrk.m_mass;
22 m_massInvariable = wtrk.m_massInvariable;
23}
24
26{
27 if (this == &wtrk)
28 return *this;
29 m_charge = wtrk.m_charge;
30 m_type = wtrk.m_type;
31 m_w = wtrk.m_w;
32 m_Ew = wtrk.m_Ew;
33 m_plmp = wtrk.m_plmp;
34 m_Vplm = wtrk.m_Vplm;
35 m_mass = wtrk.m_mass;
36 m_massInvariable = wtrk.m_massInvariable;
37 return *this;
38}
39
41{
42 HepVector tmp(4,0);
43 if (w()[1] >= 0)
44 tmp[0] = atan(w()[1]/(w()[0]));
45 else
46 tmp[0] = atan(w()[1]/(w()[0])) + 3.1415926;
47 tmp[1] = w()[2]/sqrt(w()[0]*w()[0] + w()[1]*w()[1]);
48 tmp[2] = p().m();
49 tmp[3] = sqrt(w()[3]*w()[3] - p().m()*p().m());
50 return tmp;
51}
52
53WTrackParameter::WTrackParameter(const int charge, const HepLorentzVector &p, const HepPoint3D &x, const double err[])
54{
55 HepSymMatrix error(5, 0);
56 int k = 0;
57 for (int i = 0; i < 5; i++)
58 {
59 for(int j = i; j < 5; j++)
60 {
61 error[i][j] = err[k];
62 error[j][i] = err[k];
63 k++;
64 }
65 }
66 *this = WTrackParameter(charge, p, x, error);
67}
68
69WTrackParameter::WTrackParameter(const int charge, const HepLorentzVector &p, const HepPoint3D &x, const HepSymMatrix &err)
70{
71 m_w = HepVector(7, 0);
72 m_Ew = HepSymMatrix(7, 0);
73 m_charge = charge;
74 m_type = 1;
75 m_mass = p.m();
76 m_massInvariable = true;
77 for (int i = 0; i < 4; i++)
78 m_w[i] = p[i];
79 for (int i = 0; i < 3; i++)
80 m_w[i+4] = x[i];
81
82 HepVector helix(5, 0);
83 double phi0 = atan2(-p[0], p[1]);
84 if (cos(phi0) != 0)
85 helix[0] = x[0] / cos(phi0);
86 else
87 helix[0] = x[1] / sin(phi0);
88 helix[1] = phi0;
89 helix[2] = charge/p.perp();
90 helix[3] = x[2];
91 helix[4] = p[3]/p.perp();
92 HepMatrix dWdA(7, 5, 0);
93 dWdA = GetCvtMatrix(p.m(), helix);
94 m_Ew = err.similarity(dWdA);
95}
96
97WTrackParameter::WTrackParameter(const double mass, const HepVector &hel, const double err[])
98{
99 HepSymMatrix error(5, 0);
100 int k = 0;
101 for(int i = 0; i < 5; i++)
102 {
103 for(int j = i; j < 5; j++)
104 {
105 error[i][j] = err[k];
106 error[j][i] = err[k];
107 k++;
108 }
109 }
110 *this = WTrackParameter(mass, hel, error);
111}
112
113
114WTrackParameter::WTrackParameter(const double mass, const HepVector &hel, const HepSymMatrix &err)
115{
116 m_type = 1;
117 m_mass = mass;
118 m_w = HepVector(7, 0);
119 m_Ew = HepSymMatrix(7, 0);
120 HepMatrix dWdA(7, 5, 0);
121 dWdA = GetCvtMatrix(mass, hel);
122 m_Ew = err.similarity(dWdA);
123 m_w = CvtH2W(mass, hel);
124 m_charge = hel[2] > 0 ? +1 : -1;
125 m_massInvariable = true;
126}
127
128WTrackParameter::WTrackParameter(const HepLorentzVector &p, const double dphi, const double dthe, const double dE)
129{
130 HepPoint3D x(0, 0, 0);
131 *this = WTrackParameter(x, p, dphi, dthe, dE);
132}
133
134
135WTrackParameter::WTrackParameter(const HepPoint3D &x, const HepLorentzVector &p, const double dphi, const double dthe, const double dE)
136{
137 m_w = HepVector(7, 0);
138 m_Ew = HepSymMatrix(7, 0);
139 m_type = 2;
140 m_mass = p.m();
141 m_charge = 0;
142 m_massInvariable = true;
143 for (int i = 0; i< 4; i++)
144 m_w[i] = p[i];
145 for (int i = 0; i< 3; i++)
146 m_w[i+4] = x[i];
147
148 HepMatrix dwda(7, 3, 0);
149 dwda[0][0] = -p.py();
150 dwda[1][0] = p.px();
151 dwda[4][0] = -x.y();
152 dwda[5][0] = x.x();
153
154 dwda[0][1] = p.px()*p.pz()/p.perp();
155 dwda[1][1] = p.py()*p.pz()/p.perp();
156 dwda[2][1] = -p.perp();
157 dwda[6][1] = -x.distance2()/sqrt(x.x()*x.x()+x.y()*x.y());
158
159 dwda[0][2] = p.px()/p.rho();
160 dwda[1][2] = p.py()/p.rho();
161 dwda[2][2] = p.pz()/p.rho();
162 dwda[3][2] = p.rho()/p.e();
163 // dwda[4][2] = x.x()/(x.x()*x.x()+x.y()*x.y());
164 // dwda[5][2] = x.y()/(x.x()*x.x()+x.y()*x.y());
165 // dwda[6][2] = x.z()/(x.x()*x.x()+x.y()*x.y());
166
167 HepSymMatrix emcmea(3, 0);
168 emcmea[0][0] = dphi * dphi;
169 emcmea[1][1] = dthe * dthe;
170 emcmea[2][2] = dE * dE;
171 m_Ew = emcmea.similarity(dwda);
172}
173
174HepMatrix WTrackParameter::GetCvtMatrix(const double mass, const HepVector &helix) //just suitable for charged tracks
175{
176 HepMatrix m(7, 5, 0);
177 double drho = helix[0];
178 double phi0 = helix[1];
179 double kappa = helix[2];
180 double kappa2 = kappa * kappa;
181 double kappa3 = kappa * kappa2;
182 // double dz = helix[3];
183 double lambda = helix[4];
184 double lambda2 = lambda * lambda;
185 double e = sqrt( (1+lambda2) / kappa2 + mass * mass );
186 double sinphi0 = sin(phi0);
187 double cosphi0 = cos(phi0);
188 int q = (kappa>0) ? 1 : (-1);
189 m[0][1] = -cosphi0 * q / kappa;
190 m[0][2] = sinphi0 * q / kappa2;
191 m[1][1] = -sinphi0 * q / kappa;
192 m[1][2] = -cosphi0 * q / kappa2;
193 m[2][2] = -lambda * q / kappa2;
194 m[2][4] = q / kappa;
195 m[3][2] = -(1+lambda2) / (kappa3 * e);
196 m[3][4] = lambda / (kappa2 * e);
197 m[4][0] = cosphi0;
198 m[4][1] = -drho * sinphi0;
199 m[5][0] = sinphi0;
200 m[5][1] = drho * cosphi0;
201 m[6][3] = 1;
202 return m;
203}
204
205HepVector WTrackParameter::CvtH2W(const double mass, const HepVector &helix)
206{
207 double drho = helix[0];
208 double phi0 = helix[1];
209 double kappa = helix[2];
210 double dz = helix[3];
211 double lambda = helix[4];
212 double sinphi0 = sin(phi0);
213 double cosphi0 = cos(phi0);
214 int q = (kappa>0) ? 1 : (-1);
215 HepVector w(7, 0);
216 w[0] = -sinphi0 * q / kappa;
217 w[1] = cosphi0 * q / kappa;
218 w[2] = lambda * q / kappa;
219 w[3] = sqrt( (1+lambda*lambda) / (kappa*kappa) + mass * mass );
220 w[4] = drho * cosphi0;
221 w[5] = drho * sinphi0;
222 w[6] = dz;
223 return w;
224}
double sin(const BesAngle a)
Definition: BesAngle.h:210
double cos(const BesAngle a)
Definition: BesAngle.h:213
double mass
****INTEGER imax DOUBLE PRECISION m_pi *DOUBLE PRECISION m_amfin DOUBLE PRECISION m_Chfin DOUBLE PRECISION m_Xenph DOUBLE PRECISION m_sinw2 DOUBLE PRECISION m_GFermi DOUBLE PRECISION m_MfinMin DOUBLE PRECISION m_ta2 INTEGER m_out INTEGER m_KeyFSR INTEGER m_KeyQCD *COMMON c_Semalib $ !copy of input $ !CMS energy $ !beam mass $ !final mass $ !beam charge $ !final charge $ !smallest final mass $ !Z mass $ !Z width $ !EW mixing angle $ !Gmu Fermi $ alphaQED at q
Definition: KKsem.h:33
int charge() const
HepLorentzVector p() const
double mass() const
WTrackParameter & operator=(const WTrackParameter &wtrk)
HepVector w() const
HepPoint3D x() const
HepVector philambdamass()
float charge