9 #include "Pandora/AlgorithmHeaders.h" 24 CutClusterCharacterisationAlgorithm::CutClusterCharacterisationAlgorithm() :
25 m_slidingFitWindow(5),
26 m_slidingShowerFitWindow(10),
28 m_maxShowerLengthCut(80.
f),
29 m_pathLengthRatioCut(1.005
f),
30 m_rTWidthRatioCut(0.05
f),
31 m_vertexDistanceRatioCut(0.5
f),
32 m_showerWidthRatioCut(0.35
f)
41 (void)PandoraContentApi::GetCurrentList(*pAlgorithm, pVertexList);
43 if (!pVertexList || (pVertexList->size() != 1) || (VERTEX_3D != pVertexList->front()->GetVertexType()))
46 const Vertex *
const pVertex(pVertexList->front());
64 if (!layerFitResultMapS.empty())
66 float showerFitWidth(0.
f);
68 for (
const auto &mapEntryS : layerFitResultMapS)
73 if ((layerFitResultMapP.end() != iterP) && (layerFitResultMapN.end() != iterN))
74 showerFitWidth += std::fabs(iterP->second.GetFitT() - iterN->second.GetFitT());
77 return showerFitWidth;
80 catch (
const StatusCodeException &)
94 float straightLineLength(-1.
f), integratedPathLength(-1.
f);
95 float rTMin(+std::numeric_limits<float>::max()), rTMax(-std::numeric_limits<float>::max());
103 integratedPathLength = 0.f;
104 CartesianVector previousFitPosition(globalMinLayerPosition);
108 rTMin = std::min(rTMin, static_cast<float>(mapEntry.second.GetFitT()));
109 rTMax = std::max(rTMax, static_cast<float>(mapEntry.second.GetFitT()));
111 CartesianVector thisFitPosition(0.
f, 0.
f, 0.
f);
112 slidingFitResult.
GetGlobalPosition(mapEntry.second.GetL(), mapEntry.second.GetFitT(), thisFitPosition);
113 integratedPathLength += (thisFitPosition - previousFitPosition).GetMagnitude();
114 previousFitPosition = thisFitPosition;
117 catch (
const StatusCodeException &)
121 if (straightLineLength < std::numeric_limits<float>::epsilon())
127 if ((integratedPathLength < std::numeric_limits<float>::epsilon()) || (integratedPathLength / straightLineLength >
m_pathLengthRatioCut))
135 if ((vertexDistance > std::numeric_limits<float>::epsilon()) && ((vertexDistance / straightLineLength) >
m_vertexDistanceRatioCut))
140 if ((showerFitWidth < std::numeric_limits<float>::epsilon()) || ((showerFitWidth / straightLineLength) >
m_showerWidthRatioCut))
150 PANDORA_RETURN_RESULT_IF_AND_IF(
151 STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle,
"SlidingFitWindow",
m_slidingFitWindow));
153 PANDORA_RETURN_RESULT_IF_AND_IF(
154 STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle,
"SlidingShowerFitWindow",
m_slidingShowerFitWindow));
156 PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle,
"MinCaloHitsCut",
m_minCaloHitsCut));
158 PANDORA_RETURN_RESULT_IF_AND_IF(
159 STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle,
"MaxShowerLengthCut",
m_maxShowerLengthCut));
161 PANDORA_RETURN_RESULT_IF_AND_IF(
162 STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle,
"PathLengthRatioCut",
m_pathLengthRatioCut));
164 PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle,
"RTWidthRatioCut",
m_rTWidthRatioCut));
166 PANDORA_RETURN_RESULT_IF_AND_IF(
167 STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle,
"VertexDistanceRatioCut",
m_vertexDistanceRatioCut));
169 PANDORA_RETURN_RESULT_IF_AND_IF(
170 STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle,
"ShowerWidthRatioCut",
m_showerWidthRatioCut));
Header file for the lar two dimensional sliding shower fit result class.
Header file for the cut based cluster characterisation algorithm class.
virtual bool IsClearTrack(const pandora::Cluster *const pCluster) const
Whether cluster is identified as a clear track.
static float GetVertexDistance(const pandora::Algorithm *const pAlgorithm, const pandora::Cluster *const pCluster)
Get the distance between the interaction vertex (if present in the current vertex list) and a provide...
const TwoDSlidingFitResult & GetShowerFitResult() const
Get the sliding fit result for the full shower cluster.
static pandora::CartesianVector ProjectPosition(const pandora::Pandora &pandora, const pandora::CartesianVector &position3D, const pandora::HitType view)
Project 3D position into a given 2D view.
static pandora::HitType GetClusterHitType(const pandora::Cluster *const pCluster)
Get the hit type associated with a two dimensional cluster.
static float GetWireZPitch(const pandora::Pandora &pandora, const float maxWirePitchDiscrepancy=0.01)
Return the wire pitch.
float m_rTWidthRatioCut
The maximum ratio of transverse fit position width to straight line length to qualify as a track...
float m_vertexDistanceRatioCut
The maximum ratio of vertex separation to straight line length to qualify as a track.
TwoDSlidingShowerFitResult class.
Header file for the geometry helper class.
float m_maxShowerLengthCut
The maximum cluster length to qualify as a shower.
pandora::StatusCode ReadSettings(const pandora::TiXmlHandle xmlHandle)
Header file for the cluster helper class.
unsigned int m_minCaloHitsCut
The minimum number of calo hits to qualify as a track.
pandora::StatusCode ReadSettings(const pandora::TiXmlHandle xmlHandle)
Header file for the lar two dimensional sliding fit result class.
std::map< int, LayerFitResult > LayerFitResultMap
pandora::CartesianVector GetGlobalMinLayerPosition() const
Get global position corresponding to the fit result in minimum fit layer.
unsigned int m_slidingShowerFitWindow
The layer window for the sliding shower fits.
const TwoDSlidingFitResult & GetPositiveEdgeFitResult() const
Get the sliding fit result for the positive shower edge.
unsigned int m_slidingFitWindow
The layer window for the sliding linear fits.
const LayerFitResultMap & GetLayerFitResultMap() const
Get the layer fit result map.
const TwoDSlidingFitResult & GetNegativeEdgeFitResult() const
Get the sliding fit result for the negative shower edge.
float m_showerWidthRatioCut
The maximum ratio of shower fit width to straight line length to qualify as a track.
void GetGlobalPosition(const float rL, const float rT, pandora::CartesianVector &position) const
Get global coordinates for given sliding linear fit coordinates.
boost::graph_traits< ModuleGraph >::vertex_descriptor Vertex
static float GetShowerFitWidth(const pandora::Algorithm *const pAlgorithm, const pandora::Cluster *const pCluster, const unsigned int showerFitWindow)
Get a measure of the width of a cluster, using a sliding shower fit result.
std::list< Vertex > VertexList
pandora::CartesianVector GetGlobalMaxLayerPosition() const
Get global position corresponding to the fit result in maximum fit layer.
float m_pathLengthRatioCut
The maximum ratio of path length to straight line length to qualify as a track.
TwoDSlidingFitResult class.
static float GetClosestDistance(const pandora::ClusterList &clusterList1, const pandora::ClusterList &clusterList2)
Get closest distance between clusters in a pair of cluster lists.