LArSoft  v06_85_00
Liquid Argon Software toolkit - http://larsoft.org/
SpacePointAlg.h
Go to the documentation of this file.
1 
55 #ifndef SPACEPOINTALG_H
56 #define SPACEPOINTALG_H
57 
58 #include <vector>
59 #include <string>
60 #include "fhiclcpp/ParameterSet.h"
62 
63 class TH1F;
64 namespace sim {
65  struct IDE;
66 }
67 namespace trkf{
68  class KHitTrack;
69 }
70 namespace recob{
71  class Hit;
72  class SpacePoint;
73 }
74 
75 namespace trkf {
76 
77  class SpacePointAlg {
78  public:
79 
80  // Constructor.
82 
83  // Destructor.
84  ~SpacePointAlg();
85 
86  // Configuration Accessors.
87 
88  bool filter() const {return fFilter;}
89  bool merge() const {return fMerge;}
90  double maxDT() const {return fMaxDT;}
91  double maxS() const {return fMaxS;}
92  int minViews() const {return fMinViews;}
93  bool enableU() const {return fEnableU;}
94  bool enableV() const {return fEnableV;}
95  bool enableW() const {return fEnableW;}
96 
97  // Update configuration parameters.
98  void reconfigure(const fhicl::ParameterSet& pset);
99 
100  // Print constants obtained from geometry and properties services.
101  void update() const;
102 
103  // Corrected time accessors.
104  double correctedTime(const recob::Hit& hit) const;
105 
106  // Spatial separation of hits (zero if two or fewer).
107  double separation(const art::PtrVector<recob::Hit>& hits) const;
108 
109  // Test whether the specified hits are compatible with a space point.
110  // The last two arguments can be used to override the default cuts.
111  bool compatible(const art::PtrVector<recob::Hit>& hits,
112  bool useMC = false) const;
113 
114  // Fill a single simple space point using the specified hits.
115  // Hits are assumed to be compatible.
116  void fillSpacePoint(const art::PtrVector<recob::Hit>& hits,
117  std::vector<recob::SpacePoint>& sptv,
118  int sptid) const;
119 
121  void fillSpacePoints(std::vector<recob::SpacePoint>& spts,
122  std::multimap<double, KHitTrack> const& trackMap) const;
123 
124  // Fill a single complex space point using the specified hits.
125  // Complex space points allow multiple hits in one plane.
126  // Hits are assumed to be compatible.
127  void fillComplexSpacePoint(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(const art::PtrVector<recob::Hit>& hits,
134  std::vector<recob::SpacePoint>& spts) const;
135 
136  // Fill a vector of space points compatible with mc truth information
137  void makeMCTruthSpacePoints(const art::PtrVector<recob::Hit>& hits,
138  std::vector<recob::SpacePoint>& spts) const;
139 
140  // Get hits associated with a particular space point, based on most recent
141  // invocation of any make*SpacePoints method.
142  const art::PtrVector<recob::Hit>& getAssociatedHits(const recob::SpacePoint& spt) const;
143 
144  // Clear space point to Hit associations.
145  void clearHitMap() const {fSptHitMap.clear();}
146 
147  // Return number of space point to Hit associations.
148  int numHitMap() const {return fSptHitMap.size();}
149 
150  private:
151 
152  // This is the real method for calculating space points (each of
153  // the public make*SpacePoints methods comes here).
154  void makeSpacePoints(const art::PtrVector<recob::Hit>& hits,
155  std::vector<recob::SpacePoint>& spts,
156  bool useMC) const;
157 
158  // Configuration paremeters.
159 
160  double fMaxDT;
161  double fMaxS;
162  int fMinViews;
163  bool fEnableU;
164  bool fEnableV;
165  bool fEnableW;
166  bool fFilter;
167  bool fMerge;
168  bool fPreferColl;
169 
170  // Temporary variables.
171 
172  struct HitMCInfo
173  {
174  std::vector<int> trackIDs;
175  std::vector<double> xyz;
176  std::vector<const recob::Hit*> pchit;
177  std::vector<double> dist2;
178  };
179  mutable std::map<const recob::Hit*, HitMCInfo> fHitMCMap;
180  mutable std::map<int, art::PtrVector<recob::Hit> > fSptHitMap;
181  };
182 }
183 
184 #endif
std::vector< const recob::Hit * > pchit
Pointer to nearest neighbor hit (indexed by plane).
std::map< const recob::Hit *, HitMCInfo > fHitMCMap
Reconstruction base classes.
double fMaxDT
Maximum time difference between planes.
bool enableW() const
Definition: SpacePointAlg.h:95
bool fFilter
Filter flag.
std::vector< double > dist2
Distance to nearest neighbor hit (indexed by plane).
bool fEnableW
Enable flag (W).
std::vector< int > trackIDs
Parent trackIDs.
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).
double maxDT() const
Definition: SpacePointAlg.h:90
int minViews() const
Definition: SpacePointAlg.h:92
double fMaxS
Maximum space separation between wires.
bool fPreferColl
Sort by collection wire.
Monte Carlo Simulation.
Detector simulation of raw signals on wires.
bool filter() const
Definition: SpacePointAlg.h:88
void clearHitMap() const
bool enableU() const
Definition: SpacePointAlg.h:93
double maxS() const
Definition: SpacePointAlg.h:91
int fMinViews
Mininum number of views per space point.
int numHitMap() const
bool merge() const
Definition: SpacePointAlg.h:89
2D representation of charge deposited in the TDC/wire plane
Definition: Hit.h:49
bool enableV() const
Definition: SpacePointAlg.h:94
bool fMerge
Merge flag.
bool fEnableV
Enable flag (V).