LArSoft  v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
lar_content::ConeClusterMopUpAlgorithm Class Reference

ConeClusterMopUpAlgorithm class. More...

#include "ConeClusterMopUpAlgorithm.h"

Inheritance diagram for lar_content::ConeClusterMopUpAlgorithm:
lar_content::ClusterMopUpBaseAlgorithm lar_content::MopUpBaseAlgorithm

Public Member Functions

 ConeClusterMopUpAlgorithm ()
 Default constructor. More...
 
template<typename T >
const std::string GetListName (const T *const pT) const
 Find the name of the list hosting a specific object. More...
 

Protected Types

typedef std::unordered_map< const pandora::Cluster *, float > AssociationDetails
 
typedef std::unordered_map< const pandora::Cluster *, AssociationDetailsClusterAssociationMap
 

Protected Member Functions

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

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...
 
pandora::StringVector m_daughterListNames
 The list of potential daughter object list names. More...
 

Private Types

typedef std::pair< float, float > Coordinate
 
typedef std::vector< CoordinateCoordinateList
 

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

Static Private Member Functions

static bool SortCoordinates (const Coordinate &lhs, const Coordinate &rhs)
 Sort coordinates by increasing transverse displacement. More...
 

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_coneAngleCentile
 Cluster cone angle is defined using specified centile of distribution of hit half angles. More...
 
float m_maxConeLengthMultiplier
 Consider hits as bound if inside cone, with projected distance less than N times cone length. More...
 
float m_minBoundedFraction
 The minimum cluster bounded fraction for merging. More...
 

Detailed Description

ConeClusterMopUpAlgorithm class.

Definition at line 21 of file ConeClusterMopUpAlgorithm.h.

Member Typedef Documentation

typedef std::unordered_map<const pandora::Cluster *, float> lar_content::ClusterMopUpBaseAlgorithm::AssociationDetails
protectedinherited

Definition at line 71 of file ClusterMopUpBaseAlgorithm.h.

typedef std::unordered_map<const pandora::Cluster *, AssociationDetails> lar_content::ClusterMopUpBaseAlgorithm::ClusterAssociationMap
protectedinherited

Definition at line 72 of file ClusterMopUpBaseAlgorithm.h.

typedef std::pair<float, float> lar_content::ConeClusterMopUpAlgorithm::Coordinate
private

Definition at line 32 of file ConeClusterMopUpAlgorithm.h.

Definition at line 33 of file ConeClusterMopUpAlgorithm.h.

Constructor & Destructor Documentation

lar_content::ConeClusterMopUpAlgorithm::ConeClusterMopUpAlgorithm ( )

Default constructor.

Definition at line 23 of file ConeClusterMopUpAlgorithm.cc.

23  :
26  m_coneAngleCentile(0.85f),
29 {
30 }
float m_maxConeLengthMultiplier
Consider hits as bound if inside cone, with projected distance less than N times cone length...
float m_minBoundedFraction
The minimum cluster bounded fraction for merging.
TFile f
Definition: plotHisto.C:6
float m_showerEdgeMultiplier
Artificially tune width of shower envelope so as to make it more/less inclusive.
float m_coneAngleCentile
Cluster cone angle is defined using specified centile of distribution of hit half angles...
unsigned int m_slidingFitWindow
The layer window for the sliding linear fits.

Member Function Documentation

void lar_content::ConeClusterMopUpAlgorithm::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 34 of file ConeClusterMopUpAlgorithm.cc.

References f, lar_content::LArClusterHelper::GetClusterHitType(), lar_content::TwoDSlidingFitResult::GetGlobalPosition(), lar_content::TwoDSlidingFitResult::GetLayerFitResultMap(), lar_content::TwoDSlidingFitResult::GetLocalPosition(), lar_content::TwoDSlidingShowerFitResult::GetNegativeEdgeFitResult(), lar_content::TwoDSlidingShowerFitResult::GetPositiveEdgeFitResult(), lar_content::TwoDSlidingShowerFitResult::GetShowerFitResult(), lar_content::LArGeometryHelper::GetWirePitch(), m_coneAngleCentile, m_maxConeLengthMultiplier, m_minBoundedFraction, m_showerEdgeMultiplier, m_slidingFitWindow, lar_content::ClusterMopUpBaseAlgorithm::MakeClusterMerges(), lar_content::LArGeometryHelper::ProjectPosition(), lar_content::LArClusterHelper::SortByNHits(), and SortCoordinates().

35 {
36  ClusterAssociationMap clusterAssociationMap;
37 
38  const VertexList *pVertexList(NULL);
39  PANDORA_THROW_RESULT_IF(STATUS_CODE_SUCCESS, !=, PandoraContentApi::GetCurrentList(*this, pVertexList));
40 
41  if ((pVertexList->size() != 1) || (VERTEX_3D != (*(pVertexList->begin()))->GetVertexType()))
42  return;
43 
44  const Vertex *const pVertex(*(pVertexList->begin()));
45 
46  ClusterVector sortedPfoClusters(pfoClusters.begin(), pfoClusters.end());
47  std::sort(sortedPfoClusters.begin(), sortedPfoClusters.end(), LArClusterHelper::SortByNHits);
48 
49  ClusterVector sortedRemnantClusters(remnantClusters.begin(), remnantClusters.end());
50  std::sort(sortedRemnantClusters.begin(), sortedRemnantClusters.end(), LArClusterHelper::SortByNHits);
51 
52  for (const Cluster *const pPfoCluster : sortedPfoClusters)
53  {
54  try
55  {
56  const float slidingFitPitch(LArGeometryHelper::GetWirePitch(this->GetPandora(), LArClusterHelper::GetClusterHitType(pPfoCluster)));
57  const TwoDSlidingShowerFitResult showerFitResult(pPfoCluster, m_slidingFitWindow, slidingFitPitch, m_showerEdgeMultiplier);
58 
59  const LayerFitResultMap &layerFitResultMapS(showerFitResult.GetShowerFitResult().GetLayerFitResultMap());
60  const LayerFitResultMap &layerFitResultMapP(showerFitResult.GetPositiveEdgeFitResult().GetLayerFitResultMap());
61  const LayerFitResultMap &layerFitResultMapN(showerFitResult.GetNegativeEdgeFitResult().GetLayerFitResultMap());
62 
63  if (layerFitResultMapS.size() < 2)
64  continue;
65 
66  // Cone direction
67  CartesianVector minLayerPositionOnAxis(0.f, 0.f, 0.f), maxLayerPositionOnAxis(0.f, 0.f, 0.f);
68  showerFitResult.GetShowerFitResult().GetGlobalPosition(layerFitResultMapS.begin()->second.GetL(), 0.f, minLayerPositionOnAxis);
69  showerFitResult.GetShowerFitResult().GetGlobalPosition(layerFitResultMapS.rbegin()->second.GetL(), 0.f, maxLayerPositionOnAxis);
70 
71  const HitType hitType(LArClusterHelper::GetClusterHitType(pPfoCluster));
72  const CartesianVector vertexPosition2D(LArGeometryHelper::ProjectPosition(this->GetPandora(), pVertex->GetPosition(), hitType));
73  const bool vertexAtMinL((vertexPosition2D - minLayerPositionOnAxis).GetMagnitudeSquared() <
74  (vertexPosition2D - maxLayerPositionOnAxis).GetMagnitudeSquared());
75 
76  // Cone edges
77  CoordinateList coordinateListP, coordinateListN;
78 
79  for (LayerFitResultMap::const_iterator iterS = layerFitResultMapS.begin(); iterS != layerFitResultMapS.end(); ++iterS)
80  {
81  LayerFitResultMap::const_iterator iterP = layerFitResultMapP.find(iterS->first);
82  LayerFitResultMap::const_iterator iterN = layerFitResultMapN.find(iterS->first);
83 
84  if (layerFitResultMapP.end() != iterP)
85  coordinateListP.push_back(Coordinate(iterP->second.GetL(), iterP->second.GetFitT()));
86 
87  if (layerFitResultMapN.end() != iterN)
88  coordinateListN.push_back(Coordinate(iterN->second.GetL(), iterN->second.GetFitT()));
89  }
90 
91  if (coordinateListP.empty() || coordinateListN.empty())
92  continue;
93 
94  std::sort(coordinateListP.begin(), coordinateListP.end(), ConeClusterMopUpAlgorithm::SortCoordinates);
95  std::sort(coordinateListN.begin(), coordinateListN.end(), ConeClusterMopUpAlgorithm::SortCoordinates);
96 
97  const Coordinate maxP(coordinateListP.at(m_coneAngleCentile * coordinateListP.size()));
98  const Coordinate minP(vertexAtMinL
99  ? Coordinate(layerFitResultMapP.begin()->second.GetL(), layerFitResultMapP.begin()->second.GetFitT())
100  : Coordinate(layerFitResultMapP.rbegin()->second.GetL(), layerFitResultMapP.rbegin()->second.GetFitT()));
101 
102  const Coordinate maxN(coordinateListN.at((1.f - m_coneAngleCentile) * coordinateListN.size()));
103  const Coordinate minN(vertexAtMinL
104  ? Coordinate(layerFitResultMapN.begin()->second.GetL(), layerFitResultMapN.begin()->second.GetFitT())
105  : Coordinate(layerFitResultMapN.rbegin()->second.GetL(), layerFitResultMapN.rbegin()->second.GetFitT()));
106 
107  const float minL(layerFitResultMapS.begin()->second.GetL());
108  const float maxL(minL + m_maxConeLengthMultiplier * std::fabs(layerFitResultMapS.rbegin()->second.GetL() - minL));
109 
110  if ((std::fabs(maxP.first - minP.first) < std::numeric_limits<float>::epsilon()) ||
111  (std::fabs(maxN.first - minN.first) < std::numeric_limits<float>::epsilon()) ||
112  (std::fabs(maxL - minL) < std::numeric_limits<float>::epsilon()))
113  {
114  continue;
115  }
116 
117  // Bounded fraction calculation
118  for (const Cluster *const pRemnantCluster : sortedRemnantClusters)
119  {
120  const unsigned int nHits(pRemnantCluster->GetNCaloHits());
121 
122  unsigned int nMatchedHits(0);
123  const OrderedCaloHitList &orderedCaloHitList(pRemnantCluster->GetOrderedCaloHitList());
124 
125  for (OrderedCaloHitList::const_iterator iter = orderedCaloHitList.begin(), iterEnd = orderedCaloHitList.end(); iter != iterEnd; ++iter)
126  {
127  for (CaloHitList::const_iterator hIter = iter->second->begin(), hIterEnd = iter->second->end(); hIter != hIterEnd; ++hIter)
128  {
129  float rL(0.f), rT(0.f);
130  showerFitResult.GetShowerFitResult().GetLocalPosition((*hIter)->GetPositionVector(), rL, rT);
131 
132  if ((rL < minL) || (rL > maxL))
133  continue;
134 
135  const float rTP(minP.second + (rL - minP.first) * ((maxP.second - minP.second) / (maxP.first - minP.first)));
136  const float rTN(minN.second + (rL - minN.first) * ((maxN.second - minN.second) / (maxN.first - minN.first)));
137 
138  if ((rT > rTP) || (rT < rTN))
139  continue;
140 
141  ++nMatchedHits;
142  }
143  }
144 
145  const float boundedFraction((nHits > 0) ? static_cast<float>(nMatchedHits) / static_cast<float>(nHits) : 0.f);
146 
147  if (boundedFraction < m_minBoundedFraction)
148  continue;
149 
150  AssociationDetails &associationDetails(clusterAssociationMap[pRemnantCluster]);
151 
152  if (!associationDetails.insert(AssociationDetails::value_type(pPfoCluster, boundedFraction)).second)
153  throw StatusCodeException(STATUS_CODE_FAILURE);
154  }
155  }
156  catch (StatusCodeException &statusCodeException)
157  {
158  if (STATUS_CODE_FAILURE == statusCodeException.GetStatusCode())
159  throw statusCodeException;
160  }
161  }
162 
163  this->MakeClusterMerges(clusterAssociationMap);
164 }
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 ...
static bool SortCoordinates(const Coordinate &lhs, const Coordinate &rhs)
Sort coordinates by increasing transverse displacement.
static pandora::CartesianVector ProjectPosition(const pandora::Pandora &pandora, const pandora::CartesianVector &position3D, const pandora::HitType view)
Project 3D position into a given 2D view.
intermediate_table::const_iterator const_iterator
static pandora::HitType GetClusterHitType(const pandora::Cluster *const pCluster)
Get the hit type associated with a two dimensional cluster.
std::unordered_map< const pandora::Cluster *, AssociationDetails > ClusterAssociationMap
float m_maxConeLengthMultiplier
Consider hits as bound if inside cone, with projected distance less than N times cone length...
float m_minBoundedFraction
The minimum cluster bounded fraction for merging.
TFile f
Definition: plotHisto.C:6
float m_showerEdgeMultiplier
Artificially tune width of shower envelope so as to make it more/less inclusive.
std::map< int, LayerFitResult > LayerFitResultMap
static float GetWirePitch(const pandora::Pandora &pandora, const pandora::HitType view, const float maxWirePitchDiscrepancy=0.01)
Return the wire pitch.
std::unordered_map< const pandora::Cluster *, float > AssociationDetails
HitType
Definition: HitType.h:12
float m_coneAngleCentile
Cluster cone angle is defined using specified centile of distribution of hit half angles...
boost::graph_traits< ModuleGraph >::vertex_descriptor Vertex
Definition: ModuleGraph.h:25
std::vector< art::Ptr< recob::Cluster > > ClusterVector
unsigned int m_slidingFitWindow
The layer window for the sliding linear fits.
std::list< Vertex > VertexList
Definition: DCEL.h:169
void lar_content::ClusterMopUpBaseAlgorithm::GetClusterLists ( const pandora::ClusterList &  inputClusterList,
const bool  availabilityFlag,
pandora::ClusterList &  clusterListU,
pandora::ClusterList &  clusterListV,
pandora::ClusterList &  clusterListW 
) const
protectedvirtualinherited

Get the two dimensional clusters contained in an input cluster list, divided into three different views.

Parameters
inputClusterListthe input cluster list
availabilityFlagonly clusters with matching availability will be considered
clusterListUto receive the list of clusters in the u view
clusterListVto receive the list of clusters in the v view
clusterListWto receive the list of clusters in the w view

Definition at line 82 of file ClusterMopUpBaseAlgorithm.cc.

References lar_content::LArClusterHelper::GetClusterHitType(), and target.

Referenced by lar_content::ClusterMopUpBaseAlgorithm::GetDaughterClusterLists(), and lar_content::ClusterMopUpBaseAlgorithm::GetPfoClusterLists().

84 {
85  for (ClusterList::const_iterator cIter = inputClusterList.begin(), cIterEnd = inputClusterList.end(); cIter != cIterEnd; ++cIter)
86  {
87  const Cluster *const pCluster(*cIter);
88 
89  if (availabilityFlag != pCluster->IsAvailable())
90  continue;
91 
92  const HitType hitType(LArClusterHelper::GetClusterHitType(pCluster));
93 
94  if ((TPC_VIEW_U != hitType) && (TPC_VIEW_V != hitType) && (TPC_VIEW_W != hitType))
95  continue;
96 
97  ClusterList &target((TPC_VIEW_U == hitType) ? clusterListU : (TPC_VIEW_V == hitType) ? clusterListV : clusterListW);
98  target.push_back(pCluster);
99  }
100 }
intermediate_table::const_iterator const_iterator
static pandora::HitType GetClusterHitType(const pandora::Cluster *const pCluster)
Get the hit type associated with a two dimensional cluster.
HitType
Definition: HitType.h:12
cout<< "-> Edep in the target
Definition: analysis.C:53
void lar_content::ClusterMopUpBaseAlgorithm::GetDaughterClusterLists ( pandora::ClusterList &  clusterListU,
pandora::ClusterList &  clusterListV,
pandora::ClusterList &  clusterListW 
) const
protectedvirtualinherited

Get the two dimensional clusters contained in the input remant/daughter cluster lists, divided into three different views.

Parameters
clusterListUto receive the list of clusters in the u view
clusterListVto receive the list of clusters in the v view
clusterListWto receive the list of clusters in the w view

Definition at line 67 of file ClusterMopUpBaseAlgorithm.cc.

References lar_content::ClusterMopUpBaseAlgorithm::GetClusterLists(), and lar_content::MopUpBaseAlgorithm::m_daughterListNames.

Referenced by lar_content::ClusterMopUpBaseAlgorithm::Run().

68 {
69  for (const std::string &daughterListName : m_daughterListNames)
70  {
71  const ClusterList *pClusterList(nullptr);
72 
73  if (STATUS_CODE_SUCCESS != PandoraContentApi::GetList(*this, daughterListName, pClusterList))
74  continue;
75 
76  this->GetClusterLists(*pClusterList, true, clusterListU, clusterListV, clusterListW);
77  }
78 }
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 vie...
pandora::StringVector m_daughterListNames
The list of potential daughter object list names.
template<typename T >
template const std::string lar_content::MopUpBaseAlgorithm::GetListName ( const T *const  pT) const
inherited

Find the name of the list hosting a specific object.

Parameters
pTthe address of the object
Returns
the name of the list

Definition at line 19 of file MopUpBaseAlgorithm.cc.

Referenced by lar_content::IsolatedClusterMopUpAlgorithm::DissolveClustersToHits(), lar_content::ClusterMopUpBaseAlgorithm::MakeClusterMerges(), and lar_content::SlidingConeClusterMopUpAlgorithm::MakeClusterMerges().

20 {
21  std::string currentListName;
22  const MANAGED_CONTAINER<const T *> *pCurrentList(nullptr);
23  (void)PandoraContentApi::GetCurrentList(*this, pCurrentList, currentListName);
24 
25  if (pCurrentList && (pCurrentList->end() != std::find(pCurrentList->begin(), pCurrentList->end(), pT)))
26  return currentListName;
27 
28  for (const std::string &listName : m_daughterListNames)
29  {
30  const MANAGED_CONTAINER<const T *> *pList(nullptr);
31  (void)PandoraContentApi::GetList(*this, listName, pList);
32 
33  if (pList && (pList->end() != std::find(pList->begin(), pList->end(), pT)))
34  return listName;
35  }
36 
37  throw StatusCodeException(STATUS_CODE_NOT_FOUND);
38 }
pandora::StringVector m_daughterListNames
The list of potential daughter object list names.
void lar_content::ClusterMopUpBaseAlgorithm::GetPfoClusterLists ( pandora::ClusterList &  clusterListU,
pandora::ClusterList &  clusterListV,
pandora::ClusterList &  clusterListW 
) const
protectedvirtualinherited

Get the two dimensional clusters contained in the input pfo list, divided into three different views.

Parameters
clusterListUto receive the list of clusters in the u view
clusterListVto receive the list of clusters in the v view
clusterListWto receive the list of clusters in the w view

Definition at line 45 of file ClusterMopUpBaseAlgorithm.cc.

References lar_content::ClusterMopUpBaseAlgorithm::GetClusterLists(), lar_content::LArPfoHelper::IsTrack(), lar_content::ClusterMopUpBaseAlgorithm::m_excludePfosContainingTracks, and lar_content::ClusterMopUpBaseAlgorithm::m_pfoListNames.

Referenced by lar_content::ClusterMopUpBaseAlgorithm::Run().

46 {
47  for (StringVector::const_iterator sIter = m_pfoListNames.begin(), sIterEnd = m_pfoListNames.end(); sIter != sIterEnd; ++sIter)
48  {
49  const PfoList *pPfoList = NULL;
50  if (STATUS_CODE_SUCCESS != PandoraContentApi::GetList(*this, *sIter, pPfoList))
51  continue;
52 
53  for (PfoList::const_iterator pIter = pPfoList->begin(), pIterEnd = pPfoList->end(); pIter != pIterEnd; ++pIter)
54  {
55  const ParticleFlowObject *const pPfo = *pIter;
56 
58  continue;
59 
60  this->GetClusterLists(pPfo->GetClusterList(), false, clusterListU, clusterListV, clusterListW);
61  }
62  }
63 }
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 vie...
bool m_excludePfosContainingTracks
Whether to exclude any pfos containing clusters flagged as fixed tracks.
intermediate_table::const_iterator const_iterator
static bool IsTrack(const pandora::ParticleFlowObject *const pPfo)
Return track flag based on Pfo Particle ID.
pandora::StringVector m_pfoListNames
The list of pfo list names.
void lar_content::ClusterMopUpBaseAlgorithm::MakeClusterMerges ( const ClusterAssociationMap clusterAssociationMap) const
protectedvirtualinherited

Make the cluster merges specified in the cluster association map, using list name information in the cluster list name map.

Parameters
clusterAssociationMapthe cluster association map

Definition at line 104 of file ClusterMopUpBaseAlgorithm.cc.

References lar_content::MopUpBaseAlgorithm::GetListName(), and lar_content::LArClusterHelper::SortByNHits().

Referenced by ClusterMopUp(), lar_content::NearbyClusterMopUpAlgorithm::ClusterMopUp(), and lar_content::BoundedClusterMopUpAlgorithm::ClusterMopUp().

105 {
106  ClusterVector sortedRemnantClusters;
107  for (const auto &remnantMapEntry : clusterAssociationMap)
108  sortedRemnantClusters.push_back(remnantMapEntry.first);
109  std::sort(sortedRemnantClusters.begin(), sortedRemnantClusters.end(), LArClusterHelper::SortByNHits);
110 
111  for (const Cluster *const pRemnantCluster : sortedRemnantClusters)
112  {
113  const AssociationDetails &associationDetails(clusterAssociationMap.at(pRemnantCluster));
114  const Cluster *pBestPfoCluster(nullptr);
115  float bestFigureOfMerit(-std::numeric_limits<float>::max());
116 
117  ClusterVector sortedPfoClusters;
118  for (const auto &pfoMapEntry : associationDetails)
119  sortedPfoClusters.push_back(pfoMapEntry.first);
120  std::sort(sortedPfoClusters.begin(), sortedPfoClusters.end(), LArClusterHelper::SortByNHits);
121 
122  for (const Cluster *const pPfoCluster : sortedPfoClusters)
123  {
124  const float figureOfMerit(associationDetails.at(pPfoCluster));
125 
126  if (figureOfMerit > bestFigureOfMerit)
127  {
128  pBestPfoCluster = pPfoCluster;
129  bestFigureOfMerit = figureOfMerit;
130  }
131  }
132 
133  if (!pBestPfoCluster)
134  continue;
135 
136  PANDORA_THROW_RESULT_IF(STATUS_CODE_SUCCESS, !=,
137  PandoraContentApi::MergeAndDeleteClusters(
138  *this, pBestPfoCluster, pRemnantCluster, this->GetListName(pBestPfoCluster), this->GetListName(pRemnantCluster)));
139  }
140 }
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.
const std::string GetListName(const T *const pT) const
Find the name of the list hosting a specific object.
std::unordered_map< const pandora::Cluster *, float > AssociationDetails
std::vector< art::Ptr< recob::Cluster > > ClusterVector
StatusCode lar_content::ConeClusterMopUpAlgorithm::ReadSettings ( const pandora::TiXmlHandle  xmlHandle)
privatevirtual

Reimplemented from lar_content::ClusterMopUpBaseAlgorithm.

Definition at line 175 of file ConeClusterMopUpAlgorithm.cc.

References m_coneAngleCentile, m_maxConeLengthMultiplier, m_minBoundedFraction, m_showerEdgeMultiplier, m_slidingFitWindow, and lar_content::ClusterMopUpBaseAlgorithm::ReadSettings().

176 {
177  PANDORA_RETURN_RESULT_IF_AND_IF(
178  STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle, "SlidingFitWindow", m_slidingFitWindow));
179 
180  PANDORA_RETURN_RESULT_IF_AND_IF(
181  STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle, "ShowerEdgeMultiplier", m_showerEdgeMultiplier));
182 
183  PANDORA_RETURN_RESULT_IF_AND_IF(
184  STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle, "ConeAngleCentile", m_coneAngleCentile));
185 
186  PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=,
187  XmlHelper::ReadValue(xmlHandle, "MaxConeLengthMultiplier", m_maxConeLengthMultiplier));
188 
189  PANDORA_RETURN_RESULT_IF_AND_IF(
190  STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle, "MinBoundedFraction", m_minBoundedFraction));
191 
192  return ClusterMopUpBaseAlgorithm::ReadSettings(xmlHandle);
193 }
float m_maxConeLengthMultiplier
Consider hits as bound if inside cone, with projected distance less than N times cone length...
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.
float m_coneAngleCentile
Cluster cone angle is defined using specified centile of distribution of hit half angles...
unsigned int m_slidingFitWindow
The layer window for the sliding linear fits.
StatusCode lar_content::ClusterMopUpBaseAlgorithm::Run ( )
protectedvirtualinherited

Definition at line 28 of file ClusterMopUpBaseAlgorithm.cc.

References lar_content::ClusterMopUpBaseAlgorithm::ClusterMopUp(), lar_content::ClusterMopUpBaseAlgorithm::GetDaughterClusterLists(), and lar_content::ClusterMopUpBaseAlgorithm::GetPfoClusterLists().

29 {
30  ClusterList pfoClusterListU, pfoClusterListV, pfoClusterListW;
31  this->GetPfoClusterLists(pfoClusterListU, pfoClusterListV, pfoClusterListW);
32 
33  ClusterList daughterClusterListU, daughterClusterListV, daughterClusterListW;
34  this->GetDaughterClusterLists(daughterClusterListU, daughterClusterListV, daughterClusterListW);
35 
36  this->ClusterMopUp(pfoClusterListU, daughterClusterListU);
37  this->ClusterMopUp(pfoClusterListV, daughterClusterListV);
38  this->ClusterMopUp(pfoClusterListW, daughterClusterListW);
39 
40  return STATUS_CODE_SUCCESS;
41 }
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...
virtual void ClusterMopUp(const pandora::ClusterList &pfoClusters, const pandora::ClusterList &remnantClusters) const =0
Cluster mop up for a single view. This function is responsible for instructing pandora to make cluste...
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.
bool lar_content::ConeClusterMopUpAlgorithm::SortCoordinates ( const Coordinate lhs,
const Coordinate rhs 
)
staticprivate

Sort coordinates by increasing transverse displacement.

Parameters
lhsthe first coordinate for comparison
rhsthe second coordinate for comparison
Returns
boolean

Definition at line 168 of file ConeClusterMopUpAlgorithm.cc.

Referenced by ClusterMopUp().

169 {
170  return (lhs.second < rhs.second);
171 }

Member Data Documentation

float lar_content::ConeClusterMopUpAlgorithm::m_coneAngleCentile
private

Cluster cone angle is defined using specified centile of distribution of hit half angles.

Definition at line 49 of file ConeClusterMopUpAlgorithm.h.

Referenced by ClusterMopUp(), and ReadSettings().

pandora::StringVector lar_content::MopUpBaseAlgorithm::m_daughterListNames
protectedinherited
bool lar_content::ClusterMopUpBaseAlgorithm::m_excludePfosContainingTracks
protectedinherited
float lar_content::ConeClusterMopUpAlgorithm::m_maxConeLengthMultiplier
private

Consider hits as bound if inside cone, with projected distance less than N times cone length.

Definition at line 50 of file ConeClusterMopUpAlgorithm.h.

Referenced by ClusterMopUp(), and ReadSettings().

float lar_content::ConeClusterMopUpAlgorithm::m_minBoundedFraction
private

The minimum cluster bounded fraction for merging.

Definition at line 51 of file ConeClusterMopUpAlgorithm.h.

Referenced by ClusterMopUp(), and ReadSettings().

pandora::StringVector lar_content::ClusterMopUpBaseAlgorithm::m_pfoListNames
protectedinherited
float lar_content::ConeClusterMopUpAlgorithm::m_showerEdgeMultiplier
private

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

Definition at line 48 of file ConeClusterMopUpAlgorithm.h.

Referenced by ClusterMopUp(), and ReadSettings().

unsigned int lar_content::ConeClusterMopUpAlgorithm::m_slidingFitWindow
private

The layer window for the sliding linear fits.

Definition at line 47 of file ConeClusterMopUpAlgorithm.h.

Referenced by ClusterMopUp(), and ReadSettings().


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