All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Classes | Public Member Functions | Private Member Functions | Private Attributes | List of all members
lar_content::BoundedClusterMopUpAlgorithm Class Reference

BoundedClusterMopUpAlgorithm class. More...

#include <BoundedClusterMopUpAlgorithm.h>

Inheritance diagram for lar_content::BoundedClusterMopUpAlgorithm:
lar_content::ClusterMopUpBaseAlgorithm lar_content::MopUpBaseAlgorithm

Classes

class  XSampling
 XSampling class. More...
 

Public Member Functions

 BoundedClusterMopUpAlgorithm ()
 Default constructor. More...
 
- Public Member Functions inherited from lar_content::ClusterMopUpBaseAlgorithm
 ClusterMopUpBaseAlgorithm ()
 Default constructor. More...
 
- Public Member Functions inherited from lar_content::MopUpBaseAlgorithm
template<typename T >
const std::string GetListName (const T *const pT) const
 Find the name of the list hosting a specific object. More...
 

Private Member Functions

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 cluster alterations. More...
 
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. More...
 
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. More...
 
pandora::StatusCode ReadSettings (const pandora::TiXmlHandle xmlHandle)
 

Private Attributes

unsigned int m_slidingFitWindow
 The layer window for the sliding linear fits. More...
 
float m_showerEdgeMultiplier
 Artificially tune width of shower envelope so as to make it more/less inclusive. More...
 
float m_minBoundedFraction
 The minimum cluster bounded fraction for merging. More...
 

Additional Inherited Members

- Protected Types inherited from lar_content::ClusterMopUpBaseAlgorithm
typedef std::unordered_map
< const pandora::Cluster
*, float > 
AssociationDetails
 
typedef std::unordered_map
< const pandora::Cluster
*, AssociationDetails
ClusterAssociationMap
 
- Protected Member Functions inherited from lar_content::ClusterMopUpBaseAlgorithm
virtual pandora::StatusCode Run ()
 
virtual void GetPfoClusterLists (pandora::ClusterList &clusterListU, pandora::ClusterList &clusterListV, pandora::ClusterList &clusterListW) const
 Get the two dimensional clusters contained in the input pfo list, divided into three different views. More...
 
virtual void GetDaughterClusterLists (pandora::ClusterList &clusterListU, pandora::ClusterList &clusterListV, pandora::ClusterList &clusterListW) const
 Get the two dimensional clusters contained in the input remant/daughter cluster lists, divided into three different views. More...
 
virtual void GetClusterLists (const pandora::ClusterList &inputClusterList, const bool availabilityFlag, pandora::ClusterList &clusterListU, pandora::ClusterList &clusterListV, pandora::ClusterList &clusterListW) const
 Get the two dimensional clusters contained in an input cluster list, divided into three different views. More...
 
virtual void MakeClusterMerges (const ClusterAssociationMap &clusterAssociationMap) const
 Make the cluster merges specified in the cluster association map, using list name information in the cluster list name map. More...
 
- Protected Attributes inherited from lar_content::ClusterMopUpBaseAlgorithm
pandora::StringVector m_pfoListNames
 The list of pfo list names. More...
 
bool m_excludePfosContainingTracks
 Whether to exclude any pfos containing clusters flagged as fixed tracks. More...
 
- Protected Attributes inherited from lar_content::MopUpBaseAlgorithm
pandora::StringVector m_daughterListNames
 The list of potential daughter object list names. More...
 

Detailed Description

BoundedClusterMopUpAlgorithm class.

Definition at line 24 of file BoundedClusterMopUpAlgorithm.h.

Constructor & Destructor Documentation

lar_content::BoundedClusterMopUpAlgorithm::BoundedClusterMopUpAlgorithm ( )

Default constructor.

Definition at line 21 of file BoundedClusterMopUpAlgorithm.cc.

21  :
25 {
26 }
float m_minBoundedFraction
The minimum cluster bounded fraction for merging.
float m_showerEdgeMultiplier
Artificially tune width of shower envelope so as to make it more/less inclusive.
unsigned int m_slidingFitWindow
The layer window for the sliding linear fits.

Member Function Documentation

void lar_content::BoundedClusterMopUpAlgorithm::ClusterMopUp ( const pandora::ClusterList &  pfoClusters,
const pandora::ClusterList &  remnantClusters 
) const
privatevirtual

Cluster mop up for a single view. This function is responsible for instructing pandora to make cluster alterations.

Parameters
pfoClustersthe list of pfo clusters
remnantClustersthe list of remnant clusters

