KHitContainer.h
Go to the documentation of this file.
1 ////////////////////////////////////////////////////////////////////////
2 ///
3 /// \file KHitContainer.h
4 ///
5 /// \brief A collection of KHitGroups.
6 ///
7 /// \author H. Greenlee
8 ///
9 /// This class internally maintains three STL lists of KHitGroup objects.
10 ///
11 /// 1. Sorted KHitGroup objects (have path length).
12 /// 2. Unsorted KHitGroup objects (don't currently have path length).
13 /// 3. Unused KHitGroup objects.
14 ///
15 /// The following methods are provided.
16 ///
17 /// 1. Sort
18 ///
19 /// A KTrack object and propagation direction are passed as arguments.
20 /// The track is propagated without error to each object on the sorted
21 /// and (maybe) the unsorted list. Reachable objects have their path
22 /// length updated, are moved to the sorted list, and are eventually
23 /// sorted. Unreachable objects are moved to the unsorted list.
24 ///
25 /// Here are the envisioned use cases of this class.
26 ///
27 /// 1. At the beginning of the event, a set of candidate measurements
28 /// are loaded into the unsorted list.
29 /// 2. Candidate measurements are sorted using a seed track.
30 /// 3. During the progress of the Kalman filter, candidate measurements
31 /// are visited in order from the sorted list.
32 /// 4. If necessary, candidate measurements can be resorted during the
33 /// progress of the Kalman filter using the updated track.
34 /// 5. After candidate measurements are disposed of (added to track or
35 /// rejected), they are moved to the unused list.
36 /// 6. The Kalman filter can be repeated using a new seed track by
37 /// moving all objects to the unsorted list.
38 ///
39 /// Most of these use cases involve transfering objects among the three
40 /// lists. These kinds of operations can be accomplished using STL
41 /// list splice method without copying the objects.
42 ///
43 ////////////////////////////////////////////////////////////////////////
44 
45 #ifndef KHITCONTAINER_H
46 #define KHITCONTAINER_H
47 
53 #include <list>
54 
55 namespace detinfo {
56  class DetectorPropertiesData;
57 }
58 
59 namespace trkf {
60 
61  class KHitContainer {
62  public:
63  virtual ~KHitContainer() = default;
64 
65  virtual void fill(detinfo::DetectorPropertiesData const& clock_data,
66  const art::PtrVector<recob::Hit>& hits,
67  int only_plane) = 0;
68 
69  const std::list<KHitGroup>&
70  getSorted() const
71  {
72  return fSorted;
73  }
74  const std::list<KHitGroup>&
75  getUnsorted() const
76  {
77  return fUnsorted;
78  }
79  const std::list<KHitGroup>&
80  getUnused() const
81  {
82  return fUnused;
83  }
84 
85  // Non-const Accessors.
86 
87  std::list<KHitGroup>&
89  {
90  return fSorted;
91  } ///< Sorted list.
92  std::list<KHitGroup>&
94  {
95  return fUnsorted;
96  } ///< Unsorted list.
97  std::list<KHitGroup>&
99  {
100  return fUnused;
101  } ///< Unused list.
102 
103  /// Clear all lists.
104  void clear();
105 
106  /// Move all objects to unsorted list (from sorted and unused lists).
107  void reset();
108 
109  /// (Re)sort objects in unsorted and sorted lists.
110  void sort(const KTrack& trk,
111  bool addUnsorted,
112  const Propagator& prop,
114 
115  /// Return the plane with the most KHitGroups in the unsorted list.
116  unsigned int getPreferredPlane() const;
117 
118  private:
119  // Attributes.
120 
121  std::list<KHitGroup> fSorted; ///< Sorted KHitGroup objects.
122  std::list<KHitGroup> fUnsorted; ///< Unsorted KHitGroup objects.
123  std::list<KHitGroup> fUnused; ///< Unused KHitGroup objects.
124  };
125 }
126 
127 #endif
const std::list< KHitGroup > & getUnused() const
Definition: KHitContainer.h:80
std::list< KHitGroup > & getUnused()
Unused list.
Definition: KHitContainer.h:98
string dir
std::list< KHitGroup > fUnused
Unused KHitGroup objects.
QTextStream & reset(QTextStream &s)
const std::list< KHitGroup > & getUnsorted() const
Definition: KHitContainer.h:75
std::list< KHitGroup > fUnsorted
Unsorted KHitGroup objects.
Base class for Kalman filter track propagator.
General LArSoft Utilities.
A collection of measurements on the same surface.
Declaration of signal hit object.
std::list< KHitGroup > & getSorted()
Sorted list.
Definition: KHitContainer.h:88
def fill(s)
Definition: translator.py:93
vector< vector< double > > clear
std::list< KHitGroup > fSorted
Sorted KHitGroup objects.
Basic Kalman filter track class, without error.
std::list< KHitGroup > & getUnsorted()
Unsorted list.
Definition: KHitContainer.h:93
PropDirection
Propagation direction enum.
Definition: Propagator.h:94
const std::list< KHitGroup > & getSorted() const
Definition: KHitContainer.h:70