13 #include "cetlib_except/exception.h" 51 double nyz = std::hypot(ny, nz);
54 if (nyz != 0.)
fPhi = atan2(-ny, nz);
81 double sinth = std::sin(
fTheta);
82 double costh = std::cos(
fTheta);
83 double sinphi = std::sin(
fPhi);
84 double cosphi = std::cos(
fPhi);
88 (xyz[0] -
fX0) * costh + (xyz[1] -
fY0) * sinth * sinphi - (xyz[2] -
fZ0) * sinth * cosphi;
91 uvw[1] = (xyz[1] -
fY0) * cosphi + (xyz[2] -
fZ0) * sinphi;
95 (xyz[0] -
fX0) * sinth - (xyz[1] -
fY0) * costh * sinphi + (xyz[2] -
fZ0) * costh * cosphi;
107 double sinth = std::sin(
fTheta);
108 double costh = std::cos(
fTheta);
109 double sinphi = std::sin(
fPhi);
110 double cosphi = std::cos(
fPhi);
113 xyz[0] =
fX0 + uvw[0] * costh + uvw[2] * sinth;
116 xyz[1] =
fY0 + uvw[0] * sinth * sinphi + uvw[1] * cosphi - uvw[2] * costh * sinphi;
119 xyz[2] =
fZ0 - uvw[0] * sinth * cosphi + uvw[1] * sinphi + uvw[2] * costh * cosphi;
158 double p = 1. / std::max(invp, 1.
e-3);
162 double dudw = vec(2);
163 double dvdw = vec(3);
167 double dwds = 1. / std::sqrt(1. + dudw * dudw + dvdw * dvdw);
172 throw cet::exception(
"SurfXYZPlane") <<
"Track direction not specified.\n";
176 double pu = p * dudw * dwds;
177 double pv = p * dvdw * dwds;
178 double pw = p * dwds;
182 double sinth = std::sin(
fTheta);
183 double costh = std::cos(
fTheta);
184 double sinphi = std::sin(
fPhi);
185 double cosphi = std::cos(
fPhi);
187 mom[0] = pu * costh + pw * sinth;
188 mom[1] = pu * sinth * sinphi + pv * cosphi - pw * costh * sinphi;
189 mom[2] = -pu * sinth * cosphi + pv * sinphi + pw * costh * cosphi;
216 double delta_phi = TVector2::Phi_mpi_pi(
fPhi - psurf->
phi());
243 throw cet::exception(
"SurfXYZPlane") <<
"Attempt to find distance to non-parallel surface.\n";
248 double otheruvw[3] = {0., 0., 0.};
288 out <<
"SurfXYZPlane{ x0=" <<
fX0 <<
", y0=" <<
fY0 <<
", z0=" <<
fZ0 <<
", phi=" <<
fPhi 289 <<
", 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.
double y0() const
Y origin.
constexpr auto abs(T v)
Returns the absolute value of the argument.
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).
double x0() const
X origin.
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).
double z0() const
Z origin.
virtual void toGlobal(const double uvw[3], double xyz[3]) const =0
Transform local to global coordinates.
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.
cet::coded_exception< error, detail::translate > exception