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

NViewTrackMatchingAlgorithm class. More...

#include "NViewTrackMatchingAlgorithm.h"

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

Public Types

typedef T MatchingType
 

Public Member Functions

 NViewTrackMatchingAlgorithm ()
 Default constructor. More...
 
virtual ~NViewTrackMatchingAlgorithm ()
 Destructor. More...
 
const TwoDSlidingFitResultGetCachedSlidingFitResult (const pandora::Cluster *const pCluster) const
 Get a sliding fit result from the algorithm cache. More...
 
unsigned int GetSlidingFitWindow () const
 Get the layer window for the sliding linear fits. More...
 
virtual bool MakeClusterSplits (const SplitPositionMap &splitPositionMap)
 Make cluster splits. More...
 
virtual bool MakeClusterSplit (const pandora::CartesianVector &splitPosition, const pandora::Cluster *&pCurrentCluster, const pandora::Cluster *&pLowXCluster, const pandora::Cluster *&pHighXCluster) const
 Make a cluster split. More...
 
virtual void UpdateForNewCluster (const pandora::Cluster *const pNewCluster)
 Update to reflect addition of a new cluster to the problem space. More...
 
virtual void UpdateUponDeletion (const pandora::Cluster *const pDeletedCluster)
 Update to reflect cluster deletion. 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 void SetPfoParticleId (PandoraContentApi::ParticleFlowObject::Parameters &pfoParameters) const
 Set pfo particle id. 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 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...
 

Static Public Member Functions

static bool SortSplitPositions (const pandora::CartesianVector &lhs, const pandora::CartesianVector &rhs)
 Sort split position cartesian vectors by increasing x coordinate. More...
 

Protected Member Functions

void AddToSlidingFitCache (const pandora::Cluster *const pCluster)
 Add a new sliding fit result, for the specified cluster, to the algorithm cache. More...
 
void RemoveFromSlidingFitCache (const pandora::Cluster *const pCluster)
 Remova an existing sliding fit result, for the specified cluster, from the algorithm cache. More...
 
virtual void TidyUp ()
 Tidy member variables in derived class. More...
 
virtual pandora::StatusCode ReadSettings (const pandora::TiXmlHandle xmlHandle)
 
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 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...
 

Private Attributes

unsigned int m_slidingFitWindow
 The layer window for the sliding linear fits. More...
 
TwoDSlidingFitResultMap m_slidingFitResultMap
 The sliding fit result map. More...
 
unsigned int m_minClusterCaloHits
 The min number of hits in base cluster selection method. More...
 
float m_minClusterLengthSquared
 The min length (squared) in base cluster selection method. More...
 

Detailed Description

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

NViewTrackMatchingAlgorithm class.

Definition at line 26 of file NViewTrackMatchingAlgorithm.h.

Member Typedef Documentation

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

Definition at line 23 of file NViewMatchingAlgorithm.h.

Constructor & Destructor Documentation

Default constructor.

Definition at line 28 of file NViewTrackMatchingAlgorithm.cc.

28  :
32 {
33 }
float m_minClusterLengthSquared
The min length (squared) in base cluster selection method.
TFile f
Definition: plotHisto.C:6
unsigned int m_minClusterCaloHits
The min number of hits in base cluster selection method.
unsigned int m_slidingFitWindow
The layer window for the sliding linear fits.

Destructor.

Definition at line 38 of file NViewTrackMatchingAlgorithm.cc.

39 {
40 }

Member Function Documentation

template<typename T>
void lar_content::NViewTrackMatchingAlgorithm< T >::AddToSlidingFitCache ( const pandora::Cluster *const  pCluster)
protected

Add a new sliding fit result, for the specified cluster, to the algorithm cache.

Parameters
pClusteraddress of the relevant cluster

Definition at line 255 of file NViewTrackMatchingAlgorithm.cc.

References lar_content::LArClusterHelper::GetClusterHitType(), lar_content::LArGeometryHelper::GetWirePitch(), lar_content::NViewTrackMatchingAlgorithm< T >::m_slidingFitResultMap, and lar_content::NViewTrackMatchingAlgorithm< T >::m_slidingFitWindow.

Referenced by lar_content::NViewTrackMatchingAlgorithm< T >::PrepareInputClusters(), and lar_content::NViewTrackMatchingAlgorithm< T >::UpdateForNewCluster().

256 {
257  const float slidingFitPitch(LArGeometryHelper::GetWirePitch(this->GetPandora(), LArClusterHelper::GetClusterHitType(pCluster)));
258  const TwoDSlidingFitResult slidingFitResult(pCluster, m_slidingFitWindow, slidingFitPitch);
259 
260  if (!m_slidingFitResultMap.insert(TwoDSlidingFitResultMap::value_type(pCluster, slidingFitResult)).second)
261  throw StatusCodeException(STATUS_CODE_FAILURE);
262 }
static pandora::HitType GetClusterHitType(const pandora::Cluster *const pCluster)
Get the hit type associated with a two dimensional cluster.
static float GetWirePitch(const pandora::Pandora &pandora, const pandora::HitType view, const float maxWirePitchDiscrepancy=0.01)
Return the wire pitch.
unsigned int m_slidingFitWindow
The layer window for the sliding linear fits.
TwoDSlidingFitResultMap m_slidingFitResultMap
The sliding fit result map.
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::ClearLongitudinalTracksTool::CreateThreeDParticles(), lar_content::ClearTracksTool::CreateThreeDParticles(), lar_content::TwoViewClearTracksTool::CreateThreeDParticles(), lar_content::ClearTrackFragmentsTool::FindTrackFragments(), lar_content::MatchedEndPointsTool::Run(), lar_content::SimpleShowersTool::Run(), lar_content::ConnectedRemnantsTool::Run(), lar_content::MopUpRemnantsTool::Run(), lar_content::TwoViewSimpleTracksTool::Run(), lar_content::MissingTrackTool::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 TwoDSlidingFitResult & lar_content::NViewTrackMatchingAlgorithm< T >::GetCachedSlidingFitResult ( const pandora::Cluster *const  pCluster) const
template<typename T>
const pandora::ClusterList & lar_content::NViewMatchingAlgorithm< T >::GetInputClusterList ( const pandora::HitType  hitType) const
virtualinherited
template<typename T >
T & lar_content::NViewMatchingAlgorithm< T >::GetMatchingControl ( )
inlineprotectedinherited

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
virtualinherited

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.
template<typename T >
unsigned int lar_content::NViewTrackMatchingAlgorithm< T >::GetSlidingFitWindow ( ) const
inline

Get the layer window for the sliding linear fits.

Returns
the layer window for the sliding linear fits

Definition at line 118 of file NViewTrackMatchingAlgorithm.h.

References lar_content::NViewTrackMatchingAlgorithm< T >::m_slidingFitWindow.

Referenced by lar_content::MissingTrackSegmentTool::GetSlidingFitResultMap().

119 {
120  return m_slidingFitWindow;
121 }
unsigned int m_slidingFitWindow
The layer window for the sliding linear fits.
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>
bool lar_content::NViewTrackMatchingAlgorithm< T >::MakeClusterSplit ( const pandora::CartesianVector &  splitPosition,
const pandora::Cluster *&  pCurrentCluster,
const pandora::Cluster *&  pLowXCluster,
const pandora::Cluster *&  pHighXCluster 
) const
virtual

Make a cluster split.

Parameters
splitPositionthe split position
pCurrentClusterthe cluster to split
pLowXClusterto receive the low x cluster
pHighXClusterto receive the high x cluster
Returns
whether a cluster split occurred

Definition at line 105 of file NViewTrackMatchingAlgorithm.cc.

References f, lar_content::LArPointingCluster::GetInnerVertex(), lar_content::LArPointingCluster::GetOuterVertex(), and lar_content::LArPointingCluster::Vertex::GetPosition().

Referenced by lar_content::NViewTrackMatchingAlgorithm< T >::MakeClusterSplits().

107 {
108  CartesianVector lowXEnd(0.f, 0.f, 0.f), highXEnd(0.f, 0.f, 0.f);
109 
110  try
111  {
112  LArPointingCluster pointingCluster(pCurrentCluster);
113  const bool innerIsLowX(pointingCluster.GetInnerVertex().GetPosition().GetX() < pointingCluster.GetOuterVertex().GetPosition().GetX());
114  lowXEnd = (innerIsLowX ? pointingCluster.GetInnerVertex().GetPosition() : pointingCluster.GetOuterVertex().GetPosition());
115  highXEnd = (innerIsLowX ? pointingCluster.GetOuterVertex().GetPosition() : pointingCluster.GetInnerVertex().GetPosition());
116  }
117  catch (const StatusCodeException &)
118  {
119  return false;
120  }
121 
122  const CartesianVector lowXUnitVector((lowXEnd - splitPosition).GetUnitVector());
123  const CartesianVector highXUnitVector((highXEnd - splitPosition).GetUnitVector());
124 
125  CaloHitList caloHitList;
126  pCurrentCluster->GetOrderedCaloHitList().FillCaloHitList(caloHitList);
127 
128  std::string originalListName, fragmentListName;
129  const ClusterList clusterList(1, pCurrentCluster);
130  PANDORA_THROW_RESULT_IF(STATUS_CODE_SUCCESS, !=, PandoraContentApi::InitializeFragmentation(*this, clusterList, originalListName, fragmentListName));
131 
132  pLowXCluster = nullptr;
133  pHighXCluster = nullptr;
134 
135  for (const CaloHit *const pCaloHit : caloHitList)
136  {
137  const CartesianVector unitVector((pCaloHit->GetPositionVector() - splitPosition).GetUnitVector());
138  const float dotProductLowX(unitVector.GetDotProduct(lowXUnitVector));
139  const float dotProductHighX(unitVector.GetDotProduct(highXUnitVector));
140 
141  const Cluster *&pClusterToModify((dotProductLowX > dotProductHighX) ? pLowXCluster : pHighXCluster);
142 
143  if (!pClusterToModify)
144  {
145  PandoraContentApi::Cluster::Parameters parameters;
146  parameters.m_caloHitList.push_back(pCaloHit);
147  PANDORA_THROW_RESULT_IF(STATUS_CODE_SUCCESS, !=, PandoraContentApi::Cluster::Create(*this, parameters, pClusterToModify));
148  }
149  else
150  {
151  PANDORA_THROW_RESULT_IF(STATUS_CODE_SUCCESS, !=, PandoraContentApi::AddToCluster(*this, pClusterToModify, pCaloHit));
152  }
153  }
154 
155  if (!pLowXCluster || !pHighXCluster)
156  {
157  PANDORA_THROW_RESULT_IF(STATUS_CODE_SUCCESS, !=, PandoraContentApi::EndFragmentation(*this, originalListName, fragmentListName));
158  return false;
159  }
160 
161  PANDORA_THROW_RESULT_IF(STATUS_CODE_SUCCESS, !=, PandoraContentApi::EndFragmentation(*this, fragmentListName, originalListName));
162  return true;
163 }
TFile f
Definition: plotHisto.C:6
template<typename T >
bool lar_content::NViewTrackMatchingAlgorithm< T >::MakeClusterSplits ( const SplitPositionMap splitPositionMap)
virtual

Make cluster splits.

Parameters
splitPositionMapthe split position map
Returns
whether changes to the overlap container have been made

Definition at line 58 of file NViewTrackMatchingAlgorithm.cc.

References lar_content::LArClusterHelper::GetClusterHitType(), lar_content::NViewMatchingAlgorithm< T >::GetClusterListName(), lar_content::NViewTrackMatchingAlgorithm< T >::MakeClusterSplit(), lar_content::LArClusterHelper::SortByNHits(), lar_content::NViewTrackMatchingAlgorithm< T >::UpdateForNewCluster(), and lar_content::NViewTrackMatchingAlgorithm< T >::UpdateUponDeletion().

Referenced by lar_content::ThreeDKinkBaseTool::ApplyChanges(), lar_content::TwoViewThreeDKinkTool::ApplyChanges(), and lar_content::TrackSplittingTool::Run().

