All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
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 #include "Pandora/PandoraInternal.h"
14 
15 namespace lar_content
16 {
17 
20 
21 //------------------------------------------------------------------------------------------------------------------------------------------
22 
23 /**
24  * @brief TwoDShowerFitFeatureTool to calculate variables related to sliding shower fit
25  */
27 {
28 public:
29  /**
30  * @brief Default constructor
31  */
33 
34  void Run(LArMvaHelper::MvaFeatureVector &featureVector, const pandora::Algorithm *const pAlgorithm, const pandora::Cluster *const pCluster);
35  void Run(LArMvaHelper::MvaFeatureMap &featureMap, pandora::StringVector &featureOrder, const std::string &featureToolName,
36  const pandora::Algorithm *const pAlgorithm, const pandora::Cluster *const pCluster);
37 
38 private:
39  pandora::StatusCode ReadSettings(const pandora::TiXmlHandle xmlHandle);
40 
41  /**
42  * @brief Calculation of the shower fit width variable
43  *
44  * @param pAlgorithm address of the calling algorithm
45  * @param pCluster the cluster we are characterizing
46  *
47  * @return shower fit width
48  */
49  float CalculateShowerFitWidth(const pandora::Algorithm *const pAlgorithm, const pandora::Cluster *const pCluster) const;
50 
51  unsigned int m_slidingShowerFitWindow; ///< The sliding shower fit window
52  unsigned int m_slidingLinearFitWindow; ///< The sliding linear fit window
53 };
54 
55 //------------------------------------------------------------------------------------------------------------------------------------------
56 
57 /**
58  * @brief TwoDLinearFitFeatureTool class for the calculation of variables related to 2d sliding linear fit
59  */
61 {
62 public:
63  /**
64  * @brief Default constructor
65  */
67 
68  void Run(LArMvaHelper::MvaFeatureVector &featureVector, const pandora::Algorithm *const pAlgorithm, const pandora::Cluster *const pCluster);
69  void Run(LArMvaHelper::MvaFeatureMap &featureMap, pandora::StringVector &featureOrder, const std::string &featureToolName,
70  const pandora::Algorithm *const pAlgorithm, const pandora::Cluster *const pCluster);
71 
72 private:
73  pandora::StatusCode ReadSettings(const pandora::TiXmlHandle xmlHandle);
74 
75  /**
76  * @brief Calculation of several variables related to sliding linear fit
77  *
78  * @param pCluster the cluster we are characterizing
79  * @param straightLineLengthLarge to receive to length reported by the straight line fit
80  * @param diffWithStraigthLineMean to receive the difference with straight line mean variable
81  * @param diffWithStraightLineSigma to receive the difference with straight line sigma variable
82  * @param dTdLWidth to receive the dTdL width variable
83  * @param maxFitGapLength to receive the max fit gap length variable
84  * @param rmsSlidingLinearFit to receive the RMS from the linear fit
85  */
86  void CalculateVariablesSlidingLinearFit(const pandora::Cluster *const pCluster, float &straightLineLengthLarge, float &diffWithStraigthLineMean,
87  float &diffWithStraightLineSigma, float &dTdLWidth, float &maxFitGapLength, float &rmsSlidingLinearFit) const;
88 
89  unsigned int m_slidingLinearFitWindow; ///< The sliding linear fit window
90  unsigned int m_slidingLinearFitWindowLarge; ///< The sliding linear fit window - should be large, providing a simple linear fit
91 };
92 
93 //------------------------------------------------------------------------------------------------------------------------------------------
94 
95 /**
96  * @brief TwoDVertexDistanceFeatureTool class for the calculation of 2d distance to neutrino vertex
97  */
99 {
100 public:
101  /**
102  * @brief Default constructor
103  */
105 
106  void Run(LArMvaHelper::MvaFeatureVector &featureVector, const pandora::Algorithm *const pAlgorithm, const pandora::Cluster *const pCluster);
107  void Run(LArMvaHelper::MvaFeatureMap &featureMap, pandora::StringVector &featureOrder, const std::string &featureToolName,
108  const pandora::Algorithm *const pAlgorithm, const pandora::Cluster *const pCluster);
109 
110 private:
111  pandora::StatusCode ReadSettings(const pandora::TiXmlHandle xmlHandle);
112 
113  /**
114  * @brief Calculation of vertex distance
115  *
116  * @param pCluster the cluster we are characterizing
117  *
118  * @return distance to neutrino vertex
119  */
120  float CalculateVertexDistance(const pandora::Algorithm *const pAlgorithm, const pandora::Cluster *const pCluster) const;
121 
122  unsigned int m_slidingLinearFitWindow; ///< The sliding linear fit window
123 };
124 
125 //------------------------------------------------------------------------------------------------------------------------------------------
126 
127 /**
128  * @brief PfoHierarchyFeatureTool for calculation of features relating to reconstructed particle hierarchy
129  */
131 {
132 public:
133  /**
134  * @brief Default constructor
135  */
137 
138  void Run(LArMvaHelper::MvaFeatureVector &featureVector, const pandora::Algorithm *const pAlgorithm, const pandora::ParticleFlowObject *const pInputPfo);
139  void Run(LArMvaHelper::MvaFeatureMap &featureMap, pandora::StringVector &featureOrder, const std::string &featureToolName,
140  const pandora::Algorithm *const pAlgorithm, const pandora::ParticleFlowObject *const pInputPfo);
141 
142 private:
143  pandora::StatusCode ReadSettings(const pandora::TiXmlHandle xmlHandle);
144 };
145 
146 //------------------------------------------------------------------------------------------------------------------------------------------
147 
148 /**
149  * @brief ThreeDLinearFitFeatureTool class for the calculation of variables related to 3d sliding linear fit
150  */
152 {
153 public:
154  /**
155  * @brief Default constructor
156  */
158 
159  void Run(LArMvaHelper::MvaFeatureVector &featureVector, const pandora::Algorithm *const pAlgorithm, const pandora::ParticleFlowObject *const pInputPfo);
160  void Run(LArMvaHelper::MvaFeatureMap &featureMap, pandora::StringVector &featureOrder, const std::string &featureToolName,
161  const pandora::Algorithm *const pAlgorithm, const pandora::ParticleFlowObject *const pInputPfo);
162 
163 private:
164  pandora::StatusCode ReadSettings(const pandora::TiXmlHandle xmlHandle);
165 
166  /**
167  * @brief Calculation of several variables related to sliding linear fit
168  *
169  * @param pCluster the cluster we are characterizing
170  * @param straightLineLengthLarge to receive to length reported by the straight line fit
171  * @param diffWithStraigthLineMean to receive the difference with straight line mean variable
172  * @param diffWithStraightLineSigma to receive the difference with straight line sigma variable
173  * @param dTdLWidth to receive the dTdL width variable
174  * @param maxFitGapLength to receive the max fit gap length variable
175  * @param rmsSlidingLinearFit to receive the RMS from the linear fit
176  */
177  void CalculateVariablesSlidingLinearFit(const pandora::Cluster *const pCluster, float &straightLineLengthLarge,
178  float &diffWithStraigthLineMean, float &maxFitGapLength, float &rmsSlidingLinearFit) const;
179 
180  unsigned int m_slidingLinearFitWindow; ///< The sliding linear fit window
181  unsigned int m_slidingLinearFitWindowLarge; ///< The sliding linear fit window - should be large, providing a simple linear fit
182 };
183 
184 //------------------------------------------------------------------------------------------------------------------------------------------
185 
186 /**
187  * @brief ThreeDVertexDistanceFeatureTool class for the calculation of 3d distance to neutrino vertex
188  */
190 {
191 public:
192  /**
193  * @brief Default constructor
194  */
196 
197  void Run(LArMvaHelper::MvaFeatureVector &featureVector, const pandora::Algorithm *const pAlgorithm, const pandora::ParticleFlowObject *const pInputPfo);
198  void Run(LArMvaHelper::MvaFeatureMap &featureMap, pandora::StringVector &featureOrder, const std::string &featureToolName,
199  const pandora::Algorithm *const pAlgorithm, const pandora::ParticleFlowObject *const pInputPfo);
200 
201 private:
202  pandora::StatusCode ReadSettings(const pandora::TiXmlHandle xmlHandle);
203 };
204 
205 //------------------------------------------------------------------------------------------------------------------------------------------
206 
207 /**
208  * @brief ConeChargeFeatureTool class for the calculation of charge distribution and conicalness
209  */
211 {
212 public:
213  /**
214  * @brief Default constructor
215  */
217 
218  void Run(LArMvaHelper::MvaFeatureVector &featureVector, const pandora::Algorithm *const pAlgorithm, const pandora::ParticleFlowObject *const pInputPfo);
219  void Run(LArMvaHelper::MvaFeatureMap &featureMap, pandora::StringVector &featureOrder, const std::string &featureToolName,
220  const pandora::Algorithm *const pAlgorithm, const pandora::ParticleFlowObject *const pInputPfo);
221 
222 private:
223  pandora::StatusCode ReadSettings(const pandora::TiXmlHandle xmlHandle);
224 
225  /**
226  * @brief Configurable parameters to calculate cone charge variables
227  *
228  * @param conMinHits: minimum hit requirement at start and end of pfo to calculate conicalness
229  * @param minCharge: minimum charge requirement at start and end of pfo to calculate conicalness
230  * @param conFracRange: conincal fractional range to determine start/end of pfo
231  * @param MoliereRadius: 10.1 cm to determine halo/core of pfo
232  * @param MoliereRadiusFrac: fraction of Moliere radius, default = 0.2
233  */
234  unsigned int m_conMinHits;
235  float m_minCharge;
239 
240  /**
241  * @brief Calculate charge distribution in relation to the Moeliere radius
242  *
243  * @param caloHitList: the calo hit list of plane w
244  * @param pfoStart: start position of the pfo
245  * @param pfoDir: direction of pfo from the principle vector of pca
246  * @param chargeCore: to receive sum of charge within Moeliete radius * fraction
247  * @param chargeHalo: to receive sum of charge outside of Moeliere radius * fraction
248  * @param chargeCon: to receive weighted sum of total charge
249  */
250  void CalculateChargeDistribution(const pandora::CaloHitList &caloHitList, const pandora::CartesianVector &pfoStart,
251  const pandora::CartesianVector &pfoDir, float &chargeCore, float &chargeHalo, float &chargeCon);
252 
253  /**
254  * @brief Calculate conicalness as a ratio of charge distribution at the end and start of pfo
255  *
256  * @param caloHitList: the calo hit list of plane w
257  * @param pfoStart: start position of the pfo
258  * @param pfoDir: direction of pfo from the principle vector of pca
259  * @param pfoLength: length of the whole pfo
260  * return conicalness
261  */
262  float CalculateConicalness(const pandora::CaloHitList &caloHitList, const pandora::CartesianVector &pfoStart,
263  const pandora::CartesianVector &pfoDir, const float pfoLength);
264 };
265 
266 //------------------------------------------------------------------------------------------------------------------------------------------
267 
268 /**
269  * @brief ThreeDOpeningAngleFeatureTool class for the calculation of distance to neutrino vertex
270  */
272 {
273 public:
274  /**
275  * @brief Default constructor
276  */
278 
279  void Run(LArMvaHelper::MvaFeatureVector &featureVector, const pandora::Algorithm *const pAlgorithm, const pandora::ParticleFlowObject *const pInputPfo);
280  void Run(LArMvaHelper::MvaFeatureMap &featureMap, pandora::StringVector &featureOrder, const std::string &featureToolName,
281  const pandora::Algorithm *const pAlgorithm, const pandora::ParticleFlowObject *const pInputPfo);
282 
283 private:
284  pandora::StatusCode ReadSettings(const pandora::TiXmlHandle xmlHandle);
285 
286  /**
287  * @brief Obtain positions at the vertex and non-vertex end of a list of three dimensional calo hits
288  *
289  * @param threeDCaloHitList the list of three dimensional calo hits
290  * @param pointVectorStart to receive the positions at the start/vertex region
291  * @param pointVectorEnd to receive the positions at the end region (opposite end to vertex)
292  */
293  void Divide3DCaloHitList(const pandora::Algorithm *const pAlgorithm, const pandora::CaloHitList &threeDCaloHitList,
294  pandora::CartesianPointVector &pointVectorStart, pandora::CartesianPointVector &pointVectorEnd);
295 
296  /**
297  * @brief Use the results of principal component analysis to calculate an opening angle
298  *
299  * @param principal the principal axis
300  * @param secondary the secondary axis
301  * @param eigenValues the eigenvalues
302  *
303  * @return the opening angle
304  */
305  float OpeningAngle(const pandora::CartesianVector &principal, const pandora::CartesianVector &secondary,
306  const pandora::CartesianVector &eigenValues) const;
307 
308  float m_hitFraction; ///< Fraction of hits in start and end of pfo
309  float m_defaultValue; ///< Default value to return, in case calculation not feasible
310 };
311 
312 //------------------------------------------------------------------------------------------------------------------------------------------
313 
314 /**
315  * @brief ThreeDPCAFeatureTool class for the calculation of PCA-related variables
316  */
318 {
319 public:
320  /**
321  * @brief Default constructor
322  */
324 
325  void Run(LArMvaHelper::MvaFeatureVector &featureVector, const pandora::Algorithm *const pAlgorithm, const pandora::ParticleFlowObject *const pInputPfo);
326  void Run(LArMvaHelper::MvaFeatureMap &featureMap, pandora::StringVector &featureOrder, const std::string &featureToolName,
327  const pandora::Algorithm *const pAlgorithm, const pandora::ParticleFlowObject *const pInputPfo);
328 
329 private:
330  pandora::StatusCode ReadSettings(const pandora::TiXmlHandle xmlHandle);
331 };
332 
333 //------------------------------------------------------------------------------------------------------------------------------------------
334 
335 /**
336  * @brief ThreeDChargeFeatureTool class for the calculation of charge-related features
337  */
339 {
340 public:
341  /**
342  * @brief Default constructor
343  */
345 
346  /**
347  * @brief VertexComparator class for comparison of two points wrt neutrino vertex position
348  */
350  {
351  public:
352  /**
353  * @brief Constructor
354  */
355  VertexComparator(const pandora::CartesianVector vertexPosition2D);
356 
357  /**
358  * @brief operator <
359  *
360  * @param rhs object for comparison
361  *
362  * @return boolean
363  */
364  bool operator()(const pandora::CaloHit *const left, const pandora::CaloHit *const right) const;
365 
366  pandora::CartesianVector m_neutrinoVertex; //The neutrino vertex used to sort
367  };
368 
369  void Run(LArMvaHelper::MvaFeatureVector &featureVector, const pandora::Algorithm *const pAlgorithm, const pandora::ParticleFlowObject *const pInputPfo);
370  void Run(LArMvaHelper::MvaFeatureMap &featureMap, pandora::StringVector &featureOrder, const std::string &featureToolName,
371  const pandora::Algorithm *const pAlgorithm, const pandora::ParticleFlowObject *const pInputPfo);
372 
373 private:
374  /**
375  * @brief Calculation of the charge variables
376  *
377  * @param pAlgorithm, the algorithm
378  * @param pCluster the cluster we are characterizing
379  * @param totalCharge, to receive the total charge
380  * @param chargeSigma, to receive the charge sigma
381  * @param chargeMean, to receive the charge mean
382  * @param startCharge, to receive the charge in the initial 10% hits
383  * @param endCharge, to receive the charge in the last 10% hits
384  */
385  void CalculateChargeVariables(const pandora::Algorithm *const pAlgorithm, const pandora::Cluster *const pCluster, float &totalCharge,
386  float &chargeSigma, float &chargeMean, float &endCharge);
387 
388  /**
389  * @brief Function to order the calo hit list by distance to neutrino vertex
390  *
391  * @param pAlgorithm, the algorithm
392  * @param pCluster the cluster we are characterizing
393  * @param caloHitList to receive the ordered calo hit list
394  *
395  */
397  const pandora::Algorithm *const pAlgorithm, const pandora::Cluster *const pCluster, pandora::CaloHitList &caloHitList);
398 
399  pandora::StatusCode ReadSettings(const pandora::TiXmlHandle xmlHandle);
400 
401  float m_endChargeFraction; ///< Fraction of hits that will be considered to calculate end charge (default 10%)
402 };
403 
404 } // namespace lar_content
405 
406 #endif // #ifndef LAR_TRACK_SHOWER_ID_FEATURE_TOOLS_H
pandora::StatusCode ReadSettings(const pandora::TiXmlHandle xmlHandle)
float CalculateVertexDistance(const pandora::Algorithm *const pAlgorithm, const pandora::Cluster *const pCluster) const
Calculation of vertex distance.
void OrderCaloHitsByDistanceToVertex(const pandora::Algorithm *const pAlgorithm, const pandora::Cluster *const pCluster, pandora::CaloHitList &caloHitList)
Function to order the calo hit list by distance to neutrino vertex.
ConeChargeFeatureTool class for the calculation of charge distribution and conicalness.
ThreeDLinearFitFeatureTool class for the calculation of variables related to 3d sliding linear fit...
void Run(LArMvaHelper::MvaFeatureVector &featureVector, const pandora::Algorithm *const pAlgorithm, const pandora::ParticleFlowObject *const pInputPfo)
MvaTypes::MvaFeatureVector MvaFeatureVector
Definition: LArMvaHelper.h:72
float m_hitFraction
Fraction of hits in start and end of pfo.
pandora::StatusCode ReadSettings(const pandora::TiXmlHandle xmlHandle)
void Run(LArMvaHelper::MvaFeatureVector &featureVector, const pandora::Algorithm *const pAlgorithm, const pandora::ParticleFlowObject *const pInputPfo)
pandora::StatusCode ReadSettings(const pandora::TiXmlHandle xmlHandle)
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.
pandora::StatusCode ReadSettings(const pandora::TiXmlHandle xmlHandle)
pandora::StatusCode ReadSettings(const pandora::TiXmlHandle xmlHandle)
MvaTypes::MvaFeatureMap MvaFeatureMap
Definition: LArMvaHelper.h:75
unsigned int m_conMinHits
Configurable parameters to calculate cone charge variables.
void CalculateVariablesSlidingLinearFit(const pandora::Cluster *const pCluster, float &straightLineLengthLarge, float &diffWithStraigthLineMean, float &maxFitGapLength, float &rmsSlidingLinearFit) const
Calculation of several variables related to sliding linear fit.
void Run(LArMvaHelper::MvaFeatureVector &featureVector, const pandora::Algorithm *const pAlgorithm, const pandora::Cluster *const pCluster)
void Run(LArMvaHelper::MvaFeatureVector &featureVector, const pandora::Algorithm *const pAlgorithm, const pandora::ParticleFlowObject *const pInputPfo)
unsigned int m_slidingLinearFitWindow
The sliding linear fit window.
MvaFeatureTool< const pandora::Algorithm *const, const pandora::Cluster *const > ClusterCharacterisationFeatureTool
void Run(LArMvaHelper::MvaFeatureVector &featureVector, const pandora::Algorithm *const pAlgorithm, const pandora::ParticleFlowObject *const pInputPfo)
unsigned int m_slidingLinearFitWindow
The sliding linear fit window.
bool operator()(const pandora::CaloHit *const left, const pandora::CaloHit *const right) const
operator &lt;
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.
float OpeningAngle(const pandora::CartesianVector &principal, const pandora::CartesianVector &secondary, const pandora::CartesianVector &eigenValues) const
Use the results of principal component analysis to calculate an opening angle.
void Run(LArMvaHelper::MvaFeatureVector &featureVector, const pandora::Algorithm *const pAlgorithm, const pandora::ParticleFlowObject *const pInputPfo)
void Run(LArMvaHelper::MvaFeatureVector &featureVector, const pandora::Algorithm *const pAlgorithm, const pandora::ParticleFlowObject *const pInputPfo)
pandora::StatusCode ReadSettings(const pandora::TiXmlHandle xmlHandle)
pandora::StatusCode ReadSettings(const pandora::TiXmlHandle xmlHandle)
unsigned int m_slidingLinearFitWindow
The sliding linear fit window.
pandora::StatusCode ReadSettings(const pandora::TiXmlHandle xmlHandle)
walls no left
Definition: selectors.fcl:105
ThreeDChargeFeatureTool class for the calculation of charge-related features.
VertexComparator class for comparison of two points wrt neutrino vertex position. ...
VertexComparator(const pandora::CartesianVector vertexPosition2D)
Constructor.
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.
void CalculateChargeVariables(const pandora::Algorithm *const pAlgorithm, const pandora::Cluster *const pCluster, float &totalCharge, float &chargeSigma, float &chargeMean, float &endCharge)
Calculation of the charge variables.
void Run(LArMvaHelper::MvaFeatureVector &featureVector, const pandora::Algorithm *const pAlgorithm, const pandora::ParticleFlowObject *const pInputPfo)
void Divide3DCaloHitList(const pandora::Algorithm *const pAlgorithm, const pandora::CaloHitList &threeDCaloHitList, pandora::CartesianPointVector &pointVectorStart, pandora::CartesianPointVector &pointVectorEnd)
Obtain positions at the vertex and non-vertex end of a list of three dimensional calo hits...
ThreeDPCAFeatureTool class for the calculation of PCA-related variables.
TwoDShowerFitFeatureTool to calculate variables related to sliding shower fit.
pandora::StatusCode ReadSettings(const pandora::TiXmlHandle xmlHandle)
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...
float CalculateConicalness(const pandora::CaloHitList &caloHitList, const pandora::CartesianVector &pfoStart, const pandora::CartesianVector &pfoDir, const float pfoLength)
Calculate conicalness as a ratio of charge distribution at the end and start of pfo.
MvaFeatureTool class template.
Definition: LArMvaHelper.h:33
void Run(LArMvaHelper::MvaFeatureVector &featureVector, const pandora::Algorithm *const pAlgorithm, const pandora::Cluster *const pCluster)
unsigned int m_slidingLinearFitWindow
The sliding linear fit window.
void CalculateVariablesSlidingLinearFit(const pandora::Cluster *const pCluster, float &straightLineLengthLarge, float &diffWithStraigthLineMean, float &diffWithStraightLineSigma, float &dTdLWidth, float &maxFitGapLength, float &rmsSlidingLinearFit) const
Calculation of several variables related to sliding linear fit.
void CalculateChargeDistribution(const pandora::CaloHitList &caloHitList, const pandora::CartesianVector &pfoStart, const pandora::CartesianVector &pfoDir, float &chargeCore, float &chargeHalo, float &chargeCon)
Calculate charge distribution in relation to the Moeliere radius.
ThreeDOpeningAngleFeatureTool class for the calculation of distance to neutrino vertex.
void Run(LArMvaHelper::MvaFeatureVector &featureVector, const pandora::Algorithm *const pAlgorithm, const pandora::Cluster *const pCluster)
pandora::StatusCode ReadSettings(const pandora::TiXmlHandle xmlHandle)