LArSoft  v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
InteractGeneral.cxx
Go to the documentation of this file.
1 
13 #include <cmath>
14 
15 namespace trkf {
16 
24  : Interactor(tcut), fInteract(detProp, tcut), fProp(detProp, -1., false)
25  {}
26 
46  bool InteractGeneral::noise(const KTrack& trk, double s, TrackError& noise_matrix) const
47  {
48  // Get track position and direction.
49 
50  double xyz[3];
51  double mom[3];
52  trk.getPosition(xyz);
53  trk.getMomentum(mom);
54 
55  // Generate a SurfXYZPlane with origin at current track position, and
56  // normal to current track direction.
57 
58  std::shared_ptr<Surface> psurf(
59  new SurfXYZPlane(xyz[0], xyz[1], xyz[2], mom[0], mom[1], mom[2]));
60 
61  // Propagate track to newly created surface (zero-distance propagation).
62 
63  TrackMatrix prop_matrix;
64  KTrack temp_trk = trk;
65  std::optional<double> result =
66  fProp.short_vec_prop(temp_trk, psurf, Propagator::UNKNOWN, false, &prop_matrix);
67 
68  // Return failure if propagation did not succeed.
69 
70  if (!result) return false;
71 
72  // Calculate noise on plane surface.
73 
74  TrackError plane_noise(5);
75  fInteract.noise(temp_trk, s, plane_noise);
76 
77  // Transform noise matrix to original surface using inverse of propagation matrix.
78 
79  invert(prop_matrix);
80  TrackMatrix temp = prod(plane_noise, trans(prop_matrix));
81  TrackMatrix temp2 = prod(prop_matrix, temp);
82  noise_matrix = ublas::symmetric_adaptor<TrackMatrix>(temp2);
83 
84  // Done (success).
85 
86  return true;
87  }
88 } // end namespace trkf
Interactor for planar surfaces.
General planar surface.
KSymMatrix< 5 >::type TrackError
Track error matrix, dimension 5x5.
KMatrix< 5, 5 >::type TrackMatrix
General 5x5 matrix.
InteractGeneral(detinfo::DetectorPropertiesData const &detProp, double tcut)
void getPosition(double xyz[3]) const
Get position of track.
Definition: KTrack.cxx:157
bool invert(ublas::matrix< T, L, A > &m)
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
void getMomentum(double mom[3]) const
Get momentum vector of track.
Definition: KTrack.cxx:201
bool noise(const KTrack &trk, double s, TrackError &noise_matrix) const override
Calculate noise matrix.
bool noise(const KTrack &trk, double s, TrackError &noise_matrix) const override
InteractPlane fInteract