8#ifndef LAR_EVENT_SLICING_TOOL_H
9#define LAR_EVENT_SLICING_TOOL_H 1
15#include <unordered_map>
20template <
typename,
unsigned int>
21class KDTreeLinkerAlgo;
22template <
typename,
unsigned int>
54 typedef std::unordered_map<const pandora::Cluster *, const pandora::ParticleFlowObject *>
ClusterToPfoMap;
227 typedef std::list<const pandora::CartesianVector *>
PointList;
Header file for the lar three dimensional sliding cone fit result class.
Header file for the master algorithm class.
EventSlicingBaseTool class.
void GetKDTreeEntries2D(const SlicingAlgorithm::SliceList &sliceList, PointList &pointsU, PointList &pointsV, PointList &pointsW, PointToSliceIndexMap &pointToSliceIndexMap) const
Use projections of 3D hits already assigned to slices to populate kd trees to aid assignment of remai...
std::vector< pandora::ClusterVector > ClusterSliceList
float m_maxClosestApproach
Pointing association: max distance of closest approach between straight line fits.
void GetRemainingClusters(const pandora::Algorithm *const pAlgorithm, const SlicingAlgorithm::HitTypeToNameMap &clusterListNames, const pandora::ClusterSet &assignedClusters, pandora::ClusterList &remainingClusters) const
Get the list of 2D clusters with hits yets to be assigned to slices.
unsigned int m_min3DHitsToSeedNewSlice
The minimum number of hits in a 3D cluster to seed a new slice.
void GetKDTreeEntries3D(const ClusterToSliceIndexMap &clusterToSliceIndexMap, PointList &pointsU, PointList &pointsV, PointList &pointsW, PointToSliceIndexMap &pointToSliceIndexMap) const
Use 2D hits already assigned to slices to populate kd trees to aid assignment of remaining clusters.
const PointKDNode2D * MatchClusterToSlice(const pandora::Cluster *const pCluster2D, PointKDTree2D &kdTree) const
Use the provided kd tree to efficiently identify the most appropriate slice for the provided 2D clust...
void RunSlicing(const pandora::Algorithm *const pAlgorithm, const SlicingAlgorithm::HitTypeToNameMap &caloHitListNames, const SlicingAlgorithm::HitTypeToNameMap &clusterListNames, SlicingAlgorithm::SliceList &sliceList)
Run the slicing tool.
unsigned int m_halfWindowLayers
The number of layers to use for half-window of sliding fit.
void AssignRemainingHitsToSlices(const pandora::ClusterList &remainingClusters, const ClusterToSliceIndexMap &clusterToSliceIndexMap, SlicingAlgorithm::SliceList &sliceList) const
Use the list of remaining 2D clusters to assign all remaining 2D hits to existing slices in the slice...
bool PassShowerCone(const pandora::Cluster *const pConeCluster, const pandora::Cluster *const pNearbyCluster, const ThreeDSlidingConeFitResultMap &showerConeFitResults) const
Compare the provided clusters to assess whether they are associated via cone fits to the shower clust...
std::unordered_map< const pandora::Cluster *, unsigned int > ClusterToSliceIndexMap
void CopyPfoHitsToSlices(const ClusterToSliceIndexMap &clusterToSliceIndexMap, const ClusterToPfoMap &clusterToPfoMap, SlicingAlgorithm::SliceList &sliceList, pandora::ClusterSet &assignedClusters) const
Use 3D clusters in the cluster slice list, find their parent pfos and assign all hits in all 2D clust...
unsigned int m_minHitsPer3DCluster
The minimum number of hits in a 3D cluster to warrant consideration in slicing.
bool IsNode(const LArPointingCluster &cluster1, const LArPointingCluster &cluster2) const
Check whether a pair of pointing clusters are nodally associated.
std::unordered_map< const pandora::CartesianVector *, unsigned int > PointToSliceIndexMap
float m_coneTanHalfAngle1
The cone tan half angle to use when calculating bounded cluster fractions 1.
float m_coneBoundedFraction2
The minimum cluster bounded fraction for association 2.
void CreateSlices(const ClusterSliceList &clusterSliceList, SlicingAlgorithm::SliceList &sliceList, ClusterToSliceIndexMap &clusterToSliceIndexMap) const
Create new slices for each of the groupings of 3D clusters in the provided cluster slice list.
void CopyAllHitsToSingleSlice(const pandora::Algorithm *const pAlgorithm, const SlicingAlgorithm::HitTypeToNameMap &caloHitListNames, SlicingAlgorithm::SliceList &sliceList) const
Copy all the input hits in an event into a single slice.
bool PassProximity(const pandora::Cluster *const pClusterInSlice, const pandora::Cluster *const pCandidateCluster) const
Compare the provided clusters to assess whether they are associated via pointing.
bool m_usePointingAssociation
Whether to use pointing association.
pandora::StatusCode ReadSettings(const pandora::TiXmlHandle xmlHandle)
Read the algorithm settings.
bool m_useProximityAssociation
Whether to use proximity association.
bool CheckClosestApproach(const LArPointingCluster &cluster1, const LArPointingCluster &cluster2) const
Check closest approach metrics for a pair of pointing clusters.
std::string m_showerPfoListName
The name of the input shower pfo list.
std::list< const pandora::CartesianVector * > PointList
float m_maxHitSeparationSquared
Proximity association: max distance allowed between the closest pair of hits.
float m_coneLengthMultiplier
The cone length multiplier to use when calculating bounded cluster fractions.
KDTreeLinkerAlgo< const pandora::CartesianVector *, 2 > PointKDTree2D
void CollectAssociatedClusters(const pandora::Cluster *const pClusterInSlice, const pandora::ClusterVector &candidateClusters, const ThreeDSlidingFitResultMap &trackFitResults, const ThreeDSlidingConeFitResultMap &showerConeFitResults, pandora::ClusterVector &clusterSlice, pandora::ClusterSet &usedClusters) const
Collect all clusters associated with a provided cluster.
float m_vertexAngularAllowance
Pointing association check: pointing angular allowance in degrees.
float m_maxVertexLongitudinalDistance
Pointing association check: max longitudinal distance cut.
float m_maxConeLength
The maximum allowed cone length to use when calculating bounded cluster fractions.
std::unordered_map< const pandora::Cluster *, const pandora::ParticleFlowObject * > ClusterToPfoMap
void GetThreeDClusters(const pandora::Algorithm *const pAlgorithm, const std::string &pfoListName, pandora::ClusterList &clusters3D, ClusterToPfoMap &clusterToPfoMap) const
Get the 3D clusters from a specified list of pfos, storing the 3D clusters in the provided list and p...
unsigned int m_nConeFitLayers
The number of layers over which to sum fitted direction to obtain cone fit.
float m_coneBoundedFraction1
The minimum cluster bounded fraction for association 1.
unsigned int m_nConeFits
The number of cone fits to perform, spread roughly uniformly along the shower length.
float m_coneTanHalfAngle2
The cone tan half angle to use when calculating bounded cluster fractions 2.
std::vector< PointKDNode2D > PointKDNode2DList
float m_minVertexLongitudinalDistance
Pointing association check: min longitudinal distance cut.
bool m_use3DProjectionsInHitPickUp
Whether to include 3D cluster projections when assigning remaining clusters to slices.
bool IsEmission(const LArPointingCluster &cluster1, const LArPointingCluster &cluster2) const
Check whether a pair of pointing clusters are consistent with an emission.
bool m_useShowerConeAssociation
Whether to use shower cone association.
EventSlicingTool()
Default constructor.
float m_maxInterceptDistance
Pointing association: max distance from cluster vertex to point of closest approach.
float m_maxVertexTransverseDistance
Pointing association check: max transverse distance cut.
void GetClusterSliceList(const pandora::ClusterList &trackClusters3D, const pandora::ClusterList &showerClusters3D, ClusterSliceList &clusterSliceList) const
Divide the provided lists of 3D track and shower clusters into slices.
bool PassPointing(const pandora::Cluster *const pClusterInSlice, const pandora::Cluster *const pCandidateCluster, const ThreeDSlidingFitResultMap &trackFitResults) const
Compare the provided clusters to assess whether they are associated via pointing (checks association ...
static bool SortPoints(const pandora::CartesianVector *const pLhs, const pandora::CartesianVector *const pRhs)
Sort points (use Z, followed by X, followed by Y)
std::string m_trackPfoListName
The name of the input track pfo list.
KDTreeNodeInfoT< const pandora::CartesianVector *, 2 > PointKDNode2D
Class that implements the KDTree partition of 2D space and a closest point search algorithm.
Data stored in each KDTree node. The dim1/dim2 fields are usually the duplication of some PFRecHit va...
LArPointingCluster class.
std::map< pandora::HitType, std::string > HitTypeToNameMap
std::vector< Slice > SliceList
Algorithm class. Algorithm addresses are held only by the algorithm manager. They have a fully define...
std::unordered_map< const pandora::Cluster *, ThreeDSlidingConeFitResult > ThreeDSlidingConeFitResultMap
std::unordered_map< const pandora::Cluster *, ThreeDSlidingFitResult > ThreeDSlidingFitResultMap
std::vector< const Cluster * > ClusterVector
MANAGED_CONTAINER< const Cluster * > ClusterList
std::unordered_set< const Cluster * > ClusterSet
StatusCode
The StatusCode enum.