29 #ifndef CLUSTERHELPER_H
30 #define CLUSTERHELPER_H
32 #include "Pandora/PandoraInternal.h"
33 #include "Pandora/PandoraInputTypes.h"
35 #include "Helpers/ClusterFitHelper.h"
37 namespace april_content
51 ClusterPca(
const pandora::Cluster *
const pCluster);
69 const pandora::CartesianVector &
GetEigenVector(
int component)
const;
116 static pandora::StatusCode
GetCentroid(
const pandora::Cluster *
const pCluster, pandora::CartesianVector ¢roid);
125 static pandora::StatusCode
GetClosestDistanceApproach(
const pandora::Cluster *
const pCluster,
const pandora::CartesianVector &point,
126 float &closestDistance,
bool onlyUseConnectedHit =
true);
128 static pandora::StatusCode
GetClosestDistanceApproach(
const pandora::CaloHitList& caloHitList,
const pandora::CartesianVector &point,
129 float &closestDistance,
bool onlyUseConnectedHit =
true);
138 static pandora::StatusCode
GetCentroidDistance(
const pandora::Cluster *
const pCluster,
const pandora::CartesianVector &point,
139 float ¢roidDistance);
141 static float GetHadronicEnergyInECAL(
const pandora::Cluster *
const pCluster);
142 static float GetEnergyRatio(
const pandora::OrderedCaloHitList& orderedCaloHitList);
143 static pandora::StatusCode GetEnergyRatio(
const pandora::OrderedCaloHitList& orderedCaloHitList,
float& energyRatio,
unsigned int& nHits);
145 static pandora::HitRegion GetRegion(
const pandora::Cluster *
const pCluster);
147 static float GetElectromagneticEnergyInECAL(
const pandora::Cluster *
const pCluster);
149 static pandora::StatusCode GetClusterVolume(
const pandora::Cluster *
const pCluster,
float& clusterVolume);
151 static pandora::StatusCode FitStart(
const pandora::Cluster *
const pCluster,
const unsigned int maxOccupiedLayers, pandora::ClusterFitResult &clusterFitResult);
153 static pandora::StatusCode FitFullCluster(
const pandora::Cluster *
const pCluster, pandora::ClusterFitResult &clusterFitResult,
bool useMainCluster =
false,
float eps = 50.);
155 static pandora::StatusCode GetMainClusterHits(
const pandora::Cluster *
const pCluster, pandora::CaloHitList& mainClusterHits);
157 static pandora::OrderedCaloHitList GetOrderedConnectedCaloHitList(
const pandora::Cluster *
const pCluster);
159 static float GetClusterAxisStartingPointAngle(
const pandora::Cluster *
const pCluster);
161 static void GetShowerStartingPoint(
const pandora::Cluster *
const pCluster, pandora::CartesianVector& startingPoint);
162 static void GetShowerStartingLayer(
const pandora::Cluster *
const pCluster,
int& showerStartLayer);
171 static pandora::StatusCode
GetClosestDistanceApproach(
const pandora::Cluster *
const pCluster,
const pandora::CartesianVector &point,
172 float &closestDistance, pandora::CartesianVector& distanceVector,
bool onlyUseConnectedHit =
true);
174 static pandora::StatusCode
GetClosestDistanceApproach(
const pandora::Cluster *
const pCluster1,
const pandora::Cluster *
const pCluster2,
175 float &closestDistance, pandora::CartesianVector& distanceVector,
bool onlyUseConnectedHit =
true);
177 static pandora::StatusCode
GetClosestDistanceApproach(
const pandora::Cluster *
const pCluster1,
const pandora::Cluster *
const pCluster2,
178 float &closestDistance,
bool onlyUseConnectedHit =
true);
181 const pandora::CaloHitList& caloHitList2,
float &closestDistance,
bool onlyUseConnectedHit =
true);
183 static pandora::StatusCode GetTrackClusterDistance(
const pandora::TrackState *
const pTrackState,
const pandora::Cluster *
const pCluster,
184 const unsigned int maxSearchLayer,
const float parallelDistanceCut,
const float minTrackClusterCosAngle,
float &trackClusterDistance);
192 static pandora::StatusCode
GetNCaloHitSeeds(
const pandora::Cluster *
const pCluster,
unsigned int &nSeeds);
204 static bool IsClusterLeavingDetector(
const pandora::Cluster *
const pCluster,
const unsigned int nOuterLayersToExamine = 4,
205 const unsigned int nMipLikeOccupiedLayers = 4,
const unsigned int nShowerLikeOccupiedLayers = 3,
206 const float showerLikeEnergyInOuterLayers = 1.f);
208 static bool ContainsHitInOuterSamplingLayer(
const pandora::Cluster *
const pCluster);
210 static bool IsClusterLeavingDetector(
const pandora::Pandora &pandora,
const pandora::Cluster *
const pCluster,
unsigned int nOuterLayersToExamine = 3,
211 float maxDistanceToDetectorEdge = 50.f,
unsigned int minNHitsNearEdges = 3);
219 static bool ContainsHitType(
const pandora::Cluster *
const pCluster,
const pandora::HitType hitType);
227 static pandora::StatusCode
GetMeanSurroundingEnergy(
const pandora::Cluster *
const pCluster,
float &meanSurroundingEnergy);
235 static pandora::StatusCode
GetMeanDensity(
const pandora::Cluster *
const pCluster,
float &meanDensity);
236 static float GetMeanDensity(
const pandora::Cluster *
const pCluster);
247 static pandora::StatusCode
GetChiClusterMerging(
const pandora::Pandora &pandora,
const pandora::Cluster *
const pClusterToEnlarge,
const pandora::Cluster *
const pClusterToMerge,
float& trackEnergy,
float &oldChi,
float &newChi);
255 static pandora::StatusCode
MergeClusters(
const pandora::Algorithm &algorithm, ClusterToClusterMap &clusterToClusterMap);
266 static pandora::StatusCode GetTrackClusterDistance(
const pandora::Pandora &pandora,
const pandora::Cluster *
const pCluster,
const pandora::Track *
const pTrack,
const float maxTransverseDistance,
float &trackClusterDistance);
281 static bool DoesClusterCrossGapRegion(
const pandora::Pandora &pandora,
const pandora::Cluster *
const pCluster,
const unsigned int startLayer,
282 const unsigned int endLayer,
const pandora::DetectorGap *&pDetectorGap,
const unsigned int nSamplingPoints = 50);
298 static bool DoesFitCrossGapRegion(
const pandora::Pandora &pandora,
const pandora::ClusterFitResult &clusterFitResult,
299 const pandora::CartesianVector &startPosition,
const float propagationDistance,
const pandora::DetectorGap *&pDetectorGap,
const unsigned int nSamplingPoints = 50);
308 static pandora::StatusCode
GetDistanceToDetectorGap(
const pandora::CartesianVector &positionVector,
const pandora::DetectorGap *
const pDetectorGap,
float &distanceToGap);
319 static pandora::StatusCode
GetCaloHitsNearDetectorGaps(
const pandora::Pandora &pandora,
const pandora::Cluster *
const pCluster,
const float maxDistanceFine,
320 const float maxDistanceCoarse, pandora::CaloHitList &caloHitList,
bool shouldUseIsolatedHits);
332 static pandora::StatusCode
GetCaloHitsNearDetectorGap(
const pandora::Pandora &pandora,
const pandora::Cluster *
const pCluster,
const pandora::DetectorGap *
const pDetectorGap,
const float maxDistanceFine,
333 const float maxDistanceCoarse, pandora::CaloHitList &caloHitList,
bool shouldUseIsolatedHits);
338 static pandora::StatusCode CleanAndDeleteCluster(
const pandora::Algorithm &algorithm,
const pandora::Cluster *
const pCluster);
343 static pandora::StatusCode CleanAndDeleteClusters(
const pandora::Algorithm &algorithm,
const pandora::ClusterList &clusterList);
345 static bool CanMergeCluster(
const pandora::Pandora &pandora,
const pandora::Cluster *
const pCluster,
const float minMipFraction,
346 const float maxAllHitsFitRms);
348 static float GetAverageTime(
const pandora::Cluster *
const pCluster,
bool onlyForECALHit =
false);
349 static float GetMeanHitPerLayer(
const pandora::Cluster *
const pCluster);
351 static pandora::StatusCode GetMainClusterHits(
const pandora::Cluster *
const pCluster, pandora::CaloHitList& mainClusterHits,
float eps);
353 static pandora::StatusCode GetRMS(
const pandora::Cluster *
const pCluster, pandora::CartesianVector cog, pandora::CartesianVector axis,
float& rms1,
float& rms2);
354 static pandora::StatusCode GetRMS(
const pandora::CaloHitList& clusterHits, pandora::CartesianVector cog, pandora::CartesianVector axis,
float& rms1,
float& rms2);
356 static unsigned int GetClusterConnectorNumber(
const pandora::Cluster *
const pCluster);
364 if(component < 0 || component > 2)
365 throw pandora::StatusCodeException(pandora::STATUS_CODE_INVALID_PARAMETER);
374 if(component < 0 || component > 2)
375 throw pandora::StatusCodeException(pandora::STATUS_CODE_INVALID_PARAMETER);
396 #endif // CLUSTERHELPER_H
static pandora::StatusCode GetNCaloHitSeeds(const pandora::Cluster *const pCluster, unsigned int &nSeeds)
Get the number of calo hit seeds in the cluster.
Definition: ClusterHelper.cc:993
Component struct.
Definition: ClusterHelper.h:85
const pandora::Cluster * GetCluster() const
Get the input cluster.
Definition: ClusterHelper.h:389
static pandora::StatusCode GetMeanSurroundingEnergy(const pandora::Cluster *const pCluster, float &meanSurroundingEnergy)
Get the mean surrounding energy of the cluster.
Definition: ClusterHelper.cc:1170
static pandora::StatusCode GetDistanceToDetectorGap(const pandora::CartesianVector &positionVector, const pandora::DetectorGap *const pDetectorGap, float &distanceToGap)
Get the distance to detector gap.
Definition: ClusterHelper.cc:1539
Component()
Contructor.
Definition: ClusterHelper.cc:48
static bool DoesFitCrossGapRegion(const pandora::Pandora &pandora, const pandora::ClusterFitResult &clusterFitResult, const pandora::CartesianVector &startPosition, const float propagationDistance, const pandora::DetectorGap *&pDetectorGap, const unsigned int nSamplingPoints=50)
Whether a linear fit crosses a registered gap region. The fit will be propagated through the specifie...
Definition: ClusterHelper.cc:1507
static bool DoesClusterCrossGapRegion(const pandora::Pandora &pandora, const pandora::Cluster *const pCluster, const unsigned int startLayer, const unsigned int endLayer, const pandora::DetectorGap *&pDetectorGap, const unsigned int nSamplingPoints=50)
Whether a linear fit to a cluster crosses a registered gap region. Only the region between the startl...
Definition: ClusterHelper.cc:1486
static pandora::StatusCode GetCentroidDistance(const pandora::Cluster *const pCluster, const pandora::CartesianVector &point, float ¢roidDistance)
Get the distance between the cluster centroid and the given position vector.
Definition: ClusterHelper.cc:862
static bool IsClusterLeavingDetector(const pandora::Cluster *const pCluster, const unsigned int nOuterLayersToExamine=4, const unsigned int nMipLikeOccupiedLayers=4, const unsigned int nShowerLikeOccupiedLayers=3, const float showerLikeEnergyInOuterLayers=1.f)
Whether the cluster is leaving the detector.
Definition: ClusterHelper.cc:1018
static bool ContainsHitType(const pandora::Cluster *const pCluster, const pandora::HitType hitType)
Whether the cluster contains at least one hit of target type.
Definition: ClusterHelper.cc:1150
ClusterPca(const pandora::Cluster *const pCluster)
Constructor.
Definition: ClusterHelper.cc:58
static pandora::StatusCode GetChiClusterMerging(const pandora::Pandora &pandora, const pandora::Cluster *const pClusterToEnlarge, const pandora::Cluster *const pClusterToMerge, float &trackEnergy, float &oldChi, float &newChi)
Evaluate the chi before and after to merge the two clusters.
Definition: ClusterHelper.cc:1329
static pandora::StatusCode GetCaloHitsNearDetectorGap(const pandora::Pandora &pandora, const pandora::Cluster *const pCluster, const pandora::DetectorGap *const pDetectorGap, const float maxDistanceFine, const float maxDistanceCoarse, pandora::CaloHitList &caloHitList, bool shouldUseIsolatedHits)
Get the calo hit list belonging to the cluster, close to all registered detector gaps.
Definition: ClusterHelper.cc:1670
static pandora::StatusCode MergeClusters(const pandora::Algorithm &algorithm, ClusterToClusterMap &clusterToClusterMap)
Perform intelligent merging of clusters (daughter <-> parent relationship management) ...
Definition: ClusterHelper.cc:1371
float m_eigenValue
The eigen value.
Definition: ClusterHelper.h:92
pandora::CartesianVector m_eigenVector
The eigen vector.
Definition: ClusterHelper.h:93
Component m_components[3]
The eigen values and vectors for each component.
Definition: ClusterHelper.h:96
ClusterHelper class.
Definition: ClusterHelper.h:107
static pandora::StatusCode GetMeanDensity(const pandora::Cluster *const pCluster, float &meanDensity)
Get the mean density of the cluster.
Definition: ClusterHelper.cc:1296
static pandora::StatusCode GetClosestDistanceApproach(const pandora::Cluster *const pCluster, const pandora::CartesianVector &point, float &closestDistance, bool onlyUseConnectedHit=true)
Get the closest distance approach between all the hits of the cluster and the given position vector...
Definition: ClusterHelper.cc:767
static pandora::StatusCode GetCaloHitsNearDetectorGaps(const pandora::Pandora &pandora, const pandora::Cluster *const pCluster, const float maxDistanceFine, const float maxDistanceCoarse, pandora::CaloHitList &caloHitList, bool shouldUseIsolatedHits)
Get the calo hit list belonging to the cluster, close to all registered detector gaps.
Definition: ClusterHelper.cc:1654
float m_transverseRatio
The cluster transverse ratio.
Definition: ClusterHelper.h:97
float GetEigenValue(int component) const
Get the eigen value for a given component. Components are sorted by descending order.
Definition: ClusterHelper.h:362
float GetTransverseRatio() const
Get the transverse ratio of the cluster.
Definition: ClusterHelper.h:382
const pandora::CartesianVector & GetEigenVector(int component) const
Get the eigen vector for a given component. Components are sorted by descending order.
Definition: ClusterHelper.h:372
const pandora::Cluster * m_pCluster
The inout cluster.
Definition: ClusterHelper.h:98
ClusterPca class.
Definition: ClusterHelper.h:43
static pandora::StatusCode GetCentroid(const pandora::Cluster *const pCluster, pandora::CartesianVector ¢roid)
Get the cluster centroid.
Definition: ClusterHelper.cc:278