LArSoft  v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
lar_content::NViewMatchingAlgorithm< T > Class Template Referenceabstract

NViewMatchingAlgorithm class. More...

#include "NViewMatchingAlgorithm.h"

Inheritance diagram for lar_content::NViewMatchingAlgorithm< T >:
lar_content::MatchingBaseAlgorithm lar_content::NViewDeltaRayMatchingAlgorithm< T > lar_content::NViewTrackMatchingAlgorithm< T >

Public Types

typedef T MatchingType
 

Public Member Functions

 NViewMatchingAlgorithm ()
 Default constructor. More...
 
virtual ~NViewMatchingAlgorithm ()
 Destructor. More...
 
void UpdateForNewCluster (const pandora::Cluster *const pNewCluster)
 Update to reflect addition of a new cluster to the problem space. More...
 
void UpdateUponDeletion (const pandora::Cluster *const pDeletedCluster)
 Update to reflect cluster deletion. More...
 
const std::string & GetClusterListName (const pandora::HitType hitType) const
 Get the cluster list name corresponding to a specified hit type. More...
 
const pandora::ClusterList & GetInputClusterList (const pandora::HitType hitType) const
 Get the input cluster list corresponding to a specified hit type. More...
 
const pandora::ClusterList & GetSelectedClusterList (const pandora::HitType hitType) const
 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

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

Protected Attributes

MatchingType m_matchingControl
 The matching control. More...
 

Detailed Description

template<typename T>
class lar_content::NViewMatchingAlgorithm< T >

NViewMatchingAlgorithm class.

Definition at line 20 of file NViewMatchingAlgorithm.h.

Member Typedef Documentation

template<typename T>
typedef T lar_content::NViewMatchingAlgorithm< T >::MatchingType

Definition at line 23 of file NViewMatchingAlgorithm.h.

Constructor & Destructor Documentation

Default constructor.

Definition at line 27 of file NViewMatchingAlgorithm.cc.

27  :
28  m_matchingControl(this)
29 {
30 }
MatchingType m_matchingControl
The matching control.
template<typename T >
lar_content::NViewMatchingAlgorithm< T >::~NViewMatchingAlgorithm ( )
virtual

Destructor.

Definition at line 35 of file NViewMatchingAlgorithm.cc.

36 {
37 }

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 virtualinherited
bool lar_content::MatchingBaseAlgorithm::CreateThreeDParticles ( const ProtoParticleVector protoParticleVector)
virtualinherited

Create particles using findings from recent algorithm processing.

Parameters
protoParticleVectorthe proto particle vector
whetherparticles were created

Definition at line 88 of file MatchingBaseAlgorithm.cc.

Referenced by lar_content::NViewDeltaRayMatchingAlgorithm< T >::CreatePfos(), lar_content::ClearRemnantsTool::CreateThreeDParticles(), lar_content::TwoViewClearTracksTool::CreateThreeDParticles(), lar_content::ClearLongitudinalTracksTool::CreateThreeDParticles(), lar_content::ClearTracksTool::CreateThreeDParticles(), lar_content::ClearTrackFragmentsTool::FindTrackFragments(), lar_content::MissingTrackTool::Run(), lar_content::MatchedEndPointsTool::Run(), lar_content::ConnectedRemnantsTool::Run(), lar_content::MopUpRemnantsTool::Run(), lar_content::SimpleShowersTool::Run(), lar_content::TwoViewSimpleTracksTool::Run(), lar_content::TracksCrossingGapsTool::Run(), lar_content::MissingTrackSegmentTool::Run(), lar_content::LongTracksTool::Run(), lar_content::TwoViewLongTracksTool::Run(), and lar_content::ClearShowersTool::Run().

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 }
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 virtualinherited
template<typename T>
const pandora::ClusterList & lar_content::NViewMatchingAlgorithm< T >::GetInputClusterList ( const pandora::HitType  hitType) const
virtual
template<typename T >
T & lar_content::NViewMatchingAlgorithm< T >::GetMatchingControl ( )
inlineprotected

Get the matching control.

Definition at line 59 of file NViewMatchingAlgorithm.h.

References lar_content::NViewMatchingAlgorithm< T >::m_matchingControl.

60 {
61  return m_matchingControl;
62 }
MatchingType m_matchingControl
The matching control.
template<typename T>
const pandora::ClusterList & lar_content::NViewMatchingAlgorithm< T >::GetSelectedClusterList ( const pandora::HitType  hitType) const
virtual

Get the selected cluster list corresponding to a specified hit type.

Parameters
hitTypethe hit type
Returns
the selected cluster list

Implements lar_content::MatchingBaseAlgorithm.

Definition at line 74 of file NViewMatchingAlgorithm.cc.

References lar_content::NViewMatchingAlgorithm< T >::m_matchingControl.

75 {
76  return m_matchingControl.GetSelectedClusterList(hitType);
77 }
MatchingType m_matchingControl
The matching control.
bool lar_content::MatchingBaseAlgorithm::MakeClusterMerges ( const ClusterMergeMap clusterMergeMap)
virtualinherited

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.

Referenced by lar_content::SplitShowersTool::ApplyChanges(), lar_content::ThreeDKinkBaseTool::ApplyChanges(), lar_content::TwoViewThreeDKinkTool::ApplyChanges(), lar_content::ConnectedRemnantsTool::Run(), and lar_content::MissingTrackSegmentTool::Run().

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.
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.
HitType
Definition: HitType.h:12
template<typename T >
void lar_content::NViewMatchingAlgorithm< T >::PerformMainLoop ( )
protectedvirtual

Main loop over cluster combinations in order to populate the overlap container. Responsible for calling CalculateOverlapResult.

Implements lar_content::MatchingBaseAlgorithm.

Reimplemented in lar_content::ThreeViewTrackFragmentsAlgorithm.

Definition at line 106 of file NViewMatchingAlgorithm.cc.

References lar_content::NViewMatchingAlgorithm< T >::m_matchingControl.

107 {
108  m_matchingControl.PerformMainLoop();
109 }
MatchingType m_matchingControl
The matching control.
template<typename T >
void lar_content::NViewMatchingAlgorithm< T >::PrepareAllInputClusters ( )
protectedvirtual

Perform any preparatory steps required, e.g. caching expensive fit results for clusters.

Implements lar_content::MatchingBaseAlgorithm.

Definition at line 90 of file NViewMatchingAlgorithm.cc.

References lar_content::NViewMatchingAlgorithm< T >::m_matchingControl.

91 {
92  m_matchingControl.PrepareAllInputClusters();
93 }
MatchingType m_matchingControl
The matching control.
template<typename T>
StatusCode lar_content::NViewMatchingAlgorithm< T >::ReadSettings ( const pandora::TiXmlHandle  xmlHandle)
protectedvirtual

Reimplemented from lar_content::MatchingBaseAlgorithm.

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, and lar_content::ThreeViewRemnantsAlgorithm.

Definition at line 114 of file NViewMatchingAlgorithm.cc.

References lar_content::NViewMatchingAlgorithm< T >::m_matchingControl, and lar_content::MatchingBaseAlgorithm::ReadSettings().

Referenced by lar_content::NViewTrackMatchingAlgorithm< T >::ReadSettings(), and lar_content::NViewDeltaRayMatchingAlgorithm< T >::ReadSettings().

115 {
116  PANDORA_RETURN_RESULT_IF(STATUS_CODE_SUCCESS, !=, m_matchingControl.ReadSettings(xmlHandle));
117 
118  return MatchingBaseAlgorithm::ReadSettings(xmlHandle);
119 }
virtual pandora::StatusCode ReadSettings(const pandora::TiXmlHandle xmlHandle)
MatchingType m_matchingControl
The matching control.
template<typename T >
void lar_content::NViewMatchingAlgorithm< T >::SelectAllInputClusters ( )
protectedvirtual

Select a subset of input clusters for processing in this algorithm.

Implements lar_content::MatchingBaseAlgorithm.

Definition at line 82 of file NViewMatchingAlgorithm.cc.

References lar_content::NViewMatchingAlgorithm< T >::m_matchingControl.

83 {
84  m_matchingControl.SelectAllInputClusters();
85 }
MatchingType m_matchingControl
The matching control.
void lar_content::MatchingBaseAlgorithm::SelectInputClusters ( const pandora::ClusterList *const  pInputClusterList,
pandora::ClusterList &  selectedClusterList 
) const
virtualinherited
void lar_content::MatchingBaseAlgorithm::SetPfoParameters ( const ProtoParticle protoParticle,
PandoraContentApi::ParticleFlowObject::Parameters &  pfoParameters 
) const
virtualinherited

Set Pfo properties.

Parameters
protoParticlethe input proto particle
pfoParametersthe output pfo parameters

Definition at line 116 of file MatchingBaseAlgorithm.cc.

References f, and lar_content::ProtoParticle::m_clusterList.

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 }
TFile f
Definition: plotHisto.C:6
virtual void SetPfoParticleId(PandoraContentApi::ParticleFlowObject::Parameters &pfoParameters) const
Set pfo particle id.
void lar_content::MatchingBaseAlgorithm::SetPfoParticleId ( PandoraContentApi::ParticleFlowObject::Parameters &  pfoParameters) const
virtualinherited

Member Data Documentation


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