17 #include "cetlib_except/exception.h" 52 boost::optional<double>
54 const std::shared_ptr<const Surface>& psurf,
62 boost::optional<double> result(
false, 0.);
70 double x02 = to->
x0();
71 double y02 = to->
y0();
72 double z02 = to->
z0();
73 double theta2 = to->
theta();
74 double phi2 = to->
phi();
91 TrackMatrix* plocal_prop_matrix = (prop_matrix==0 ? 0 : &local_prop_matrix);
92 boost::optional<double> result1 =
origin_vec_prop(trk, psurf, plocal_prop_matrix);
101 <<
"Track state vector has wrong size" << vec.size() <<
"\n";
104 double dudw1 = vec(2);
105 double dvdw1 = vec(3);
106 double pinv = vec(4);
118 double sinth2 = std::sin(theta2);
119 double costh2 = std::cos(theta2);
120 double sinphi2 = std::sin(phi2);
121 double cosphi2 = std::cos(phi2);
127 double ruy = sinth2*sinphi2;
128 double ruz = -sinth2*cosphi2;
130 double rvy = cosphi2;
131 double rvz = sinphi2;
134 double rwy = -costh2*sinphi2;
135 double rwz = costh2*cosphi2;
140 double u2 = (x01-x02)*rux + (y01-y02)*ruy + (z01-z02)*ruz + u1;
141 double v2 = (y01-y02)*rvy + (z01-z02)*rvz + v1;
142 double w2 = (x01-x02)*rwx + (y01-y02)*rwy + (z01-z02)*rwz;
146 double u2p = u2 - w2 * dudw1;
147 double v2p = v2 - w2 * dvdw1;
151 double s = -w2 * std::sqrt(1. + dudw1*dudw1 + dvdw1*dvdw1);
172 boost::optional<double> pinv2(
true, pinv);
174 double* pderiv = (prop_matrix != 0 ? &deriv : 0);
187 result = boost::optional<double>(
true,
s);
191 if(prop_matrix != 0) {
193 pm.resize(vec.size(), vec.size(),
false);
230 *prop_matrix = prod(pm, *plocal_prop_matrix);
235 if(noise_matrix != 0) {
236 noise_matrix->resize(vec.size(), vec.size(),
false);
241 return boost::optional<double>(
false, 0.);
245 noise_matrix->clear();
280 boost::optional<double>
282 const std::shared_ptr<const Surface>& porient,
287 boost::optional<double> result(
false, 0.);
299 <<
"Track state vector has wrong size" << vec.size() <<
"\n";
316 double theta2 = orient->
theta();
317 double phi2 = orient->
phi();
318 std::shared_ptr<const Surface> porigin(
new SurfXYZPlane(x02, y02, z02, phi2, theta2));
327 double phi1 = from->phi();
332 result = boost::optional<double>(ok, 0.);
341 double phi1 = from->phi();
346 result = boost::optional<double>(ok, 0.);
355 double theta1 = from->theta();
356 double phi1 = from->phi();
361 result = boost::optional<double>(ok, 0.);
376 result = boost::optional<double>(
false, 0.);
393 double sinth2 = std::sin(theta2);
394 double costh2 = std::cos(theta2);
396 double sindphi = std::sin(phi2 - phi1);
397 double cosdphi = std::cos(phi2 - phi1);
402 double phid1 = vec(2);
403 double eta1 = vec(3);
409 double ruv = sinth2*sindphi;
410 double ruw = -sinth2*cosdphi;
412 double rvv = cosdphi;
413 double rvw = sindphi;
416 double rwv = -costh2*sindphi;
417 double rww = costh2*cosdphi;
421 double sinphid1 = std::sin(phid1);
422 double cosphid1 = std::cos(phid1);
423 double sh1 = 1. / std::cosh(eta1);
424 double th1 = std::tanh(eta1);
428 double u1 = -r1 * sinphid1;
429 double w1 = r1 * cosphid1;
433 double du1 = sh1*cosphid1;
435 double dw1 = sh1*sinphid1;
440 double du2 = ruu*du1 + ruv*dv1 + ruw*dw1;
441 double dv2 = rvv*dv1 + rvw*dw1;
442 double dw2 = rwu*du1 + rwv*dv1 + rww*dw1;
449 dir = Surface::TrackDirection::FORWARD;
451 dir = Surface::TrackDirection::BACKWARD;
457 double dudw2 = du2 / dw2;
458 double dvdw2 = dv2 / dw2;
462 if(prop_matrix != 0) {
464 pm.resize(vec.size(), vec.size(),
false);
470 double du1dr1 = -sinphid1;
471 double du1dphi1 = -w1;
473 double dw1dr1 = cosphid1;
474 double dw1dphi1 = u1;
476 double ddu1dphi1 = -sinphid1*sh1;
477 double ddu1deta1 = -cosphid1*sh1*th1;
479 double ddv1deta1 = sh1*sh1;
481 double ddw1dphi1 = cosphid1*sh1;
482 double ddw1deta1 = -sinphid1*sh1*th1;
486 double du2dr1 = ruu*du1dr1 + ruw*dw1dr1;
487 double dv2dr1 = rvw*dw1dr1;
488 double dw2dr1 = rwu*du1dr1 + rww*dw1dr1;
494 double du2dphi1 = ruu*du1dphi1 + ruw*dw1dphi1;
495 double dv2dphi1 = rvw*dw1dphi1;
496 double dw2dphi1 = rwu*du1dphi1 + rww*dw1dphi1;
498 double ddu2dphi1 = ruu*ddu1dphi1 + ruw*ddw1dphi1;
499 double ddv2dphi1 = rvw*ddw1dphi1;
500 double ddw2dphi1 = rwu*ddu1dphi1 + rww*ddw1dphi1;
502 double ddu2deta1 = ruu*ddu1deta1 + ruv*ddv1deta1 + ruw*ddw1deta1;
503 double ddv2deta1 = rvv*ddv1deta1 + rvw*ddw1deta1;
504 double ddw2deta1 = rwu*ddu1deta1 + rwv*ddv1deta1 + rww*ddw1deta1;
508 double ddudw2ddu2 = 1. / dw2;
509 double ddudw2ddw2 = -dudw2 / dw2;
511 double ddvdw2ddv2 = 1. / dw2;
512 double ddvdw2ddw2 = -dvdw2 / dw2;
516 double ddudw2dphi1 = ddudw2ddu2*ddu2dphi1 + ddudw2ddw2*ddw2dphi1;
517 double ddudw2deta1 = ddudw2ddu2*ddu2deta1 + ddudw2ddw2*ddw2deta1;
519 double ddvdw2dphi1 = ddvdw2ddv2*ddv2dphi1 + ddvdw2ddw2*ddw2dphi1;
520 double ddvdw2deta1 = ddvdw2ddv2*ddv2deta1 + ddvdw2ddw2*ddw2deta1;
530 double dstdr1 = -dw2dr1;
531 double dstdv1 = -dw2dv1;
532 double dstdphi1 = -dw2dphi1;
536 du2dr1 += dstdr1 * dudw2;
537 du2dv1 += dstdv1 * dudw2;
538 du2dphi1 += dstdphi1 * dudw2;
540 dv2dr1 += dstdr1 * dvdw2;
541 dv2dv1 += dstdv1 * dvdw2;
542 dv2dphi1 += dstdphi1 * dvdw2;
560 pm(2,2) = ddudw2dphi1;
561 pm(3,2) = ddvdw2dphi1;
566 pm(2,3) = ddudw2deta1;
567 pm(3,3) = ddvdw2deta1;
598 double sinth2 = std::sin(theta2);
599 double costh2 = std::cos(theta2);
601 double sindphi = std::sin(phi2 - phi1);
602 double cosdphi = std::cos(phi2 - phi1);
606 double dudw1 = vec(2);
607 double dvdw1 = vec(3);
618 double ruv = sinth2*sindphi;
619 double ruw = -sinth2*cosdphi;
621 double rvv = cosdphi;
622 double rvw = sindphi;
625 double rwv = -costh2*sindphi;
626 double rww = costh2*cosdphi;
633 double dw2dw1 = dudw1*rwu + dvdw1*rwv + rww;
639 double dudw2 = (dudw1*ruu + dvdw1*ruv + ruw) / dw2dw1;
640 double dvdw2 = (dvdw1*rvv + rvw) / dw2dw1;
654 << __func__ <<
": unexpected direction #" << ((int) dir) <<
"\n";
659 if(prop_matrix != 0) {
661 pm.resize(vec.size(), vec.size(),
false);
665 pm(0,0) = ruu - dudw2*rwu;
666 pm(1,0) = -dvdw2*rwu;
671 pm(0,1) = ruv - dudw2*rwv;
672 pm(1,1) = rvv - dvdw2*rwv;
679 pm(2,2) = (ruu - dudw2*rwu) / dw2dw1;
680 pm(3,2) = -dvdw2*rwu / dw2dw1;
685 pm(2,3) = (ruv - dudw2*rwv) / dw2dw1;
686 pm(3,3) = (rvv - dvdw2*rwv) / dw2dw1;
717 double sinth1 = std::sin(theta1);
718 double costh1 = std::cos(theta1);
719 double sinth2 = std::sin(theta2);
720 double costh2 = std::cos(theta2);
722 double sindphi = std::sin(phi2 - phi1);
723 double cosdphi = std::cos(phi2 - phi1);
727 double dudw1 = vec(2);
728 double dvdw1 = vec(3);
738 double ruu = costh1*costh2 + sinth1*sinth2*cosdphi;
739 double ruv = sinth2*sindphi;
740 double ruw = sinth1*costh2 - costh1*sinth2*cosdphi;
742 double rvu = -sinth1*sindphi;
743 double rvv = cosdphi;
744 double rvw = costh1*sindphi;
746 double rwu = costh1*sinth2 - sinth1*costh2*cosdphi;
747 double rwv = -costh2*sindphi;
748 double rww = sinth1*sinth2 + costh1*costh2*cosdphi;
755 double dw2dw1 = dudw1*rwu + dvdw1*rwv + rww;
761 double dudw2 = (dudw1*ruu + dvdw1*ruv + ruw) / dw2dw1;
762 double dvdw2 = (dudw1*rvu + dvdw1*rvv + rvw) / dw2dw1;
776 << __func__ <<
": unexpected direction #" << ((int) dir) <<
"\n";
781 if(prop_matrix != 0) {
783 pm.resize(vec.size(), vec.size(),
false);
787 pm(0,0) = ruu - dudw2*rwu;
788 pm(1,0) = rvu - dvdw2*rwu;
793 pm(0,1) = ruv - dudw2*rwv;
794 pm(1,1) = rvv - dvdw2*rwv;
801 pm(2,2) = (ruu - dudw2*rwu) / dw2dw1;
802 pm(3,2) = (rvu - dvdw2*rwu) / dw2dw1;
807 pm(2,3) = (ruv - dudw2*rwv) / dw2dw1;
808 pm(3,3) = (rvv - dvdw2*rwv) / dw2dw1;
TrackDirection
Track direction enum.
double Mass() const
Based on pdg code.
const std::shared_ptr< const Surface > & getSurface() const
Surface.
double y0() const
Y origin.
KSymMatrix< 5 >::type TrackError
Track error matrix, dimension 5x5.
void setVector(const TrackVector &vec)
Set state vector.
void setDirection(Surface::TrackDirection dir)
Set direction.
Planar surface parallel to x-axis.
boost::optional< double > short_vec_prop(KTrack &trk, const std::shared_ptr< const Surface > &surf, Propagator::PropDirection dir, bool doDedx, TrackMatrix *prop_matrix=0, TrackError *noise_matrix=0) const
Propagate without error.
boost::optional< double > dedx_prop(double pinv, double mass, double s, double *deriv=0) const
Method to calculate updated momentum due to dE/dx.
const std::shared_ptr< const Interactor > & getInteractor() const
virtual ~PropXYZPlane()
Destructor.
void setSurface(const std::shared_ptr< const Surface > &psurf)
Set surface.
bool transformXYZPlane(double theta1, double phi1, double theta2, double phi2, TrackVector &vec, Surface::TrackDirection &dir, TrackMatrix *prop_matrix) const
Transform xyz plane -> xyz plane.
void getPosition(double xyz[3]) const
Get position of track.
Propagate to SurfXYZPlane surface.
double phi() const
Rot. angle about x-axis (wire angle).
double x0() const
X origin.
KVector< 5 >::type TrackVector
Track state vector, dimension 5.
bool transformYZLine(double phi1, double theta2, double phi2, TrackVector &vec, Surface::TrackDirection &dir, TrackMatrix *prop_matrix) const
Transform yz line -> xyz plane.
double theta() const
Rot. angle about y'-axis (projected Lorentz angle).
virtual boost::optional< double > origin_vec_prop(KTrack &trk, const std::shared_ptr< const Surface > &porient, TrackMatrix *prop_matrix=0) const
Propagate without error to surface whose origin parameters coincide with track position.
const TrackVector & getVector() const
Track state vector.
KMatrix< 5, 5 >::type TrackMatrix
General 5x5 matrix.
Interactor for planar surfaces.
Surface::TrackDirection getDirection() const
Track direction.
bool transformYZPlane(double phi1, double theta2, double phi2, TrackVector &vec, Surface::TrackDirection &dir, TrackMatrix *prop_matrix) const
Transform yz plane -> xyz plane.
double z0() const
Z origin.
Line surface perpendicular to x-axis.
PropXYZPlane(double tcut, bool doDedx)
Constructor.
cet::coded_exception< error, detail::translate > exception
bool isValid() const
Test if track is valid.
PropDirection
Propagation direction enum.