All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
KGTrack.h
Go to the documentation of this file.
1 ////////////////////////////////////////////////////////////////////////
2 ///
3 /// \file KGTrack.h
4 ///
5 /// \brief A collection of KHitTracks.
6 ///
7 /// \author H. Greenlee
8 ///
9 /// This class is a colleciton of KHitTracks. In other words, it has
10 /// full information every measurement, and every fit on every
11 /// measurement surface. This is the maximum amount of information
12 /// that it is possible to have.
13 ///
14 /// KHitTrack collection is stored as a map, indexed by path distance.
15 /// This organization makes it easy to find the one or two nearest
16 /// KHitTrack objects to any path distance.
17 ///
18 /// Note that by combining information from forward and backward fit
19 /// tracks (Kalman smoothing), it is possible to obtain optimal fit
20 /// information (based on all past and future hits) for each measurement
21 /// surface, or any other surface, including interior surfaces.
22 ///
23 ////////////////////////////////////////////////////////////////////////
24 
25 #ifndef KGTRACK_H
26 #define KGTRACK_H
27 
28 #include <iosfwd>
29 #include <map>
30 #include <vector>
31 
32 #include "canvas/Persistency/Common/PtrVector.h"
33 
35 
36 namespace detinfo {
37  class DetectorPropertiesData;
38 }
39 
40 namespace recob {
41  class Hit;
42  class Track;
43 }
44 
45 namespace trkf {
46 
47  class KGTrack {
48  public:
49  KGTrack(int prefplane);
50 
51  int
52  getPrefPlane() const
53  {
54  return fPrefPlane;
55  }
56 
57  /// KHitTrack collection, indexed by path distance.
58  const std::multimap<double, KHitTrack>&
59  getTrackMap() const
60  {
61  return fTrackMap;
62  }
63 
64  /// Number of measurements in track.
65  size_t
66  numHits() const
67  {
68  return fTrackMap.size();
69  }
70 
71  /// Track at start point.
72  const KHitTrack& startTrack() const;
73 
74  /// Track at end point.
75  const KHitTrack& endTrack() const;
76 
77  /// Validity flag.
78  bool
79  isValid() const
80  {
81  return fTrackMap.size() > 0;
82  }
83 
84  // Modifiers.
85 
86  /// Modifiable KHitTrack collection, indexed by path distance.
87  std::multimap<double, KHitTrack>&
89  {
90  return fTrackMap;
91  }
92 
93  /// Modifiable track at start point.
95 
96  /// Modifiable track at end point.
98 
99  /// Add track.
100  void addTrack(const KHitTrack& trh);
101 
102  /// Recalibrate track map.
103  void recalibrate();
104 
105  /// Clear track collection.
106  void
108  {
109  fTrackMap.clear();
110  }
111 
112  // Methods.
113 
114  /// Fill a recob::Track.
117  int id) const;
118 
119  /// Fill a PtrVector of Hits.
120  void fillHits(art::PtrVector<recob::Hit>& hits, std::vector<unsigned int>& hittpindex) const;
121 
122  const std::multimap<double, KHitTrack>
123  TrackMap() const
124  {
125  return fTrackMap;
126  }
127 
128  /// Printout
129  std::ostream& Print(std::ostream& out) const;
130 
131  private:
132  /// Preferred plane.
134 
135  /// KHitTrack collection, indexed by path distance.
136  std::multimap<double, KHitTrack> fTrackMap;
137  };
138 
139  /// Output operator.
140  std::ostream& operator<<(std::ostream& out, const KGTrack& trg);
141 
142 }
143 
144 #endif
int getPrefPlane() const
Definition: KGTrack.h:52
Basic Kalman filter track class, plus one measurement on same surface.
void fillHits(art::PtrVector< recob::Hit > &hits, std::vector< unsigned int > &hittpindex) const
Fill a PtrVector of Hits.
Definition: KGTrack.cxx:224
int fPrefPlane
Preferred plane.
Definition: KGTrack.h:133
void recalibrate()
Recalibrate track map.
Definition: KGTrack.cxx:94
const KHitTrack & endTrack() const
Track at end point.
Definition: KGTrack.cxx:42
std::multimap< double, KHitTrack > & getTrackMap()
Modifiable KHitTrack collection, indexed by path distance.
Definition: KGTrack.h:88
void addTrack(const KHitTrack &trh)
Add track.
Definition: KGTrack.cxx:81
process_name use argoneut_mc_hitfinder track
void clear()
Clear track collection.
Definition: KGTrack.h:107
Definition: Data.h:7
const std::multimap< double, KHitTrack > & getTrackMap() const
KHitTrack collection, indexed by path distance.
Definition: KGTrack.h:59
void fillTrack(detinfo::DetectorPropertiesData const &detProp, recob::Track &track, int id) const
Fill a recob::Track.
Definition: KGTrack.cxx:126
std::ostream & operator<<(std::ostream &out, const KGTrack &trg)
Output operator.
Definition: KGTrack.cxx:309
KGTrack(int prefplane)
Definition: KGTrack.cxx:27
std::multimap< double, KHitTrack > fTrackMap
KHitTrack collection, indexed by path distance.
Definition: KGTrack.h:136
std::ostream & Print(std::ostream &out) const
Printout.
Definition: KGTrack.cxx:259
size_t numHits() const
Number of measurements in track.
Definition: KGTrack.h:66
const std::multimap< double, KHitTrack > TrackMap() const
Definition: KGTrack.h:123
bool isValid() const
Validity flag.
Definition: KGTrack.h:79
const KHitTrack & startTrack() const
Track at start point.
Definition: KGTrack.cxx:31
auto const detProp
Track from a non-cascading particle.A recob::Track consists of a recob::TrackTrajectory, plus additional members relevant for a &quot;fitted&quot; track: