LArSoft  v06_85_00
Liquid Argon Software toolkit - http://larsoft.org/
lar_content::ThreeDBaseAlgorithm< T > Class Template Referenceabstract

ThreeDBaseAlgorithm class. More...

#include "ThreeDBaseAlgorithm.h"

Inheritance diagram for lar_content::ThreeDBaseAlgorithm< T >:
lar_content::ThreeDTracksBaseAlgorithm< T >

Public Types

typedef OverlapTensor< T > TensorType
 

Public Member Functions

 ThreeDBaseAlgorithm ()
 Default constructor. More...
 
virtual ~ThreeDBaseAlgorithm ()
 Destructor. 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 =0
 Calculate Pfo properties from proto particle. More...
 
virtual bool MakeClusterMerges (const ClusterMergeMap &clusterMergeMap)
 Merge clusters together. 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 RemoveUnavailableTensorElements ()
 Update tensor to remove all elements that have been added to pfos and so are unavailable. More...
 
const pandora::ClusterList & GetInputClusterListU () const
 Get the input u cluster list. More...
 
const pandora::ClusterList & GetInputClusterListV () const
 Get the input v cluster list. More...
 
const pandora::ClusterList & GetInputClusterListW () const
 Get the input w cluster list. More...
 
const pandora::ClusterList & GetSelectedClusterListU () const
 Get the selected u cluster list. More...
 
const pandora::ClusterList & GetSelectedClusterListV () const
 Get the selected v cluster list. More...
 
const pandora::ClusterList & GetSelectedClusterListW () const
 Get the selected w cluster list. More...
 
const std::string & GetClusterListNameU () const
 Get the name of the u cluster list. More...
 
const std::string & GetClusterListNameV () const
 Get the name of the v cluster list. More...
 
const std::string & GetClusterListNameW () const
 Get the name of the w cluster list. More...
 
virtual void SelectInputClusters (const pandora::ClusterList *const pInputClusterList, pandora::ClusterList &selectedClusterList) const =0
 Select a subset of input clusters for processing in this algorithm. More...
 

Protected Member Functions

virtual pandora::StatusCode ReadSettings (const pandora::TiXmlHandle xmlHandle)
 
virtual void SelectAllInputClusters ()
 Select a subset of input clusters for processing in this algorithm. More...
 
virtual void PreparationStep ()
 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 tensor. Responsible for calling CalculateOverlapResult. More...
 
virtual void CalculateOverlapResult (const pandora::Cluster *const pClusterU, const pandora::Cluster *const pClusterV, const pandora::Cluster *const pClusterW)=0
 Calculate cluster overlap result and store in tensor. More...
 
virtual void ExamineTensor ()=0
 Examine contents of tensor, collect together best-matching 2D particles and modify clusters as required. More...
 
virtual void TidyUp ()
 Tidy member variables in derived class. More...
 

Protected Attributes

const pandora::ClusterList * m_pInputClusterListU
 Address of the input cluster list U. More...
 
const pandora::ClusterList * m_pInputClusterListV
 Address of the input cluster list V. More...
 
const pandora::ClusterList * m_pInputClusterListW
 Address of the input cluster list W. More...
 
pandora::ClusterList m_clusterListU
 The selected modified cluster list U. More...
 
pandora::ClusterList m_clusterListV
 The selected modified cluster list V. More...
 
pandora::ClusterList m_clusterListW
 The selected modified cluster list W. More...
 
TensorType m_overlapTensor
 The overlap tensor. More...
 

Private Member Functions

pandora::StatusCode Run ()
 

Private Attributes

std::string m_inputClusterListNameU
 The name of the view U cluster list. More...
 
std::string m_inputClusterListNameV
 The name of the view V cluster list. More...
 
std::string m_inputClusterListNameW
 The name of the view W cluster list. More...
 
std::string m_outputPfoListName
 The output pfo list name. More...
 

Detailed Description

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

ThreeDBaseAlgorithm class.

Definition at line 42 of file ThreeDBaseAlgorithm.h.

Member Typedef Documentation

template<typename T>
typedef OverlapTensor<T> lar_content::ThreeDBaseAlgorithm< T >::TensorType

Definition at line 45 of file ThreeDBaseAlgorithm.h.

Constructor & Destructor Documentation

template<typename T >
lar_content::ThreeDBaseAlgorithm< T >::ThreeDBaseAlgorithm ( )

Default constructor.

Definition at line 25 of file ThreeDBaseAlgorithm.cc.

25  :
29 {
30 }
const pandora::ClusterList * m_pInputClusterListV
Address of the input cluster list V.
const pandora::ClusterList * m_pInputClusterListU
Address of the input cluster list U.
const pandora::ClusterList * m_pInputClusterListW
Address of the input cluster list W.
template<typename T >
lar_content::ThreeDBaseAlgorithm< T >::~ThreeDBaseAlgorithm ( )
virtual

Destructor.

Definition at line 35 of file ThreeDBaseAlgorithm.cc.

36 {
37 }

Member Function Documentation

template<typename T>
virtual void lar_content::ThreeDBaseAlgorithm< T >::CalculateOverlapResult ( const pandora::Cluster *const  pClusterU,
const pandora::Cluster *const  pClusterV,
const pandora::Cluster *const  pClusterW 
)
protectedpure virtual

Calculate cluster overlap result and store in tensor.

Parameters
pClusterUaddress of U view cluster
pClusterVaddress of V view cluster
pClusterWaddress of W view cluster

Implemented in lar_content::ThreeDShowersAlgorithm, lar_content::ThreeDTrackFragmentsAlgorithm, lar_content::ThreeDTransverseTracksAlgorithm, lar_content::ThreeDRemnantsAlgorithm, and lar_content::ThreeDLongitudinalTracksAlgorithm.

Referenced by lar_content::ThreeDBaseAlgorithm< T >::PerformMainLoop(), and lar_content::ThreeDBaseAlgorithm< T >::UpdateForNewCluster().

template<typename T >
bool lar_content::ThreeDBaseAlgorithm< T >::CreateThreeDParticles ( const ProtoParticleVector protoParticleVector)
virtual

Create particles using findings from recent algorithm processing.

Parameters
protoParticleVectorthe proto particle vector
whetherparticles were created

Definition at line 42 of file ThreeDBaseAlgorithm.cc.

References lar_content::ThreeDBaseAlgorithm< T >::m_outputPfoListName, and lar_content::ThreeDBaseAlgorithm< T >::SetPfoParameters().

Referenced by lar_content::ClearRemnantsTool::CreateThreeDParticles(), lar_content::ClearTracksTool::CreateThreeDParticles(), lar_content::ClearLongitudinalTracksTool::CreateThreeDParticles(), lar_content::ClearTrackFragmentsTool::FindTrackFragments(), lar_content::ConnectedRemnantsTool::Run(), lar_content::MatchedEndPointsTool::Run(), lar_content::MopUpRemnantsTool::Run(), lar_content::SimpleShowersTool::Run(), lar_content::MissingTrackTool::Run(), lar_content::TracksCrossingGapsTool::Run(), lar_content::MissingTrackSegmentTool::Run(), lar_content::LongTracksTool::Run(), and lar_content::ClearShowersTool::Run().

43 {
44  bool particlesMade(false);
45  const PfoList *pPfoList = NULL; std::string pfoListName;
46  PANDORA_THROW_RESULT_IF(STATUS_CODE_SUCCESS, !=, PandoraContentApi::CreateTemporaryListAndSetCurrent(*this, pPfoList, pfoListName));
47 
48  for (typename ProtoParticleVector::const_iterator iter = protoParticleVector.begin(), iterEnd = protoParticleVector.end(); iter != iterEnd; ++iter)
49  {
50  PandoraContentApi::ParticleFlowObject::Parameters pfoParameters;
51  this->SetPfoParameters(*iter, pfoParameters);
52 
53  const ParticleFlowObject *pPfo(NULL);
54  PANDORA_THROW_RESULT_IF(STATUS_CODE_SUCCESS, !=, PandoraContentApi::ParticleFlowObject::Create(*this, pfoParameters, pPfo));
55  particlesMade = true;
56  }
57 
58  if (!pPfoList->empty())
59  {
60  PANDORA_THROW_RESULT_IF(STATUS_CODE_SUCCESS, !=, PandoraContentApi::SaveList<Pfo>(*this, m_outputPfoListName));
61  PANDORA_THROW_RESULT_IF(STATUS_CODE_SUCCESS, !=, PandoraContentApi::ReplaceCurrentList<Pfo>(*this, m_outputPfoListName));
62  }
63 
64  return particlesMade;
65 }
intermediate_table::const_iterator const_iterator
virtual void SetPfoParameters(const ProtoParticle &protoParticle, PandoraContentApi::ParticleFlowObject::Parameters &pfoParameters) const =0
Calculate Pfo properties from proto particle.
std::string m_outputPfoListName
The output pfo list name.
template<typename T>
virtual void lar_content::ThreeDBaseAlgorithm< T >::ExamineTensor ( )
protectedpure virtual
template<typename T >
const std::string & lar_content::ThreeDBaseAlgorithm< T >::GetClusterListNameU ( ) const
inline
template<typename T >
const std::string & lar_content::ThreeDBaseAlgorithm< T >::GetClusterListNameV ( ) const
inline
template<typename T >
const std::string & lar_content::ThreeDBaseAlgorithm< T >::GetClusterListNameW ( ) const
inline
template<typename T >
const pandora::ClusterList & lar_content::ThreeDBaseAlgorithm< T >::GetInputClusterListU ( ) const
inline

Get the input u cluster list.

Definition at line 214 of file ThreeDBaseAlgorithm.h.

Referenced by lar_content::MissingTrackSegmentTool::GetCandidateClusters(), lar_content::ShowerTensorVisualizationTool::Run(), and lar_content::TransverseTensorVisualizationTool::Run().

215 {
216  if (NULL == m_pInputClusterListU)
217  throw pandora::StatusCodeException(pandora::STATUS_CODE_NOT_INITIALIZED);
218 
219  return (*m_pInputClusterListU);
220 }
const pandora::ClusterList * m_pInputClusterListU
Address of the input cluster list U.
template<typename T >
const pandora::ClusterList & lar_content::ThreeDBaseAlgorithm< T >::GetInputClusterListV ( ) const
inline

Get the input v cluster list.

Definition at line 225 of file ThreeDBaseAlgorithm.h.

Referenced by lar_content::MissingTrackSegmentTool::GetCandidateClusters(), lar_content::ShowerTensorVisualizationTool::Run(), and lar_content::TransverseTensorVisualizationTool::Run().

226 {
227  if (NULL == m_pInputClusterListV)
228  throw pandora::StatusCodeException(pandora::STATUS_CODE_NOT_INITIALIZED);
229 
230  return (*m_pInputClusterListV);
231 }
const pandora::ClusterList * m_pInputClusterListV
Address of the input cluster list V.
template<typename T >
const pandora::ClusterList & lar_content::ThreeDBaseAlgorithm< T >::GetInputClusterListW ( ) const
inline

Get the input w cluster list.

Definition at line 236 of file ThreeDBaseAlgorithm.h.

Referenced by lar_content::MissingTrackSegmentTool::GetCandidateClusters(), lar_content::ShowerTensorVisualizationTool::Run(), and lar_content::TransverseTensorVisualizationTool::Run().

237 {
238  if (NULL == m_pInputClusterListW)
239  throw pandora::StatusCodeException(pandora::STATUS_CODE_NOT_INITIALIZED);
240 
241  return (*m_pInputClusterListW);
242 }
const pandora::ClusterList * m_pInputClusterListW
Address of the input cluster list W.
template<typename T >
const pandora::ClusterList & lar_content::ThreeDBaseAlgorithm< T >::GetSelectedClusterListU ( ) const
inline

Get the selected u cluster list.

Definition at line 247 of file ThreeDBaseAlgorithm.h.

References lar_content::ProtoParticle::m_clusterListU.

248 {
249  return m_clusterListU;
250 }
pandora::ClusterList m_clusterListU
The selected modified cluster list U.
template<typename T >
const pandora::ClusterList & lar_content::ThreeDBaseAlgorithm< T >::GetSelectedClusterListV ( ) const
inline

Get the selected v cluster list.

Definition at line 255 of file ThreeDBaseAlgorithm.h.

References lar_content::ProtoParticle::m_clusterListV.

256 {
257  return m_clusterListV;
258 }
pandora::ClusterList m_clusterListV
The selected modified cluster list V.
template<typename T >
const pandora::ClusterList & lar_content::ThreeDBaseAlgorithm< T >::GetSelectedClusterListW ( ) const
inline

Get the selected w cluster list.

Definition at line 263 of file ThreeDBaseAlgorithm.h.

References lar_content::ProtoParticle::m_clusterListW.

264 {
265  return m_clusterListW;
266 }
pandora::ClusterList m_clusterListW
The selected modified cluster list W.
template<typename T >
bool lar_content::ThreeDBaseAlgorithm< T >::MakeClusterMerges ( const ClusterMergeMap clusterMergeMap)
virtual

Merge clusters together.

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

Definition at line 70 of file ThreeDBaseAlgorithm.cc.

References lar_content::LArClusterHelper::GetClusterHitType(), lar_content::ThreeDBaseAlgorithm< T >::GetClusterListNameU(), lar_content::ThreeDBaseAlgorithm< T >::GetClusterListNameV(), lar_content::ThreeDBaseAlgorithm< T >::GetClusterListNameW(), lar_content::LArClusterHelper::SortByNHits(), lar_content::ThreeDBaseAlgorithm< T >::UpdateForNewCluster(), and lar_content::ThreeDBaseAlgorithm< T >::UpdateUponDeletion().

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

71 {
72  ClusterSet deletedClusters;
73 
74  ClusterList parentClusters;
75  for (const auto &mapEntry : clusterMergeMap) parentClusters.push_back(mapEntry.first);
76  parentClusters.sort(LArClusterHelper::SortByNHits);
77 
78  for (const Cluster *const pParentCluster : parentClusters)
79  {
80  const HitType hitType(LArClusterHelper::GetClusterHitType(pParentCluster));
81  const std::string clusterListName((TPC_VIEW_U == hitType) ? this->GetClusterListNameU() : (TPC_VIEW_V == hitType) ? this->GetClusterListNameV() : this->GetClusterListNameW());
82 
83  if (!((TPC_VIEW_U == hitType) || (TPC_VIEW_V == hitType) || (TPC_VIEW_W == hitType)))
84  throw StatusCodeException(STATUS_CODE_FAILURE);
85 
86  ClusterList daughterClusters(clusterMergeMap.at(pParentCluster));
87  daughterClusters.sort(LArClusterHelper::SortByNHits);
88 
89  for (const Cluster *const pDaughterCluster : daughterClusters)
90  {
91  if (deletedClusters.count(pParentCluster) || deletedClusters.count(pDaughterCluster))
92  throw StatusCodeException(STATUS_CODE_FAILURE);
93 
94  this->UpdateUponDeletion(pDaughterCluster);
95  this->UpdateUponDeletion(pParentCluster);
96  PANDORA_THROW_RESULT_IF(STATUS_CODE_SUCCESS, !=, PandoraContentApi::MergeAndDeleteClusters(*this, pParentCluster, pDaughterCluster, clusterListName, clusterListName));
97 
98  this->UpdateForNewCluster(pParentCluster);
99  deletedClusters.insert(pDaughterCluster);
100  }
101  }
102 
103  return !(deletedClusters.empty());
104 }
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 & GetClusterListNameU() const
Get the name of the u cluster list.
const std::string & GetClusterListNameV() const
Get the name of the v cluster list.
static pandora::HitType GetClusterHitType(const pandora::Cluster *const pCluster)
Get the hit type associated with a two dimensional cluster.
const std::string & GetClusterListNameW() const
Get the name of the w cluster list.
virtual void UpdateUponDeletion(const pandora::Cluster *const pDeletedCluster)
Update to reflect cluster deletion.
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::ThreeDBaseAlgorithm< T >::PerformMainLoop ( )
protectedvirtual

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

Reimplemented in lar_content::ThreeDTrackFragmentsAlgorithm.

Definition at line 280 of file ThreeDBaseAlgorithm.cc.

References lar_content::ThreeDBaseAlgorithm< T >::CalculateOverlapResult(), lar_content::ThreeDBaseAlgorithm< T >::m_clusterListU, lar_content::ThreeDBaseAlgorithm< T >::m_clusterListV, lar_content::ThreeDBaseAlgorithm< T >::m_clusterListW, and lar_content::LArClusterHelper::SortByNHits().

Referenced by lar_content::ThreeDBaseAlgorithm< T >::Run().

281 {
282  ClusterVector clusterVectorU(m_clusterListU.begin(), m_clusterListU.end());
283  ClusterVector clusterVectorV(m_clusterListV.begin(), m_clusterListV.end());
284  ClusterVector clusterVectorW(m_clusterListW.begin(), m_clusterListW.end());
285  std::sort(clusterVectorU.begin(), clusterVectorU.end(), LArClusterHelper::SortByNHits);
286  std::sort(clusterVectorV.begin(), clusterVectorV.end(), LArClusterHelper::SortByNHits);
287  std::sort(clusterVectorW.begin(), clusterVectorW.end(), LArClusterHelper::SortByNHits);
288 
289  for (const Cluster *const pClusterU : clusterVectorU)
290  {
291  for (const Cluster *const pClusterV : clusterVectorV)
292  {
293  for (const Cluster *const pClusterW : clusterVectorW)
294  this->CalculateOverlapResult(pClusterU, pClusterV, pClusterW);
295  }
296  }
297 }
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 CalculateOverlapResult(const pandora::Cluster *const pClusterU, const pandora::Cluster *const pClusterV, const pandora::Cluster *const pClusterW)=0
Calculate cluster overlap result and store in tensor.
pandora::ClusterList m_clusterListW
The selected modified cluster list W.
pandora::ClusterList m_clusterListV
The selected modified cluster list V.
std::vector< art::Ptr< recob::Cluster > > ClusterVector
pandora::ClusterList m_clusterListU
The selected modified cluster list U.
template<typename T >
void lar_content::ThreeDBaseAlgorithm< T >::PreparationStep ( )
protectedvirtual
template<typename T>
StatusCode lar_content::ThreeDBaseAlgorithm< T >::ReadSettings ( const pandora::TiXmlHandle  xmlHandle)
protectedvirtual

Reimplemented in lar_content::ThreeDShowersAlgorithm, lar_content::ThreeDTrackFragmentsAlgorithm, lar_content::ThreeDTracksBaseAlgorithm< T >, lar_content::ThreeDTracksBaseAlgorithm< TransverseOverlapResult >, lar_content::ThreeDTracksBaseAlgorithm< FragmentOverlapResult >, lar_content::ThreeDTracksBaseAlgorithm< LongitudinalOverlapResult >, lar_content::ThreeDTransverseTracksAlgorithm, lar_content::ThreeDLongitudinalTracksAlgorithm, and lar_content::ThreeDRemnantsAlgorithm.

Definition at line 302 of file ThreeDBaseAlgorithm.cc.

References lar_content::ThreeDBaseAlgorithm< T >::m_inputClusterListNameU, lar_content::ThreeDBaseAlgorithm< T >::m_inputClusterListNameV, lar_content::ThreeDBaseAlgorithm< T >::m_inputClusterListNameW, and lar_content::ThreeDBaseAlgorithm< T >::m_outputPfoListName.

Referenced by lar_content::ThreeDRemnantsAlgorithm::ReadSettings(), lar_content::ThreeDTracksBaseAlgorithm< T >::ReadSettings(), and lar_content::ThreeDShowersAlgorithm::ReadSettings().

303 {
304  PANDORA_RETURN_RESULT_IF(STATUS_CODE_SUCCESS, !=, XmlHelper::ReadValue(xmlHandle, "InputClusterListNameU", m_inputClusterListNameU));
305  PANDORA_RETURN_RESULT_IF(STATUS_CODE_SUCCESS, !=, XmlHelper::ReadValue(xmlHandle, "InputClusterListNameV", m_inputClusterListNameV));
306  PANDORA_RETURN_RESULT_IF(STATUS_CODE_SUCCESS, !=, XmlHelper::ReadValue(xmlHandle, "InputClusterListNameW", m_inputClusterListNameW));
307  PANDORA_RETURN_RESULT_IF(STATUS_CODE_SUCCESS, !=, XmlHelper::ReadValue(xmlHandle, "OutputPfoListName", m_outputPfoListName));
308 
309  return STATUS_CODE_SUCCESS;
310 }
std::string m_inputClusterListNameV
The name of the view V cluster list.
std::string m_inputClusterListNameW
The name of the view W cluster list.
std::string m_inputClusterListNameU
The name of the view U cluster list.
std::string m_outputPfoListName
The output pfo list name.
template<typename T >
void lar_content::ThreeDBaseAlgorithm< T >::RemoveUnavailableTensorElements ( )
virtual

Update tensor to remove all elements that have been added to pfos and so are unavailable.

Definition at line 175 of file ThreeDBaseAlgorithm.cc.

References lar_content::OverlapTensor< T >::GetClusterNavigationMapUV(), lar_content::OverlapTensor< T >::GetClusterNavigationMapVW(), lar_content::OverlapTensor< T >::GetClusterNavigationMapWU(), lar_content::ThreeDBaseAlgorithm< T >::m_overlapTensor, lar_content::LArClusterHelper::SortByNHits(), and lar_content::ThreeDBaseAlgorithm< T >::UpdateUponDeletion().

176 {
180  ClusterList usedClusters;
181 
182  for (typename TensorType::ClusterNavigationMap::const_iterator iter = navigationMapUV.begin(), iterEnd = navigationMapUV.end(); iter != iterEnd; ++iter)
183  {
184  if (!(iter->first->IsAvailable()))
185  usedClusters.push_back(iter->first);
186  }
187 
188  for (typename TensorType::ClusterNavigationMap::const_iterator iter = navigationMapVW.begin(), iterEnd = navigationMapVW.end(); iter != iterEnd; ++iter)
189  {
190  if (!(iter->first->IsAvailable()))
191  usedClusters.push_back(iter->first);
192  }
193 
194  for (typename TensorType::ClusterNavigationMap::const_iterator iter = navigationMapWU.begin(), iterEnd = navigationMapWU.end(); iter != iterEnd; ++iter)
195  {
196  if (!(iter->first->IsAvailable()))
197  usedClusters.push_back(iter->first);
198  }
199 
200  usedClusters.sort(LArClusterHelper::SortByNHits);
201 
202  for (ClusterList::const_iterator iter = usedClusters.begin(), iterEnd = usedClusters.end(); iter != iterEnd; ++iter)
203  this->UpdateUponDeletion(*iter);
204 }
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 ClusterNavigationMap & GetClusterNavigationMapVW() const
Get the cluster navigation map V->W.
const ClusterNavigationMap & GetClusterNavigationMapUV() const
Get the cluster navigation map U->V.
intermediate_table::const_iterator const_iterator
TensorType m_overlapTensor
The overlap tensor.
virtual void UpdateUponDeletion(const pandora::Cluster *const pDeletedCluster)
Update to reflect cluster deletion.
std::unordered_map< const pandora::Cluster *, pandora::ClusterList > ClusterNavigationMap
const ClusterNavigationMap & GetClusterNavigationMapWU() const
Get the cluster navigation map W->U.
template<typename T >
StatusCode lar_content::ThreeDBaseAlgorithm< T >::Run ( )
private

Definition at line 242 of file ThreeDBaseAlgorithm.cc.

References lar_content::ThreeDBaseAlgorithm< T >::ExamineTensor(), lar_content::ThreeDBaseAlgorithm< T >::m_inputClusterListNameU, lar_content::ThreeDBaseAlgorithm< T >::m_inputClusterListNameV, lar_content::ThreeDBaseAlgorithm< T >::m_inputClusterListNameW, lar_content::ThreeDBaseAlgorithm< T >::m_pInputClusterListU, lar_content::ThreeDBaseAlgorithm< T >::m_pInputClusterListV, lar_content::ThreeDBaseAlgorithm< T >::m_pInputClusterListW, lar_content::ThreeDBaseAlgorithm< T >::PerformMainLoop(), lar_content::ThreeDBaseAlgorithm< T >::PreparationStep(), lar_content::ThreeDBaseAlgorithm< T >::SelectAllInputClusters(), and lar_content::ThreeDBaseAlgorithm< T >::TidyUp().

243 {
244  try
245  {
246  PANDORA_THROW_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_INITIALIZED, !=, PandoraContentApi::GetList(*this,
248  PANDORA_THROW_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_INITIALIZED, !=, PandoraContentApi::GetList(*this,
250  PANDORA_THROW_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_INITIALIZED, !=, PandoraContentApi::GetList(*this,
252 
253  if ((NULL == m_pInputClusterListU) || (NULL == m_pInputClusterListV) || (NULL == m_pInputClusterListW))
254  {
255  if (PandoraContentApi::GetSettings(*this)->ShouldDisplayAlgorithmInfo())
256  std::cout << "ThreeDBaseAlgorithm: one or more input cluster lists unavailable." << std::endl;
257  throw StatusCodeException(STATUS_CODE_SUCCESS);
258  }
259 
260  this->SelectAllInputClusters();
261  this->PreparationStep();
262  this->PerformMainLoop();
263  this->ExamineTensor();
264  this->TidyUp();
265  }
266  catch (StatusCodeException &statusCodeException)
267  {
268  this->TidyUp();
269 
270  if (STATUS_CODE_SUCCESS != statusCodeException.GetStatusCode())
271  throw statusCodeException;
272  }
273 
274  return STATUS_CODE_SUCCESS;
275 }
virtual void PerformMainLoop()
Main loop over cluster combinations in order to populate the tensor. Responsible for calling Calculat...
std::string m_inputClusterListNameV
The name of the view V cluster list.
const pandora::ClusterList * m_pInputClusterListV
Address of the input cluster list V.
const pandora::ClusterList * m_pInputClusterListU
Address of the input cluster list U.
virtual void SelectAllInputClusters()
Select a subset of input clusters for processing in this algorithm.
const pandora::ClusterList * m_pInputClusterListW
Address of the input cluster list W.
virtual void ExamineTensor()=0
Examine contents of tensor, collect together best-matching 2D particles and modify clusters as requir...
virtual void TidyUp()
Tidy member variables in derived class.
std::string m_inputClusterListNameW
The name of the view W cluster list.
virtual void PreparationStep()
Perform any preparatory steps required, e.g. caching expensive fit results for clusters.
std::string m_inputClusterListNameU
The name of the view U cluster list.
template<typename T >
void lar_content::ThreeDBaseAlgorithm< T >::SelectAllInputClusters ( )
protectedvirtual

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

Definition at line 209 of file ThreeDBaseAlgorithm.cc.

References lar_content::ThreeDBaseAlgorithm< T >::m_clusterListU, lar_content::ThreeDBaseAlgorithm< T >::m_clusterListV, lar_content::ThreeDBaseAlgorithm< T >::m_clusterListW, lar_content::ThreeDBaseAlgorithm< T >::m_pInputClusterListU, lar_content::ThreeDBaseAlgorithm< T >::m_pInputClusterListV, lar_content::ThreeDBaseAlgorithm< T >::m_pInputClusterListW, and lar_content::ThreeDBaseAlgorithm< T >::SelectInputClusters().

Referenced by lar_content::ThreeDBaseAlgorithm< T >::Run().

210 {
214 }
virtual void SelectInputClusters(const pandora::ClusterList *const pInputClusterList, pandora::ClusterList &selectedClusterList) const =0
Select a subset of input clusters for processing in this algorithm.
pandora::ClusterList m_clusterListW
The selected modified cluster list W.
const pandora::ClusterList * m_pInputClusterListV
Address of the input cluster list V.
const pandora::ClusterList * m_pInputClusterListU
Address of the input cluster list U.
const pandora::ClusterList * m_pInputClusterListW
Address of the input cluster list W.
pandora::ClusterList m_clusterListV
The selected modified cluster list V.
pandora::ClusterList m_clusterListU
The selected modified cluster list U.
template<typename T>
virtual void lar_content::ThreeDBaseAlgorithm< T >::SelectInputClusters ( const pandora::ClusterList *const  pInputClusterList,
pandora::ClusterList &  selectedClusterList 
) const
pure virtual
template<typename T>
virtual void lar_content::ThreeDBaseAlgorithm< T >::SetPfoParameters ( const ProtoParticle protoParticle,
PandoraContentApi::ParticleFlowObject::Parameters &  pfoParameters 
) const
pure virtual
template<typename T >
void lar_content::ThreeDBaseAlgorithm< T >::TidyUp ( )
protectedvirtual

Tidy member variables in derived class.

Reimplemented in lar_content::ThreeDTracksBaseAlgorithm< T >, lar_content::ThreeDTracksBaseAlgorithm< TransverseOverlapResult >, lar_content::ThreeDTracksBaseAlgorithm< FragmentOverlapResult >, lar_content::ThreeDTracksBaseAlgorithm< LongitudinalOverlapResult >, and lar_content::ThreeDShowersAlgorithm.

Definition at line 226 of file ThreeDBaseAlgorithm.cc.

References lar_content::OverlapTensor< T >::Clear(), lar_content::ThreeDBaseAlgorithm< T >::m_clusterListU, lar_content::ThreeDBaseAlgorithm< T >::m_clusterListV, lar_content::ThreeDBaseAlgorithm< T >::m_clusterListW, lar_content::ThreeDBaseAlgorithm< T >::m_overlapTensor, lar_content::ThreeDBaseAlgorithm< T >::m_pInputClusterListU, lar_content::ThreeDBaseAlgorithm< T >::m_pInputClusterListV, and lar_content::ThreeDBaseAlgorithm< T >::m_pInputClusterListW.

Referenced by lar_content::ThreeDBaseAlgorithm< T >::Run(), lar_content::ThreeDShowersAlgorithm::TidyUp(), and lar_content::ThreeDTracksBaseAlgorithm< T >::TidyUp().

227 {
229 
230  m_pInputClusterListU = NULL;
231  m_pInputClusterListV = NULL;
232  m_pInputClusterListW = NULL;
233 
234  m_clusterListU.clear();
235  m_clusterListV.clear();
236  m_clusterListW.clear();
237 }
pandora::ClusterList m_clusterListW
The selected modified cluster list W.
const pandora::ClusterList * m_pInputClusterListV
Address of the input cluster list V.
const pandora::ClusterList * m_pInputClusterListU
Address of the input cluster list U.
const pandora::ClusterList * m_pInputClusterListW
Address of the input cluster list W.
pandora::ClusterList m_clusterListV
The selected modified cluster list V.
void Clear()
Clear overlap tensor.
TensorType m_overlapTensor
The overlap tensor.
pandora::ClusterList m_clusterListU
The selected modified cluster list U.
template<typename T>
void lar_content::ThreeDBaseAlgorithm< 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 in lar_content::ThreeDTracksBaseAlgorithm< T >, lar_content::ThreeDTracksBaseAlgorithm< TransverseOverlapResult >, lar_content::ThreeDTracksBaseAlgorithm< FragmentOverlapResult >, lar_content::ThreeDTracksBaseAlgorithm< LongitudinalOverlapResult >, lar_content::ThreeDShowersAlgorithm, and lar_content::ThreeDTrackFragmentsAlgorithm.

Definition at line 109 of file ThreeDBaseAlgorithm.cc.

References lar_content::ThreeDBaseAlgorithm< T >::CalculateOverlapResult(), lar_content::LArClusterHelper::GetClusterHitType(), lar_content::ThreeDBaseAlgorithm< T >::m_clusterListU, lar_content::ThreeDBaseAlgorithm< T >::m_clusterListV, lar_content::ThreeDBaseAlgorithm< T >::m_clusterListW, and lar_content::LArClusterHelper::SortByNHits().

Referenced by lar_content::ThreeDBaseAlgorithm< T >::MakeClusterMerges(), lar_content::ThreeDShowersAlgorithm::UpdateForNewCluster(), and lar_content::ThreeDTracksBaseAlgorithm< T >::UpdateForNewCluster().

110 {
111  const HitType hitType(LArClusterHelper::GetClusterHitType(pNewCluster));
112 
113  if (!((TPC_VIEW_U == hitType) || (TPC_VIEW_V == hitType) || (TPC_VIEW_W == hitType)))
114  throw StatusCodeException(STATUS_CODE_FAILURE);
115 
116  ClusterList &clusterList((TPC_VIEW_U == hitType) ? m_clusterListU : (TPC_VIEW_V == hitType) ? m_clusterListV : m_clusterListW);
117 
118  if (clusterList.end() != std::find(clusterList.begin(), clusterList.end(), pNewCluster))
119  throw StatusCodeException(STATUS_CODE_ALREADY_PRESENT);
120 
121  clusterList.push_back(pNewCluster);
122 
123  const ClusterList &clusterList1((TPC_VIEW_U == hitType) ? m_clusterListV : m_clusterListU);
124  const ClusterList &clusterList2((TPC_VIEW_W == hitType) ? m_clusterListV : m_clusterListW);
125 
126  ClusterVector clusterVector1(clusterList1.begin(), clusterList1.end());
127  ClusterVector clusterVector2(clusterList2.begin(), clusterList2.end());
128  std::sort(clusterVector1.begin(), clusterVector1.end(), LArClusterHelper::SortByNHits);
129  std::sort(clusterVector2.begin(), clusterVector2.end(), LArClusterHelper::SortByNHits);
130 
131  for (const Cluster *const pCluster1 : clusterVector1)
132  {
133  for (const Cluster *const pCluster2 : clusterVector2)
134  {
135  if (TPC_VIEW_U == hitType)
136  {
137  this->CalculateOverlapResult(pNewCluster, pCluster1, pCluster2);
138  }
139  else if (TPC_VIEW_V == hitType)
140  {
141  this->CalculateOverlapResult(pCluster1, pNewCluster, pCluster2);
142  }
143  else
144  {
145  this->CalculateOverlapResult(pCluster1, pCluster2, pNewCluster);
146  }
147  }
148  }
149 }
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 CalculateOverlapResult(const pandora::Cluster *const pClusterU, const pandora::Cluster *const pClusterV, const pandora::Cluster *const pClusterW)=0
Calculate cluster overlap result and store in tensor.
pandora::ClusterList m_clusterListW
The selected modified cluster list W.
static pandora::HitType GetClusterHitType(const pandora::Cluster *const pCluster)
Get the hit type associated with a two dimensional cluster.
pandora::ClusterList m_clusterListV
The selected modified cluster list V.
std::vector< art::Ptr< recob::Cluster > > ClusterVector
pandora::ClusterList m_clusterListU
The selected modified cluster list U.
template<typename T>
void lar_content::ThreeDBaseAlgorithm< T >::UpdateUponDeletion ( const pandora::Cluster *const  pDeletedCluster)
virtual

Update to reflect cluster deletion.

Parameters
pDeletedClusteraddress of the deleted cluster

Reimplemented in lar_content::ThreeDTracksBaseAlgorithm< T >, lar_content::ThreeDTracksBaseAlgorithm< TransverseOverlapResult >, lar_content::ThreeDTracksBaseAlgorithm< FragmentOverlapResult >, lar_content::ThreeDTracksBaseAlgorithm< LongitudinalOverlapResult >, and lar_content::ThreeDShowersAlgorithm.

Definition at line 154 of file ThreeDBaseAlgorithm.cc.

References lar_content::ThreeDBaseAlgorithm< T >::m_clusterListU, lar_content::ThreeDBaseAlgorithm< T >::m_clusterListV, lar_content::ThreeDBaseAlgorithm< T >::m_clusterListW, lar_content::ThreeDBaseAlgorithm< T >::m_overlapTensor, and lar_content::OverlapTensor< T >::RemoveCluster().

Referenced by lar_content::ThreeDBaseAlgorithm< T >::MakeClusterMerges(), lar_content::ThreeDBaseAlgorithm< T >::RemoveUnavailableTensorElements(), lar_content::ThreeDShowersAlgorithm::UpdateUponDeletion(), and lar_content::ThreeDTracksBaseAlgorithm< T >::UpdateUponDeletion().

155 {
156  ClusterList::iterator iterU = std::find(m_clusterListU.begin(), m_clusterListU.end(), pDeletedCluster);
157  ClusterList::iterator iterV = std::find(m_clusterListV.begin(), m_clusterListV.end(), pDeletedCluster);
158  ClusterList::iterator iterW = std::find(m_clusterListW.begin(), m_clusterListW.end(), pDeletedCluster);
159 
160  if (m_clusterListU.end() != iterU)
161  m_clusterListU.erase(iterU);
162 
163  if (m_clusterListV.end() != iterV)
164  m_clusterListV.erase(iterV);
165 
166  if (m_clusterListW.end() != iterW)
167  m_clusterListW.erase(iterW);
168 
169  m_overlapTensor.RemoveCluster(pDeletedCluster);
170 }
pandora::ClusterList m_clusterListW
The selected modified cluster list W.
intermediate_table::iterator iterator
pandora::ClusterList m_clusterListV
The selected modified cluster list V.
TensorType m_overlapTensor
The overlap tensor.
pandora::ClusterList m_clusterListU
The selected modified cluster list U.
void RemoveCluster(const pandora::Cluster *const pCluster)
Remove entries from tensor corresponding to specified cluster.

Member Data Documentation

template<typename T>
std::string lar_content::ThreeDBaseAlgorithm< T >::m_inputClusterListNameU
private

The name of the view U cluster list.

Definition at line 205 of file ThreeDBaseAlgorithm.h.

Referenced by lar_content::ThreeDBaseAlgorithm< T >::ReadSettings(), and lar_content::ThreeDBaseAlgorithm< T >::Run().

template<typename T>
std::string lar_content::ThreeDBaseAlgorithm< T >::m_inputClusterListNameV
private

The name of the view V cluster list.

Definition at line 206 of file ThreeDBaseAlgorithm.h.

Referenced by lar_content::ThreeDBaseAlgorithm< T >::ReadSettings(), and lar_content::ThreeDBaseAlgorithm< T >::Run().

template<typename T>
std::string lar_content::ThreeDBaseAlgorithm< T >::m_inputClusterListNameW
private

The name of the view W cluster list.

Definition at line 207 of file ThreeDBaseAlgorithm.h.

Referenced by lar_content::ThreeDBaseAlgorithm< T >::ReadSettings(), and lar_content::ThreeDBaseAlgorithm< T >::Run().

template<typename T>
std::string lar_content::ThreeDBaseAlgorithm< T >::m_outputPfoListName
private
template<typename T>
const pandora::ClusterList* lar_content::ThreeDBaseAlgorithm< T >::m_pInputClusterListU
protected
template<typename T>
const pandora::ClusterList* lar_content::ThreeDBaseAlgorithm< T >::m_pInputClusterListV
protected
template<typename T>
const pandora::ClusterList* lar_content::ThreeDBaseAlgorithm< T >::m_pInputClusterListW
protected

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