LArThreeDSlidingConeFitResult.h
Go to the documentation of this file.
1 /**
2  * @file larpandoracontent/LArObjects/LArThreeDSlidingConeFitResult.h
3  *
4  * @brief Header file for the lar three dimensional sliding cone fit result class.
5  *
6  * $Log: $
7  */
8 #ifndef LAR_THREE_D_SLIDING_CONE_FIT_RESULT_H
9 #define LAR_THREE_D_SLIDING_CONE_FIT_RESULT_H 1
10 
11 #include "Api/PandoraApi.h"
12 
14 
15 #include <list>
16 #include <unordered_map>
17 
18 namespace lar_content
19 {
20 
21 /**
22  * @brief ConeSelection enum
23  */
25 {
29 };
30 
31 //------------------------------------------------------------------------------------------------------------------------------------------
32 
33 /**
34  * @brief SimpleCone class
35  */
37 {
38 public:
39  /**
40  * @brief Constructor
41  *
42  * @param coneApex
43  * @param coneDirection
44  * @param coneLength
45  * @param coneTanHalfAngle
46  */
47  SimpleCone(const pandora::CartesianVector &coneApex, const pandora::CartesianVector &coneDirection, const float coneLength, const float coneTanHalfAngle);
48 
49  /**
50  * @brief Get the cone apex
51  *
52  * @return the cone apex
53  */
54  const pandora::CartesianVector &GetConeApex() const;
55 
56  /**
57  * @brief Get the cone direction
58  *
59  * @return the cone direction
60  */
61  const pandora::CartesianVector &GetConeDirection() const;
62 
63  /**
64  * @brief Get the cone length
65  *
66  * @return the cone length
67  */
68  float GetConeLength() const;
69 
70  /**
71  * @brief Get the tangent of the cone half-angle
72  *
73  * @return the tangent of the cone half-angle
74  */
75  float GetConeTanHalfAngle() const;
76 
77  /**
78  * @brief Get the mean transverse distance to all hits in a cluster (whether contained or not)
79  *
80  * @param pCluster the address of the cluster
81  *
82  * @return the mean transverse distance to all hits (whether contained or not)
83  */
84  float GetMeanRT(const pandora::Cluster *const pCluster) const;
85 
86  /**
87  * @brief Get the fraction of hits in a provided cluster that are bounded within the cone, using fitted cone angle and length
88  *
89  * @param pCluster the address of the cluster
90  *
91  * @return the bounded hit fraction
92  */
93  float GetBoundedHitFraction(const pandora::Cluster *const pCluster) const;
94 
95  /**
96  * @brief Get the fraction of hits in a provided cluster that are bounded within the cone, using provided cone angle and length
97  *
98  * @param pCluster the address of the cluster
99  * @param coneLength the provided cone length
100  * @param coneTanHalfAngle the provided tangent of the cone half-angle
101  *
102  * @return the bounded hit fraction
103  */
104  float GetBoundedHitFraction(const pandora::Cluster *const pCluster, const float coneLength, const float coneTanHalfAngle) const;
105 
106 private:
107  pandora::CartesianVector m_coneApex; ///< The cone apex
108  pandora::CartesianVector m_coneDirection; ///< The cone direction
109  float m_coneLength; ///< The cone length
110  float m_coneTanHalfAngle; ///< The tangent of the cone half-angle
111 };
112 
113 typedef std::vector<SimpleCone> SimpleConeList;
114 
115 //------------------------------------------------------------------------------------------------------------------------------------------
116 
117 typedef std::map<int, pandora::TrackState> TrackStateMap;
118 
119 /**
120  * @brief ThreeDSlidingConeFitResult class
121  */
123 {
124 public:
125  /**
126  * @brief Constructor
127  *
128  * @param pT describing the positions to be fitted
129  * @param slidingFitWindow the sliding fit window
130  * @param slidingFitLayerPitch the sliding fit pitch, units cm
131  */
132  template <typename T>
133  ThreeDSlidingConeFitResult(const T *const pT, const unsigned int slidingFitWindow, const float slidingFitLayerPitch);
134 
135  /**
136  * @brief Get the sliding fit result for the full cluster
137  *
138  * @return the sliding fit result for the full cluster
139  */
140  const ThreeDSlidingFitResult &GetSlidingFitResult() const;
141 
142  /**
143  * @brief Get the track state map, which caches results from the sliding fit result
144  *
145  * @return the track state map
146  */
147  const TrackStateMap &GetTrackStateMap() const;
148 
149  /**
150  * @brief Get the list of simple cones fitted to the three dimensional cluster
151  *
152  * @param nLayersForConeFit the number of layer to use to extract the cone direction
153  * @param nCones the number of cones to extract from the cluster (spaced uniformly along the cluster)
154  * @param coneSelection whether to receive forwards or backwards (or both) cones
155  * @param simpleConeList to receive the simple cone list
156  */
157  void GetSimpleConeList(const unsigned int nLayersForConeFit, const unsigned int nCones, const ConeSelection coneSelection,
158  SimpleConeList &simpleConeList) const;
159 
160 private:
161  typedef std::list<pandora::TrackState> TrackStateLinkedList; ///< The track state linked list typedef
162 
163  const ThreeDSlidingFitResult m_slidingFitResult; ///< The sliding fit result for the full cluster
164  TrackStateMap m_trackStateMap; ///< The track state map
165 };
166 
167 typedef std::vector<ThreeDSlidingConeFitResult> ThreeDSlidingConeFitResultList;
168 typedef std::unordered_map<const pandora::Cluster *, ThreeDSlidingConeFitResult> ThreeDSlidingConeFitResultMap;
169 
170 //------------------------------------------------------------------------------------------------------------------------------------------
171 //------------------------------------------------------------------------------------------------------------------------------------------
172 
173 inline SimpleCone::SimpleCone(const pandora::CartesianVector &coneApex, const pandora::CartesianVector &coneDirection,
174  const float coneLength, const float coneTanHalfAngle) :
175  m_coneApex(coneApex),
176  m_coneDirection(coneDirection),
177  m_coneLength(coneLength),
178  m_coneTanHalfAngle(coneTanHalfAngle)
179 {
180 }
181 
182 //------------------------------------------------------------------------------------------------------------------------------------------
183 
184 inline const pandora::CartesianVector &SimpleCone::GetConeApex() const
185 {
186  return m_coneApex;
187 }
188 
189 //------------------------------------------------------------------------------------------------------------------------------------------
190 
191 inline const pandora::CartesianVector &SimpleCone::GetConeDirection() const
192 {
193  return m_coneDirection;
194 }
195 
196 //------------------------------------------------------------------------------------------------------------------------------------------
197 
198 inline float SimpleCone::GetConeLength() const
199 {
200  return m_coneLength;
201 }
202 
203 //------------------------------------------------------------------------------------------------------------------------------------------
204 
206 {
207  return m_coneTanHalfAngle;
208 }
209 
210 //------------------------------------------------------------------------------------------------------------------------------------------
211 
212 inline float SimpleCone::GetBoundedHitFraction(const pandora::Cluster *const pCluster) const
213 {
214  return this->GetBoundedHitFraction(pCluster, this->GetConeLength(), this->GetConeTanHalfAngle());
215 }
216 
217 //------------------------------------------------------------------------------------------------------------------------------------------
218 //------------------------------------------------------------------------------------------------------------------------------------------
219 
221 {
222  return m_slidingFitResult;
223 }
224 
225 //------------------------------------------------------------------------------------------------------------------------------------------
226 
227 inline const TrackStateMap &ThreeDSlidingConeFitResult::GetTrackStateMap() const
228 {
229  return m_trackStateMap;
230 }
231 
232 } // namespace lar_content
233 
234 #endif // #ifndef LAR_THREE_D_SLIDING_CONE_FIT_RESULT_H
const ThreeDSlidingFitResult m_slidingFitResult
The sliding fit result for the full cluster.
std::vector< ThreeDSlidingConeFitResult > ThreeDSlidingConeFitResultList
std::vector< SimpleCone > SimpleConeList
SimpleCone(const pandora::CartesianVector &coneApex, const pandora::CartesianVector &coneDirection, const float coneLength, const float coneTanHalfAngle)
Constructor.
const ThreeDSlidingFitResult & GetSlidingFitResult() const
Get the sliding fit result for the full cluster.
std::list< pandora::TrackState > TrackStateLinkedList
The track state linked list typedef.
float GetConeTanHalfAngle() const
Get the tangent of the cone half-angle.
std::map< int, pandora::TrackState > TrackStateMap
pandora::CartesianVector m_coneDirection
The cone direction.
const pandora::CartesianVector & GetConeApex() const
Get the cone apex.
float m_coneTanHalfAngle
The tangent of the cone half-angle.
float GetBoundedHitFraction(const pandora::Cluster *const pCluster) const
Get the fraction of hits in a provided cluster that are bounded within the cone, using fitted cone an...
Header file for the lar three dimensional sliding fit result class.
pandora::CartesianVector m_coneApex
The cone apex.
float GetMeanRT(const pandora::Cluster *const pCluster) const
Get the mean transverse distance to all hits in a cluster (whether contained or not) ...
std::unordered_map< const pandora::Cluster *, ThreeDSlidingConeFitResult > ThreeDSlidingConeFitResultMap
const TrackStateMap & GetTrackStateMap() const
Get the track state map, which caches results from the sliding fit result.
ConeSelection
ConeSelection enum.
float GetConeLength() const
Get the cone length.
const pandora::CartesianVector & GetConeDirection() const
Get the cone direction.
TrackStateMap m_trackStateMap
The track state map.