Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes | List of all members
lar_content::MatchingBaseAlgorithm Class Referenceabstract

MatchingBaseAlgorithm class. More...

#include <MatchingBaseAlgorithm.h>

Inheritance diagram for lar_content::MatchingBaseAlgorithm:
lar_content::NViewMatchingAlgorithm< T > lar_content::NViewMatchingAlgorithm< ThreeViewMatchingControl< DeltaRayOverlapResult > > lar_content::NViewMatchingAlgorithm< ThreeViewMatchingControl< float > > lar_content::NViewMatchingAlgorithm< ThreeViewMatchingControl< FragmentOverlapResult > > lar_content::NViewMatchingAlgorithm< ThreeViewMatchingControl< LongitudinalOverlapResult > > lar_content::NViewMatchingAlgorithm< ThreeViewMatchingControl< ShowerOverlapResult > > lar_content::NViewMatchingAlgorithm< ThreeViewMatchingControl< TransverseOverlapResult > > lar_content::NViewMatchingAlgorithm< TwoViewMatchingControl< TwoViewDeltaRayOverlapResult > > lar_content::NViewMatchingAlgorithm< TwoViewMatchingControl< TwoViewTransverseOverlapResult > >

Public Member Functions

 MatchingBaseAlgorithm ()
 Default constructor. More...
 
virtual ~MatchingBaseAlgorithm ()
 Destructor. More...
 
virtual void UpdateForNewCluster (const pandora::Cluster *const pNewCluster)=0
 Update to reflect addition of a new cluster to the problem space. More...
 
virtual void UpdateUponDeletion (const pandora::Cluster *const pDeletedCluster)=0
 Update to reflect cluster deletion. More...
 
virtual const std::stringGetClusterListName (const pandora::HitType hitType) const =0
 Get the cluster list name corresponding to a specified hit type. More...
 
virtual const pandora::ClusterList & GetInputClusterList (const pandora::HitType hitType) const =0
 Get the input cluster list corresponding to a specified hit type. More...
 
virtual const pandora::ClusterList & GetSelectedClusterList (const pandora::HitType hitType) const =0
 Get the selected cluster list corresponding to a specified hit type. More...
 
virtual void CalculateOverlapResult (const pandora::Cluster *const pCluster1, const pandora::Cluster *const pCluster2, const pandora::Cluster *const pCluster3=nullptr)=0
 Calculate cluster overlap result and store in container. More...
 
virtual void SelectInputClusters (const pandora::ClusterList *const pInputClusterList, pandora::ClusterList &selectedClusterList) const
 Select a subset of input clusters for processing in this algorithm. More...
 
virtual void PrepareInputClusters (pandora::ClusterList &preparedClusterList)
 Perform any preparatory steps required on the input clusters, e.g. caching expensive fit results. More...
 
virtual bool MakeClusterMerges (const ClusterMergeMap &clusterMergeMap)
 Merge clusters together. More...
 
virtual bool CreateThreeDParticles (const ProtoParticleVector &protoParticleVector)
 Create particles using findings from recent algorithm processing. More...
 
virtual void SetPfoParameters (const ProtoParticle &protoParticle, PandoraContentApi::ParticleFlowObject::Parameters &pfoParameters) const
 Set Pfo properties. More...
 
virtual void SetPfoParticleId (PandoraContentApi::ParticleFlowObject::Parameters &pfoParameters) const
 Set pfo particle id. More...
 

Protected Member Functions

virtual void SelectAllInputClusters ()=0
 Select a subset of input clusters for processing in this algorithm. More...
 
virtual void PrepareAllInputClusters ()=0
 Perform any preparatory steps required, e.g. caching expensive fit results for clusters. More...
 
virtual void PerformMainLoop ()=0
 Main loop over cluster combinations in order to populate the overlap container. Responsible for calling CalculateOverlapResult. More...
 
virtual void ExamineOverlapContainer ()=0
 Examine contents of overlap container, collect together best-matching 2D particles and modify clusters as required. More...
 
virtual void TidyUp ()=0
 Tidy member variables in derived class. More...
 
virtual pandora::StatusCode ReadSettings (const pandora::TiXmlHandle xmlHandle)
 

Private Member Functions

pandora::StatusCode Run ()
 

