LArSoft  v07_13_02
Liquid Argon Software toolkit - http://larsoft.org/
PropAny.cxx
Go to the documentation of this file.
1 
11 #include <cmath>
17 #include "cetlib_except/exception.h"
18 
19 namespace trkf {
20 
28  PropAny::PropAny(double tcut, bool doDedx) :
29  Propagator(tcut, doDedx, (tcut >= 0 ?
30  std::shared_ptr<const Interactor>(new InteractPlane(tcut)) :
31  std::shared_ptr<const Interactor>())),
32  fPropYZLine(tcut, doDedx),
33  fPropYZPlane(tcut, doDedx),
34  fPropXYZPlane(tcut, doDedx)
35  {}
36 
39  {}
40 
57  boost::optional<double>
59  const std::shared_ptr<const Surface>& psurf,
61  bool doDedx,
62  TrackMatrix* prop_matrix,
63  TrackError* noise_matrix) const
64  {
65  // Default result.
66 
67  boost::optional<double> result(false, 0.);
68 
69  // Test the type of the destination surface.
70 
71  if(dynamic_cast<const SurfYZLine*>(&*psurf))
72  result = fPropYZLine.short_vec_prop(trk, psurf, dir, doDedx, prop_matrix, noise_matrix);
73  else if(dynamic_cast<const SurfYZPlane*>(&*psurf))
74  result = fPropYZPlane.short_vec_prop(trk, psurf, dir, doDedx, prop_matrix, noise_matrix);
75  else if(dynamic_cast<const SurfXYZPlane*>(&*psurf))
76  result = fPropXYZPlane.short_vec_prop(trk, psurf, dir, doDedx, prop_matrix, noise_matrix);
77  else
78  throw cet::exception("PropAny") << "Destination surface has unknown type.\n";
79 
80  // Done.
81 
82  return result;
83  }
84 
98  boost::optional<double>
100  const std::shared_ptr<const Surface>& porient,
101  TrackMatrix* prop_matrix) const
102  {
103  // Default result.
104 
105  boost::optional<double> result(false, 0.);
106 
107  // Test the type of the destination surface.
108 
109  if(dynamic_cast<const SurfYZLine*>(&*porient))
110  result = fPropYZLine.origin_vec_prop(trk, porient, prop_matrix);
111  else if(dynamic_cast<const SurfYZPlane*>(&*porient))
112  result = fPropYZPlane.origin_vec_prop(trk, porient, prop_matrix);
113  else if(dynamic_cast<const SurfXYZPlane*>(&*porient))
114  result = fPropXYZPlane.origin_vec_prop(trk, porient, prop_matrix);
115  else
116  throw cet::exception("PropAny") << "Destination surface has unknown type.\n";
117 
118  // Done.
119 
120  return result;
121  }
122 
123 } // end namespace trkf
virtual boost::optional< double > origin_vec_prop(KTrack &trk, const std::shared_ptr< const Surface > &porient, TrackMatrix *prop_matrix=0) const
Propagate without error to surface whose origin parameters coincide with track position.
Definition: PropYZLine.cxx:272
General planar surface.
KSymMatrix< 5 >::type TrackError
Track error matrix, dimension 5x5.
Planar surface parallel to x-axis.
boost::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
Propagate without error.
STL namespace.
PropYZPlane fPropYZPlane
Definition: PropAny.h:60
PropAny(double tcut, bool doDedx)
Constructor.
Definition: PropAny.cxx:28
boost::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
Propagate without error.
Definition: PropYZLine.cxx:53
boost::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
Propagate without error.
Definition: PropAny.cxx:58
PropYZLine fPropYZLine
Underlying propagators.
Definition: PropAny.h:59
virtual ~PropAny()
Destructor.
Definition: PropAny.cxx:38
Propagate between any two surfaces.
PropXYZPlane fPropXYZPlane
Definition: PropAny.h:61
virtual boost::optional< double > origin_vec_prop(KTrack &trk, const std::shared_ptr< const Surface > &porient, TrackMatrix *prop_matrix=0) const
Propagate without error to surface whose origin parameters coincide with track position.
virtual boost::optional< double > origin_vec_prop(KTrack &trk, const std::shared_ptr< const Surface > &porient, TrackMatrix *prop_matrix=0) const
Propagate without error to surface whose origin parameters coincide with track position.
virtual boost::optional< double > origin_vec_prop(KTrack &trk, const std::shared_ptr< const Surface > &porient, TrackMatrix *prop_matrix=0) const
Propagate without error to surface whose origin parameters coincide with track position.
Definition: PropAny.cxx:99
TDirectory * dir
Definition: macro.C:5
KMatrix< 5, 5 >::type TrackMatrix
General 5x5 matrix.
Interactor for planar surfaces.
Line surface perpendicular to x-axis.
boost::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
Propagate without error.
Definition: PropYZPlane.cxx:53
cet::coded_exception< error, detail::translate > exception
Definition: exception.h:33
PropDirection
Propagation direction enum.
Definition: Propagator.h:92