Implements lar_content::ClusterMopUpBaseAlgorithm.

Definition at line 30 of file BoundedClusterMopUpAlgorithm.cc.

31 {
32  ClusterAssociationMap clusterAssociationMap;
33  const float slidingFitPitch(LArGeometryHelper::GetWireZPitch(this->GetPandora()));
34 
35  ClusterVector sortedPfoClusters(pfoClusters.begin(), pfoClusters.end());
36  std::sort(sortedPfoClusters.begin(), sortedPfoClusters.end(), LArClusterHelper::SortByNHits);
37 
38  ClusterVector sortedRemnantClusters(remnantClusters.begin(), remnantClusters.end());
39  std::sort(sortedRemnantClusters.begin(), sortedRemnantClusters.end(), LArClusterHelper::SortByNHits);
40 
41  for (const Cluster *const pPfoCluster : sortedPfoClusters)
42  {
43  CaloHitList clusterHitList;
44  pPfoCluster->GetOrderedCaloHitList().FillCaloHitList(clusterHitList);
45  if (clusterHitList.size() <= 3)
46  continue;
47  try
48  {
49  const TwoDSlidingShowerFitResult fitResult(pPfoCluster, m_slidingFitWindow, slidingFitPitch, m_showerEdgeMultiplier);
50 
51  ShowerPositionMap showerPositionMap;
52  const XSampling xSampling(fitResult.GetShowerFitResult());
53  this->GetShowerPositionMap(fitResult, xSampling, showerPositionMap);
54  for (const Cluster *const pRemnantCluster : sortedRemnantClusters)
55  {
56  const float boundedFraction(this->GetBoundedFraction(pRemnantCluster, xSampling, showerPositionMap));
57 
58  if (boundedFraction < m_minBoundedFraction)
59  continue;
60 
61  AssociationDetails &associationDetails(clusterAssociationMap[pRemnantCluster]);
62 
63  if (!associationDetails.insert(AssociationDetails::value_type(pPfoCluster, boundedFraction)).second)
64  throw StatusCodeException(STATUS_CODE_ALREADY_PRESENT);
65  }
66  }
67  catch (const StatusCodeException &e)
68  {
69  if (e.GetStatusCode() != STATUS_CODE_NOT_INITIALIZED)
70  throw e;
71  }
72  }
73 
74  this->MakeClusterMerges(clusterAssociationMap);
75 }
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, then pulse-height.
virtual void MakeClusterMerges(const ClusterAssociationMap &clusterAssociationMap) const
Make the cluster merges specified in the cluster association map, using list name information in the ...
float m_minBoundedFraction
The minimum cluster bounded fraction for merging.
static float GetWireZPitch(const pandora::Pandora &pandora, const float maxWirePitchDiscrepancy=0.01)
Return the wire pitch.
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.
std::unordered_map< const pandora::Cluster *, AssociationDetails > ClusterAssociationMap
std::map< int, ShowerExtent > ShowerPositionMap
float m_showerEdgeMultiplier
Artificially tune width of shower envelope so as to make it more/less inclusive.
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. ...
std::unordered_map< const pandora::Cluster *, float > AssociationDetails
do i e
unsigned int m_slidingFitWindow
The layer window for the sliding linear fits.
std::vector< art::Ptr< recob::Cluster > > ClusterVector
float lar_content::BoundedClusterMopUpAlgorithm::GetBoundedFraction ( const pandora::Cluster *const  pCluster,
const XSampling xSampling,
const ShowerPositionMap showerPositionMap 
) const
private

Get the fraction of hits in a cluster bounded by a specified shower position map.

Parameters
pClusteraddress of the cluster
xSamplingthe x sampling details
showerPositionMapthe shower position map
Returns
the fraction of bounded hits

Definition at line 107 of file BoundedClusterMopUpAlgorithm.cc.

