TrackShowerIdFeatureTool.h
Go to the documentation of this file.
1 /**
2  * @file larpandoracontent/LArTrackShowerId/TrackShowerIdFeatureTool.h
3  *
4  * @brief Header file for the track shower id feature tools
5  *
6  * $Log: $
7  */
8 #ifndef LAR_TRACK_SHOWER_ID_FEATURE_TOOLS_H
9 #define LAR_TRACK_SHOWER_ID_FEATURE_TOOLS_H 1
10 
12 
13 namespace lar_content
14 {
15 
18 
19 //------------------------------------------------------------------------------------------------------------------------------------------
20 
21 /**
22  * @brief TwoDShowerFitFeatureTool to calculate variables related to sliding shower fit
23  */
24 class TwoDShowerFitFeatureTool : public ClusterCharacterisationFeatureTool
25 {
26 public:
27  /**
28  * @brief Default constructor
29  */
31 
32  void Run(LArMvaHelper::MvaFeatureVector &featureVector, const pandora::Algorithm *const pAlgorithm, const pandora::Cluster *const pCluster);
33 
34 private:
35  pandora::StatusCode ReadSettings(const pandora::TiXmlHandle xmlHandle);
36 
37  /**
38  * @brief Calculation of the shower fit width variable
39  *
40  * @param pAlgorithm address of the calling algorithm
41  * @param pCluster the cluster we are characterizing
42  *
43  * @return shower fit width
44  */
45  float CalculateShowerFitWidth(const pandora::Algorithm *const pAlgorithm, const pandora::Cluster *const pCluster) const;
46 
47  unsigned int m_slidingShowerFitWindow; ///< The sliding shower fit window
48  unsigned int m_slidingLinearFitWindow; ///< The sliding linear fit window
49 };
50 
51 //------------------------------------------------------------------------------------------------------------------------------------------
52 
53 /**
54  * @brief TwoDLinearFitFeatureTool class for the calculation of variables related to 2d sliding linear fit
55  */
56 class TwoDLinearFitFeatureTool : public ClusterCharacterisationFeatureTool
57 {
58 public:
59  /**
60  * @brief Default constructor
61  */
63 
64  void Run(LArMvaHelper::MvaFeatureVector &featureVector, const pandora::Algorithm *const pAlgorithm, const pandora::Cluster *const pCluster);
65 
66 private:
67  pandora::StatusCode ReadSettings(const pandora::TiXmlHandle xmlHandle);
68 
69  /**
70  * @brief Calculation of several variables related to sliding linear fit
71  *
72  * @param pCluster the cluster we are characterizing
73  * @param straightLineLengthLarge to receive to length reported by the straight line fit
74  * @param diffWithStraigthLineMean to receive the difference with straight line mean variable
75  * @param diffWithStraightLineSigma to receive the difference with straight line sigma variable
76  * @param dTdLWidth to receive the dTdL width variable
77  * @param maxFitGapLength to receive the max fit gap length variable
78  * @param rmsSlidingLinearFit to receive the RMS from the linear fit
79  */
80  void CalculateVariablesSlidingLinearFit(const pandora::Cluster *const pCluster, float &straightLineLengthLarge, float &diffWithStraigthLineMean,
81  float &diffWithStraightLineSigma, float &dTdLWidth, float &maxFitGapLength, float &rmsSlidingLinearFit) const;
82 
83  unsigned int m_slidingLinearFitWindow; ///< The sliding linear fit window
84  unsigned int m_slidingLinearFitWindowLarge; ///< The sliding linear fit window - should be large, providing a simple linear fit
85 };
86 
87 //------------------------------------------------------------------------------------------------------------------------------------------
88 
89 /**
90  * @brief TwoDVertexDistanceFeatureTool class for the calculation of 2d distance to neutrino vertex
91  */
92 class TwoDVertexDistanceFeatureTool : public ClusterCharacterisationFeatureTool
93 {
94 public:
95  /**
96  * @brief Default constructor
97  */
99 
100  void Run(LArMvaHelper::MvaFeatureVector &featureVector, const pandora::Algorithm *const pAlgorithm, const pandora::Cluster *const pCluster);
101 
102 private:
103  pandora::StatusCode ReadSettings(const pandora::TiXmlHandle xmlHandle);
104 
105  /**
106  * @brief Calculation of vertex distance
107  *
108  * @param pCluster the cluster we are characterizing
109  *
110  * @return distance to neutrino vertex
111  */
112  float CalculateVertexDistance(const pandora::Algorithm *const pAlgorithm, const pandora::Cluster *const pCluster) const;
113 
114  unsigned int m_slidingLinearFitWindow; ///< The sliding linear fit window
115 };
116 
117 //------------------------------------------------------------------------------------------------------------------------------------------
118 
119 /**
120  * @brief PfoHierarchyFeatureTool for calculation of features relating to reconstructed particle hierarchy
121  */
122 class PfoHierarchyFeatureTool : public PfoCharacterisationFeatureTool
123 {
124 public:
125  /**
126  * @brief Default constructor
127  */
129 
130  void Run(LArMvaHelper::MvaFeatureVector &featureVector, const pandora::Algorithm *const pAlgorithm, const pandora::ParticleFlowObject *const pInputPfo);
131 
132 private:
133  pandora::StatusCode ReadSettings(const pandora::TiXmlHandle xmlHandle);
134 };
135 
136 //------------------------------------------------------------------------------------------------------------------------------------------
137 
138 /**
139  * @brief ThreeDLinearFitFeatureTool class for the calculation of variables related to 3d sliding linear fit
140  */
141 class ThreeDLinearFitFeatureTool : public PfoCharacterisationFeatureTool
142 {
143 public:
144  /**
145  * @brief Default constructor
146  */
148 
149  void Run(LArMvaHelper::MvaFeatureVector &featureVector, const pandora::Algorithm *const pAlgorithm, const pandora::ParticleFlowObject *const pInputPfo);
150 
151 private:
152  pandora::StatusCode ReadSettings(const pandora::TiXmlHandle xmlHandle);
153 
154  /**
155  * @brief Calculation of several variables related to sliding linear fit
156  *
157  * @param pCluster the cluster we are characterizing
158  * @param straightLineLengthLarge to receive to length reported by the straight line fit
159  * @param diffWithStraigthLineMean to receive the difference with straight line mean variable
160  * @param diffWithStraightLineSigma to receive the difference with straight line sigma variable
161  * @param dTdLWidth to receive the dTdL width variable
162  * @param maxFitGapLength to receive the max fit gap length variable
163  * @param rmsSlidingLinearFit to receive the RMS from the linear fit
164  */
165  void CalculateVariablesSlidingLinearFit(const pandora::Cluster *const pCluster, float &straightLineLengthLarge,
166  float &diffWithStraigthLineMean, float &maxFitGapLength, float &rmsSlidingLinearFit) const;
167 
168  unsigned int m_slidingLinearFitWindow; ///< The sliding linear fit window
169  unsigned int m_slidingLinearFitWindowLarge; ///< The sliding linear fit window - should be large, providing a simple linear fit
170 };
171 
172 //------------------------------------------------------------------------------------------------------------------------------------------
173 
174 /**
175  * @brief ThreeDVertexDistanceFeatureTool class for the calculation of 3d distance to neutrino vertex
176  */
177 class ThreeDVertexDistanceFeatureTool : public PfoCharacterisationFeatureTool
178 {
179 public:
180  /**
181  * @brief Default constructor
182  */
184 
185  void Run(LArMvaHelper::MvaFeatureVector &featureVector, const pandora::Algorithm *const pAlgorithm, const pandora::ParticleFlowObject *const pInputPfo);
186 
187 private:
188  pandora::StatusCode ReadSettings(const pandora::TiXmlHandle xmlHandle);
189 };
190 
191 //------------------------------------------------------------------------------------------------------------------------------------------
192 
193 /**
194  * @brief ThreeDOpeningAngleFeatureTool class for the calculation of distance to neutrino vertex
195  */
196 class ThreeDOpeningAngleFeatureTool : public PfoCharacterisationFeatureTool
197 {
198 public:
199  /**
200  * @brief Default constructor
201  */
203 
204  void Run(LArMvaHelper::MvaFeatureVector &featureVector, const pandora::Algorithm *const pAlgorithm, const pandora::ParticleFlowObject *const pInputPfo);
205 
206 private:
207  pandora::StatusCode ReadSettings(const pandora::TiXmlHandle xmlHandle);
208 
209  /**
210  * @brief Obtain positions at the vertex and non-vertex end of a list of three dimensional calo hits
211  *
212  * @param threeDCaloHitList the list of three dimensional calo hits
213  * @param pointVectorStart to receive the positions at the start/vertex region
214  * @param pointVectorEnd to receive the positions at the end region (opposite end to vertex)
215  */
216  void Divide3DCaloHitList(const pandora::Algorithm *const pAlgorithm, const pandora::CaloHitList &threeDCaloHitList,
217  pandora::CartesianPointVector &pointVectorStart, pandora::CartesianPointVector &pointVectorEnd);
218 
219  /**
220  * @brief Use the results of principal component analysis to calculate an opening angle
221  *
222  * @param principal the principal axis
223  * @param secondary the secondary axis
224  * @param eigenValues the eigenvalues
225  *
226  * @return the opening angle
227  */
228  float OpeningAngle(const pandora::CartesianVector &principal, const pandora::CartesianVector &secondary,
229  const pandora::CartesianVector &eigenValues) const;
230 
231  float m_hitFraction; ///< Fraction of hits in start and end of pfo
232  float m_defaultValue; ///< Default value to return, in case calculation not feasible
233 };
234 
235 //------------------------------------------------------------------------------------------------------------------------------------------
236 
237 /**
238  * @brief ThreeDPCAFeatureTool class for the calculation of PCA-related variables
239  */
240 class ThreeDPCAFeatureTool : public PfoCharacterisationFeatureTool
241 {
242 public:
243  /**
244  * @brief Default constructor
245  */
247 
248  void Run(LArMvaHelper::MvaFeatureVector &featureVector, const pandora::Algorithm *const pAlgorithm, const pandora::ParticleFlowObject *const pInputPfo);
249 
250 private:
251  pandora::StatusCode ReadSettings(const pandora::TiXmlHandle xmlHandle);
252 };
253 
254 //------------------------------------------------------------------------------------------------------------------------------------------
255 
256 /**
257  * @brief ThreeDChargeFeatureTool class for the calculation of charge-related features
258  */
259 class ThreeDChargeFeatureTool : public PfoCharacterisationFeatureTool
260 {
261 public:
262  /**
263  * @brief Default constructor
264  */
266 
267  /**
268  * @brief VertexComparator class for comparison of two points wrt neutrino vertex position
269  */
271  {
272  public:
273  /**
274  * @brief Constructor
275  */
276  VertexComparator(const pandora::CartesianVector vertexPosition2D);
277 
278  /**
279  * @brief operator <
280  *
281  * @param rhs object for comparison
282  *
283  * @return boolean
284  */
285  bool operator()(const pandora::CaloHit *const left, const pandora::CaloHit *const right) const;
286 
287  pandora::CartesianVector m_neutrinoVertex; //The neutrino vertex used to sort
288  };
289 
290  void Run(LArMvaHelper::MvaFeatureVector &featureVector, const pandora::Algorithm *const pAlgorithm, const pandora::ParticleFlowObject *const pInputPfo);
291 
292 private:
293  /**
294  * @brief Calculation of the charge variables
295  *
296  * @param pAlgorithm, the algorithm
297  * @param pCluster the cluster we are characterizing
298  * @param totalCharge, to receive the total charge
299  * @param chargeSigma, to receive the charge sigma
300  * @param chargeMean, to receive the charge mean
301  * @param startCharge, to receive the charge in the initial 10% hits
302  * @param endCharge, to receive the charge in the last 10% hits
303  */
304  void CalculateChargeVariables(const pandora::Algorithm *const pAlgorithm, const pandora::Cluster *const pCluster, float &totalCharge,
305  float &chargeSigma, float &chargeMean, float &endCharge);
306 
307  /**
308  * @brief Function to order the calo hit list by distance to neutrino vertex
309  *
310  * @param pAlgorithm, the algorithm
311  * @param pCluster the cluster we are characterizing
312  * @param caloHitList to receive the ordered calo hit list
313  *
314  */
315  void OrderCaloHitsByDistanceToVertex(
316  const pandora::Algorithm *const pAlgorithm, const pandora::Cluster *const pCluster, pandora::CaloHitList &caloHitList);
317 
318  pandora::StatusCode ReadSettings(const pandora::TiXmlHandle xmlHandle);
319 
320  float m_endChargeFraction; ///< Fraction of hits that will be considered to calculate end charge (default 10%)
321 };
322 
323 } // namespace lar_content
324 
325 #endif // #ifndef LAR_TRACK_SHOWER_ID_FEATURE_TOOLS_H
ThreeDLinearFitFeatureTool class for the calculation of variables related to 3d sliding linear fit...
MvaTypes::MvaFeatureVector MvaFeatureVector
Definition: LArMvaHelper.h:58
float m_hitFraction
Fraction of hits in start and end of pfo.
MvaFeatureTool< const pandora::Algorithm *const, const pandora::ParticleFlowObject *const > PfoCharacterisationFeatureTool
ThreeDVertexDistanceFeatureTool class for the calculation of 3d distance to neutrino vertex...
PfoHierarchyFeatureTool for calculation of features relating to reconstructed particle hierarchy...
unsigned int m_slidingShowerFitWindow
The sliding shower fit window.
void Run(LArMvaHelper::MvaFeatureVector &featureVector, const pandora::Algorithm *const pAlgorithm, const pandora::Cluster *const pCluster)
unsigned int m_slidingLinearFitWindow
The sliding linear fit window.
MvaFeatureTool< const pandora::Algorithm *const, const pandora::Cluster *const > ClusterCharacterisationFeatureTool
unsigned int m_slidingLinearFitWindow
The sliding linear fit window.
TwoDVertexDistanceFeatureTool class for the calculation of 2d distance to neutrino vertex...
float CalculateShowerFitWidth(const pandora::Algorithm *const pAlgorithm, const pandora::Cluster *const pCluster) const
Calculation of the shower fit width variable.
unsigned int m_slidingLinearFitWindowLarge
The sliding linear fit window - should be large, providing a simple linear fit.
unsigned int m_slidingLinearFitWindow
The sliding linear fit window.
ThreeDChargeFeatureTool class for the calculation of charge-related features.
VertexComparator class for comparison of two points wrt neutrino vertex position. ...
unsigned int m_slidingLinearFitWindowLarge
The sliding linear fit window - should be large, providing a simple linear fit.
float m_defaultValue
Default value to return, in case calculation not feasible.
ThreeDPCAFeatureTool class for the calculation of PCA-related variables.
TwoDShowerFitFeatureTool to calculate variables related to sliding shower fit.
float m_endChargeFraction
Fraction of hits that will be considered to calculate end charge (default 10%)
TwoDLinearFitFeatureTool class for the calculation of variables related to 2d sliding linear fit...
MvaFeatureTool class template.
Definition: LArMvaHelper.h:27
unsigned int m_slidingLinearFitWindow
The sliding linear fit window.
ThreeDOpeningAngleFeatureTool class for the calculation of distance to neutrino vertex.
pandora::StatusCode ReadSettings(const pandora::TiXmlHandle xmlHandle)