14 #include "cetlib_except/exception.h" 64 double sinphi = std::sin(
fPhi);
65 double cosphi = std::cos(
fPhi);
68 uvw[0] = xyz[0] -
fX0;
71 uvw[1] = (xyz[1] -
fY0) * cosphi + (xyz[2] -
fZ0) * sinphi;
74 uvw[2] = -(xyz[1] -
fY0) * sinphi + (xyz[2] -
fZ0) * cosphi;
86 double sinphi = std::sin(
fPhi);
87 double cosphi = std::cos(
fPhi);
90 xyz[0] =
fX0 + uvw[0];
93 xyz[1] =
fY0 + uvw[1] * cosphi - uvw[2] * sinphi;
96 xyz[2] =
fZ0 + uvw[1] * sinphi + uvw[2] * cosphi;
111 while (result(2) <= -TMath::Pi())
112 result(2) += TMath::TwoPi();
113 while (result(2) > TMath::Pi())
114 result(2) -= TMath::TwoPi();
130 double sinphi = std::sin(phi);
131 double cosphi = std::cos(phi);
134 uvw[0] = -vec(0) * sinphi;
136 uvw[2] = vec(0) * cosphi;
158 double p = 1. / std::max(invp, 1.
e-3);
165 double sinphi = std::sin(phi);
166 double cosphi = std::cos(phi);
167 double sh = 1. / std::cosh(eta);
168 double th = std::tanh(eta);
172 double pu = p * cosphi * sh;
174 double pw = p * sinphi * sh;
178 double sinfphi = std::sin(
fPhi);
179 double cosfphi = std::cos(
fPhi);
182 mom[1] = pv * cosfphi - pw * sinfphi;
183 mom[2] = pv * sinfphi + pw * cosfphi;
210 double delta_phi = TVector2::Phi_mpi_pi(
fPhi - psurf->
phi());
232 throw cet::exception(
"SurfYZLine") <<
"Attempt to find distance to non-parallel surface.\n";
237 double otheruvw[3] = {0., 0., 0.};
245 return std::hypot(myuvw[0], myuvw[2]);
270 double delta_phi = TVector2::Phi_mpi_pi(
fPhi - psurf->
phi());
271 double dx =
fX0 - psurf->
x0();
272 double dy =
fY0 - psurf->
y0();
273 double dz =
fZ0 - psurf->
z0();
284 out <<
"SurfYZLine{ x0=" <<
fX0 <<
", y0=" <<
fY0 <<
", z0=" <<
fZ0 <<
", phi=" <<
fPhi <<
"}";
TrackDirection
Track direction enum.
constexpr auto abs(T v)
Returns the absolute value of the argument.
virtual void toGlobal(const double uvw[3], double xyz[3]) const
Transform local to global coordinates.
virtual bool isEqual(const Surface &surf) const
Test two surfaces for equality, within tolerance.
virtual void toLocal(const double xyz[3], double uvw[3]) const
Transform global to local coordinates.
virtual bool isTrackValid(const TrackVector &vec) const
Surface-specific tests of validity of track parameters.
virtual void getMomentum(const TrackVector &vec, double mom[3], TrackDirection dir=UNKNOWN) const
Get momentum vector of track.
virtual bool isParallel(const Surface &surf) const
Test whether two surfaces are parallel, within tolerance.
virtual double distanceTo(const Surface &surf) const
Find perpendicular distance to a parallel surface.
virtual ~SurfYZLine()
Destructor.
static double fPhiTolerance
Phi tolerance for parallel.
virtual std::ostream & Print(std::ostream &out) const
Printout.
KVector< 5 >::type TrackVector
Track state vector, dimension 5.
double z0() const
Z origin.
static double fSepTolerance
Separation tolerance for equal.
double x0() const
X origin.
virtual TrackVector getDiff(const TrackVector &vec1, const TrackVector &vec2) const
Calculate difference of two track parameter vectors.
double phi() const
Rotation angle about x-axis.
double y0() const
Y origin.
Line surface perpendicular to x-axis.
double fPhi
Rotation angle about x-axis.
virtual Surface * clone() const
Clone method.
virtual void getPosition(const TrackVector &vec, double xyz[3]) const
Get position of track.
virtual void toGlobal(const double uvw[3], double xyz[3]) const =0
Transform local to global coordinates.
cet::coded_exception< error, detail::translate > exception
SurfYZLine()
Default constructor.