8 #ifndef LAR_VERTEX_SELECTION_BASE_ALGORITHM_H 9 #define LAR_VERTEX_SELECTION_BASE_ALGORITHM_H 1 11 #include "Objects/Vertex.h" 12 #include "Pandora/Algorithm.h" 22 template <
typename,
unsigned int>
23 class KDTreeLinkerAlgo;
24 template <
typename,
unsigned int>
25 class KDTreeNodeInfoT;
95 float GetMinZCoordinate()
const;
102 float GetDecayConstant()
const;
110 void SetConstants(
const float minZCoordinate,
const float decayConstant);
130 SlidingFitData(
const pandora::Cluster *
const pCluster,
const int slidingFitWindow,
const float slidingFitPitch);
137 const pandora::CartesianVector &GetMinLayerDirection()
const;
144 const pandora::CartesianVector &GetMaxLayerDirection()
const;
151 const pandora::CartesianVector &GetMinLayerPosition()
const;
158 const pandora::CartesianVector &GetMaxLayerPosition()
const;
165 const pandora::Cluster *GetCluster()
const;
190 ShowerCluster(
const pandora::ClusterList &clusterList,
const int slidingFitWindow,
const float slidingFitPitch);
197 const pandora::ClusterList &GetClusters()
const;
213 pandora::CartesianPointVector GetClusterListCoordinateVector(
const pandora::ClusterList &clusterList)
const;
230 typedef std::map<pandora::HitType, const std::reference_wrapper<HitKDTree2D>>
KDTreeMap;
233 const ClusterListMap &,
const KDTreeMap &,
const ShowerClusterListMap &,
const float,
float &>
268 HitKDTree2D &kdTreeV, HitKDTree2D &kdTreeW, VertexScoreList &vertexScoreList)
const = 0;
278 void GetClusterLists(
const pandora::StringVector &inputClusterListNames, pandora::ClusterList &clusterListU,
279 pandora::ClusterList &clusterListV, pandora::ClusterList &clusterListW)
const;
290 const unsigned int slidingFitWindow, SlidingFitDataList &slidingFitDataList)
const;
317 float GetVertexEnergy(
const pandora::Vertex *
const pVertex,
const KDTreeMap &kdTreeMap)
const;
330 pandora::StatusCode
ReadSettings(
const pandora::TiXmlHandle xmlHandle);
333 pandora::StatusCode
Run();
342 void InitializeKDTrees(HitKDTree2D &kdTreeU, HitKDTree2D &kdTreeV, HitKDTree2D &kdTreeW)
const;
391 static bool SortByVertexZPosition(
const pandora::Vertex *
const pLhs,
const pandora::Vertex *
const pRhs);
421 const float vertexMinZ(std::max(pVertex->GetPosition().GetZ(), beamConstants.
GetMinZCoordinate()));
467 return m_minZCoordinate.Get();
474 return m_decayConstant.Get();
481 m_minZCoordinate = minZCoordinate;
482 m_decayConstant = decayConstant;
489 return m_minLayerDirection;
496 return m_maxLayerDirection;
503 return m_minLayerPosition;
510 return m_maxLayerPosition;
524 return m_clusterList;
531 return m_twoDSlidingFitResult;
536 #endif // #ifndef LAR_VERTEX_SELECTION_BASE_ALGORITHM_H const pandora::Cluster * m_pCluster
Pointer to the corresponding cluster.
float m_minCandidateScoreFraction
Ignore other top-scoring candidates with score less than a fraction of original.
pandora::CartesianPointVector m_coordinateVector
The coordinate vector.
void SetConstants(const float minZCoordinate, const float decayConstant)
Set the beam constants.
std::vector< ShowerCluster > ShowerClusterList
KDTreeNodeInfoT< const pandora::CaloHit *, 2 > HitKDNode2D
KDTreeLinkerAlgo< const pandora::CaloHit *, 2 > HitKDTree2D
virtual void FilterVertexList(const pandora::VertexList *const pInputVertexList, HitKDTree2D &kdTreeU, HitKDTree2D &kdTreeV, HitKDTree2D &kdTreeW, pandora::VertexVector &filteredVertices) const
Filter the input list of vertices to obtain a reduced number of vertex candidates.
pandora::StatusCode Run()
std::string m_outputVertexListName
The name under which to save the output vertex list.
pandora::StringVector m_inputCaloHitListNames
The list of calo hit list names.
void GetClusterLists(const pandora::StringVector &inputClusterListNames, pandora::ClusterList &clusterListU, pandora::ClusterList &clusterListV, pandora::ClusterList &clusterListW) const
Get the cluster lists.
pandora::InputFloat m_minZCoordinate
The min z coordinate.
void CalculateClusterSlidingFits(const pandora::ClusterList &inputClusterList, const unsigned int minClusterCaloHits, const unsigned int slidingFitWindow, SlidingFitDataList &slidingFitDataList) const
Calculate the cluster sliding fits.
const pandora::CartesianVector & GetMaxLayerDirection() const
Get the max layer direction.
TwoDSlidingFitResult m_twoDSlidingFitResult
The fit to the hits of the cluster list.
pandora::CartesianVector m_minLayerPosition
The position of the fit at the max layer.
bool IsBeamModeOn() const
Whether algorithm is running in beam mode, assuming neutrinos travel in positive z-direction.
const pandora::CartesianVector & GetMinLayerPosition() const
Get the min layer position.
VertexSelectionBaseAlgorithm()
Default constructor.
const pandora::ClusterList & GetClusters() const
Get the cluster list.
bool IsVertexOnHit(const pandora::Vertex *const pVertex, const pandora::HitType hitType, HitKDTree2D &kdTree) const
Whether the vertex lies on a hit in the specified view.
std::vector< SlidingFitData > SlidingFitDataList
Data stored in each KDTree node. The dim1/dim2 fields are usually the duplication of some PFRecHit va...
pandora::CartesianVector m_maxLayerDirection
The direction of the fit at the min layer.
bool AcceptVertexLocation(const pandora::Vertex *const pVertex, const pandora::VertexList &selectedVertexList) const
Whether to accept a candidate vertex, based on its spatial position in relation to other selected can...
std::vector< HitKDNode2D > HitKDNode2DList
float VertexHitEnergy(const pandora::Vertex *const pVertex, const pandora::HitType hitType, HitKDTree2D &kdTree) const
Finds the energy of the nearest hit to the vertex candidate in this view.
std::map< pandora::HitType, const ShowerClusterList > ShowerClusterListMap
Map of shower cluster lists for passing to tools.
virtual void GetBeamConstants(const pandora::VertexVector &vertexVector, BeamConstants &beamConstants) const
Get the beam score constants for a provided list of candidate vertices.
unsigned int m_maxTopScoreSelections
Max number of top-scoring vertex candidate to select for output.
pandora::CartesianVector m_minLayerDirection
The direction of the fit at the min layer.
bool IsVertexInGap(const pandora::Vertex *const pVertex, const pandora::HitType hitType) const
Whether the vertex lies in a registered gap.
Header file for the lar support vector machine class.
MvaFeatureTool< const VertexSelectionBaseAlgorithm *const, const pandora::Vertex *const, const SlidingFitDataListMap &, const ClusterListMap &, const KDTreeMap &, const ShowerClusterListMap &, const float, float & > VertexFeatureTool
The base type for the vertex feature tools.
Header file for the lar two dimensional sliding fit result class.
std::map< pandora::HitType, const pandora::ClusterList & > ClusterListMap
Map array of cluster lists for passing to tools.
const TwoDSlidingFitResult & GetFit() const
Get the 2D sliding linear fit.
float GetDecayConstant() const
Get the decay constant.
VertexSelectionBaseAlgorithm class.
pandora::CartesianVector m_maxLayerPosition
The position of the fit at the max layer.
bool m_useDetectorGaps
Whether to account for registered detector gaps in vertex selection.
static bool SortByVertexZPosition(const pandora::Vertex *const pLhs, const pandora::Vertex *const pRhs)
Sort vertices by increasing z position.
VertexScore(const pandora::Vertex *const pVertex, const float score)
Constructor.
void InitializeKDTrees(HitKDTree2D &kdTreeU, HitKDTree2D &kdTreeV, HitKDTree2D &kdTreeW) const
Initialize kd trees with details of hits in algorithm-configured cluster lists.
const pandora::Vertex * m_pVertex
The address of the vertex.
std::vector< VertexScore > VertexScoreList
bool operator<(const VertexScore &rhs) const
operator<
const pandora::Vertex * GetVertex() const
Get the address of the vertex.
const pandora::CartesianVector & GetMaxLayerPosition() const
Get the max layer position.
bool m_beamMode
Whether to run in beam mode, assuming neutrinos travel in positive z-direction.
float GetScore() const
Get the score.
bool m_isEmptyViewAcceptable
Whether views entirely empty of hits are classed as 'acceptable' for candidate filtration.
bool m_selectSingleVertex
Whether to make a final decision and select just one vertex candidate.
float GetMinZCoordinate() const
Get the min z coordinate.
std::map< pandora::HitType, const SlidingFitDataList > SlidingFitDataListMap
Map of sliding fit data lists for passing to tools.
float GetVertexEnergy(const pandora::Vertex *const pVertex, const KDTreeMap &kdTreeMap) const
Calculate the energy of a vertex candidate by summing values from all three planes.
unsigned int m_minVertexAcceptableViews
The minimum number of views in which a candidate must sit on/near a hit or in a gap (or view can be e...
std::vector< art::Ptr< recob::Vertex > > VertexVector
virtual void GetVertexScoreList(const pandora::VertexVector &vertexVector, const BeamConstants &beamConstants, HitKDTree2D &kdTreeU, HitKDTree2D &kdTreeV, HitKDTree2D &kdTreeW, VertexScoreList &vertexScoreList) const =0
Get the vertex score list for a provided list of candidate vertices.
boost::graph_traits< ModuleGraph >::vertex_descriptor Vertex
void SelectTopScoreVertices(VertexScoreList &vertexScoreList, pandora::VertexList &selectedVertexList) const
From the top-scoring candidate vertices, select a subset for further investigation.
std::map< pandora::HitType, const std::reference_wrapper< HitKDTree2D > > KDTreeMap
Map array of hit kd trees for passing to tools.
float GetBeamDeweightingScore(const BeamConstants &beamConstants, const pandora::Vertex *const pVertex) const
Get the beam deweighting score for a vertex.
float m_nDecayLengthsInZSpan
The number of score decay lengths to use over the course of the vertex z-span.
float m_minCandidateDisplacement
Ignore other top-scoring candidates located in close proximity to original.
bool m_replaceCurrentVertexList
Whether to replace the current vertex list with the output list.
MvaFeatureTool class template.
pandora::ClusterList m_clusterList
The list of clusters.
pandora::StatusCode ReadSettings(const pandora::TiXmlHandle xmlHandle)
const pandora::CartesianVector & GetMinLayerDirection() const
Get the min layer direction.
std::list< Vertex > VertexList
float m_gapTolerance
The tolerance to use when querying whether a sampling point is in a gap, units cm.
TwoDSlidingFitResult class.
float m_maxOnHitDisplacement
Max hit-vertex displacement for declaring vertex to lie on a hit in each view.
const pandora::Cluster * GetCluster() const
Get a pointer to the corresponding cluster.
pandora::InputFloat m_decayConstant
The decay constant.