LArSoft  v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
SpacePointAlg.h
Go to the documentation of this file.
1 
55 #ifndef SPACEPOINTALG_H
56 #define SPACEPOINTALG_H
57 
58 #include <map>
59 #include <vector>
60 
63 namespace fhicl {
64  class ParameterSet;
65 }
66 
67 namespace detinfo {
68  class DetectorClocksData;
69  class DetectorPropertiesData;
70 }
71 
72 namespace trkf {
73  class KHitTrack;
74 }
77 
78 namespace trkf {
79 
80  class SpacePointAlg {
81  public:
83 
84  // Configuration Accessors.
85 
86  bool filter() const noexcept { return fFilter; }
87  bool merge() const noexcept { return fMerge; }
88  double maxDT() const noexcept { return fMaxDT; }
89  double maxS() const noexcept { return fMaxS; }
90  int minViews() const noexcept { return fMinViews; }
91  bool enableU() const noexcept { return fEnableU; }
92  bool enableV() const noexcept { return fEnableV; }
93  bool enableW() const noexcept { return fEnableW; }
94 
95  // Print constants obtained from geometry and properties services.
96  void update(detinfo::DetectorPropertiesData const& detProp) const;
97 
98  // Corrected time accessors.
99  double correctedTime(detinfo::DetectorPropertiesData const& detProp,
100  const recob::Hit& hit) const;
101 
102  // Spatial separation of hits (zero if two or fewer).
103  double separation(const art::PtrVector<recob::Hit>& hits) const;
104 
105  // Test whether the specified hits are compatible with a space point.
106  // The last two arguments can be used to override the default cuts.
107  bool compatible(detinfo::DetectorPropertiesData const& detProp,
108  const art::PtrVector<recob::Hit>& hits,
109  bool useMC = false) const;
110 
111  // Fill a single simple space point using the specified hits.
112  // Hits are assumed to be compatible.
113  void fillSpacePoint(detinfo::DetectorPropertiesData const& detProp,
114  const art::PtrVector<recob::Hit>& hits,
115  std::vector<recob::SpacePoint>& sptv,
116  int sptid) const;
117 
119  void fillSpacePoints(detinfo::DetectorPropertiesData const& detProp,
120  std::vector<recob::SpacePoint>& spts,
121  std::multimap<double, KHitTrack> const& trackMap) const;
122 
123  // Fill a single complex space point using the specified hits.
124  // Complex space points allow multiple hits in one plane.
125  // Hits are assumed to be compatible.
126  void fillComplexSpacePoint(detinfo::DetectorPropertiesData const& detProp,
127  const art::PtrVector<recob::Hit>& hits,
128  std::vector<recob::SpacePoint>& sptv,
129  int sptid) const;
130 
131  // Fill a vector of space points from an unsorted collection of hits.
132  // Space points are generated for all compatible combinations of hits.
133  void makeSpacePoints(detinfo::DetectorClocksData const& clockData,
134  detinfo::DetectorPropertiesData const& detProp,
135  const art::PtrVector<recob::Hit>& hits,
136  std::vector<recob::SpacePoint>& spts) const;
137 
138  // Fill a vector of space points compatible with mc truth information
139  void makeMCTruthSpacePoints(detinfo::DetectorClocksData const& clockData,
140  detinfo::DetectorPropertiesData const& detProp,
141  const art::PtrVector<recob::Hit>& hits,
142  std::vector<recob::SpacePoint>& spts) const;
143 
144  // Get hits associated with a particular space point, based on most recent
145  // invocation of any make*SpacePoints method.
146  const art::PtrVector<recob::Hit>& getAssociatedHits(const recob::SpacePoint& spt) const;
147 
148  // Clear space point to Hit associations.
149  void clearHitMap() const { fSptHitMap.clear(); }
150 
151  // Return number of space point to Hit associations.
152  int numHitMap() const { return fSptHitMap.size(); }
153 
154  private:
155  // This is the real method for calculating space points (each of
156  // the public make*SpacePoints methods comes here).
157  void makeSpacePoints(detinfo::DetectorClocksData const& clockData,
158  detinfo::DetectorPropertiesData const& detProp,
159  const art::PtrVector<recob::Hit>& hits,
160  std::vector<recob::SpacePoint>& spts,
161  bool useMC) const;
162 
163  // Configuration paremeters.
164 
165  double fMaxDT;
166  double fMaxS;
167  int fMinViews;
168  bool fEnableU;
169  bool fEnableV;
170  bool fEnableW;
171  bool fFilter;
172  bool fMerge;
173  bool fPreferColl;
174  double fTickOffsetU;
175  double fTickOffsetV;
176  double fTickOffsetW;
177 
178  // Temporary variables.
179 
180  struct HitMCInfo {
181  std::vector<int> trackIDs;
182  std::vector<double> xyz;
183  std::vector<const recob::Hit*> pchit;
184  std::vector<double> dist2;
185  };
186  mutable std::map<const recob::Hit*, HitMCInfo> fHitMCMap;
187  mutable std::map<int, art::PtrVector<recob::Hit>> fSptHitMap;
188  };
189 }
190 
191 #endif
bool enableW() const noexcept
Definition: SpacePointAlg.h:93
bool filter() const noexcept
Definition: SpacePointAlg.h:86
bool enableV() const noexcept
Definition: SpacePointAlg.h:92
std::vector< const recob::Hit * > pchit
Pointer to nearest neighbor hit (indexed by plane).
std::map< const recob::Hit *, HitMCInfo > fHitMCMap
double fTickOffsetU
Tick offset for plane U.
double fMaxDT
Maximum time difference between planes.
bool fFilter
Filter flag.
Declaration of signal hit object.
std::vector< double > dist2
Distance to nearest neighbor hit (indexed by plane).
bool fEnableW
Enable flag (W).
std::vector< int > trackIDs
Parent trackIDs.
int minViews() const noexcept
Definition: SpacePointAlg.h:90
void hits()
Definition: readHits.C:15
bool fEnableU
Enable flag (U).
std::map< int, art::PtrVector< recob::Hit > > fSptHitMap
std::vector< double > xyz
Location of ionization (all tracks).
parameter set interface
bool merge() const noexcept
Definition: SpacePointAlg.h:87
double maxDT() const noexcept
Definition: SpacePointAlg.h:88
double fMaxS
Maximum space separation between wires.
General LArSoft Utilities.
bool fPreferColl
Sort by collection wire.
Detector simulation of raw signals on wires.
void clearHitMap() const
double fTickOffsetV
Tick offset for plane V.
Contains all timing reference information for the detector.
bool enableU() const noexcept
Definition: SpacePointAlg.h:91
double fTickOffsetW
Tick offset for plane W.
double maxS() const noexcept
Definition: SpacePointAlg.h:89
int fMinViews
Mininum number of views per space point.
int numHitMap() const
2D representation of charge deposited in the TDC/wire plane
Definition: Hit.h:46
bool fMerge
Merge flag.
bool fEnableV
Enable flag (V).