8 #ifndef LAR_EVENT_SLICING_TOOL_H 9 #define LAR_EVENT_SLICING_TOOL_H 1 15 #include <unordered_map> 22 template <
typename,
unsigned int>
23 class KDTreeLinkerAlgo;
24 template <
typename,
unsigned int>
25 class KDTreeNodeInfoT;
42 void RunSlicing(
const pandora::Algorithm *
const pAlgorithm,
const HitTypeToNameMap &caloHitListNames,
43 const HitTypeToNameMap &clusterListNames,
SliceList &sliceList);
55 typedef std::unordered_map<const pandora::Cluster *, const pandora::ParticleFlowObject *>
ClusterToPfoMap;
66 void GetThreeDClusters(
const pandora::Algorithm *
const pAlgorithm,
const std::string &pfoListName, pandora::ClusterList &clusters3D,
67 ClusterToPfoMap &clusterToPfoMap)
const;
79 const pandora::ClusterList &trackClusters3D,
const pandora::ClusterList &showerClusters3D, ClusterSliceList &clusterSliceList)
const;
104 bool PassPointing(
const pandora::Cluster *
const pClusterInSlice,
const pandora::Cluster *
const pCandidateCluster,
115 bool PassProximity(
const pandora::Cluster *
const pClusterInSlice,
const pandora::Cluster *
const pCandidateCluster)
const;
126 bool PassShowerCone(
const pandora::Cluster *
const pConeCluster,
const pandora::Cluster *
const pNearbyCluster,
178 void CreateSlices(
const ClusterSliceList &clusterSliceList,
SliceList &sliceList, ClusterToSliceIndexMap &clusterToSliceIndexMap)
const;
189 void CopyPfoHitsToSlices(
const ClusterToSliceIndexMap &clusterToSliceIndexMap,
const ClusterToPfoMap &clusterToPfoMap,
190 SliceList &sliceList, pandora::ClusterSet &assignedClusters)
const;
200 void GetRemainingClusters(
const pandora::Algorithm *
const pAlgorithm,
const HitTypeToNameMap &clusterListNames,
201 const pandora::ClusterSet &assignedClusters, pandora::ClusterList &remainingClusters)
const;
211 void GetRemainingClusters(
const pandora::Algorithm *
const pAlgorithm,
const std::string &clusterListName,
212 const pandora::ClusterSet &assignedClusters, pandora::ClusterList &remainingClusters)
const;
222 const pandora::ClusterList &remainingClusters,
const ClusterToSliceIndexMap &clusterToSliceIndexMap,
SliceList &sliceList)
const;
228 typedef std::list<const pandora::CartesianVector *>
PointList;
241 PointToSliceIndexMap &pointToSliceIndexMap)
const;
252 void GetKDTreeEntries3D(
const ClusterToSliceIndexMap &clusterToSliceIndexMap, PointList &pointsU, PointList &pointsV,
253 PointList &pointsW, PointToSliceIndexMap &pointToSliceIndexMap)
const;
263 const PointKDNode2D *
MatchClusterToSlice(
const pandora::Cluster *
const pCluster2D, PointKDTree2D &kdTree)
const;
271 static bool SortPoints(
const pandora::CartesianVector *
const pLhs,
const pandora::CartesianVector *
const pRhs);
273 pandora::StatusCode
ReadSettings(
const pandora::TiXmlHandle xmlHandle);
308 #endif // #ifndef LAR_EVENT_SLICING_TOOL_H 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_nConeFits
The number of cone fits to perform, spread roughly uniformly along the shower length.
KDTreeLinkerAlgo< const pandora::CartesianVector *, 2 > PointKDTree2D
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.
unsigned int m_min3DHitsToSeedNewSlice
The minimum number of hits in a 3D cluster to seed a new slice.
float m_maxHitSeparationSquared
Proximity association: max distance allowed between the closest pair of hits.
unsigned int m_nConeFitLayers
The number of layers over which to sum fitted direction to obtain cone fit.
float m_coneTanHalfAngle2
The cone tan half angle to use when calculating bounded cluster fractions 2.
pandora::StatusCode ReadSettings(const pandora::TiXmlHandle xmlHandle)
std::unordered_map< const pandora::Cluster *, const pandora::ParticleFlowObject * > ClusterToPfoMap
float m_maxVertexTransverseDistance
Pointing association check: max transverse distance cut.
float m_coneBoundedFraction2
The minimum cluster bounded fraction for association 2.
std::string m_showerPfoListName
The name of the input shower pfo list.
Class that implements the KDTree partition of 2D space and a closest point search algorithm...
void CopyPfoHitsToSlices(const ClusterToSliceIndexMap &clusterToSliceIndexMap, const ClusterToPfoMap &clusterToPfoMap, 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...
void CopyAllHitsToSingleSlice(const pandora::Algorithm *const pAlgorithm, const HitTypeToNameMap &caloHitListNames, SliceList &sliceList) const
Copy all the input hits in an event into a single 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::vector< Slice > SliceList
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 ...
unsigned int m_minHitsPer3DCluster
The minimum number of hits in a 3D cluster to warrant consideration in slicing.
LArPointingCluster class.
EventSlicingBaseTool class.
float m_coneTanHalfAngle1
The cone tan half angle to use when calculating bounded cluster fractions 1.
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.
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...
Header file for the lar three dimensional sliding cone fit result class.
float m_maxVertexLongitudinalDistance
Pointing association check: max longitudinal distance cut.
Data stored in each KDTree node. The dim1/dim2 fields are usually the duplication of some PFRecHit va...
std::unordered_map< const pandora::CartesianVector *, unsigned int > PointToSliceIndexMap
std::string m_trackPfoListName
The name of the input track pfo list.
KDTreeNodeInfoT< const pandora::CartesianVector *, 2 > PointKDNode2D
bool m_useProximityAssociation
Whether to use proximity association.
float m_maxClosestApproach
Pointing association: max distance of closest approach between straight line fits.
std::unordered_map< const pandora::Cluster *, ThreeDSlidingFitResult > ThreeDSlidingFitResultMap
bool IsNode(const LArPointingCluster &cluster1, const LArPointingCluster &cluster2) const
Check whether a pair of pointing clusters are nodally associated.
static bool SortPoints(const pandora::CartesianVector *const pLhs, const pandora::CartesianVector *const pRhs)
Sort points (use Z, followed by X, followed by Y)
std::map< pandora::HitType, std::string > HitTypeToNameMap
bool m_usePointingAssociation
Whether to use pointing association.
float m_coneLengthMultiplier
The cone length multiplier to use when calculating bounded cluster fractions.
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. ...
void GetKDTreeEntries2D(const 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
std::unordered_map< const pandora::Cluster *, ThreeDSlidingConeFitResult > ThreeDSlidingConeFitResultMap
std::list< const pandora::CartesianVector * > PointList
void RunSlicing(const pandora::Algorithm *const pAlgorithm, const HitTypeToNameMap &caloHitListNames, const HitTypeToNameMap &clusterListNames, SliceList &sliceList)
Run the slicing tool.
bool CheckClosestApproach(const LArPointingCluster &cluster1, const LArPointingCluster &cluster2) const
Check closest approach metrics for a pair of pointing clusters.
std::vector< PointKDNode2D > PointKDNode2DList
std::unordered_map< const pandora::Cluster *, unsigned int > ClusterToSliceIndexMap
EventSlicingTool()
Default constructor.
float m_maxInterceptDistance
Pointing association: max distance from cluster vertex to point of closest approach.
void GetRemainingClusters(const pandora::Algorithm *const pAlgorithm, const HitTypeToNameMap &clusterListNames, const pandora::ClusterSet &assignedClusters, pandora::ClusterList &remainingClusters) const
Get the list of 2D clusters with hits yets to be assigned to slices.
float m_minVertexLongitudinalDistance
Pointing association check: min longitudinal distance cut.
bool IsEmission(const LArPointingCluster &cluster1, const LArPointingCluster &cluster2) const
Check whether a pair of pointing clusters are consistent with an emission.
bool m_use3DProjectionsInHitPickUp
Whether to include 3D cluster projections when assigning remaining clusters to slices.
std::vector< art::Ptr< recob::Cluster > > ClusterVector
float m_maxConeLength
The maximum allowed cone length to use when calculating bounded cluster fractions.
bool m_useShowerConeAssociation
Whether to use shower cone association.
float m_vertexAngularAllowance
Pointing association check: pointing angular allowance in degrees.
void CreateSlices(const ClusterSliceList &clusterSliceList, SliceList &sliceList, ClusterToSliceIndexMap &clusterToSliceIndexMap) const
Create new slices for each of the groupings of 3D clusters in the provided cluster slice list...
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...
float m_coneBoundedFraction1
The minimum cluster bounded fraction for association 1.
void AssignRemainingHitsToSlices(const pandora::ClusterList &remainingClusters, const ClusterToSliceIndexMap &clusterToSliceIndexMap, SliceList &sliceList) const
Use the list of remaining 2D clusters to assign all remaining 2D hits to existing slices in the slice...
unsigned int m_halfWindowLayers
The number of layers to use for half-window of sliding fit.