All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Propagator.h
Go to the documentation of this file.
1 ////////////////////////////////////////////////////////////////////////
2 ///
3 /// \file Propagator.h
4 ///
5 /// \brief Base class for Kalman filter track propagator.
6 ///
7 /// \author H. Greenlee
8 ///
9 /// This class provides the general interface for propagating a track
10 /// (KTrack or KETrack) from its current surface to some destionation
11 /// surface.
12 ///
13 /// This class supports various use cases.
14 ///
15 /// 1. Propagate without error, short distance (method short_vec_prop).
16 /// 2. Propagate without error, long distance (method vec_prop).
17 /// 3. Linearized propagation without error, short distance (method lin_prop).
18 /// 4. Propagate with error, but without noise (method err_prop).
19 /// 5. Propagate with error and noise (method noise_prop).
20 /// 6. Coordinate transformations without motion (method origin_vec_prop).
21 ///
22 /// Methods short_vec_prop and origin_vec_prop are pure virtual.
23 ///
24 /// Other methods are implemented by calling short_vec_prop internally.
25 ///
26 /// The long distance propagation method (vec_prop) divides
27 /// propagation into steps if the distance exceeds some threshold
28 ///
29 /// Linearized propagation uses a linear approximation of the
30 /// propagation function with respect to some reference trajectory.
31 /// This type of propagation only makes sense for short distance
32 /// propagation, so lin_prop is implemented by calling short_vec_prop.
33 ///
34 /// All of the *vec_prop methods include optional hooks for returning
35 /// the propagation matrix and the noise matrix. These hooks provide
36 /// enough information to propagate the error matrix (methods err_prop
37 /// and noise_prop) locally within this class in terms of method
38 /// vec_prop (so long distance propagation with error is supported).
39 ///
40 /// All propagation methods update the surface and track state vector,
41 /// provided the propagation is successful. The error and noise
42 /// propagation methods additionally update the track error matrix.
43 ///
44 /// In case of propagation failure, all propagation methods promise
45 /// to leave the original track unmodified.
46 ///
47 /// Use case three (propagate with error, but without noise) updates the
48 /// track error matrix reversibly.
49 ///
50 /// Use case four (propagate with error and noise) adds irreversible
51 /// propagation noise to the error matrix.
52 ///
53 /// All propagation methods except origin_vec_prop allow the direction
54 /// of propagation to be specified as forward, backward, or unknown.
55 /// If the direction is specified as unknown, the propagator decides
56 /// which direction to use.
57 ///
58 /// All propagation methods return the propagation distance as a value
59 /// of type std::optional<double>. This type of value is equivalent
60 /// to the contained value (that is, the propagation distance), plus a
61 /// flag indicating whether the contained value is initialized. A
62 /// non-initialized return value means that the propagation failed.
63 ///
64 /// Calculation of dE/dx can be enabled or disabled by a flag passed to
65 /// the constructor, as well as by a flag passed to individual
66 /// propagation methods. Nonzero energy loss will take place only if
67 /// both flags are true.
68 ///
69 /// Method origin_vec_prop always returns a propgation distance of
70 /// zero (if successful). Origin propagation does not calculate noise
71 /// (noise is zero by definition). Origin propagation does not accept
72 /// or need a propgation direction or dE/dx flag.
73 ///
74 ////////////////////////////////////////////////////////////////////////
75 
76 #ifndef PROPAGATOR_H
77 #define PROPAGATOR_H
78 
82 namespace detinfo {
83  class DetectorPropertiesData;
84 }
85 
86 #include <memory>
87 #include <optional>
88 
89 namespace trkf {
90 
91  class Propagator {
92  public:
93  /// Propagation direction enum.
95 
96  /// Constructor.
98  double tcut,
99  bool doDedx,
100  const std::shared_ptr<const Interactor>& interactor);
101 
102  /// Destructor.
103  virtual ~Propagator();
104 
105  // Accessors.
106 
107  double
108  getTcut() const
109  {
110  return fTcut;
111  }
112  bool
113  getDoDedx() const
114  {
115  return fDoDedx;
116  }
117  const std::shared_ptr<const Interactor>&
119  {
120  return fInteractor;
121  }
122 
123  // Virtual methods.
124 
125  /// Clone method.
126  virtual Propagator* clone() const = 0;
127 
128  /// Propagate without error (short distance).
129  virtual std::optional<double> short_vec_prop(KTrack& trk,
130  const std::shared_ptr<const Surface>& psurf,
132  bool doDedx,
133  TrackMatrix* prop_matrix = 0,
134  TrackError* noise_matrix = 0) const = 0;
135 
136  /// Propagate without error to surface whose origin parameters coincide with track position.
137  virtual std::optional<double> origin_vec_prop(KTrack& trk,
138  const std::shared_ptr<const Surface>& porient,
139  TrackMatrix* prop_matrix = 0) const = 0;
140 
141  /// Propagate without error (long distance).
142  std::optional<double> vec_prop(KTrack& trk,
143  const std::shared_ptr<const Surface>& psurf,
145  bool doDedx,
146  TrackMatrix* prop_matrix = 0,
147  TrackError* noise_matrix = 0) const;
148 
149  /// Linearized propagate without error.
150  std::optional<double> lin_prop(KTrack& trk,
151  const std::shared_ptr<const Surface>& psurf,
153  bool doDedx,
154  KTrack* ref = 0,
155  TrackMatrix* prop_matrix = 0,
156  TrackError* noise_matrix = 0) const;
157  /// Propagate with error, but without noise.
158  std::optional<double> err_prop(KETrack& tre,
159  const std::shared_ptr<const Surface>& psurf,
161  bool doDedx,
162  KTrack* ref = 0,
163  TrackMatrix* prop_matrix = 0) const;
164 
165  /// Propagate with error and noise.
166  std::optional<double> noise_prop(KETrack& tre,
167  const std::shared_ptr<const Surface>& psurf,
169  bool doDedx,
170  KTrack* ref = 0) const;
171 
172  /// Method to calculate updated momentum due to dE/dx.
173  std::optional<double> dedx_prop(double pinv, double mass, double s, double* deriv = 0) const;
174 
175  private:
177  double fTcut; ///< Maximum delta ray energy for dE/dx.
178  bool fDoDedx; ///< Energy loss enable flag.
179  std::shared_ptr<const Interactor> fInteractor; ///< Interactor (for calculating noise).
180  };
181 }
182 
183 #endif
KSymMatrix< 5 >::type TrackError
Track error matrix, dimension 5x5.
virtual std::optional< double > short_vec_prop(KTrack &trk, const std::shared_ptr< const Surface > &psurf, PropDirection dir, bool doDedx, TrackMatrix *prop_matrix=0, TrackError *noise_matrix=0) const =0
Propagate without error (short distance).
virtual std::optional< double > origin_vec_prop(KTrack &trk, const std::shared_ptr< const Surface > &porient, TrackMatrix *prop_matrix=0) const =0
Propagate without error to surface whose origin parameters coincide with track position.
Base class for Kalman filter track interactor.
double getTcut() const
Definition: Propagator.h:108
const std::shared_ptr< const Interactor > & getInteractor() const
Definition: Propagator.h:118
double fTcut
Maximum delta ray energy for dE/dx.
Definition: Propagator.h:177
virtual ~Propagator()
Destructor.
virtual Propagator * clone() const =0
Clone method.
std::optional< double > vec_prop(KTrack &trk, const std::shared_ptr< const Surface > &psurf, PropDirection dir, bool doDedx, TrackMatrix *prop_matrix=0, TrackError *noise_matrix=0) const
Propagate without error (long distance).
Definition: Propagator.cxx:53
std::optional< double > noise_prop(KETrack &tre, const std::shared_ptr< const Surface > &psurf, PropDirection dir, bool doDedx, KTrack *ref=0) const
Propagate with error and noise.
Definition: Propagator.cxx:386
detinfo::DetectorPropertiesData const & fDetProp
Definition: Propagator.h:176
std::optional< double > lin_prop(KTrack &trk, const std::shared_ptr< const Surface > &psurf, PropDirection dir, bool doDedx, KTrack *ref=0, TrackMatrix *prop_matrix=0, TrackError *noise_matrix=0) const
Linearized propagate without error.
Definition: Propagator.cxx:251
PropDirection
Propagation direction enum.
std::optional< double > err_prop(KETrack &tre, const std::shared_ptr< const Surface > &psurf, PropDirection dir, bool doDedx, KTrack *ref=0, TrackMatrix *prop_matrix=0) const
Propagate with error, but without noise.
Definition: Propagator.cxx:346
Kalman filter linear algebra typedefs.
tuple dir
Definition: dropbox.py:28
bool getDoDedx() const
Definition: Propagator.h:113
KMatrix< 5, 5 >::type TrackMatrix
General 5x5 matrix.
std::optional< double > dedx_prop(double pinv, double mass, double s, double *deriv=0) const
Method to calculate updated momentum due to dE/dx.
Definition: Propagator.cxx:452
then echo File list $list not found else cat $list while read file do echo $file sed s
Definition: file_to_url.sh:60
float mass
Definition: dedx.py:47
std::shared_ptr< const Interactor > fInteractor
Interactor (for calculating noise).
Definition: Propagator.h:179
bool fDoDedx
Energy loss enable flag.
Definition: Propagator.h:178
Basic Kalman filter track class, with error.
Propagator(detinfo::DetectorPropertiesData const &detProp, double tcut, bool doDedx, const std::shared_ptr< const Interactor > &interactor)
Constructor.
Definition: Propagator.cxx:26
auto const detProp
PropDirection
Propagation direction enum.
Definition: Propagator.h:94