11 TrackStatePropagator::TrackStatePropagator(
double minStep,
15 double wrongDirDistTolerance,
18 , fMaxElossFrac(maxElossFrac)
21 , fWrongDirDistTolerance(wrongDirDistTolerance)
22 , fPropPinvErr(propPinvErr)
24 larprop = lar::providerFrom<detinfo::LArPropertiesService>();
61 SVector5 par5d = tmpState.parameters();
81 const double mass = origin.
mass();
82 const double p = 1. / par5d[4];
84 const double t = e - mass;
86 const double range = t / dedx;
89 if (domcs && smax > 0 &&
std::abs(s) > smax) {
94 s = (s > 0 ? smax : -smax);
120 if (dodedx) {
apply_dedx(par5d(4), detProp, dedx, e, origin.
mass(),
s, deriv); }
125 cov5d = ROOT::Math::Similarity(pm, cov5d);
126 cov5d = cov5d + noise_matrix;
136 double& dw2dw1)
const 143 const double sinA2 = target.
sinAlpha();
144 const double cosA2 = target.
cosAlpha();
147 const double sinB2 = target.
sinBeta();
148 const double cosB2 = target.
cosBeta();
149 const double sindB = -sinB1 * cosB2 + cosB1 * sinB2;
150 const double cosdB = cosB1 * cosB2 + sinB1 * sinB2;
151 const double ruu = cosA1 * cosA2 + sinA1 * sinA2 * cosdB;
152 const double ruv = sinA2 * sindB;
153 const double ruw = sinA1 * cosA2 - cosA1 * sinA2 * cosdB;
154 const double rvu = -sinA1 * sindB;
155 const double rvv = cosdB;
156 const double rvw = cosA1 * sindB;
157 const double rwu = cosA1 * sinA2 - sinA1 * cosA2 * cosdB;
158 const double rwv = -cosA2 * sindB;
159 const double rww = sinA1 * sinA2 + cosA1 * cosA2 * cosdB;
160 dw2dw1 = par5[2] * rwu + par5[3] * rwv + rww;
165 const double dudw2 = (par5[2] * ruu + par5[3] * ruv + ruw) / dw2dw1;
166 const double dvdw2 = (par5[2] * rvu + par5[3] * rvv + rvw) / dw2dw1;
169 pm(0, 0) = ruu - dudw2 * rwu;
170 pm(1, 0) = rvu - dvdw2 * rwu;
175 pm(0, 1) = ruv - dudw2 * rwv;
176 pm(1, 1) = rvv - dvdw2 * rwv;
183 pm(2, 2) = (ruu - dudw2 * rwu) / dw2dw1;
184 pm(3, 2) = (rvu - dvdw2 * rwu) / dw2dw1;
189 pm(2, 3) = (ruv - dudw2 * rwv) / dw2dw1;
190 pm(3, 3) = (rvv - dvdw2 * rwv) / dw2dw1;
209 ROOT::Math::Similarity(pm, origin.
covariance()),
211 isTrackAlongPlaneDir,
224 if (targdir.Dot(origmom.Unit()) == 0) {
229 double s = targdir.Dot(targpos - origpos) / targdir.Dot(origmom.Unit());
242 double sperp = targdir.Dot(targpos - origpos);
247 std::pair<double, double>
256 if (targdir.Dot(origmom.Unit()) == 0) {
258 return std::pair<double, double>(DBL_MAX, DBL_MAX);
261 double sperp = targdir.Dot(targpos - origpos);
263 double s = sperp / targdir.Dot(origmom.Unit());
265 return std::pair<double, double>(
s, sperp);
278 if (pinv == 0.)
return;
280 const double emid = e1 - 0.5 * s * dedx;
282 const double pmid = std::sqrt(emid * emid - mass * mass);
283 const double e2 = e1 - 0.001 * s * detProp.
Eloss(pmid, mass,
fTcut);
285 const double p2 = std::sqrt(e2 * e2 - mass * mass);
286 double pinv2 = 1. / p2;
287 if (pinv < 0.) pinv2 = -pinv2;
289 deriv = pinv2 * pinv2 * pinv2 * e2 / (pinv * pinv * pinv * e1);
312 if (pinv == 0. || s == 0.)
return true;
315 if (range > 100.) range = 100.;
316 const double p2 = p *
p;
324 const double betainv = std::sqrt(1. + pinv * pinv * mass * mass);
325 const double theta_fact = (0.0136 * pinv * betainv) * (1. + 0.038 * std::log(range / x0));
326 const double theta02 = theta_fact * theta_fact *
std::abs(s / x0);
329 const double ufact2 = 1. + dudw * dudw;
330 const double vfact2 = 1. + dvdw * dvdw;
331 const double uvfact2 = 1. + dudw * dudw + dvdw * dvdw;
332 const double uvfact = std::sqrt(uvfact2);
333 const double uv = dudw * dvdw;
334 const double dist2_3 = s * s / 3.;
336 if (flipSign) dist_2 = -dist_2;
341 const double pinvvar = evar * e2 / (p2 * p2 * p2);
346 noise_matrix(0, 0) += dist2_3 * theta02 * ufact2;
347 noise_matrix(1, 0) += dist2_3 * theta02 * uv;
348 noise_matrix(1, 1) += dist2_3 * theta02 * vfact2;
351 noise_matrix(2, 2) += theta02 * uvfact2 * ufact2;
352 noise_matrix(3, 2) += theta02 * uvfact2 * uv;
353 noise_matrix(3, 3) += theta02 * uvfact2 * vfact2;
356 noise_matrix(2, 0) += dist_2 * theta02 * uvfact * ufact2;
357 noise_matrix(3, 1) += dist_2 * theta02 * uvfact * vfact2;
360 noise_matrix(2, 1) += dist_2 * theta02 * uvfact * uv;
361 noise_matrix(3, 0) += dist_2 * theta02 * uvfact * uv;
double cosAlpha() const
Return cached values of trigonometric function for angles defining the plane.
recob::tracking::Plane Plane
Class for track parameters (and errors) defined on a recob::tracking::Plane.
Vector_t const & direction() const
Reference direction orthogonal to the plane.
int fMaxNit
Maximum number of iterations.
double ElossVar(double mom, double mass) const
Energy loss fluctuation ( )
const Vector_t & momentum() const
momentum of the track
const SVector5 & parameters() const
track parameters defined on the plane
recob::tracking::SMatrixSym55 SMatrixSym55
recob::tracking::SMatrix55 SMatrix55
TrackState propagateToPlane(bool &success, const detinfo::DetectorPropertiesData &detProp, const TrackState &origin, const Plane &target, bool dodedx, bool domcs, PropDirection dir=FORWARD) const
Main function for propagation of a TrackState to a Plane.
double distanceToPlane(bool &success, const Point_t &origpos, const Vector_t &origdir, const Plane &target) const
Distance of a TrackState (Point and Vector) to a Plane, along the TrackState direction.
bool apply_mcs(detinfo::DetectorPropertiesData const &detProp, double dudw, double dvdw, double pinv, double mass, double s, double range, double p, double e2, bool flipSign, SMatrixSym55 &noise_matrix) const
Apply multiple coulomb scattering.
recob::tracking::Point_t Point_t
double mass() const
mass hypthesis of the track
double fMinStep
Minimum propagation step length guaranteed.
std::enable_if_t< std::is_arithmetic_v< T >, T > hypot(T x, T y)
void apply_dedx(double &pinv, detinfo::DetectorPropertiesData const &detProp, double dedx, double e1, double mass, double s, double &deriv) const
Apply energy loss.
const Point_t & position() const
position of the track
double fTcut
Maximum delta ray energy for dE/dx.
bool isTrackAlongPlaneDir() const
is the track momentum along the plane direction?
recob::tracking::SVector5 SVector5
PropDirection
Propagation direction enum.
int pID() const
particle id hypthesis of the track
Point_t const & position() const
Reference position on the plane.
TrackState rotateToPlane(bool &success, const TrackState &origin, const Plane &target) const
Rotation of a TrackState to a Plane (zero distance propagation)
Point_t propagatedPosByDistance(const Point_t &origpos, const Vector_t &origdir, double distance) const
Quick accesss to the propagated position given a distance.
double perpDistanceToPlane(bool &success, const Point_t &origpos, const Plane &target) const
Distance of a TrackState (Point) to a Plane along the direction orthogonal to the Plane...
double Density(double temperature=0.) const
Returns argon density at a given temperature.
double distance(double x1, double y1, double z1, double x2, double y2, double z2)
static int max(int a, int b)
std::pair< double, double > distancePairToPlane(bool &success, const Point_t &origpos, const Vector_t &origdir, const Plane &target) const
Return both direction types in one go.
const detinfo::LArProperties * larprop
Class defining a plane for tracking. It provides various functionalities to convert track parameters ...
double Eloss(double mom, double mass, double tcut) const
Restricted mean energy loss (dE/dx)
bool fPropPinvErr
Propagate error on 1/p or not (in order to avoid infs, it should be set to false when 1/p not updated...
double fWrongDirDistTolerance
Allowed propagation distance in the wrong direction.
virtual double RadiationLength() const =0
const SMatrixSym55 & covariance() const
track parameter covariance matrix on the plane
double fMaxElossFrac
Maximum propagation step length based on fraction of energy loss.
const Plane & plane() const
plane where the parameters are defined
recob::tracking::Vector_t Vector_t
constexpr Point origin()
Returns a origin position with a point of the specified type.