LArSoft  v06_85_00
Liquid Argon Software toolkit - http://larsoft.org/
TrackStatePropagator.h
Go to the documentation of this file.
1 #ifndef TRACKSTATEPROPAGATOR_H
2 #define TRACKSTATEPROPAGATOR_H
3 
4 #include <memory>
5 
8 #include "fhiclcpp/types/Atom.h"
9 #include "fhiclcpp/types/Table.h"
10 
11 namespace detinfo {
12  class DetectorProperties;
13  class LArProperties;
14 }
15 
16 namespace trkf {
17 
36 
38  {
39  public:
40 
45 
46  struct Config {
47  using Name = fhicl::Name;
50  Name("minStep"),
51  Comment("Minimum propagation step length guaranteed."),
52  1.0
53  };
54  fhicl::Atom<double> maxElossFrac {
55  Name("maxElossFrac"),
56  Comment("Maximum propagation step length based on fraction of energy loss."),
57  0.1
58  };
60  Name("maxNit"),
61  Comment("Maximum number of iterations when applying material effects."),
62  10
63  };
65  Name("tcut"),
66  Comment("Maximum delta ray energy for dE/dx."),
67  10.
68  };
69  fhicl::Atom<double> wrongDirDistTolerance {
70  Name("wrongDirDistTolerance"),
71  Comment("Allowed propagation distance in the wrong direction."),
72  0.01
73  };
74  fhicl::Atom<bool> propPinvErr {
75  Name("propPinvErr"),
76  Comment("Propagate error on 1/p or not (in order to avoid infs, it should be set to false when 1/p not updated)."),
77  false
78  };
79  };
81 
83  enum PropDirection {FORWARD=0, BACKWARD=1, UNKNOWN=2};
84 
86  TrackStatePropagator(double minStep, double maxElossFrac, int maxNit, double tcut, double wrongDirDistTolerance, bool propPinvErr);
87 
89  explicit TrackStatePropagator(Parameters const & p) : TrackStatePropagator(p().minStep(),p().maxElossFrac(),p().maxNit(),p().tcut(),p().wrongDirDistTolerance(),p().propPinvErr()) {}
90 
92  virtual ~TrackStatePropagator();
93 
95  TrackState propagateToPlane(bool& success, const TrackState& origin, const Plane& target, bool dodedx, bool domcs, PropDirection dir = FORWARD) const;
96 
98  inline TrackState rotateToPlane(bool& success, const TrackState& origin, const Plane& target) const { double dw2dw1 = 0.; return rotateToPlane(success, origin, target, dw2dw1);}
99 
101  inline Point_t propagatedPosByDistance(const Point_t& origpos, const Vector_t& origdir, double distance) const { return origpos+distance*origdir; }
102 
104  double distanceToPlane(bool& success, const Point_t& origpos, const Vector_t& origdir, const Plane& target) const;
106  inline double distanceToPlane(bool& success, const TrackState& origin, const Plane& target) const {
107  return distanceToPlane(success, origin.position(), origin.momentum().Unit(), target);
108  }
110 
112  double perpDistanceToPlane(bool& success, const Point_t& origpos, const Plane& target) const;
114  inline double perpDistanceToPlane(bool& success, const TrackState& origin, const Plane& target) const {
115  return perpDistanceToPlane(success, origin.position(), target);
116  }
118 
120  std::pair<double, double> distancePairToPlane(bool& success, const Point_t& origpos, const Vector_t& origdir, const Plane& target) const;
122  inline std::pair<double, double> distancePairToPlane(bool& success, const TrackState& origin, const Plane& target) const {
123  return distancePairToPlane(success, origin.position(), origin.momentum().Unit(), target);
124  }
126 
128  void apply_dedx(double& pinv, double dedx, double e1, double mass, double s, double& deriv) const;
129 
131  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;
132 
134  double getTcut() const {return fTcut;}
135 
136  private:
137 
139  TrackState rotateToPlane(bool& success, const TrackState& origin, const Plane& target, double& dw2dw1) const;
140 
141  double fMinStep;
142  double fMaxElossFrac;
143  int fMaxNit;
144  double fTcut;
149  };
150 }
151 
152 #endif
Class for track parameters (and errors) defined on a recob::tracking::Plane.
Definition: TrackState.h:79
Float_t s
Definition: plot.C:23
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...
int fMaxNit
Maximum number of iterations.
geo::Point_t Point_t
Type for representation of position in physical 3D space.
Definition: TrackingTypes.h:20
cout<< "-> Edep in the target
Definition: analysis.C:54
const Vector_t & momentum() const
momentum of the track
Definition: TrackState.h:98
recob::tracking::SMatrixSym55 SMatrixSym55
Definition: TrackState.h:15
TrackStatePropagator(Parameters const &p)
Constructor from Parameters (fhicl::Table<Config>).
Class for propagation of a trkf::TrackState to a recob::tracking::Plane.
recob::tracking::Point_t Point_t
double fMinStep
Minimum propagation step length guaranteed.
const Point_t & position() const
position of the track
Definition: TrackState.h:96
ROOT::Math::SVector< double, 6 > SVector6
Definition: TrackingTypes.h:63
double fTcut
Maximum delta ray energy for dE/dx.
PropDirection
Propagation direction enum.
recob::tracking::SVector6 SVector6
TrackState rotateToPlane(bool &success, const TrackState &origin, const Plane &target) const
Rotation of a TrackState to a Plane (zero distance propagation)
geo::Vector_t Vector_t
Type for representation of momenta in 3D space.
Definition: TrackingTypes.h:23
Point_t propagatedPosByDistance(const Point_t &origpos, const Vector_t &origdir, double distance) const
Quick accesss to the propagated position given a distance.
std::pair< double, double > distancePairToPlane(bool &success, const TrackState &origin, const Plane &target) const
Return both direction types in one go.
General LArSoft Utilities.
const detinfo::LArProperties * larprop
Class defining a plane for tracking. It provides various functionalities to convert track parameters ...
Definition: TrackingPlane.h:37
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.
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.
const detinfo::DetectorProperties * detprop
double fMaxElossFrac
Maximum propagation step length based on fraction of energy loss.
recob::tracking::Plane Plane
Definition: TrackState.h:17
recob::tracking::Vector_t Vector_t
constexpr Point origin()
Returns a origin position with a point of the specified type.
Definition: geo_vectors.h:230
double getTcut() const
get Tcut parameter used in DetectorPropertiesService Eloss method