Pandora
Pandora source code navigator
Loading...
Searching...
No Matches
ClusterCharacterisationBaseAlgorithm.cc
Go to the documentation of this file.
1
10
13
15
16using namespace pandora;
17
18namespace lar_content
19{
20
22 m_zeroMode(false),
23 m_overwriteExistingId(false),
24 m_useUnavailableClusters(false)
25{
26}
27
28//------------------------------------------------------------------------------------------------------------------------------------------
29
33
34//------------------------------------------------------------------------------------------------------------------------------------------
35
37{
38 for (const std::string &clusterListName : m_inputClusterListNames)
39 {
40 const ClusterList *pClusterList = NULL;
42 STATUS_CODE_SUCCESS, STATUS_CODE_NOT_INITIALIZED, !=, PandoraContentApi::GetList(*this, clusterListName, pClusterList));
43
44 if (!pClusterList || pClusterList->empty())
45 {
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
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}
90
91//------------------------------------------------------------------------------------------------------------------------------------------
92
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
100 STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle, "OverwriteExistingId", m_overwriteExistingId));
101
103 STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle, "UseUnavailableClusters", m_useUnavailableClusters));
104
105 return STATUS_CODE_SUCCESS;
106}
107
108} // namespace lar_content
Grouping of header files for many classes of use in particle flow algorithms.
Header file for the cluster characterisation base algorithm class.
Header file for the cluster helper class.
Header file for the geometry helper class.
#define PANDORA_RETURN_RESULT_IF_AND_IF(StatusCode1, StatusCode2, Operator, Command)
Definition StatusCodes.h:31
#define PANDORA_RETURN_RESULT_IF(StatusCode1, Operator, Command)
Definition StatusCodes.h:19
static bool IsAvailable(const pandora::Algorithm &algorithm, const T *const pT)
Is object, or a list of objects, available as a building block.
static pandora::StatusCode GetList(const pandora::Algorithm &algorithm, const std::string &listName, const T *&pT)
Get a named list.
static const pandora::PandoraSettings * GetSettings(const pandora::Algorithm &algorithm)
Get the pandora settings instance.
bool m_zeroMode
Whether to zero all existing cluster particle id, overrides all other parameters.
bool m_useUnavailableClusters
Whether to consider clusters that are already constituents of a pfo.
virtual bool IsClearTrack(const pandora::Cluster *const pCluster) const =0
Whether cluster is identified as a clear track.
pandora::StringVector m_inputClusterListNames
The names of the input cluster lists.
bool m_overwriteExistingId
Whether to consider any clusters that already have an assigned particle id.
pandora::StatusCode ReadSettings(const pandora::TiXmlHandle xmlHandle)
Read the algorithm settings.
Cluster class.
Definition Cluster.h:31
StatusCode AlterMetadata(const object_creation::Cluster::Metadata &metadata)
Alter the metadata information stored in a cluster.
Definition Cluster.cc:275
bool ShouldDisplayAlgorithmInfo() const
Whether to display algorithm information during processing.
static StatusCode ReadVectorOfValues(const TiXmlHandle &xmlHandle, const std::string &xmlElementName, std::vector< T > &vector)
Read a vector of values from a (space separated) list in an xml element.
Definition XmlHelper.h:229
static StatusCode ReadValue(const TiXmlHandle &xmlHandle, const std::string &xmlElementName, T &t)
Read a value from an xml element.
Definition XmlHelper.h:136
MANAGED_CONTAINER< const Cluster * > ClusterList
@ UNKNOWN_PARTICLE_TYPE
Definition PdgTable.h:103
StatusCode
The StatusCode enum.