LArSoft  v06_85_00
Liquid Argon Software toolkit - http://larsoft.org/
trkf::TrackStatePropagator Class Reference

Class for propagation of a trkf::TrackState to a recob::tracking::Plane. More...

#include "TrackStatePropagator.h"

Classes

struct  Config
 

Public Types

enum  PropDirection { FORWARD =0, BACKWARD =1, UNKNOWN =2 }
 Propagation direction enum. More...
 
using Plane = recob::tracking::Plane
 
using Point_t = recob::tracking::Point_t
 
using Vector_t = recob::tracking::Vector_t
 
using SVector6 = recob::tracking::SVector6
 
using Parameters = fhicl::Table< Config >
 

Public Member Functions

 TrackStatePropagator (double minStep, double maxElossFrac, int maxNit, double tcut, double wrongDirDistTolerance, bool propPinvErr)
 Constructor from parameter values. More...
 
 TrackStatePropagator (Parameters const &p)
 Constructor from Parameters (fhicl::Table<Config>). More...
 
virtual ~TrackStatePropagator ()
 Destructor. More...
 
TrackState propagateToPlane (bool &success, const TrackState &origin, const Plane &target, bool dodedx, bool domcs, PropDirection dir=FORWARD) const
 Main function for propagation of a TrackState to a Plane. More...
 
TrackState rotateToPlane (bool &success, const TrackState &origin, const Plane &target) const
 Rotation of a TrackState to a Plane (zero distance propagation) More...
 
Point_t propagatedPosByDistance (const Point_t &origpos, const Vector_t &origdir, double distance) const
 Quick accesss to the propagated position given a distance. More...
 
void apply_dedx (double &pinv, double dedx, double e1, double mass, double s, double &deriv) const
 Apply energy loss. More...
 
bool apply_mcs (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. More...
 
double getTcut () const
 get Tcut parameter used in DetectorPropertiesService Eloss method More...
 
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. More...
 
double distanceToPlane (bool &success, const TrackState &origin, const Plane &target) const
 Distance of a TrackState (Point and Vector) to a Plane, along the TrackState direction. More...
 
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. More...
 
double perpDistanceToPlane (bool &success, const TrackState &origin, const Plane &target) const
 Distance of a TrackState (Point) to a Plane along the direction orthogonal to the Plane. More...
 
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. More...
 
std::pair< double, double > distancePairToPlane (bool &success, const TrackState &origin, const Plane &target) const
 Return both direction types in one go. More...
 

Private Member Functions

TrackState rotateToPlane (bool &success, const TrackState &origin, const Plane &target, double &dw2dw1) const
 Rotation of a TrackState to a Plane (zero distance propagation), keeping track of dw2dw1 (needed by mcs) More...
 

Private Attributes

double fMinStep
 Minimum propagation step length guaranteed. More...
 
double fMaxElossFrac
 Maximum propagation step length based on fraction of energy loss. More...
 
int fMaxNit
 Maximum number of iterations. More...
 
double fTcut
 Maximum delta ray energy for dE/dx. More...
 
double fWrongDirDistTolerance
 Allowed propagation distance in the wrong direction. More...
 
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) More...
 
const detinfo::DetectorPropertiesdetprop
 
const detinfo::LArPropertieslarprop
 

Detailed Description

Class for propagation of a trkf::TrackState to a recob::tracking::Plane.

Author
G. Cerati (FNAL, MicroBooNE)
Date
2017
Version
1.0

This class holds the functionalities needed to propagate a trkf::TrackState to a recob::tracking::Plane. While the core physics is mainly duplicated from trkf::Propagator and its derived classes (kudos to H. Greenlee), the code and the interface are optimized for usage with classes based on SMatrix (e.g. TrackState) and for the needs of TrackKalmanFitter.

While the propagated position can be directly computed, accounting for the material effects in the covariance matrix requires an iterative procedure in case of long propagations distances.

For configuration options see TrackStatePropagator::Config

Definition at line 37 of file TrackStatePropagator.h.

Member Typedef Documentation

Member Enumeration Documentation

Constructor & Destructor Documentation

trkf::TrackStatePropagator::TrackStatePropagator ( double  minStep,
double  maxElossFrac,
int  maxNit,
double  tcut,
double  wrongDirDistTolerance,
bool  propPinvErr 
)

Constructor from parameter values.

Definition at line 11 of file TrackStatePropagator.cxx.

References detprop, and larprop.

11  :
12  fMinStep(minStep),
13  fMaxElossFrac(maxElossFrac),
14  fMaxNit(maxNit),
15  fTcut(tcut),
16  fWrongDirDistTolerance(wrongDirDistTolerance),
17  fPropPinvErr(propPinvErr)
18  {
20  larprop = lar::providerFrom<detinfo::LArPropertiesService>();
21  }
int fMaxNit
Maximum number of iterations.
double fMinStep
Minimum propagation step length guaranteed.
double fTcut
Maximum delta ray energy for dE/dx.
const detinfo::LArProperties * larprop
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.
const detinfo::DetectorProperties * detprop
double fMaxElossFrac
Maximum propagation step length based on fraction of energy loss.
trkf::TrackStatePropagator::TrackStatePropagator ( Parameters const &  p)
inlineexplicit

Constructor from Parameters (fhicl::Table<Config>).

Definition at line 89 of file TrackStatePropagator.h.

References dir, geo::origin(), and target.

89 : TrackStatePropagator(p().minStep(),p().maxElossFrac(),p().maxNit(),p().tcut(),p().wrongDirDistTolerance(),p().propPinvErr()) {}
TrackStatePropagator(double minStep, double maxElossFrac, int maxNit, double tcut, double wrongDirDistTolerance, bool propPinvErr)
Constructor from parameter values.
trkf::TrackStatePropagator::~TrackStatePropagator ( )
virtual

Destructor.

Definition at line 23 of file TrackStatePropagator.cxx.

23 {}

Member Function Documentation

void trkf::TrackStatePropagator::apply_dedx ( double &  pinv,
double  dedx,
double  e1,
double  mass,
double  s,
double &  deriv 
) const

Apply energy loss.

Definition at line 217 of file TrackStatePropagator.cxx.

References detprop, detinfo::DetectorProperties::Eloss(), and fTcut.

Referenced by propagateToPlane().