Private Attributes

std::string m_outputPfoListName
 The output pfo list name. More...
 

Detailed Description

MatchingBaseAlgorithm class.

Definition at line 38 of file MatchingBaseAlgorithm.h.

Constructor & Destructor Documentation

lar_content::MatchingBaseAlgorithm::MatchingBaseAlgorithm ( )

Default constructor.

Definition at line 20 of file MatchingBaseAlgorithm.cc.

21 {
22 }
lar_content::MatchingBaseAlgorithm::~MatchingBaseAlgorithm ( )
virtual

Destructor.

Definition at line 26 of file MatchingBaseAlgorithm.cc.

27 {
28 }

Member Function Documentation

virtual void lar_content::MatchingBaseAlgorithm::CalculateOverlapResult ( const pandora::Cluster *const  pCluster1,
const pandora::Cluster *const  pCluster2,
const pandora::Cluster *const  pCluster3 = nullptr 
)
pure virtual
bool lar_content::MatchingBaseAlgorithm::CreateThreeDParticles ( const ProtoParticleVector protoParticleVector)
virtual

Create particles using findings from recent algorithm processing.

Parameters
protoParticleVectorthe proto particle vector
whetherparticles were created

Definition at line 88 of file MatchingBaseAlgorithm.cc.

89 {
90  bool particlesMade(false);
91  const PfoList *pPfoList(nullptr);
92  std::string pfoListName;
93  PANDORA_THROW_RESULT_IF(STATUS_CODE_SUCCESS, !=, PandoraContentApi::CreateTemporaryListAndSetCurrent(*this, pPfoList, pfoListName));
94 
95  for (const ProtoParticle &protoParticle : protoParticleVector)
96  {
97  PandoraContentApi::ParticleFlowObject::Parameters pfoParameters;
98  this->SetPfoParameters(protoParticle, pfoParameters);
99 
100  const ParticleFlowObject *pPfo(nullptr);
101  PANDORA_THROW_RESULT_IF(STATUS_CODE_SUCCESS, !=, PandoraContentApi::ParticleFlowObject::Create(*this, pfoParameters, pPfo));
102  particlesMade = true;
103  }
104 
105  if (!pPfoList->empty())
106  {
107  PANDORA_THROW_RESULT_IF(STATUS_CODE_SUCCESS, !=, PandoraContentApi::SaveList<Pfo>(*this, m_outputPfoListName));
108  PANDORA_THROW_RESULT_IF(STATUS_CODE_SUCCESS, !=, PandoraContentApi::ReplaceCurrentList<Pfo>(*this, m_outputPfoListName));
109  }
110 
111  return particlesMade;
112 }
std::string string
Definition: nybbler.cc:12
virtual void SetPfoParameters(const ProtoParticle &protoParticle, PandoraContentApi::ParticleFlowObject::Parameters &pfoParameters) const
Set Pfo properties.
std::string m_outputPfoListName
The output pfo list name.
virtual void lar_content::MatchingBaseAlgorithm::ExamineOverlapContainer ( )
protectedpure virtual
virtual const std::string& lar_content::MatchingBaseAlgorithm::GetClusterListName ( const pandora::HitType  hitType) const
pure virtual
virtual const pandora::ClusterList& lar_content::MatchingBaseAlgorithm::GetInputClusterList ( const pandora::HitType  hitType) const
pure virtual
virtual const pandora::ClusterList& lar_content::MatchingBaseAlgorithm::GetSelectedClusterList ( const pandora::HitType  hitType) const
pure virtual
bool lar_content::MatchingBaseAlgorithm::MakeClusterMerges ( const ClusterMergeMap clusterMergeMap)
virtual

Merge clusters together.

Parameters
clusterMergeMapthe cluster merge map
Returns
whether changes to the overlap container have been made

Definition at line 48 of file MatchingBaseAlgorithm.cc.

49 {
50  ClusterSet deletedClusters;
51 
52  ClusterList parentClusters;
53  for (const auto &mapEntry : clusterMergeMap)
54  parentClusters.push_back(mapEntry.first);
55  parentClusters.sort(LArClusterHelper::SortByNHits);
56 
57  for (const Cluster *const pParentCluster : parentClusters)
58  {
59  const HitType hitType(LArClusterHelper::GetClusterHitType(pParentCluster));
60  const std::string &clusterListName(this->GetClusterListName(hitType));
61 
62  if (!((TPC_VIEW_U == hitType) || (TPC_VIEW_V == hitType) || (TPC_VIEW_W == hitType)))
63  throw StatusCodeException(STATUS_CODE_FAILURE);
64 
65  ClusterList daughterClusters(clusterMergeMap.at(pParentCluster));
66  daughterClusters.sort(LArClusterHelper::SortByNHits);
67 
68  for (const Cluster *const pDaughterCluster : daughterClusters)
69  {
70  if (deletedClusters.count(pParentCluster) || deletedClusters.count(pDaughterCluster))
71  throw StatusCodeException(STATUS_CODE_FAILURE);
72 
73  this->UpdateUponDeletion(pDaughterCluster);
74  this->UpdateUponDeletion(pParentCluster);
75  PANDORA_THROW_RESULT_IF(STATUS_CODE_SUCCESS, !=,
76  PandoraContentApi::MergeAndDeleteClusters(*this, pParentCluster, pDaughterCluster, clusterListName, clusterListName));
77 
78  this->UpdateForNewCluster(pParentCluster);
79  deletedClusters.insert(pDaughterCluster);
80  }
81  }
82 
83  return !(deletedClusters.empty());
84 }
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 UpdateUponDeletion(const pandora::Cluster *const pDeletedCluster)=0
Update to reflect cluster deletion.
enum cvn::HType HitType
std::string string
Definition: nybbler.cc:12
static pandora::HitType GetClusterHitType(const pandora::Cluster *const pCluster)
Get the hit type associated with a two dimensional cluster.
virtual const std::string & GetClusterListName(const pandora::HitType hitType) const =0
Get the cluster list name corresponding to a specified hit type.
virtual void UpdateForNewCluster(const pandora::Cluster *const pNewCluster)=0
Update to reflect addition of a new cluster to the problem space.
virtual void lar_content::MatchingBaseAlgorithm::PerformMainLoop ( )
protectedpure virtual
virtual void lar_content::MatchingBaseAlgorithm::PrepareAllInputClusters ( )
protectedpure virtual
void lar_content::MatchingBaseAlgorithm::PrepareInputClusters ( pandora::ClusterList &  preparedClusterList)
virtual
StatusCode lar_content::MatchingBaseAlgorithm::ReadSettings ( const pandora::TiXmlHandle  xmlHandle)
protectedvirtual

Reimplemented in lar_content::NViewDeltaRayMatchingAlgorithm< T >, lar_content::NViewDeltaRayMatchingAlgorithm< ThreeViewMatchingControl< DeltaRayOverlapResult > >, lar_content::NViewDeltaRayMatchingAlgorithm< TwoViewMatchingControl< TwoViewDeltaRayOverlapResult > >, lar_content::TwoViewDeltaRayMatchingAlgorithm, lar_content::ThreeViewShowersAlgorithm, lar_content::ThreeViewTrackFragmentsAlgorithm, lar_content::ThreeViewTransverseTracksAlgorithm, lar_content::NViewTrackMatchingAlgorithm< T >, lar_content::NViewTrackMatchingAlgorithm< TwoViewMatchingControl< TwoViewTransverseOverlapResult > >, lar_content::NViewTrackMatchingAlgorithm< ThreeViewMatchingControl< FragmentOverlapResult > >, lar_content::NViewTrackMatchingAlgorithm< ThreeViewMatchingControl< TransverseOverlapResult > >, lar_content::NViewTrackMatchingAlgorithm< ThreeViewMatchingControl< LongitudinalOverlapResult > >, lar_content::TwoViewTransverseTracksAlgorithm, lar_content::ThreeViewLongitudinalTracksAlgorithm, lar_content::ThreeViewDeltaRayMatchingAlgorithm, lar_content::NViewMatchingAlgorithm< T >, lar_content::NViewMatchingAlgorithm< ThreeViewMatchingControl< float > >, lar_content::NViewMatchingAlgorithm< ThreeViewMatchingControl< DeltaRayOverlapResult > >, lar_content::NViewMatchingAlgorithm< TwoViewMatchingControl< TwoViewTransverseOverlapResult > >, lar_content::NViewMatchingAlgorithm< ThreeViewMatchingControl< FragmentOverlapResult > >, lar_content::NViewMatchingAlgorithm< ThreeViewMatchingControl< ShowerOverlapResult > >, lar_content::NViewMatchingAlgorithm< ThreeViewMatchingControl< TransverseOverlapResult > >, lar_content::NViewMatchingAlgorithm< TwoViewMatchingControl< TwoViewDeltaRayOverlapResult > >, lar_content::NViewMatchingAlgorithm< ThreeViewMatchingControl< LongitudinalOverlapResult > >, and lar_content::ThreeViewRemnantsAlgorithm.

Definition at line 158 of file MatchingBaseAlgorithm.cc.

159 {
160  PANDORA_RETURN_RESULT_IF(STATUS_CODE_SUCCESS, !=, XmlHelper::ReadValue(xmlHandle, "OutputPfoListName", m_outputPfoListName));
161 
162  return STATUS_CODE_SUCCESS;
163 }
std::string m_outputPfoListName
The output pfo list name.
StatusCode lar_content::MatchingBaseAlgorithm::Run ( )
private

Definition at line 135 of file MatchingBaseAlgorithm.cc.

136 {
137  try
138  {
139  this->SelectAllInputClusters();
140  this->PrepareAllInputClusters();
141  this->PerformMainLoop();
142  this->ExamineOverlapContainer();
143  this->TidyUp();
144  }
145  catch (StatusCodeException &statusCodeException)
146  {
147  this->TidyUp();
148 
149  if (STATUS_CODE_SUCCESS != statusCodeException.GetStatusCode())
150  throw statusCodeException;
151  }
152 
153  return STATUS_CODE_SUCCESS;
154 }
virtual void ExamineOverlapContainer()=0
Examine contents of overlap container, collect together best-matching 2D particles and modify cluster...
virtual void PerformMainLoop()=0
Main loop over cluster combinations in order to populate the overlap container. Responsible for calli...
virtual void SelectAllInputClusters()=0
Select a subset of input clusters for processing in this algorithm.
virtual void PrepareAllInputClusters()=0
Perform any preparatory steps required, e.g. caching expensive fit results for clusters.
virtual void TidyUp()=0
Tidy member variables in derived class.
virtual void lar_content::MatchingBaseAlgorithm::SelectAllInputClusters ( )
protectedpure virtual
void lar_content::MatchingBaseAlgorithm::SelectInputClusters ( const pandora::ClusterList *const  pInputClusterList,
pandora::ClusterList &  selectedClusterList 
) const
virtual
void lar_content::MatchingBaseAlgorithm::SetPfoParameters ( const ProtoParticle protoParticle,
PandoraContentApi::ParticleFlowObject::Parameters &  pfoParameters 
) const
virtual

Set Pfo properties.

Parameters
protoParticlethe input proto particle
pfoParametersthe output pfo parameters

Definition at line 116 of file MatchingBaseAlgorithm.cc.

117 {
118  this->SetPfoParticleId(pfoParameters);
119  pfoParameters.m_charge = PdgTable::GetParticleCharge(pfoParameters.m_particleId.Get());
120  pfoParameters.m_mass = PdgTable::GetParticleMass(pfoParameters.m_particleId.Get());
121  pfoParameters.m_energy = 0.f;
122  pfoParameters.m_momentum = CartesianVector(0.f, 0.f, 0.f);
123  pfoParameters.m_clusterList = protoParticle.m_clusterList;
124 }
virtual void SetPfoParticleId(PandoraContentApi::ParticleFlowObject::Parameters &pfoParameters) const
Set pfo particle id.
void lar_content::MatchingBaseAlgorithm::SetPfoParticleId ( PandoraContentApi::ParticleFlowObject::Parameters &  pfoParameters) const
virtual
virtual void lar_content::MatchingBaseAlgorithm::TidyUp ( )
protectedpure virtual

Tidy member variables in derived class.

Implemented in lar_content::NViewDeltaRayMatchingAlgorithm< T >, lar_content::NViewDeltaRayMatchingAlgorithm< ThreeViewMatchingControl< DeltaRayOverlapResult > >, lar_content::NViewDeltaRayMatchingAlgorithm< TwoViewMatchingControl< TwoViewDeltaRayOverlapResult > >, lar_content::NViewTrackMatchingAlgorithm< T >, lar_content::NViewTrackMatchingAlgorithm< TwoViewMatchingControl< TwoViewTransverseOverlapResult > >, lar_content::NViewTrackMatchingAlgorithm< ThreeViewMatchingControl< FragmentOverlapResult > >, lar_content::NViewTrackMatchingAlgorithm< ThreeViewMatchingControl< TransverseOverlapResult > >, lar_content::NViewTrackMatchingAlgorithm< ThreeViewMatchingControl< LongitudinalOverlapResult > >, lar_content::ThreeViewShowersAlgorithm, lar_content::NViewMatchingAlgorithm< T >, lar_content::NViewMatchingAlgorithm< ThreeViewMatchingControl< float > >, lar_content::NViewMatchingAlgorithm< ThreeViewMatchingControl< DeltaRayOverlapResult > >, lar_content::NViewMatchingAlgorithm< TwoViewMatchingControl< TwoViewTransverseOverlapResult > >, lar_content::NViewMatchingAlgorithm< ThreeViewMatchingControl< FragmentOverlapResult > >, lar_content::NViewMatchingAlgorithm< ThreeViewMatchingControl< ShowerOverlapResult > >, lar_content::NViewMatchingAlgorithm< ThreeViewMatchingControl< TransverseOverlapResult > >, lar_content::NViewMatchingAlgorithm< TwoViewMatchingControl< TwoViewDeltaRayOverlapResult > >, and lar_content::NViewMatchingAlgorithm< ThreeViewMatchingControl< LongitudinalOverlapResult > >.

virtual void lar_content::MatchingBaseAlgorithm::UpdateForNewCluster ( const pandora::Cluster *const  pNewCluster)
pure virtual
virtual void lar_content::MatchingBaseAlgorithm::UpdateUponDeletion ( const pandora::Cluster *const  pDeletedCluster)
pure virtual

Update to reflect cluster deletion.

Parameters
pDeletedClusteraddress of the deleted cluster

Implemented in lar_content::NViewDeltaRayMatchingAlgorithm< T >, lar_content::NViewDeltaRayMatchingAlgorithm< ThreeViewMatchingControl< DeltaRayOverlapResult > >, lar_content::NViewDeltaRayMatchingAlgorithm< TwoViewMatchingControl< TwoViewDeltaRayOverlapResult > >, lar_content::NViewTrackMatchingAlgorithm< T >, lar_content::NViewTrackMatchingAlgorithm< TwoViewMatchingControl< TwoViewTransverseOverlapResult > >, lar_content::NViewTrackMatchingAlgorithm< ThreeViewMatchingControl< FragmentOverlapResult > >, lar_content::NViewTrackMatchingAlgorithm< ThreeViewMatchingControl< TransverseOverlapResult > >, lar_content::NViewTrackMatchingAlgorithm< ThreeViewMatchingControl< LongitudinalOverlapResult > >, lar_content::ThreeViewShowersAlgorithm, lar_content::NViewMatchingAlgorithm< T >, lar_content::NViewMatchingAlgorithm< ThreeViewMatchingControl< float > >, lar_content::NViewMatchingAlgorithm< ThreeViewMatchingControl< DeltaRayOverlapResult > >, lar_content::NViewMatchingAlgorithm< TwoViewMatchingControl< TwoViewTransverseOverlapResult > >, lar_content::NViewMatchingAlgorithm< ThreeViewMatchingControl< FragmentOverlapResult > >, lar_content::NViewMatchingAlgorithm< ThreeViewMatchingControl< ShowerOverlapResult > >, lar_content::NViewMatchingAlgorithm< ThreeViewMatchingControl< TransverseOverlapResult > >, lar_content::NViewMatchingAlgorithm< TwoViewMatchingControl< TwoViewDeltaRayOverlapResult > >, and lar_content::NViewMatchingAlgorithm< ThreeViewMatchingControl< LongitudinalOverlapResult > >.

Member Data Documentation

std::string lar_content::MatchingBaseAlgorithm::m_outputPfoListName
private

The output pfo list name.

Definition at line 181 of file MatchingBaseAlgorithm.h.


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