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