LArSoft  v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
lar_content::ClusterCharacterisationBaseAlgorithm Class Referenceabstract

ClusterCharacterisationBaseAlgorithm class. More...

#include "ClusterCharacterisationBaseAlgorithm.h"

Inheritance diagram for lar_content::ClusterCharacterisationBaseAlgorithm:
lar_content::CheatingClusterCharacterisationAlgorithm lar_content::CutClusterCharacterisationAlgorithm lar_dl_content::DlClusterCharacterisationAlgorithm

Public Member Functions

 ClusterCharacterisationBaseAlgorithm ()
 Default constructor. More...
 
 ~ClusterCharacterisationBaseAlgorithm ()
 Destructor. More...
 

Protected Member Functions

virtual bool IsClearTrack (const pandora::Cluster *const pCluster) const =0
 Whether cluster is identified as a clear track. More...
 
pandora::StatusCode Run ()
 
pandora::StatusCode ReadSettings (const pandora::TiXmlHandle xmlHandle)
 

Protected Attributes

pandora::StringVector m_inputClusterListNames
 The names of the input cluster lists. More...
 
bool m_zeroMode
 Whether to zero all existing cluster particle id, overrides all other parameters. More...
 
bool m_overwriteExistingId
 Whether to consider any clusters that already have an assigned particle id. More...
 
bool m_useUnavailableClusters
 Whether to consider clusters that are already constituents of a pfo. More...
 

Detailed Description

Constructor & Destructor Documentation

lar_content::ClusterCharacterisationBaseAlgorithm::ClusterCharacterisationBaseAlgorithm ( )

Default constructor.

Definition at line 21 of file ClusterCharacterisationBaseAlgorithm.cc.

21  :
22  m_zeroMode(false),
23  m_overwriteExistingId(false),
25 {
26 }
bool m_overwriteExistingId
Whether to consider any clusters that already have an assigned particle id.
bool m_useUnavailableClusters
Whether to consider clusters that are already constituents of a pfo.
bool m_zeroMode
Whether to zero all existing cluster particle id, overrides all other parameters. ...
lar_content::ClusterCharacterisationBaseAlgorithm::~ClusterCharacterisationBaseAlgorithm ( )

Destructor.

Definition at line 30 of file ClusterCharacterisationBaseAlgorithm.cc.

31 {
32 }

Member Function Documentation

virtual bool lar_content::ClusterCharacterisationBaseAlgorithm::IsClearTrack ( const pandora::Cluster *const  pCluster) const
protectedpure virtual

Whether cluster is identified as a clear track.

Parameters
pClusteraddress of the relevant cluster
Returns
boolean

Implemented in lar_content::CutClusterCharacterisationAlgorithm, lar_dl_content::DlClusterCharacterisationAlgorithm, and lar_content::CheatingClusterCharacterisationAlgorithm.

Referenced by Run().

StatusCode lar_content::ClusterCharacterisationBaseAlgorithm::ReadSettings ( const pandora::TiXmlHandle  xmlHandle)
protected

Definition at line 93 of file ClusterCharacterisationBaseAlgorithm.cc.

References m_inputClusterListNames, m_overwriteExistingId, m_useUnavailableClusters, and m_zeroMode.

Referenced by lar_content::CutClusterCharacterisationAlgorithm::ReadSettings().

94 {
95  PANDORA_RETURN_RESULT_IF(STATUS_CODE_SUCCESS, !=, XmlHelper::ReadVectorOfValues(xmlHandle, "InputClusterListNames", m_inputClusterListNames));
96 
97  PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle, "ZeroMode", m_zeroMode));
98 
99  PANDORA_RETURN_RESULT_IF_AND_IF(
100  STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle, "OverwriteExistingId", m_overwriteExistingId));
101 
102  PANDORA_RETURN_RESULT_IF_AND_IF(
103  STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle, "UseUnavailableClusters", m_useUnavailableClusters));
104 
105  return STATUS_CODE_SUCCESS;
106 }
bool m_overwriteExistingId
Whether to consider any clusters that already have an assigned particle id.
bool m_useUnavailableClusters
Whether to consider clusters that are already constituents of a pfo.
pandora::StringVector m_inputClusterListNames
The names of the input cluster lists.
bool m_zeroMode
Whether to zero all existing cluster particle id, overrides all other parameters. ...
StatusCode lar_content::ClusterCharacterisationBaseAlgorithm::Run ( )
protected