218  {
219  // For infinite initial momentum, return with infinite momentum.
220  if (pinv == 0.) return;
221  //
222  const double emid = e1 - 0.5 * s * dedx;
223  if(emid > mass) {
224  const double pmid = std::sqrt(emid*emid - mass*mass);
225  const double e2 = e1 - 0.001 * s * detprop->Eloss(pmid, mass, fTcut);
226  if(e2 > mass) {
227  const double p2 = std::sqrt(e2*e2 - mass*mass);
228  double pinv2 = 1./p2;
229  if(pinv < 0.) pinv2 = -pinv2;
230  // derivative
231  deriv = pinv2*pinv2*pinv2 * e2 / (pinv*pinv*pinv * e1);
232  // update result.
233  pinv = pinv2;
234  }
235  }
236  return;
237  }
Float_t s
Definition: plot.C:23
double fTcut
Maximum delta ray energy for dE/dx.
virtual double Eloss(double mom, double mass, double tcut) const =0
Restricted mean energy loss ( )
const detinfo::DetectorProperties * detprop
bool trkf::TrackStatePropagator::apply_mcs ( 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.

Definition at line 239 of file TrackStatePropagator.cxx.

References detinfo::DetectorProperties::Density(), detprop, detinfo::DetectorProperties::ElossVar(), fPropPinvErr, larprop, and detinfo::LArProperties::RadiationLength().

Referenced by propagateToPlane().

239  {
240  // If distance is zero, or momentum is infinite, return zero noise.
241 
242  if(pinv == 0. || s == 0.)
243  return true;
244 
245  // Use crude estimate of the range of the track.
246  if(range > 100.) range = 100.;
247  const double p2 = p*p;
248 
249  // Calculate the radiation length in cm.
250  const double x0 = larprop->RadiationLength() / detprop->Density();
251 
252  // Calculate projected rms scattering angle.
253  // Use the estimted range in the logarithm factor.
254  // Use the incremental propagation distance in the square root factor.
255  const double betainv = std::sqrt(1. + pinv*pinv * mass*mass);
256  const double theta_fact = (0.0136 * pinv * betainv) * (1. + 0.038 * std::log(range/x0));
257  const double theta02 = theta_fact*theta_fact * std::abs(s/x0);
258 
259  // Calculate some common factors needed for multiple scattering.
260  const double ufact2 = 1. + dudw*dudw;
261  const double vfact2 = 1. + dvdw*dvdw;
262  const double uvfact2 = 1. + dudw*dudw + dvdw*dvdw;
263  const double uvfact = std::sqrt(uvfact2);
264  const double uv = dudw * dvdw;
265  const double dist2_3 = s*s / 3.;
266  double dist_2 = std::abs(s) / 2.;
267  if(flipSign) dist_2 = -dist_2;
268 
269  // Calculate energy loss fluctuations.
270 
271  const double evar = 1.e-6 * detprop->ElossVar(p, mass) * std::abs(s); // E variance (GeV^2).
272  const double pinvvar = evar * e2 / (p2*p2*p2); // Inv. p variance (1/GeV^2)
273 
274  // Update elements of noise matrix.
275 
276  // Position submatrix.
277  noise_matrix(0,0) += dist2_3 * theta02 * ufact2; // sigma^2(u,u)
278  noise_matrix(1,0) += dist2_3 * theta02 * uv; // sigma^2(u,v)
279  noise_matrix(1,1) += dist2_3 * theta02 * vfact2; // sigma^2(v,v)
280 
281  // Slope submatrix.
282  noise_matrix(2,2) += theta02 * uvfact2 * ufact2; // sigma^2(u', u')
283  noise_matrix(3,2) += theta02 * uvfact2 * uv; // sigma^2(v', u')
284  noise_matrix(3,3) += theta02 * uvfact2 * vfact2; // sigma^2(v', v')
285 
286  // Same-view position-slope correlations.
287  noise_matrix(2,0) += dist_2 * theta02 * uvfact * ufact2; // sigma^2(u', u)
288  noise_matrix(3,1) += dist_2 * theta02 * uvfact * vfact2; // sigma^2(v', v)
289 
290  // Opposite-view position-slope correlations.
291  noise_matrix(2,1) += dist_2 * theta02 * uvfact * uv; // sigma^2(u', v)
292  noise_matrix(3,0) += dist_2 * theta02 * uvfact * uv; // sigma^2(v', u)
293 
294  // Momentum correlations (zero).
295  // noise_matrix(4,0) += 0.; // sigma^2(pinv, u)
296  // noise_matrix(4,1) += 0.; // sigma^2(pinv, v)
297  // noise_matrix(4,2) += 0.; // sigma^2(pinv, u')
298  // noise_matrix(4,3) += 0.; // sigma^2(pinv, v')
299 
300  // Energy loss fluctuations.
301  if (fPropPinvErr) noise_matrix(4,4) += pinvvar; // sigma^2(pinv, pinv)
302 
303  // Done (success).
304  return true;
305  }
Float_t s
Definition: plot.C:23
virtual double ElossVar(double mom, double mass) const =0
Energy loss fluctuation ( )
virtual double Density(double temperature) const =0
Returns argon density at a given temperature.
const detinfo::LArProperties * larprop
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...
virtual double RadiationLength() const =0
const detinfo::DetectorProperties * detprop
std::pair< double, double > trkf::TrackStatePropagator::distancePairToPlane ( bool &  success,
const Point_t origpos,
const Vector_t origdir,
const Plane target 
) const

Return both direction types in one go.

Definition at line 201 of file TrackStatePropagator.cxx.

References recob::tracking::Plane::direction(), recob::tracking::Plane::position(), and s.

Referenced by propagateToPlane().

201  {
202  const Point_t& targpos = target.position();
203  const Vector_t& targdir = target.direction();
204  //check that origmom is not along the plane, i.e. targdir.Dot(origmom.Unit())=0
205  if (targdir.Dot(origmom.Unit())==0) {
206  success = false;
207  return std::pair<double, double>(DBL_MAX,DBL_MAX);
208  }
209  //point-plane distance projected along direction orthogonal to the plane
210  double sperp = targdir.Dot(targpos-origpos);
211  //distance along track direction
212  double s = sperp/targdir.Dot(origmom.Unit());
213  success = true;
214  return std::pair<double, double>(s,sperp);
215  }
Float_t s
Definition: plot.C:23
Vector_t const & direction() const
Reference direction orthogonal to the plane.
Definition: TrackingPlane.h:70
geo::Point_t Point_t
Type for representation of position in physical 3D space.
Definition: TrackingTypes.h:20
Point_t const & position() const
Reference position on the plane.
Definition: TrackingPlane.h:66
geo::Vector_t Vector_t
Type for representation of momenta in 3D space.
Definition: TrackingTypes.h:23
std::pair<double, double> trkf::TrackStatePropagator::distancePairToPlane ( bool &  success,
const TrackState origin,
const Plane target 
) const
inline

Return both direction types in one go.

Definition at line 122 of file TrackStatePropagator.h.

References trkf::TrackState::momentum(), trkf::TrackState::position(), s, and target.

122  {
123  return distancePairToPlane(success, origin.position(), origin.momentum().Unit(), target);
124  }
cout<< "-> Edep in the target
Definition: analysis.C:54
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.
constexpr Point origin()
Returns a origin position with a point of the specified type.
Definition: geo_vectors.h:230
double trkf::TrackStatePropagator::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.

Definition at line 178 of file TrackStatePropagator.cxx.

References recob::tracking::Plane::direction(), recob::tracking::Plane::position(), and s.

Referenced by trkf::TrackKalmanFitter::doFitWork(), and trkf::TrackKalmanFitter::setupInputStates().

178  {
179  const Point_t& targpos = target.position();
180  const Vector_t& targdir = target.direction();
181  //check that origmom is not along the plane, i.e. targdir.Dot(origmom.Unit())=0
182  if (targdir.Dot(origmom.Unit())==0) {
183  success = false;
184  return DBL_MAX;
185  }
186  //distance along track direction
187  double s = targdir.Dot(targpos-origpos)/targdir.Dot(origmom.Unit());
188  success = true;
189  return s;
190  }
Float_t s
Definition: plot.C:23
Vector_t const & direction() const
Reference direction orthogonal to the plane.
Definition: TrackingPlane.h:70
geo::Point_t Point_t
Type for representation of position in physical 3D space.
Definition: TrackingTypes.h:20
Point_t const & position() const
Reference position on the plane.
Definition: TrackingPlane.h:66
geo::Vector_t Vector_t
Type for representation of momenta in 3D space.
Definition: TrackingTypes.h:23
double trkf::TrackStatePropagator::distanceToPlane ( bool &  success,
const TrackState origin,
const Plane target 
) const
inline

Distance of a TrackState (Point and Vector) to a Plane, along the TrackState direction.

Definition at line 106 of file TrackStatePropagator.h.

References trkf::TrackState::momentum(), trkf::TrackState::position(), and target.

106  {
107  return distanceToPlane(success, origin.position(), origin.momentum().Unit(), target);
108  }
cout<< "-> Edep in the target
Definition: analysis.C:54
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.
constexpr Point origin()
Returns a origin position with a point of the specified type.
Definition: geo_vectors.h:230
double trkf::TrackStatePropagator::getTcut ( ) const
inline

get Tcut parameter used in DetectorPropertiesService Eloss method

Definition at line 134 of file TrackStatePropagator.h.

134 {return fTcut;}
double fTcut
Maximum delta ray energy for dE/dx.
double trkf::TrackStatePropagator::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.

Definition at line 192 of file TrackStatePropagator.cxx.

References recob::tracking::Plane::direction(), and recob::tracking::Plane::position().

192  {
193  const Point_t& targpos = target.position();
194  const Vector_t& targdir = target.direction();
195  //point-plane distance projected along direction orthogonal to the plane
196  double sperp = targdir.Dot(targpos-origpos);
197  success = true;
198  return sperp;
199  }
Vector_t const & direction() const
Reference direction orthogonal to the plane.
Definition: TrackingPlane.h:70
geo::Point_t Point_t
Type for representation of position in physical 3D space.
Definition: TrackingTypes.h:20
Point_t const & position() const
Reference position on the plane.
Definition: TrackingPlane.h:66
geo::Vector_t Vector_t
Type for representation of momenta in 3D space.
Definition: TrackingTypes.h:23
double trkf::TrackStatePropagator::perpDistanceToPlane ( bool &  success,
const TrackState origin,
const Plane target 
) const
inline

Distance of a TrackState (Point) to a Plane along the direction orthogonal to the Plane.

Definition at line 114 of file TrackStatePropagator.h.

References trkf::TrackState::position(), and target.

114  {
115  return perpDistanceToPlane(success, origin.position(), target);
116  }
cout<< "-> Edep in the target
Definition: analysis.C:54
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...
constexpr Point origin()
Returns a origin position with a point of the specified type.
Definition: geo_vectors.h:230
Point_t trkf::TrackStatePropagator::propagatedPosByDistance ( const Point_t origpos,
const Vector_t origdir,
double  distance 
) const
inline

Quick accesss to the propagated position given a distance.

Definition at line 101 of file TrackStatePropagator.h.

Referenced by propagateToPlane().

101 { return origpos+distance*origdir; }
TrackState trkf::TrackStatePropagator::propagateToPlane ( bool &  success,
const TrackState origin,
const Plane target,
bool  dodedx,
bool  domcs,
PropDirection  dir = FORWARD 
) const

Main function for propagation of a TrackState to a Plane.

Definition at line 27 of file TrackStatePropagator.cxx.

References apply_dedx(), apply_mcs(), BACKWARD, trkf::TrackState::covariance(), detprop, recob::tracking::Plane::direction(), distancePairToPlane(), e, detinfo::DetectorProperties::Eloss(), fMaxElossFrac, fMaxNit, fMinStep, FORWARD, fPropPinvErr, fTcut, fWrongDirDistTolerance, trkf::TrackState::isTrackAlongPlaneDir(), trkf::TrackState::mass(), max, trkf::TrackState::momentum(), geo::origin(), trkf::TrackState::parameters(), trkf::TrackState::pID(), trkf::TrackState::plane(), trkf::TrackState::position(), propagatedPosByDistance(), rotateToPlane(), and s.

Referenced by trkf::TrackKalmanFitter::doFitWork().

27  {
28  //
29  // 1- find distance to target plane
30  std::pair<double, double> distpair = distancePairToPlane(success, origin, target);
31  double distance = distpair.first;
32  double sperp = distpair.second;
33  //
34  if ((distance<-fWrongDirDistTolerance && dir==FORWARD) || (distance>fWrongDirDistTolerance && dir==BACKWARD)) {
35  success = false;
36  return origin;
37  }
38  //
39  // 2- propagate 3d position by distance, form propagated state on plane parallel to origin plane
40  Point_t p = propagatedPosByDistance(origin.position(), origin.momentum()*origin.parameters()[4], distance);
41  TrackState tmpState(SVector5(0.,0.,origin.parameters()[2],origin.parameters()[3],origin.parameters()[4]), origin.covariance(),
42  Plane(p,origin.plane().direction()), origin.isTrackAlongPlaneDir(), origin.pID());
43  //
44  // 3- rotate state to target plane
45  double dw2dw1 = 0;
46  tmpState = rotateToPlane(success, tmpState, target, dw2dw1);
47  SVector5 par5d = tmpState.parameters();
48  SMatrixSym55 cov5d = tmpState.covariance();
49  //
50  // 4- compute jacobian to propagate uncertainties
51  SMatrix55 pm = ROOT::Math::SMatrixIdentity();//diagonal elements are 1
52  pm(0,2) = sperp; // du2/d(dudw1);
53  pm(1,3) = sperp; // dv2/d(dvdw1);
54  //
55  // 5- apply material effects, performing more iterations if the distance is long
56  bool arrived = false;
57  int nit = 0; // Iteration count.
58  double deriv = 1.;
59  SMatrixSym55 noise_matrix;
60  while (!arrived) {
61  ++nit;
62  if(nit > fMaxNit) {
63  success = false;
64  return origin;
65  }
66  // Estimate maximum step distance, such that fMaxElossFrac of initial energy is lost by dedx
67  const double mass = origin.mass();
68  const double p = 1./par5d[4];
69  const double e = std::hypot(p, mass);
70  const double t = e - mass;
71  const double dedx = 0.001 * detprop->Eloss(std::abs(p), mass, fTcut);
72  const double range = t / dedx;
73  const double smax = std::max(fMinStep,fMaxElossFrac*range);
74  double s = distance;
75  if (domcs && smax>0 && std::abs(s)>smax) {
76  if (fMaxNit==1) {
77  success = false;
78  return origin;
79  }
80  s = (s>0 ? smax : -smax);
81  distance-=s;
82  } else arrived = true;
83  // now apply material effects
84  if(domcs) {
85  bool flip = false;
86  if (origin.isTrackAlongPlaneDir()==true && dw2dw1<0.) flip = true;
87  if (origin.isTrackAlongPlaneDir()==false && dw2dw1>0.) flip = true;
88  bool ok = apply_mcs(par5d[2], par5d[3], par5d[4], origin.mass(), s, range, p, e*e, flip, noise_matrix);
89  if(!ok) {
90  success = false;
91  return origin;
92  }
93  }
94  if(dodedx) {
95  apply_dedx(par5d(4), dedx, e, origin.mass(), s, deriv);
96  }
97  }
98  if (fPropPinvErr) pm(4,4)*=deriv;
99  //
100  // 6- create final track state
101  cov5d = ROOT::Math::Similarity(pm,cov5d);//*rj
102  cov5d = cov5d+noise_matrix;
103  TrackState trackState(par5d, cov5d, target, origin.momentum().Dot(target.direction())>0, origin.pID());
104  return trackState;
105  }
recob::tracking::Plane Plane
Float_t s
Definition: plot.C:23
Vector_t const & direction() const
Reference direction orthogonal to the plane.
Definition: TrackingPlane.h:70
int fMaxNit
Maximum number of iterations.
ROOT::Math::SMatrix< double, 5, 5 > SMatrix55
Definition: TrackingTypes.h:61
geo::Point_t Point_t
Type for representation of position in physical 3D space.
Definition: TrackingTypes.h:20
ROOT::Math::SMatrix< double, 5, 5, ROOT::Math::MatRepSym< double, 5 > > SMatrixSym55
Definition: TrackingTypes.h:57
double fMinStep
Minimum propagation step length guaranteed.
double fTcut
Maximum delta ray energy for dE/dx.
Int_t max
Definition: plot.C:27
virtual double Eloss(double mom, double mass, double tcut) const =0
Restricted mean energy loss ( )
bool apply_mcs(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::SVector5 SVector5
Definition: TrackState.h:12
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.
ROOT::Math::SVector< double, 5 > SVector5
Definition: TrackingTypes.h:64
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.
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...
TDirectory * dir
Definition: macro.C:5
double fWrongDirDistTolerance
Allowed propagation distance in the wrong direction.
void apply_dedx(double &pinv, double dedx, double e1, double mass, double s, double &deriv) const
Apply energy loss.
const detinfo::DetectorProperties * detprop
double fMaxElossFrac
Maximum propagation step length based on fraction of energy loss.
Float_t e
Definition: plot.C:34
constexpr Point origin()
Returns a origin position with a point of the specified type.
Definition: geo_vectors.h:230
TrackState trkf::TrackStatePropagator::rotateToPlane ( bool &  success,
const TrackState origin,
const Plane target 
) const
inline

Rotation of a TrackState to a Plane (zero distance propagation)

Definition at line 98 of file TrackStatePropagator.h.

References rotateToPlane().

Referenced by trkf::TrackKalmanFitter::fillResult(), propagateToPlane(), and rotateToPlane().

98 { double dw2dw1 = 0.; return rotateToPlane(success, origin, target, dw2dw1);}
cout<< "-> Edep in the target
Definition: analysis.C:54
TrackState rotateToPlane(bool &success, const TrackState &origin, const Plane &target) const
Rotation of a TrackState to a Plane (zero distance propagation)
constexpr Point origin()
Returns a origin position with a point of the specified type.
Definition: geo_vectors.h:230
TrackState trkf::TrackStatePropagator::rotateToPlane ( bool &  success,
const TrackState origin,
const Plane target,
double &  dw2dw1 
) const
private

Rotation of a TrackState to a Plane (zero distance propagation), keeping track of dw2dw1 (needed by mcs)

Definition at line 107 of file TrackStatePropagator.cxx.

References recob::tracking::Plane::cosAlpha(), recob::tracking::Plane::cosBeta(), trkf::TrackState::covariance(), recob::tracking::Plane::direction(), trkf::TrackState::momentum(), geo::origin(), trkf::TrackState::parameters(), trkf::TrackState::pID(), trkf::TrackState::plane(), recob::tracking::Plane::position(), trkf::TrackState::position(), recob::tracking::Plane::sinAlpha(), and recob::tracking::Plane::sinBeta().

107  {
108  const bool isTrackAlongPlaneDir = origin.momentum().Dot(target.direction())>0;
109  //
110  SVector5 par5 = origin.parameters();
111  const double sinA1 = origin.plane().sinAlpha();
112  const double cosA1 = origin.plane().cosAlpha();
113  const double sinA2 = target.sinAlpha();
114  const double cosA2 = target.cosAlpha();
115  const double sinB1 = origin.plane().sinBeta();
116  const double cosB1 = origin.plane().cosBeta();
117  const double sinB2 = target.sinBeta();
118  const double cosB2 = target.cosBeta();
119  const double sindB = -sinB1*cosB2 + cosB1*sinB2;
120  const double cosdB = cosB1*cosB2 + sinB1*sinB2;
121  const double ruu = cosA1*cosA2 + sinA1*sinA2*cosdB;
122  const double ruv = sinA2*sindB;
123  const double ruw = sinA1*cosA2 - cosA1*sinA2*cosdB;
124  const double rvu = -sinA1*sindB;
125  const double rvv = cosdB;
126  const double rvw = cosA1*sindB;
127  const double rwu = cosA1*sinA2 - sinA1*cosA2*cosdB;
128  const double rwv = -cosA2*sindB;
129  const double rww = sinA1*sinA2 + cosA1*cosA2*cosdB;
130  dw2dw1 = par5[2]*rwu + par5[3]*rwv + rww;
131  if(dw2dw1 == 0.) {
132  success = false;
133  return origin;
134  }
135  const double dudw2 = (par5[2]*ruu + par5[3]*ruv + ruw) / dw2dw1;
136  const double dvdw2 = (par5[2]*rvu + par5[3]*rvv + rvw) / dw2dw1;
137  SMatrix55 pm;
138  //
139  pm(0,0) = ruu - dudw2*rwu; // du2/du1
140  pm(1,0) = rvu - dvdw2*rwu; // dv2/du1
141  pm(2,0) = 0.; // d(dudw2)/du1
142  pm(3,0) = 0.; // d(dvdw2)/du1
143  pm(4,0) = 0.; // d(pinv2)/du1
144  //
145  pm(0,1) = ruv - dudw2*rwv; // du2/dv1
146  pm(1,1) = rvv - dvdw2*rwv; // dv2/dv1
147  pm(2,1) = 0.; // d(dudw2)/dv1
148  pm(3,1) = 0.; // d(dvdw2)/dv1
149  pm(4,1) = 0.; // d(pinv2)/dv1
150  //
151  pm(0,2) = 0.; // du2/d(dudw1);
152  pm(1,2) = 0.; // dv2/d(dudw1);
153  pm(2,2) = (ruu - dudw2*rwu) / dw2dw1; // d(dudw2)/d(dudw1);
154  pm(3,2) = (rvu - dvdw2*rwu) / dw2dw1; // d(dvdw2)/d(dudw1);
155  pm(4,2) = 0.; // d(pinv2)/d(dudw1);
156  //
157  pm(0,3) = 0.; // du2/d(dvdw1);
158  pm(1,3) = 0.; // dv2/d(dvdw1);
159  pm(2,3) = (ruv - dudw2*rwv) / dw2dw1; // d(dudw2)/d(dvdw1);
160  pm(3,3) = (rvv - dvdw2*rwv) / dw2dw1; // d(dvdw2)/d(dvdw1);
161  pm(4,3) = 0.; // d(pinv2)/d(dvdw1);
162  //
163  pm(0,4) = 0.; // du2/d(pinv1);
164  pm(1,4) = 0.; // dv2/d(pinv1);
165  pm(2,4) = 0.; // d(dudw2)/d(pinv1);
166  pm(3,4) = 0.; // d(dvdw2)/d(pinv1);
167  pm(4,4) = 1.; // d(pinv2)/d(pinv1);
168  //
169  par5[0] = (origin.position().X() - target.position().X()) * cosA2 + (origin.position().Y() - target.position().Y())*sinA2*sinB2 - (origin.position().Z() - target.position().Z())*sinA2*cosB2;
170  par5[1] = (origin.position().Y() - target.position().Y()) * cosB2 + (origin.position().Z() - target.position().Z()) * sinB2;
171  par5[2] = dudw2;
172  par5[3] = dvdw2;
173  //
174  success = true;
175  return TrackState(par5,ROOT::Math::Similarity(pm,origin.covariance()),Plane(origin.position(),target.direction()),isTrackAlongPlaneDir,origin.pID());
176  }
double cosAlpha() const
Return cached values of trigonometric function for angles defining the plane.
recob::tracking::Plane Plane
Vector_t const & direction() const
Reference direction orthogonal to the plane.
Definition: TrackingPlane.h:70
ROOT::Math::SMatrix< double, 5, 5 > SMatrix55
Definition: TrackingTypes.h:61
double cosBeta() const
Return cached values of trigonometric function for angles defining the plane.
Point_t const & position() const
Reference position on the plane.
Definition: TrackingPlane.h:66
ROOT::Math::SVector< double, 5 > SVector5
Definition: TrackingTypes.h:64
double sinAlpha() const
Return cached values of trigonometric function for angles defining the plane.
double sinBeta() const
Return cached values of trigonometric function for angles defining the plane.
constexpr Point origin()
Returns a origin position with a point of the specified type.
Definition: geo_vectors.h:230

Member Data Documentation

const detinfo::DetectorProperties* trkf::TrackStatePropagator::detprop
private
double trkf::TrackStatePropagator::fMaxElossFrac
private

Maximum propagation step length based on fraction of energy loss.

Definition at line 142 of file TrackStatePropagator.h.

Referenced by propagateToPlane().

int trkf::TrackStatePropagator::fMaxNit
private

Maximum number of iterations.

Definition at line 143 of file TrackStatePropagator.h.

Referenced by propagateToPlane().

double trkf::TrackStatePropagator::fMinStep
private

Minimum propagation step length guaranteed.

Definition at line 141 of file TrackStatePropagator.h.

Referenced by propagateToPlane().

bool trkf::TrackStatePropagator::fPropPinvErr
private

Propagate error on 1/p or not (in order to avoid infs, it should be set to false when 1/p not updated)

Definition at line 146 of file TrackStatePropagator.h.

Referenced by apply_mcs(), and propagateToPlane().

double trkf::TrackStatePropagator::fTcut
private

Maximum delta ray energy for dE/dx.

Definition at line 144 of file TrackStatePropagator.h.

Referenced by apply_dedx(), and propagateToPlane().

double trkf::TrackStatePropagator::fWrongDirDistTolerance
private

Allowed propagation distance in the wrong direction.

Definition at line 145 of file TrackStatePropagator.h.

Referenced by propagateToPlane().

const detinfo::LArProperties* trkf::TrackStatePropagator::larprop
private

Definition at line 148 of file TrackStatePropagator.h.

Referenced by apply_mcs(), and TrackStatePropagator().


The documentation for this class was generated from the following files: