13 #include "cetlib_except/exception.h"
57 double nx,
double ny,
double nz) :
66 double nyz = std::hypot(ny, nz);
70 fPhi = atan2(-ny, nz);
98 double sinth = std::sin(
fTheta);
99 double costh = std::cos(
fTheta);
100 double sinphi = std::sin(
fPhi);
101 double cosphi = std::cos(
fPhi);
104 uvw[0] = (xyz[0]-
fX0)*costh + (xyz[1]-
fY0)*sinth*sinphi - (xyz[2]-
fZ0)*sinth*cosphi;
107 uvw[1] = (xyz[1]-
fY0)*cosphi + (xyz[2]-
fZ0)*sinphi;
110 uvw[2] = (xyz[0]-
fX0)*sinth - (xyz[1]-
fY0)*costh*sinphi + (xyz[2]-
fZ0)*costh*cosphi;
122 double sinth = std::sin(
fTheta);
123 double costh = std::cos(
fTheta);
124 double sinphi = std::sin(
fPhi);
125 double cosphi = std::cos(
fPhi);
128 xyz[0] =
fX0 + uvw[0]*costh + uvw[2]*sinth;
131 xyz[1] =
fY0 + uvw[0]*sinth*sinphi + uvw[1]*cosphi - uvw[2]*costh*sinphi;
134 xyz[2] =
fZ0 - uvw[0]*sinth*cosphi + uvw[1]*sinphi + uvw[2]*costh*cosphi;
174 double p = 1. / std::max(invp, 1.
e-3);
178 double dudw = vec(2);
179 double dvdw = vec(3);
183 double dwds = 1. / std::sqrt(1. + dudw*dudw + dvdw*dvdw);
188 throw cet::exception(
"SurfXYZPlane") <<
"Track direction not specified.\n";
192 double pu = p * dudw * dwds;
193 double pv = p * dvdw * dwds;
194 double pw = p * dwds;
198 double sinth = std::sin(
fTheta);
199 double costh = std::cos(
fTheta);
200 double sinphi = std::sin(
fPhi);
201 double cosphi = std::cos(
fPhi);
203 mom[0] = pu*costh + pw*sinth;
204 mom[1] = pu*sinth*sinphi + pv*cosphi - pw*costh*sinphi;
205 mom[2] = -pu*sinth*cosphi + pv*sinphi + pw*costh*cosphi;
232 double delta_phi = TVector2::Phi_mpi_pi(
fPhi - psurf->
phi());
259 throw cet::exception(
"SurfXYZPlane") <<
"Attempt to find distance to non-parallel surface.\n";
264 double otheruvw[3] = {0., 0., 0.};
305 out <<
"SurfXYZPlane{ x0=" <<
fX0 <<
", y0=" <<
fY0 <<
", z0=" <<
fZ0
306 <<
", phi=" <<
fPhi <<
", theta=" <<
fTheta <<
"}";
virtual void getPosition(const TrackVector &vec, double xyz[3]) const
Get position of track.
TrackDirection
Track direction enum.
virtual bool isEqual(const Surface &surf) const
Test two surfaces for equality, within tolerance.
virtual void toGlobal(const double uvw[3], double xyz[3]) const =0
Transform local to global coordinates.
virtual std::ostream & Print(std::ostream &out) const
Printout.
static double fPhiTolerance
Phi tolerance for parallel.
virtual bool isParallel(const Surface &surf) const
Test whether two surfaces are parallel, within tolerance.
static double fSepTolerance
Separation tolerance for equal.
virtual bool isTrackValid(const TrackVector &vec) const
Surface-specific tests of validity of track parameters.
virtual double distanceTo(const Surface &surf) const
Find perpendicular forward distance to a parallel surface.
double phi() const
Rot. angle about x-axis (wire angle).
virtual void toLocal(const double xyz[3], double uvw[3]) const
Transform global to local coordinates.
SurfXYZPlane()
Default constructor.
KVector< 5 >::type TrackVector
Track state vector, dimension 5.
double theta() const
Rot. angle about y'-axis (projected Lorentz angle).
virtual void toGlobal(const double uvw[3], double xyz[3]) const
Transform local to global coordinates.
constexpr double dist(const TReal *x, const TReal *y, const unsigned int dimension)
double fTheta
Rotation angle about y'-axis (projected Lorentz angle).
static double fThetaTolerance
Theta tolerance for parallel.
virtual TrackDirection getDirection(const TrackVector &, TrackDirection dir=UNKNOWN) const
Get direction of track (default UNKNOWN).
virtual ~SurfXYZPlane()
Destructor.
double fPhi
Rotation angle about x-axis (wire angle).
virtual void getMomentum(const TrackVector &vec, double mom[3], TrackDirection dir=UNKNOWN) const
Get momentum vector of track.
virtual Surface * clone() const
Clone method.