RemovalBaseTool.h
Go to the documentation of this file.
1 /**
2  * @file larpandoracontent/LArThreeDReco/LArCosmicRay/RemovalBaseTool.h
3  *
4  * @brief Header file for the removal base tool class.
5  *
6  * $Log: $
7  */
8 #ifndef REMOVAL_BASE_TOOL_H
9 #define REMOVAL_BASE_TOOL_H 1
10 
12 
13 namespace lar_content
14 {
15 /**
16  * @brief RemovalBaseTool class
17  */
19 {
20 public:
21  typedef std::vector<pandora::HitType> HitTypeVector;
22 
23  /**
24  * @brief Default constructor
25  */
27 
28 protected:
29  virtual bool Run(ThreeViewDeltaRayMatchingAlgorithm *const pAlgorithm, TensorType &overlapTensor) = 0;
30  virtual pandora::StatusCode ReadSettings(const pandora::TiXmlHandle xmlHandle) = 0;
31 
32  /**
33  * @brief Determine whether the matched clusters suggest that the delta ray is at the endpoint of the cosmic ray (and is likely to be a michel)
34  *
35  * @param element the tensor element
36  * @param ignoreHitType whether to ignore the cluster under investigation
37  * @param hitTypeToIgnore the hit type to ignore
38  *
39  * @return whether the delta ray is at the endpoint of the cosmic ray
40  */
41  bool IsMuonEndpoint(const TensorType::Element &element, const bool ignoreHitType, const pandora::HitType hitTypeToIgnore = pandora::TPC_VIEW_U) const;
42 
43  /**
44  * @brief Determine whether the input element is the best to use to modify the contaminated cluster (best is defined by the total hit count)
45  *
46  * @param element the tensor element
47  * @param hitType the hit type of the cluster under investigation
48  * @param elementList the tensor element list
49  * @param modifiedClusters the set of modified clusters
50  *
51  * @return whether the input element is the best element
52  */
53  bool IsBestElement(const TensorType::Element &element, const pandora::HitType hitType, const TensorType::ElementList &elementList,
54  const pandora::ClusterSet &modifiedClusters) const;
55 
56  /**
57  * @brief Determine whether element satifies simple checks
58  *
59  * @param element the tensor element
60  * @param hitType the hit type of the cluster under investigation
61  *
62  * @return whether the checks pass
63  */
64  virtual bool PassElementChecks(const TensorType::Element &element, const pandora::HitType hitType) const = 0;
65 
66  /**
67  * @brief Whether a given position is close to a defined line
68  *
69  * @param hitPosition the input position
70  * @param lineStart the start position of the line
71  * @param lineEnd the end position of the line
72  * @param distanceToLine the definition of close
73  *
74  * @return whether the position is close to the definied line
75  */
76  bool IsCloseToLine(const pandora::CartesianVector &hitPosition, const pandora::CartesianVector &lineStart,
77  const pandora::CartesianVector &lineEnd, const float distanceToLine) const;
78 
79  /**
80  * @brief Whether the projection of a given position lies on a defined line
81  *
82  * @param lowerBoundary the start position of the line
83  * @param upperBoundary the end position of the line
84  * @param point the input position
85  *
86  * @return whether the position lies between the two points
87  */
88  bool IsInLineSegment(const pandora::CartesianVector &lowerBoundary, const pandora::CartesianVector &upperBoundary,
89  const pandora::CartesianVector &point) const;
90 
91  /**
92  * @brief Collect the hits that are closest to and can be projected onto a defined line
93  *
94  * @param pCluster the address of the input cluster containing the hits to be investigated
95  * @param lowerBoundary the start position of the line
96  * @param upperBoundary the end position of the line
97  * @param collectedHits the collected hits
98  */
99  void FindExtrapolatedHits(const pandora::Cluster *const pCluster, const pandora::CartesianVector &lowerBoundary,
100  const pandora::CartesianVector &upperBoundary, pandora::CaloHitList &collectedHits) const;
101 
102  /**
103  * @brief Use two views of a delta ray pfo to calculate projected positions in a given third view
104  *
105  * @param element the tensor element
106  * @param hitType the view to be projected into
107  * @param projectedPositions the output list of projected positions
108  *
109  * @return a status code reflecting whether the procedure ran smoothly and if the outcome is good
110  */
111  pandora::StatusCode ProjectDeltaRayPositions(
112  const TensorType::Element &element, const pandora::HitType hitType, pandora::CartesianPointVector &projectedPositions) const;
113 
114  float m_minSeparation; ///< The minimum delta ray - parent muon cluster separation required to investigate a delta/cosmic ray cluster
115  float m_distanceToLine; ///< The maximum perpendicular distance of a position to a line for it to be considered close
116 };
117 
118 } // namespace lar_content
119 
120 #endif // #ifndef REMOVAL_BASE_TOOL_H
float m_minSeparation
The minimum delta ray - parent muon cluster separation required to investigate a delta/cosmic ray clu...
RemovalBaseTool()
Default constructor.
enum cvn::HType HitType
virtual bool Run(ThreeViewDeltaRayMatchingAlgorithm *const pAlgorithm, TensorType &overlapTensor)=0
Run the algorithm tool.
float m_distanceToLine
The maximum perpendicular distance of a position to a line for it to be considered close...
bool IsBestElement(const TensorType::Element &element, const pandora::HitType hitType, const TensorType::ElementList &elementList, const pandora::ClusterSet &modifiedClusters) const
Determine whether the input element is the best to use to modify the contaminated cluster (best is de...
bool IsInLineSegment(const pandora::CartesianVector &lowerBoundary, const pandora::CartesianVector &upperBoundary, const pandora::CartesianVector &point) const
Whether the projection of a given position lies on a defined line.
virtual bool PassElementChecks(const TensorType::Element &element, const pandora::HitType hitType) const =0
Determine whether element satifies simple checks.
void FindExtrapolatedHits(const pandora::Cluster *const pCluster, const pandora::CartesianVector &lowerBoundary, const pandora::CartesianVector &upperBoundary, pandora::CaloHitList &collectedHits) const
Collect the hits that are closest to and can be projected onto a defined line.
bool IsCloseToLine(const pandora::CartesianVector &hitPosition, const pandora::CartesianVector &lineStart, const pandora::CartesianVector &lineEnd, const float distanceToLine) const
Whether a given position is close to a defined line.
pandora::StatusCode ProjectDeltaRayPositions(const TensorType::Element &element, const pandora::HitType hitType, pandora::CartesianPointVector &projectedPositions) const
Use two views of a delta ray pfo to calculate projected positions in a given third view...
std::vector< pandora::HitType > HitTypeVector
bool IsMuonEndpoint(const TensorType::Element &element, const bool ignoreHitType, const pandora::HitType hitTypeToIgnore=pandora::TPC_VIEW_U) const
Determine whether the matched clusters suggest that the delta ray is at the endpoint of the cosmic ra...
RemovalBaseTool class.
virtual pandora::StatusCode ReadSettings(const pandora::TiXmlHandle xmlHandle)=0