DeltaRayIdentificationAlgorithm.h
Go to the documentation of this file.
1 /**
2  * @file larpandoracontent/LArThreeDReco/LArCosmicRay/DeltaRayIdentificationAlgorithm.h
3  *
4  * @brief Header file for the delta ray identification algorithm class.
5  *
6  * $Log: $
7  */
8 #ifndef LAR_DELTA_RAY_IDENTIFICATION_ALGORITHM_H
9 #define LAR_DELTA_RAY_IDENTIFICATION_ALGORITHM_H 1
10 
11 #include "Pandora/Algorithm.h"
12 
13 #include <unordered_map>
14 
15 namespace lar_content
16 {
17 
18 /**
19  * @brief DeltaRayIdentificationAlgorithm class
20  */
21 class DeltaRayIdentificationAlgorithm : public pandora::Algorithm
22 {
23 public:
24  /**
25  * @brief Default constructor
26  */
28 
29 private:
30  pandora::StatusCode Run();
31 
32  typedef std::unordered_map<const pandora::ParticleFlowObject *, const pandora::ParticleFlowObject *> PfoAssociationMap;
33 
34  /**
35  * @brief Get the vector of Pfos, given the input list name
36  *
37  * @param inputPfoListName the input Pfo list name
38  * @param outputPfoVector the output vector of Pfos
39  */
40  void GetPfos(const std::string &inputPfoListName, pandora::PfoVector &outputPfoVector) const;
41 
42  /**
43  * @brief Build parent/daughter associations between PFOs
44  *
45  * @param inputPfos the input vector of current parent Pfos
46  * @param outputPfos the input vector of current daughter Pfos
47  * @param pfoAssociationMap the output map of parent/daughter associations
48  */
49  void BuildAssociationMap(const pandora::PfoVector &inputPfos, const pandora::PfoVector &outputPfos, PfoAssociationMap &pfoAssociationMap) const;
50 
51  /**
52  * @brief Determine if a given pair of Pfos have a parent/daughter association
53  *
54  * @param pDaughterPfo the input daughter Pfo
55  * @param pParentPfo the input parent Pfo
56  * @param displacement the average displacement between parent and daughter
57  *
58  * @return boolean
59  */
60  bool IsAssociated(const pandora::ParticleFlowObject *const pDaughterPfo, const pandora::ParticleFlowObject *const pParentPfo, float &displacement) const;
61 
62  /**
63  * @brief Calculate 2D separation between two Pfos
64  *
65  * @param pDaughterPfo the input daughter Pfo
66  * @param pParentPfo the input parent Pfo
67  *
68  * @return average displacement between parent and daughter
69  */
70  float GetTwoDSeparation(const pandora::ParticleFlowObject *const pDaughterPfo, const pandora::ParticleFlowObject *const pParentPfo) const;
71 
72  /**
73  * @brief Calculate 2D separation between two Pfos
74  *
75  * @param pPfo the input daughter Pfo
76  * @param hitType the hit type
77  * @param vertexVector the vector of possible vertex positions
78  */
79  void GetTwoDVertices(const pandora::ParticleFlowObject *const pPfo, const pandora::HitType &hitType, pandora::CartesianPointVector &vertexVector) const;
80 
81  /**
82  * @brief Calculate closest 2D separation between a set of vertices and a set of clusters
83  *
84  * @param vertexVector the vector of possible vertex positions
85  * @param clusterList the list of clusters
86  */
87  float GetClosestDistance(const pandora::CartesianPointVector &vertexVector, const pandora::ClusterList &clusterList) const;
88 
89  /**
90  * @brief Build the parent/daughter links from the map of parent/daughter associations
91  *
92  * @param pfoAssociationMap the map of parent/daughter associations
93  * @param outputPfoList the output list of daughter Pfos
94  */
95  void BuildParentDaughterLinks(const PfoAssociationMap &pfoAssociationMap, pandora::PfoList &outputPfoList) const;
96 
97  /**
98  * @brief For a given daughter, follow the parent/daughter links to find the overall parent
99  *
100  * @param pfoAssociationMap the map of parent/daughter associations
101  * @param pPfo the daughter Pfo
102  *
103  * @return the parent Pfo
104  */
105  const pandora::ParticleFlowObject *GetParent(const PfoAssociationMap &pfoAssociationMap, const pandora::ParticleFlowObject *const pPfo) const;
106 
107  pandora::StatusCode ReadSettings(const pandora::TiXmlHandle xmlHandle);
108 
109  std::string m_parentPfoListName; ///< The parent pfo list name
110  std::string m_daughterPfoListName; ///< The daughter pfo list name
111 
112  float m_distanceForMatching; ///< Maximum allowed distance of delta ray from parent cosmic ray
113  float m_minParentLengthSquared; ///< Minimum allowed length of parent cosmic ray
114  float m_maxDaughterLengthSquared; ///< Maximum allowed length of daughter delta ray
115 };
116 
117 } // namespace lar_content
118 
119 #endif // #ifndef LAR_DELTA_RAY_IDENTIFICATION_ALGORITHM_H
float m_distanceForMatching
Maximum allowed distance of delta ray from parent cosmic ray.
pandora::StatusCode ReadSettings(const pandora::TiXmlHandle xmlHandle)
enum cvn::HType HitType
std::string string
Definition: nybbler.cc:12
void GetPfos(const std::string &inputPfoListName, pandora::PfoVector &outputPfoVector) const
Get the vector of Pfos, given the input list name.
const pandora::ParticleFlowObject * GetParent(const PfoAssociationMap &pfoAssociationMap, const pandora::ParticleFlowObject *const pPfo) const
For a given daughter, follow the parent/daughter links to find the overall parent.
float GetTwoDSeparation(const pandora::ParticleFlowObject *const pDaughterPfo, const pandora::ParticleFlowObject *const pParentPfo) const
Calculate 2D separation between two Pfos.
std::string m_parentPfoListName
The parent pfo list name.
float m_maxDaughterLengthSquared
Maximum allowed length of daughter delta ray.
std::string m_daughterPfoListName
The daughter pfo list name.
void GetTwoDVertices(const pandora::ParticleFlowObject *const pPfo, const pandora::HitType &hitType, pandora::CartesianPointVector &vertexVector) const
Calculate 2D separation between two Pfos.
bool IsAssociated(const pandora::ParticleFlowObject *const pDaughterPfo, const pandora::ParticleFlowObject *const pParentPfo, float &displacement) const
Determine if a given pair of Pfos have a parent/daughter association.
void BuildParentDaughterLinks(const PfoAssociationMap &pfoAssociationMap, pandora::PfoList &outputPfoList) const
Build the parent/daughter links from the map of parent/daughter associations.
void BuildAssociationMap(const pandora::PfoVector &inputPfos, const pandora::PfoVector &outputPfos, PfoAssociationMap &pfoAssociationMap) const
Build parent/daughter associations between PFOs.
float m_minParentLengthSquared
Minimum allowed length of parent cosmic ray.
float GetClosestDistance(const pandora::CartesianPointVector &vertexVector, const pandora::ClusterList &clusterList) const
Calculate closest 2D separation between a set of vertices and a set of clusters.
std::unordered_map< const pandora::ParticleFlowObject *, const pandora::ParticleFlowObject * > PfoAssociationMap