Definition at line 36 of file ClusterCharacterisationBaseAlgorithm.cc.

References IsClearTrack(), m_inputClusterListNames, m_overwriteExistingId, m_useUnavailableClusters, and m_zeroMode.

37 {
38  for (const std::string &clusterListName : m_inputClusterListNames)
39  {
40  const ClusterList *pClusterList = NULL;
41  PANDORA_RETURN_RESULT_IF_AND_IF(
42  STATUS_CODE_SUCCESS, STATUS_CODE_NOT_INITIALIZED, !=, PandoraContentApi::GetList(*this, clusterListName, pClusterList));
43 
44  if (!pClusterList || pClusterList->empty())
45  {
46  if (PandoraContentApi::GetSettings(*this)->ShouldDisplayAlgorithmInfo())
47  std::cout << "ClusterCharacterisationBaseAlgorithm: unable to find cluster list " << clusterListName << std::endl;
48 
49  continue;
50  }
51 
52  if (m_zeroMode)
53  {
54  for (const Cluster *const pCluster : *pClusterList)
55  {
56  PandoraContentApi::Cluster::Metadata metadata;
57  metadata.m_particleId = UNKNOWN_PARTICLE_TYPE;
58  PANDORA_RETURN_RESULT_IF(STATUS_CODE_SUCCESS, !=, PandoraContentApi::Cluster::AlterMetadata(*this, pCluster, metadata));
59  }
60 
61  return STATUS_CODE_SUCCESS;
62  }
63 
64  for (const Cluster *const pCluster : *pClusterList)
65  {
66  if (!m_overwriteExistingId && (UNKNOWN_PARTICLE_TYPE != pCluster->GetParticleId()))
67  continue;
68 
69  if (!m_useUnavailableClusters && !PandoraContentApi::IsAvailable(*this, pCluster))
70  continue;
71 
72  PandoraContentApi::Cluster::Metadata metadata;
73 
74  if (this->IsClearTrack(pCluster))
75  {
76  metadata.m_particleId = MU_MINUS;
77  }
78  else
79  {
80  metadata.m_particleId = E_MINUS;
81  }
82 
83  if (pCluster->GetParticleId() != metadata.m_particleId.Get())
84  PANDORA_RETURN_RESULT_IF(STATUS_CODE_SUCCESS, !=, PandoraContentApi::Cluster::AlterMetadata(*this, pCluster, metadata));
85  }
86  }
87 
88  return STATUS_CODE_SUCCESS;
89 }
bool m_overwriteExistingId
Whether to consider any clusters that already have an assigned particle id.
bool m_useUnavailableClusters
Whether to consider clusters that are already constituents of a pfo.
pandora::StringVector m_inputClusterListNames
The names of the input cluster lists.
bool m_zeroMode
Whether to zero all existing cluster particle id, overrides all other parameters. ...
virtual bool IsClearTrack(const pandora::Cluster *const pCluster) const =0
Whether cluster is identified as a clear track.

Member Data Documentation

pandora::StringVector lar_content::ClusterCharacterisationBaseAlgorithm::m_inputClusterListNames
protected

The names of the input cluster lists.

Definition at line 45 of file ClusterCharacterisationBaseAlgorithm.h.

Referenced by ReadSettings(), and Run().

bool lar_content::ClusterCharacterisationBaseAlgorithm::m_overwriteExistingId
protected

Whether to consider any clusters that already have an assigned particle id.

Definition at line 49 of file ClusterCharacterisationBaseAlgorithm.h.

Referenced by ReadSettings(), and Run().

bool lar_content::ClusterCharacterisationBaseAlgorithm::m_useUnavailableClusters
protected

Whether to consider clusters that are already constituents of a pfo.

Definition at line 50 of file ClusterCharacterisationBaseAlgorithm.h.

Referenced by ReadSettings(), and Run().

bool lar_content::ClusterCharacterisationBaseAlgorithm::m_zeroMode
protected

Whether to zero all existing cluster particle id, overrides all other parameters.

Definition at line 47 of file ClusterCharacterisationBaseAlgorithm.h.

Referenced by ReadSettings(), and Run().


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