LArSoft  v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
PropAny.cxx
Go to the documentation of this file.
1 
12 #include "cetlib_except/exception.h"
17 
18 namespace trkf {
19 
27  PropAny::PropAny(detinfo::DetectorPropertiesData const& detProp, double tcut, bool doDedx)
28  : Propagator(detProp,
29  tcut,
30  doDedx,
31  (tcut >= 0 ? std::make_shared<InteractPlane const>(detProp, tcut) :
32  std::shared_ptr<Interactor const>{}))
33  , fPropYZLine(detProp, tcut, doDedx)
34  , fPropYZPlane(detProp, tcut, doDedx)
35  , fPropXYZPlane(detProp, tcut, doDedx)
36  {}
37 
54  std::optional<double> PropAny::short_vec_prop(KTrack& trk,
55  const std::shared_ptr<const Surface>& psurf,
57  bool doDedx,
58  TrackMatrix* prop_matrix,
59  TrackError* noise_matrix) const
60  {
61  // Default result.
62 
63  std::optional<double> result{std::nullopt};
64 
65  // Test the type of the destination surface.
66 
67  if (dynamic_cast<const SurfYZLine*>(&*psurf))
68  result = fPropYZLine.short_vec_prop(trk, psurf, dir, doDedx, prop_matrix, noise_matrix);
69  else if (dynamic_cast<const SurfYZPlane*>(&*psurf))
70  result = fPropYZPlane.short_vec_prop(trk, psurf, dir, doDedx, prop_matrix, noise_matrix);
71  else if (dynamic_cast<const SurfXYZPlane*>(&*psurf))
72  result = fPropXYZPlane.short_vec_prop(trk, psurf, dir, doDedx, prop_matrix, noise_matrix);
73  else
74  throw cet::exception("PropAny") << "Destination surface has unknown type.\n";
75 
76  // Done.
77 
78  return result;
79  }
80 
94  std::optional<double> PropAny::origin_vec_prop(KTrack& trk,
95  const std::shared_ptr<const Surface>& porient,
96  TrackMatrix* prop_matrix) const
97  {
98  // Default result.
99 
100  std::optional<double> result{std::nullopt};
101 
102  // Test the type of the destination surface.
103 
104  if (dynamic_cast<const SurfYZLine*>(&*porient))
105  result = fPropYZLine.origin_vec_prop(trk, porient, prop_matrix);
106  else if (dynamic_cast<const SurfYZPlane*>(&*porient))
107  result = fPropYZPlane.origin_vec_prop(trk, porient, prop_matrix);
108  else if (dynamic_cast<const SurfXYZPlane*>(&*porient))
109  result = fPropXYZPlane.origin_vec_prop(trk, porient, prop_matrix);
110  else
111  throw cet::exception("PropAny") << "Destination surface has unknown type.\n";
112 
113  // Done.
114 
115  return result;
116  }
117 
118 } // end namespace trkf
virtual std::optional< double > origin_vec_prop(KTrack &trk, const std::shared_ptr< const Surface > &porient, TrackMatrix *prop_matrix=0) const override
Propagate without error to surface whose origin parameters coincide with track position.
Definition: PropAny.cxx:94
General planar surface.
std::optional< double > origin_vec_prop(KTrack &trk, const std::shared_ptr< const Surface > &porient, TrackMatrix *prop_matrix=0) const override
Propagate without error to surface whose origin parameters coincide with track position.
Definition: PropYZLine.cxx:265
std::optional< double > origin_vec_prop(KTrack &trk, const std::shared_ptr< const Surface > &porient, TrackMatrix *prop_matrix=0) const override
Propagate without error to surface whose origin parameters coincide with track position.
KSymMatrix< 5 >::type TrackError
Track error matrix, dimension 5x5.
Planar surface parallel to x-axis.
STL namespace.
PropYZPlane fPropYZPlane
Definition: PropAny.h:49
KMatrix< 5, 5 >::type TrackMatrix
General 5x5 matrix.
std::optional< double > short_vec_prop(KTrack &trk, const std::shared_ptr< const Surface > &surf, Propagator::PropDirection dir, bool doDedx, TrackMatrix *prop_matrix=0, TrackError *noise_matrix=0) const override
Propagate without error.
PropYZLine fPropYZLine
Underlying propagators.
Definition: PropAny.h:48
std::optional< double > short_vec_prop(KTrack &trk, const std::shared_ptr< const Surface > &surf, Propagator::PropDirection dir, bool doDedx, TrackMatrix *prop_matrix=0, TrackError *noise_matrix=0) const override
Propagate without error.
Definition: PropYZLine.cxx:50
Propagate between any two surfaces.
PropXYZPlane fPropXYZPlane
Definition: PropAny.h:50
std::optional< double > short_vec_prop(KTrack &trk, const std::shared_ptr< const Surface > &surf, Propagator::PropDirection dir, bool doDedx, TrackMatrix *prop_matrix=0, TrackError *noise_matrix=0) const override
Propagate without error.
Definition: PropAny.cxx:54
std::optional< double > origin_vec_prop(KTrack &trk, const std::shared_ptr< const Surface > &porient, TrackMatrix *prop_matrix=0) const override
Propagate without error to surface whose origin parameters coincide with track position.
TDirectory * dir
Definition: macro.C:5
Interactor for planar surfaces.
std::optional< double > short_vec_prop(KTrack &trk, const std::shared_ptr< const Surface > &surf, Propagator::PropDirection dir, bool doDedx, TrackMatrix *prop_matrix=0, TrackError *noise_matrix=0) const override
Propagate without error.
Definition: PropYZPlane.cxx:50
Line surface perpendicular to x-axis.
PropAny(detinfo::DetectorPropertiesData const &detProp, double tcut, bool doDedx)
Constructor.
Definition: PropAny.cxx:27
cet::coded_exception< error, detail::translate > exception
Definition: exception.h:33
PropDirection
Propagation direction enum.
Definition: Propagator.h:94