24 HepSymMatrix Ma =
Ea();
27 Helix _helix(pv, Va ,Ma);
30 Hep3Vector Wire =
w.fwd() -
w.bck();
34 wp[0] = 0.5*(
w.fwd() +
w.bck()).
x();
35 wp[1] = 0.5*(
w.fwd() +
w.bck()).
y();
43 v[0] = Wire.unit().x();
44 v[1] = Wire.unit().y();
45 v[2] = Wire.unit().z();
73 double xt[3]; _helix.
x(0., xt);
76 double x1 = wp[0] + x0;
77 double y1 = wp[1] + y0;
80 double dPhi = atan2(x0 * y1 - y0 * x1, x0 * x1 + y0 * y1);
100 double firstdfdphi = 0.;
101 static bool first =
true;
111 double tanLambda = _helix.
tanl();
115 const double convergence = 1.0e-5;
118 while (nTrial < 100) {
121 positionOnTrack = _helix.
x(dPhi);
127 l =
v[0] * t_x[0] +
v[1] * t_x[1] +
v[2] * t_x[2]
128 -
v[0] * wb[0] -
v[1] * wb[1] -
v[2] * wb[2];
130 double rcosPhi = rho *
cos(
phi0 + dPhi);
131 double rsinPhi = rho *
sin(
phi0 + dPhi);
132 t_dXdPhi[0] = rsinPhi;
133 t_dXdPhi[1] = - rcosPhi;
134 t_dXdPhi[2] = - rho * tanLambda;
137 double t_d2Xd2Phi[2];
138 t_d2Xd2Phi[0] = rcosPhi;
139 t_d2Xd2Phi[1] = rsinPhi;
143 n[0] = t_x[0] - wb[0];
144 n[1] = t_x[1] - wb[1];
145 n[2] = t_x[2] - wb[2];
148 a[0] = n[0] - l *
v[0];
149 a[1] = n[1] - l *
v[1];
150 a[2] = n[2] - l *
v[2];
151 double dfdphi =
a[0] * t_dXdPhi[0]
153 +
a[2] * t_dXdPhi[2];
158 firstdfdphi = dfdphi;
163 std::cout<<
" bad case, calculate approach ntrial = "<<nTrial<< std::endl;
168 if (fabs(dfdphi) < convergence)
171 double dv =
v[0] * t_dXdPhi[0]
173 +
v[2] * t_dXdPhi[2];
174 double t0 = t_dXdPhi[0] * t_dXdPhi[0]
175 + t_dXdPhi[1] * t_dXdPhi[1]
176 + t_dXdPhi[2] * t_dXdPhi[2];
177 double d2fd2phi = t0 - dv * dv
178 +
a[0] * t_d2Xd2Phi[0]
179 +
a[1] * t_d2Xd2Phi[1];
182 dPhi -= dfdphi / d2fd2phi;
190 positionOnWire[0] = wb[0] + l *
v[0];
191 positionOnWire[1] = wb[1] + l *
v[1];
192 positionOnWire[2] = wb[2] + l *
v[2];
196 return (positionOnTrack - positionOnWire).mag();
215 HepSymMatrix Ma =
Ea();
217 Helix _helix(pv, Va ,Ma);
219 Wire[0] = (pfwd - pbwd).
x();
220 Wire[1] = (pfwd - pbwd).
y();
221 Wire[2] = (pfwd - pbwd).z();
225 wp[0] = 0.5*(pfwd + pbwd).
x();
226 wp[1] = 0.5*(pfwd + pbwd).
y();
234 v[0] = Wire.unit().x();
235 v[1] = Wire.unit().y();
236 v[2] = Wire.unit().z();
263 double x0 = - xc.x();
264 double y0 = - xc.y();
265 double x1 = wp[0] + x0;
266 double y1 = wp[1] + y0;
273 double dPhi = atan2(x0 * y1 - y0 * x1, x0 * x1 + y0 * y1);
293 double firstdfdphi = 0.;
294 static bool first =
true;
304 double tanLambda = _helix.
tanl();
308 const double convergence = 1.0e-5;
311 while (nTrial < 100) {
314 positionOnTrack = _helix.
x(dPhi);
320 l =
v[0] * t_x[0] +
v[1] * t_x[1] +
v[2] * t_x[2]
321 -
v[0] * wb[0] -
v[1] * wb[1] -
v[2] * wb[2];
323 double rcosPhi = rho *
cos(
phi0 + dPhi);
324 double rsinPhi = rho *
sin(
phi0 + dPhi);
325 t_dXdPhi[0] = rsinPhi;
326 t_dXdPhi[1] = - rcosPhi;
327 t_dXdPhi[2] = - rho * tanLambda;
330 double t_d2Xd2Phi[2];
331 t_d2Xd2Phi[0] = rcosPhi;
332 t_d2Xd2Phi[1] = rsinPhi;
336 n[0] = t_x[0] - wb[0];
337 n[1] = t_x[1] - wb[1];
338 n[2] = t_x[2] - wb[2];
341 a[0] = n[0] - l *
v[0];
342 a[1] = n[1] - l *
v[1];
343 a[2] = n[2] - l *
v[2];
344 double dfdphi =
a[0] * t_dXdPhi[0]
346 +
a[2] * t_dXdPhi[2];
350 firstdfdphi = dfdphi;
358 if (fabs(dfdphi) < convergence)
361 double dv =
v[0] * t_dXdPhi[0]
363 +
v[2] * t_dXdPhi[2];
364 double t0 = t_dXdPhi[0] * t_dXdPhi[0]
365 + t_dXdPhi[1] * t_dXdPhi[1]
366 + t_dXdPhi[2] * t_dXdPhi[2];
367 double d2fd2phi = t0 - dv * dv
368 +
a[0] * t_d2Xd2Phi[0]
369 +
a[1] * t_d2Xd2Phi[1];
372 dPhi -= dfdphi / d2fd2phi;
377 positionOnWire[0] = wb[0] + l *
v[0];
378 positionOnWire[1] = wb[1] + l *
v[1];
379 positionOnWire[2] = wb[2] + l *
v[2];
388 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.
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.