27 HepSymMatrix Ma =
Ea();
30 Helix _helix(pv, Va ,Ma);
33 Hep3Vector Wire = w.
fwd() - w.
bck();
37 wp[0] = 0.5*(w.
fwd() + w.
bck()).x();
38 wp[1] = 0.5*(w.
fwd() + w.
bck()).y();
46 v[0] = Wire.unit().x();
47 v[1] = Wire.unit().y();
48 v[2] = Wire.unit().z();
76 double xt[3]; _helix.
x(0., xt);
79 double x1 = wp[0] + x0;
80 double y1 = wp[1] + y0;
83 double dPhi = atan2(x0 * y1 - y0 * x1, x0 * x1 + y0 * y1);
103 double firstdfdphi = 0.;
104 static bool first =
true;
114 double tanLambda = _helix.
tanl();
118 const double convergence = 1.0e-5;
121 while (nTrial < 100) {
124 positionOnTrack = _helix.
x(
dPhi);
130 l =
v[0] * t_x[0] +
v[1] * t_x[1] +
v[2] * t_x[2]
131 -
v[0] * wb[0] -
v[1] * wb[1] -
v[2] * wb[2];
135 t_dXdPhi[0] = rsinPhi;
136 t_dXdPhi[1] = - rcosPhi;
137 t_dXdPhi[2] = - rho * tanLambda;
140 double t_d2Xd2Phi[2];
141 t_d2Xd2Phi[0] = rcosPhi;
142 t_d2Xd2Phi[1] = rsinPhi;
146 n[0] = t_x[0] - wb[0];
147 n[1] = t_x[1] - wb[1];
148 n[2] = t_x[2] - wb[2];
151 a[0] =
n[0] - l *
v[0];
152 a[1] =
n[1] - l *
v[1];
153 a[2] =
n[2] - l *
v[2];
154 double dfdphi =
a[0] * t_dXdPhi[0]
156 +
a[2] * t_dXdPhi[2];
161 firstdfdphi = dfdphi;
166 std::cout<<
" bad case, calculate approach ntrial = "<<nTrial<< std::endl;
171 if (fabs(dfdphi) < convergence)
174 double dv =
v[0] * t_dXdPhi[0]
176 +
v[2] * t_dXdPhi[2];
177 double t0 = t_dXdPhi[0] * t_dXdPhi[0]
178 + t_dXdPhi[1] * t_dXdPhi[1]
179 + t_dXdPhi[2] * t_dXdPhi[2];
180 double d2fd2phi = t0 - dv * dv
181 +
a[0] * t_d2Xd2Phi[0]
182 +
a[1] * t_d2Xd2Phi[1];
185 dPhi -= dfdphi / d2fd2phi;
193 positionOnWire[0] = wb[0] + l *
v[0];
194 positionOnWire[1] = wb[1] + l *
v[1];
195 positionOnWire[2] = wb[2] + l *
v[2];
199 return (positionOnTrack - positionOnWire).mag();
218 HepSymMatrix Ma =
Ea();
220 Helix _helix(pv, Va ,Ma);
222 Wire[0] = (pfwd - pbwd).
x();
223 Wire[1] = (pfwd - pbwd).y();
224 Wire[2] = (pfwd - pbwd).z();
228 wp[0] = 0.5*(pfwd + pbwd).
x();
229 wp[1] = 0.5*(pfwd + pbwd).y();
237 v[0] = Wire.unit().x();
238 v[1] = Wire.unit().y();
239 v[2] = Wire.unit().z();
266 double x0 = - xc.x();
267 double y0 = - xc.y();
268 double x1 = wp[0] + x0;
269 double y1 = wp[1] + y0;
276 double dPhi = atan2(x0 * y1 - y0 * x1, x0 * x1 + y0 * y1);
296 double firstdfdphi = 0.;
297 static bool first =
true;
307 double tanLambda = _helix.
tanl();
311 const double convergence = 1.0e-5;
314 while (nTrial < 100) {
317 positionOnTrack = _helix.
x(
dPhi);
323 l =
v[0] * t_x[0] +
v[1] * t_x[1] +
v[2] * t_x[2]
324 -
v[0] * wb[0] -
v[1] * wb[1] -
v[2] * wb[2];
328 t_dXdPhi[0] = rsinPhi;
329 t_dXdPhi[1] = - rcosPhi;
330 t_dXdPhi[2] = - rho * tanLambda;
333 double t_d2Xd2Phi[2];
334 t_d2Xd2Phi[0] = rcosPhi;
335 t_d2Xd2Phi[1] = rsinPhi;
339 n[0] = t_x[0] - wb[0];
340 n[1] = t_x[1] - wb[1];
341 n[2] = t_x[2] - wb[2];
344 a[0] =
n[0] - l *
v[0];
345 a[1] =
n[1] - l *
v[1];
346 a[2] =
n[2] - l *
v[2];
347 double dfdphi =
a[0] * t_dXdPhi[0]
349 +
a[2] * t_dXdPhi[2];
353 firstdfdphi = dfdphi;
361 if (fabs(dfdphi) < convergence)
364 double dv =
v[0] * t_dXdPhi[0]
366 +
v[2] * t_dXdPhi[2];
367 double t0 = t_dXdPhi[0] * t_dXdPhi[0]
368 + t_dXdPhi[1] * t_dXdPhi[1]
369 + t_dXdPhi[2] * t_dXdPhi[2];
370 double d2fd2phi = t0 - dv * dv
371 +
a[0] * t_d2Xd2Phi[0]
372 +
a[1] * t_d2Xd2Phi[1];
375 dPhi -= dfdphi / d2fd2phi;
380 positionOnWire[0] = wb[0] + l *
v[0];
381 positionOnWire[1] = wb[1] + l *
v[1];
382 positionOnWire[2] = wb[2] + l *
v[2];
391 return (positionOnTrack - positionOnWire).mag();
double sin(const BesAngle a)
double cos(const BesAngle a)
**********Class see also m_nmax DOUBLE PRECISION m_amel DOUBLE PRECISION m_x2 DOUBLE PRECISION m_alfinv DOUBLE PRECISION m_Xenph INTEGER m_KeyWtm INTEGER m_idyfs DOUBLE PRECISION m_zini DOUBLE PRECISION m_q2 DOUBLE PRECISION m_Wt_KF DOUBLE PRECISION m_WtCut INTEGER m_KFfin *COMMON c_KarLud $ !Input CMS energy[GeV] $ !CMS energy after beam spread beam strahlung[GeV] $ !Beam energy spread[GeV] $ !z boost due to beam spread $ !electron beam mass *ff pair spectrum $ !minimum v
Description of a Hit in Mdc.
const KalFitWire & wire(void) const
Description of a Wire class.
HepPoint3D bck(void) const
HepPoint3D fwd(void) const
Geometry :
double dPhi(HepPoint3D &hit) const
const HepPoint3D & center(void) const
returns position of helix center(z = 0.);
double approach(KalFitHitMdc &hit, bool doSagCorrection) const
static const double ConstantAlpha
Constant alpha for uniform field.
const HepSymMatrix & Ea(void) const
returns error matrix.
HepPoint3D x(double dPhi=0.) const
returns position after rotating angle dPhi in phi direction.
const HepVector & a(void) const
returns helix parameters.
const HepPoint3D & pivot(void) const
returns pivot position.