109 {
110  if (((xSampling.m_maxX - xSampling.m_minX) < std::numeric_limits<float>::epsilon()) || (0 >= xSampling.m_nPoints) || (0 == pCluster->GetNCaloHits()))
111  {
112  throw StatusCodeException(STATUS_CODE_INVALID_PARAMETER);
113  }
114 
115  unsigned int nMatchedHits(0);
116  const OrderedCaloHitList &orderedCaloHitList(pCluster->GetOrderedCaloHitList());
117 
118  for (OrderedCaloHitList::const_iterator iter = orderedCaloHitList.begin(), iterEnd = orderedCaloHitList.end(); iter != iterEnd; ++iter)
119  {
120  for (CaloHitList::const_iterator hIter = iter->second->begin(), hIterEnd = iter->second->end(); hIter != hIterEnd; ++hIter)
121  {
122  const CaloHit *const pCaloHit = *hIter;
123  const float x(pCaloHit->GetPositionVector().GetX());
124  const float z(pCaloHit->GetPositionVector().GetZ());
125 
126  try
127  {
128  const int xBin(xSampling.GetBin(x));
129 
130  ShowerPositionMap::const_iterator positionIter = showerPositionMap.find(xBin);
131 
132  if ((showerPositionMap.end() != positionIter) && (z > positionIter->second.GetLowEdgeZ()) && (z < positionIter->second.GetHighEdgeZ()))
133  ++nMatchedHits;
134  }
135  catch (StatusCodeException &)
136  {
137  }
138  }
139  }
140 
141  return (static_cast<float>(nMatchedHits) / static_cast<float>(pCluster->GetNCaloHits()));
142 }
process_name opflash particleana ie ie ie z
process_name opflash particleana ie x
void lar_content::BoundedClusterMopUpAlgorithm::GetShowerPositionMap ( const TwoDSlidingShowerFitResult fitResult,
const XSampling xSampling,
ShowerPositionMap showerPositionMap 
) const
private

Get the shower position map containing high and low edge z positions in bins of x.

Parameters
fitResultthe sliding shower fit result
xSamplingthe x sampling details
showerPositionMapto receive the shower position map

Definition at line 79 of file BoundedClusterMopUpAlgorithm.cc.

81 {
82  for (int n = 0; n <= xSampling.m_nPoints; ++n)
83  {
84  const float x(xSampling.m_minX + (xSampling.m_maxX - xSampling.m_minX) * static_cast<float>(n) / static_cast<float>(xSampling.m_nPoints));
85 
86  FloatVector edgePositions;
87  fitResult.GetShowerEdges(x, false, edgePositions);
88 
89  if (edgePositions.size() < 2)
90  continue;
91 
92  std::sort(edgePositions.begin(), edgePositions.end());
93 
94  try
95  {
96  const int xBin(xSampling.GetBin(x));
97  showerPositionMap.insert(ShowerPositionMap::value_type(xBin, ShowerExtent(x, edgePositions.front(), edgePositions.back())));
98  }
99  catch (StatusCodeException &)
100  {
101  }
102  }
103 }
process_name opflash particleana ie x
StatusCode lar_content::BoundedClusterMopUpAlgorithm::ReadSettings ( const pandora::TiXmlHandle  xmlHandle)
privatevirtual

Reimplemented from lar_content::ClusterMopUpBaseAlgorithm.

Definition at line 170 of file BoundedClusterMopUpAlgorithm.cc.

171 {
172  PANDORA_RETURN_RESULT_IF_AND_IF(
173  STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle, "SlidingFitWindow", m_slidingFitWindow));
174 
175  PANDORA_RETURN_RESULT_IF_AND_IF(
176  STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle, "ShowerEdgeMultiplier", m_showerEdgeMultiplier));
177 
178  PANDORA_RETURN_RESULT_IF_AND_IF(
179  STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle, "MinBoundedFraction", m_minBoundedFraction));
180 
181  return ClusterMopUpBaseAlgorithm::ReadSettings(xmlHandle);
182 }
float m_minBoundedFraction
The minimum cluster bounded fraction for merging.
virtual pandora::StatusCode ReadSettings(const pandora::TiXmlHandle xmlHandle)
float m_showerEdgeMultiplier
Artificially tune width of shower envelope so as to make it more/less inclusive.
unsigned int m_slidingFitWindow
The layer window for the sliding linear fits.

Member Data Documentation

float lar_content::BoundedClusterMopUpAlgorithm::m_minBoundedFraction
private

The minimum cluster bounded fraction for merging.

Definition at line 84 of file BoundedClusterMopUpAlgorithm.h.

float lar_content::BoundedClusterMopUpAlgorithm::m_showerEdgeMultiplier
private

Artificially tune width of shower envelope so as to make it more/less inclusive.

Definition at line 83 of file BoundedClusterMopUpAlgorithm.h.

unsigned int lar_content::BoundedClusterMopUpAlgorithm::m_slidingFitWindow
private

The layer window for the sliding linear fits.

Definition at line 82 of file BoundedClusterMopUpAlgorithm.h.


The documentation for this class was generated from the following files: