22 m_slidingFitWindow(20),
23 m_showerEdgeMultiplier(1.5f),
24 m_minBoundedFraction(0.5f)
35 ClusterVector sortedPfoClusters(pfoClusters.begin(), pfoClusters.end());
38 ClusterVector sortedRemnantClusters(remnantClusters.begin(), remnantClusters.end());
41 for (
const Cluster *
const pPfoCluster : sortedPfoClusters)
44 pPfoCluster->GetOrderedCaloHitList().FillCaloHitList(clusterHitList);
45 if (clusterHitList.size() <= 3)
54 for (
const Cluster *
const pRemnantCluster : sortedRemnantClusters)
56 const float boundedFraction(this->
GetBoundedFraction(pRemnantCluster, xSampling, showerPositionMap));
63 if (!associationDetails.insert(AssociationDetails::value_type(pPfoCluster, boundedFraction)).second)
82 for (
int n = 0; n <= xSampling.
m_nPoints; ++n)
84 const float x(xSampling.
m_minX + (xSampling.
m_maxX - xSampling.
m_minX) *
static_cast<float>(n) /
static_cast<float>(xSampling.
m_nPoints));
89 if (edgePositions.size() < 2)
92 std::sort(edgePositions.begin(), edgePositions.end());
96 const int xBin(xSampling.
GetBin(x));
97 showerPositionMap.insert(ShowerPositionMap::value_type(xBin,
ShowerExtent(x, edgePositions.front(), edgePositions.back())));
115 unsigned int nMatchedHits(0);
120 for (CaloHitList::const_iterator hIter = iter->second->begin(), hIterEnd = iter->second->end(); hIter != hIterEnd; ++hIter)
122 const CaloHit *
const pCaloHit = *hIter;
128 const int xBin(xSampling.
GetBin(x));
130 ShowerPositionMap::const_iterator positionIter = showerPositionMap.find(xBin);
132 if ((showerPositionMap.end() != positionIter) && (z > positionIter->second.GetLowEdgeZ()) && (z < positionIter->second.GetHighEdgeZ()))
141 return (
static_cast<float>(nMatchedHits) /
static_cast<float>(pCluster->
GetNCaloHits()));
161 if (((x - m_minX) < -std::numeric_limits<float>::epsilon()) || ((x - m_maxX) > +std::numeric_limits<float>::epsilon()))
164 return static_cast<int>(0.5f +
static_cast<float>(m_nPoints) * (x - m_minX) / (m_maxX - m_minX));
Header file for the bounded cluster mop up algorithm class.
Header file for the cluster helper class.
Header file for the geometry helper class.
#define PANDORA_RETURN_RESULT_IF_AND_IF(StatusCode1, StatusCode2, Operator, Command)
float m_minX
The min x value.
float m_maxX
The max x value.
XSampling(const TwoDSlidingFitResult &fitResult)
Constructor.
int GetBin(const float x) const
Convert an x position into a sampling bin.
int m_nPoints
The number of sampling points to be used.
float GetBoundedFraction(const pandora::Cluster *const pCluster, const XSampling &xSampling, const ShowerPositionMap &showerPositionMap) const
Get the fraction of hits in a cluster bounded by a specified shower position map.
float m_showerEdgeMultiplier
Artificially tune width of shower envelope so as to make it more/less inclusive.
BoundedClusterMopUpAlgorithm()
Default constructor.
pandora::StatusCode ReadSettings(const pandora::TiXmlHandle xmlHandle)
Read the algorithm settings.
float m_minBoundedFraction
The minimum cluster bounded fraction for merging.
void ClusterMopUp(const pandora::ClusterList &pfoClusters, const pandora::ClusterList &remnantClusters) const
Cluster mop up for a single view. This function is responsible for instructing pandora to make cluste...
void GetShowerPositionMap(const TwoDSlidingShowerFitResult &fitResult, const XSampling &xSampling, ShowerPositionMap &showerPositionMap) const
Get the shower position map containing high and low edge z positions in bins of x.
unsigned int m_slidingFitWindow
The layer window for the sliding linear fits.
std::unordered_map< const pandora::Cluster *, AssociationDetails > ClusterAssociationMap
virtual pandora::StatusCode ReadSettings(const pandora::TiXmlHandle xmlHandle)
Read the algorithm settings.
virtual void MakeClusterMerges(const ClusterAssociationMap &clusterAssociationMap) const
Make the cluster merges specified in the cluster association map, using list name information in the ...
std::unordered_map< const pandora::Cluster *, float > AssociationDetails
static bool SortByNHits(const pandora::Cluster *const pLhs, const pandora::Cluster *const pRhs)
Sort clusters by number of hits, then layer span, then inner layer, then position,...
static float GetWireZPitch(const pandora::Pandora &pandora, const float maxWirePitchDiscrepancy=0.01)
Return the wire pitch.
TwoDSlidingFitResult class.
int GetMaxLayer() const
Get the maximum occupied layer in the sliding fit.
int GetMinLayer() const
Get the minimum occupied layer in the sliding fit.
void GetMinAndMaxX(float &minX, float &maxX) const
Get the minimum and maximum x coordinates associated with the sliding fit.
TwoDSlidingShowerFitResult class.
void GetShowerEdges(const float x, const bool widenIfAmbiguity, pandora::FloatVector &edgePositions) const
Get the most appropriate shower edges at a given x coordinate.
const TwoDSlidingFitResult & GetShowerFitResult() const
Get the sliding fit result for the full shower cluster.
const CartesianVector & GetPositionVector() const
Get the position vector of center of calorimeter cell, units mm.
float GetX() const
Get the cartesian x coordinate.
float GetZ() const
Get the cartesian z coordinate.
unsigned int GetNCaloHits() const
Get the number of calo hits in the cluster.
const OrderedCaloHitList & GetOrderedCaloHitList() const
Get the ordered calo hit list.
Calo hit lists arranged by pseudo layer.
const_iterator end() const
Returns a const iterator referring to the past-the-end element in the ordered calo hit list.
const_iterator begin() const
Returns a const iterator referring to the first element in the ordered calo hit list.
TheList::const_iterator const_iterator
const Pandora & GetPandora() const
Get the associated pandora instance.
StatusCodeException class.
StatusCode GetStatusCode() const
Get status code.
static StatusCode ReadValue(const TiXmlHandle &xmlHandle, const std::string &xmlElementName, T &t)
Read a value from an xml element.
std::map< int, ShowerExtent > ShowerPositionMap
std::vector< const Cluster * > ClusterVector
MANAGED_CONTAINER< const Cluster * > ClusterList
MANAGED_CONTAINER< const CaloHit * > CaloHitList
std::vector< float > FloatVector
StatusCode
The StatusCode enum.