59 {
60  bool changesMade(false);
61 
62  ClusterList splitClusters;
63  for (const auto &mapEntry : splitPositionMap)
64  splitClusters.push_back(mapEntry.first);
65  splitClusters.sort(LArClusterHelper::SortByNHits);
66 
67  for (const Cluster *pCurrentCluster : splitClusters)
68  {
69  CartesianPointVector splitPositions(splitPositionMap.at(pCurrentCluster));
70  std::sort(splitPositions.begin(), splitPositions.end(), NViewTrackMatchingAlgorithm<T>::SortSplitPositions);
71 
72  const HitType hitType(LArClusterHelper::GetClusterHitType(pCurrentCluster));
73  const std::string &clusterListName(this->GetClusterListName(hitType));
74 
75  if (!((TPC_VIEW_U == hitType) || (TPC_VIEW_V == hitType) || (TPC_VIEW_W == hitType)))
76  throw StatusCodeException(STATUS_CODE_FAILURE);
77 
78  PANDORA_THROW_RESULT_IF(STATUS_CODE_SUCCESS, !=, PandoraContentApi::ReplaceCurrentList<Cluster>(*this, clusterListName));
79 
80  for (const CartesianVector &splitPosition : splitPositions)
81  {
82  const Cluster *pLowXCluster(nullptr), *pHighXCluster(nullptr);
83  this->UpdateUponDeletion(pCurrentCluster);
84 
85  if (this->MakeClusterSplit(splitPosition, pCurrentCluster, pLowXCluster, pHighXCluster))
86  {
87  changesMade = true;
88  this->UpdateForNewCluster(pLowXCluster);
89  this->UpdateForNewCluster(pHighXCluster);
90  pCurrentCluster = pHighXCluster;
91  }
92  else
93  {
94  this->UpdateForNewCluster(pCurrentCluster);
95  }
96  }
97  }
98 
99  return changesMade;
100 }
static bool SortSplitPositions(const pandora::CartesianVector &lhs, const pandora::CartesianVector &rhs)
Sort split position cartesian vectors by increasing x coordinate.
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)
Update to reflect cluster deletion.
static pandora::HitType GetClusterHitType(const pandora::Cluster *const pCluster)
Get the hit type associated with a two dimensional cluster.
HitType
Definition: HitType.h:12
virtual bool MakeClusterSplit(const pandora::CartesianVector &splitPosition, const pandora::Cluster *&pCurrentCluster, const pandora::Cluster *&pLowXCluster, const pandora::Cluster *&pHighXCluster) const
Make a cluster split.
const std::string & GetClusterListName(const pandora::HitType hitType) const
Get the cluster list name corresponding to a specified hit type.
virtual void UpdateForNewCluster(const pandora::Cluster *const pNewCluster)
Update to reflect addition of a new cluster to the problem space.
template<typename T >
void lar_content::NViewMatchingAlgorithm< T >::PerformMainLoop ( )
protectedvirtualinherited

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 ( )
protectedvirtualinherited

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>
void lar_content::NViewTrackMatchingAlgorithm< T >::PrepareInputClusters ( pandora::ClusterList &  preparedClusterList)
virtual

Perform any preparatory steps required on the input clusters, e.g. caching expensive fit results.

Parameters
preparedClusterListto receive the prepared cluster list, non const so as to be able to modify input selected list

Reimplemented from lar_content::MatchingBaseAlgorithm.

Definition at line 225 of file NViewTrackMatchingAlgorithm.cc.

References lar_content::NViewTrackMatchingAlgorithm< T >::AddToSlidingFitCache().

226 {
227  for (ClusterList::iterator iter = preparedClusterList.begin(), iterEnd = preparedClusterList.end(); iter != iterEnd;)
228  {
229  try
230  {
231  this->AddToSlidingFitCache(*iter);
232  ++iter;
233  }
234  catch (const StatusCodeException &statusCodeException)
235  {
236  preparedClusterList.erase(iter++);
237 
238  if (STATUS_CODE_FAILURE == statusCodeException.GetStatusCode())
239  throw statusCodeException;
240  }
241  }
242 }
intermediate_table::iterator iterator
void AddToSlidingFitCache(const pandora::Cluster *const pCluster)
Add a new sliding fit result, for the specified cluster, to the algorithm cache.
template<typename T>
StatusCode lar_content::NViewTrackMatchingAlgorithm< T >::ReadSettings ( const pandora::TiXmlHandle  xmlHandle)
protectedvirtual

Reimplemented from lar_content::NViewMatchingAlgorithm< T >.

Reimplemented in lar_content::ThreeViewTrackFragmentsAlgorithm, lar_content::ThreeViewTransverseTracksAlgorithm, lar_content::TwoViewTransverseTracksAlgorithm, and lar_content::ThreeViewLongitudinalTracksAlgorithm.

Definition at line 287 of file NViewTrackMatchingAlgorithm.cc.

References lar_content::NViewTrackMatchingAlgorithm< T >::m_minClusterCaloHits, lar_content::NViewTrackMatchingAlgorithm< T >::m_minClusterLengthSquared, lar_content::NViewTrackMatchingAlgorithm< T >::m_slidingFitWindow, and lar_content::NViewMatchingAlgorithm< T >::ReadSettings().

288 {
289  PANDORA_RETURN_RESULT_IF_AND_IF(
290  STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle, "SlidingFitWindow", m_slidingFitWindow));
291 
292  PANDORA_RETURN_RESULT_IF_AND_IF(
293  STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle, "MinClusterCaloHits", m_minClusterCaloHits));
294 
295  float minClusterLength = std::sqrt(m_minClusterLengthSquared);
296  PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle, "MinClusterLength", minClusterLength));
297  m_minClusterLengthSquared = minClusterLength * minClusterLength;
298 
299  return NViewMatchingAlgorithm<T>::ReadSettings(xmlHandle);
300 }
float m_minClusterLengthSquared
The min length (squared) in base cluster selection method.
virtual pandora::StatusCode ReadSettings(const pandora::TiXmlHandle xmlHandle)
unsigned int m_minClusterCaloHits
The min number of hits in base cluster selection method.
unsigned int m_slidingFitWindow
The layer window for the sliding linear fits.
template<typename T>
void lar_content::NViewTrackMatchingAlgorithm< T >::RemoveFromSlidingFitCache ( const pandora::Cluster *const  pCluster)
protected

Remova an existing sliding fit result, for the specified cluster, from the algorithm cache.

Parameters
pClusteraddress of the relevant cluster

Definition at line 267 of file NViewTrackMatchingAlgorithm.cc.

References lar_content::NViewTrackMatchingAlgorithm< T >::m_slidingFitResultMap.

Referenced by lar_content::NViewTrackMatchingAlgorithm< T >::UpdateUponDeletion().

268 {
270 
271  if (m_slidingFitResultMap.end() != iter)
272  m_slidingFitResultMap.erase(iter);
273 }
intermediate_table::iterator iterator
TwoDSlidingFitResultMap m_slidingFitResultMap
The sliding fit result map.
template<typename T >
void lar_content::NViewMatchingAlgorithm< T >::SelectAllInputClusters ( )
protectedvirtualinherited

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.
template<typename T>
void lar_content::NViewTrackMatchingAlgorithm< T >::SelectInputClusters ( const pandora::ClusterList *const  pInputClusterList,
pandora::ClusterList &  selectedClusterList 
) const
virtual

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

Parameters
pInputClusterListaddress of an input cluster list
selectedClusterListto receive the selected cluster list

Reimplemented from lar_content::MatchingBaseAlgorithm.

Definition at line 205 of file NViewTrackMatchingAlgorithm.cc.

References lar_content::LArClusterHelper::GetLengthSquared(), lar_content::NViewTrackMatchingAlgorithm< T >::m_minClusterCaloHits, and lar_content::NViewTrackMatchingAlgorithm< T >::m_minClusterLengthSquared.

Referenced by lar_content::ClearTrackFragmentsTool::ProcessTensorElement().

206 {
207  for (const Cluster *const pCluster : *pInputClusterList)
208  {
209  if (!pCluster->IsAvailable())
210  continue;
211 
212  if (pCluster->GetNCaloHits() < m_minClusterCaloHits)
213  continue;
214 
216  continue;
217 
218  selectedClusterList.push_back(pCluster);
219  }
220 }
float m_minClusterLengthSquared
The min length (squared) in base cluster selection method.
unsigned int m_minClusterCaloHits
The min number of hits in base cluster selection method.
static float GetLengthSquared(const pandora::Cluster *const pCluster)
Get length squared of cluster.
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.
template<typename T >
void lar_content::NViewTrackMatchingAlgorithm< T >::SetPfoParticleId ( PandoraContentApi::ParticleFlowObject::Parameters &  pfoParameters) const
virtual

Set pfo particle id.

Parameters
pfoParametersthe output pfo parameters

Reimplemented from lar_content::MatchingBaseAlgorithm.

Definition at line 247 of file NViewTrackMatchingAlgorithm.cc.

248 {
249  pfoParameters.m_particleId = MU_MINUS; // Track
250 }
template<typename T >
bool lar_content::NViewTrackMatchingAlgorithm< T >::SortSplitPositions ( const pandora::CartesianVector &  lhs,
const pandora::CartesianVector &  rhs 
)
static

Sort split position cartesian vectors by increasing x coordinate.

Parameters
lhsthe first cartesian vector
rhsthe second cartesian vector

Definition at line 168 of file NViewTrackMatchingAlgorithm.cc.

169 {
170  return (lhs.GetX() < rhs.GetX());
171 }
template<typename T >
void lar_content::NViewTrackMatchingAlgorithm< T >::TidyUp ( )
protectedvirtual

Tidy member variables in derived class.

Reimplemented from lar_content::NViewMatchingAlgorithm< T >.

Definition at line 278 of file NViewTrackMatchingAlgorithm.cc.

References lar_content::NViewTrackMatchingAlgorithm< T >::m_slidingFitResultMap, and lar_content::NViewMatchingAlgorithm< T >::TidyUp().

279 {
280  m_slidingFitResultMap.clear();
282 }
virtual void TidyUp()
Tidy member variables in derived class.
TwoDSlidingFitResultMap m_slidingFitResultMap
The sliding fit result map.
template<typename T>
void lar_content::NViewTrackMatchingAlgorithm< T >::UpdateForNewCluster ( const pandora::Cluster *const  pNewCluster)
virtual

Update to reflect addition of a new cluster to the problem space.

Parameters
pNewClusteraddress of the new cluster

Reimplemented from lar_content::NViewMatchingAlgorithm< T >.

Reimplemented in lar_content::ThreeViewTrackFragmentsAlgorithm.

Definition at line 176 of file NViewTrackMatchingAlgorithm.cc.

References lar_content::NViewTrackMatchingAlgorithm< T >::AddToSlidingFitCache(), and lar_content::NViewMatchingAlgorithm< T >::UpdateForNewCluster().

Referenced by lar_content::NViewTrackMatchingAlgorithm< T >::MakeClusterSplits().

177 {
178  try
179  {
180  this->AddToSlidingFitCache(pNewCluster);
181  }
182  catch (const StatusCodeException &statusCodeException)
183  {
184  if (STATUS_CODE_FAILURE == statusCodeException.GetStatusCode())
185  throw statusCodeException;
186 
187  return;
188  }
189 
191 }
void AddToSlidingFitCache(const pandora::Cluster *const pCluster)
Add a new sliding fit result, for the specified cluster, to the algorithm cache.
void UpdateForNewCluster(const pandora::Cluster *const pNewCluster)
Update to reflect addition of a new cluster to the problem space.
template<typename T>
void lar_content::NViewTrackMatchingAlgorithm< T >::UpdateUponDeletion ( const pandora::Cluster *const  pDeletedCluster)
virtual

Update to reflect cluster deletion.

Parameters
pDeletedClusteraddress of the deleted cluster

Reimplemented from lar_content::NViewMatchingAlgorithm< T >.

Definition at line 196 of file NViewTrackMatchingAlgorithm.cc.

References lar_content::NViewTrackMatchingAlgorithm< T >::RemoveFromSlidingFitCache(), and lar_content::NViewMatchingAlgorithm< T >::UpdateUponDeletion().

Referenced by lar_content::ClearTrackFragmentsTool::FindTrackFragments(), lar_content::NViewTrackMatchingAlgorithm< T >::MakeClusterSplits(), and lar_content::ClearTrackFragmentsTool::ProcessTensorElement().

197 {
198  this->RemoveFromSlidingFitCache(pDeletedCluster);
200 }
void UpdateUponDeletion(const pandora::Cluster *const pDeletedCluster)
Update to reflect cluster deletion.
void RemoveFromSlidingFitCache(const pandora::Cluster *const pCluster)
Remova an existing sliding fit result, for the specified cluster, from the algorithm cache...

Member Data Documentation

template<typename T>
unsigned int lar_content::NViewTrackMatchingAlgorithm< T >::m_minClusterCaloHits
private

The min number of hits in base cluster selection method.

Definition at line 111 of file NViewTrackMatchingAlgorithm.h.

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

template<typename T>
float lar_content::NViewTrackMatchingAlgorithm< T >::m_minClusterLengthSquared
private

The min length (squared) in base cluster selection method.

Definition at line 112 of file NViewTrackMatchingAlgorithm.h.

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


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