LArTwoDSlidingShowerFitResult.h
Go to the documentation of this file.
1 /**
2  * @file larpandoracontent/LArObjects/LArTwoDSlidingShowerFitResult.h
3  *
4  * @brief Header file for the lar two dimensional sliding shower fit result class.
5  *
6  * $Log: $
7  */
8 #ifndef LAR_TWO_D_SLIDING_SHOWER_FIT_RESULT_H
9 #define LAR_TWO_D_SLIDING_SHOWER_FIT_RESULT_H 1
10 
11 #include "Api/PandoraApi.h"
12 
14 
15 #include <unordered_map>
16 
17 namespace lar_content
18 {
19 
20 /**
21  * @brief ShowerEdge enum
22  */
24 {
27 };
28 
29 //------------------------------------------------------------------------------------------------------------------------------------------
30 
31 /**
32  * @brief TwoDSlidingShowerFitResult class
33  */
35 {
36 public:
37  /**
38  * @brief Constructor
39  *
40  * @param pT describing the positions to be fitted
41  * @param slidingFitWindow the sliding fit window
42  * @param slidingFitLayerPitch the sliding fit z pitch, units cm
43  * @param showerEdgeMultiplier artificially tune width of shower envelope so as to make it more/less inclusive
44  */
45  template <typename T>
47  const T *const pT, const unsigned int slidingFitWindow, const float slidingFitLayerPitch, const float showerEdgeMultiplier = 1.f);
48 
49  /**
50  * @brief Get the sliding fit result for the full shower cluster
51  *
52  * @return the sliding fit result for the full shower cluster
53  */
55 
56  /**
57  * @brief Get the sliding fit result for the negative shower edge
58  *
59  * @return the sliding fit result for the negative shower edge
60  */
62 
63  /**
64  * @brief Get the sliding fit result for the positive shower edge
65  *
66  * @return the sliding fit result for the positive shower edge
67  */
69 
70  /**
71  * @brief Get the most appropriate shower edges at a given x coordinate
72  *
73  * @param x the x coordinate
74  * @param widenIfAmbiguity whether to widen the shower edges in cases of ambiguities (i.e. be generous)
75  * @param edgePositions to receive the list of intersections of the shower fit at the given x coordinate
76  */
77  void GetShowerEdges(const float x, const bool widenIfAmbiguity, pandora::FloatVector &edgePositions) const;
78 
79 private:
80  /**
81  * @brief Perform two dimensional sliding fit to shower edge, using specified primary axis
82  *
83  * @param pCluster the address of the input cluster
84  * @param fullShowerFit the result of fitting the full shower
85  * @param showerEdge the shower edge
86  * @param showerEdgeMultiplier artificially tune width of shower envelope so as to make it more/less inclusive
87  *
88  * @return the shower edge fit result
89  */
90  static TwoDSlidingFitResult LArTwoDShowerEdgeFit(const pandora::Cluster *const pCluster, const TwoDSlidingFitResult &fullShowerFit,
91  const ShowerEdge showerEdge, const float showerEdgeMultiplier);
92 
93  /**
94  * @brief Perform two dimensional sliding fit to shower edge, using specified primary axis
95  *
96  * @param pPointVector the address of the input point vector
97  * @param fullShowerFit the result of fitting the full shower
98  * @param showerEdge the shower edge
99  * @param showerEdgeMultiplier artificially tune width of shower envelope so as to make it more/less inclusive
100  *
101  * @return the shower edge fit result
102  */
103  static TwoDSlidingFitResult LArTwoDShowerEdgeFit(const pandora::CartesianPointVector *const pPointVector,
104  const TwoDSlidingFitResult &fullShowerFit, const ShowerEdge showerEdge, const float showerEdgeMultiplier);
105 
106  typedef std::pair<float, float> FitCoordinate;
107  typedef std::vector<FitCoordinate> FitCoordinateList;
108  typedef std::map<int, FitCoordinateList> FitCoordinateMap;
109 
110  TwoDSlidingFitResult m_showerFitResult; ///< The sliding fit result for the full shower cluster
111  TwoDSlidingFitResult m_negativeEdgeFitResult; ///< The sliding fit result for the negative shower edge
112  TwoDSlidingFitResult m_positiveEdgeFitResult; ///< The sliding fit result for the positive shower edge
113 };
114 
115 typedef std::vector<TwoDSlidingShowerFitResult> TwoDSlidingShowerFitResultList;
116 typedef std::unordered_map<const pandora::Cluster *, TwoDSlidingShowerFitResult> TwoDSlidingShowerFitResultMap;
117 
118 //------------------------------------------------------------------------------------------------------------------------------------------
119 
120 /**
121  * @brief ShowerExtent
122  */
124 {
125 public:
126  /**
127  * @brief Constructor
128  *
129  * @param xCoordinate the x coordinate
130  * @param highEdgeZ the shower high edge z coordinate
131  * @param lowEdgeZ the shower low edge z coordinate
132  */
133  ShowerExtent(const float xCoordinate, const float highEdgeZ, const float lowEdgeZ);
134 
135  /**
136  * @param Get the x coordinate
137  *
138  * @return the x coordinate
139  */
140  float GetXCoordinate() const;
141 
142  /**
143  * @param Get the shower high edge z coordinate
144  *
145  * @return the shower high edge z coordinate
146  */
147  float GetHighEdgeZ() const;
148 
149  /**
150  * @param Get the shower low edge z coordinate
151  *
152  * @return the shower low edge z coordinate
153  */
154  float GetLowEdgeZ() const;
155 
156 private:
157  float m_xCoordinate; ///< The x coordinate
158  float m_highEdgeZ; ///< The shower high edge z coordinate
159  float m_lowEdgeZ; ///< The shower low edge z coordinate
160 };
161 
162 typedef std::map<int, ShowerExtent> ShowerPositionMap;
163 
164 //------------------------------------------------------------------------------------------------------------------------------------------
165 //------------------------------------------------------------------------------------------------------------------------------------------
166 
168 {
169  return m_showerFitResult;
170 }
171 
172 //------------------------------------------------------------------------------------------------------------------------------------------
173 
175 {
177 }
178 
179 //------------------------------------------------------------------------------------------------------------------------------------------
180 
182 {
184 }
185 
186 //------------------------------------------------------------------------------------------------------------------------------------------
187 //------------------------------------------------------------------------------------------------------------------------------------------
188 
189 inline ShowerExtent::ShowerExtent(const float xCoordinate, const float edge1, const float edge2) :
190  m_xCoordinate(xCoordinate),
191  m_highEdgeZ(std::max(edge1, edge2)),
192  m_lowEdgeZ(std::min(edge1, edge2))
193 {
194 }
195 
196 //------------------------------------------------------------------------------------------------------------------------------------------
197 
198 inline float ShowerExtent::GetXCoordinate() const
199 {
200  return m_xCoordinate;
201 }
202 
203 //------------------------------------------------------------------------------------------------------------------------------------------
204 
205 inline float ShowerExtent::GetHighEdgeZ() const
206 {
207  return m_highEdgeZ;
208 }
209 
210 //------------------------------------------------------------------------------------------------------------------------------------------
211 
212 inline float ShowerExtent::GetLowEdgeZ() const
213 {
214  return m_lowEdgeZ;
215 }
216 
217 } // namespace lar_content
218 
219 #endif // #ifndef LAR_TWO_D_SLIDING_SHOWER_FIT_RESULT_H
ShowerEdge
ShowerEdge enum.
std::map< int, FitCoordinateList > FitCoordinateMap
const TwoDSlidingFitResult & GetShowerFitResult() const
Get the sliding fit result for the full shower cluster.
static TwoDSlidingFitResult LArTwoDShowerEdgeFit(const pandora::Cluster *const pCluster, const TwoDSlidingFitResult &fullShowerFit, const ShowerEdge showerEdge, const float showerEdgeMultiplier)
Perform two dimensional sliding fit to shower edge, using specified primary axis. ...
STL namespace.
ShowerExtent(const float xCoordinate, const float highEdgeZ, const float lowEdgeZ)
Constructor.
std::map< int, ShowerExtent > ShowerPositionMap
TwoDSlidingFitResult m_showerFitResult
The sliding fit result for the full shower cluster.
TwoDSlidingFitResult m_negativeEdgeFitResult
The sliding fit result for the negative shower edge.
Header file for the lar two dimensional sliding fit result class.
const TwoDSlidingFitResult & GetPositiveEdgeFitResult() const
Get the sliding fit result for the positive shower edge.
std::vector< TwoDSlidingShowerFitResult > TwoDSlidingShowerFitResultList
static int max(int a, int b)
TwoDSlidingFitResult m_positiveEdgeFitResult
The sliding fit result for the positive shower edge.
T min(sqlite3 *const db, std::string const &table_name, std::string const &column_name)
Definition: statistics.h:55
float m_lowEdgeZ
The shower low edge z coordinate.
const TwoDSlidingFitResult & GetNegativeEdgeFitResult() const
Get the sliding fit result for the negative shower edge.
float m_highEdgeZ
The shower high edge z coordinate.
std::unordered_map< const pandora::Cluster *, TwoDSlidingShowerFitResult > TwoDSlidingShowerFitResultMap
list x
Definition: train.py:276
Dft::FloatVector FloatVector
TwoDSlidingShowerFitResult(const T *const pT, const unsigned int slidingFitWindow, const float slidingFitLayerPitch, const float showerEdgeMultiplier=1.f)
Constructor.
void GetShowerEdges(const float x, const bool widenIfAmbiguity, pandora::FloatVector &edgePositions) const
Get the most appropriate shower edges at a given x coordinate.