LArSoft  v07_13_02
Liquid Argon Software toolkit - http://larsoft.org/
lar_content::CheatingClusterCharacterisationAlgorithm Class Reference

CheatingClusterCharacterisationAlgorithm class. More...

#include "CheatingClusterCharacterisationAlgorithm.h"

Inheritance diagram for lar_content::CheatingClusterCharacterisationAlgorithm:
lar_content::ClusterCharacterisationBaseAlgorithm

Protected Member Functions

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...
 

Private Member Functions

bool IsClearTrack (const pandora::Cluster *const pCluster) const
 Whether cluster is identified as a clear track. More...
 

Detailed Description

Member Function Documentation

bool lar_content::CheatingClusterCharacterisationAlgorithm::IsClearTrack ( const pandora::Cluster *const  pCluster) const
privatevirtual

Whether cluster is identified as a clear track.

Parameters
pClusteraddress of the relevant cluster
Returns
boolean

Implements lar_content::ClusterCharacterisationBaseAlgorithm.

Definition at line 20 of file CheatingClusterCharacterisationAlgorithm.cc.

21 {
22  try
23  {
24  // ATTN Slightly curious definition of a clear track, but this is most-likely what is needed for shower-growing
25  const MCParticle *const pMCParticle(MCParticleHelper::GetMainMCParticle(pCluster));
26 
27  if ((PHOTON != pMCParticle->GetParticleId()) && (E_MINUS != std::abs(pMCParticle->GetParticleId())))
28  return true;
29  }
30  catch (const StatusCodeException &) {}
31 
32  return false;
33 }
StatusCode lar_content::ClusterCharacterisationBaseAlgorithm::ReadSettings ( const pandora::TiXmlHandle  xmlHandle)
protectedinherited

Definition at line 92 of file ClusterCharacterisationBaseAlgorithm.cc.

References lar_content::ClusterCharacterisationBaseAlgorithm::m_inputClusterListNames, lar_content::ClusterCharacterisationBaseAlgorithm::m_overwriteExistingId, lar_content::ClusterCharacterisationBaseAlgorithm::m_useUnavailableClusters, and lar_content::ClusterCharacterisationBaseAlgorithm::m_zeroMode.

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

93 {
94  PANDORA_RETURN_RESULT_IF(STATUS_CODE_SUCCESS, !=, XmlHelper::ReadVectorOfValues(xmlHandle,
95  "InputClusterListNames", m_inputClusterListNames));
96 
97  PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle,
98  "ZeroMode", m_zeroMode));
99 
100  PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle,
101  "OverwriteExistingId", m_overwriteExistingId));
102 
103  PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle,
104  "UseUnavailableClusters", m_useUnavailableClusters));
105 
106  return STATUS_CODE_SUCCESS;
107 }
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 ( )
protectedinherited

Definition at line 36 of file ClusterCharacterisationBaseAlgorithm.cc.

References lar_content::ClusterCharacterisationBaseAlgorithm::IsClearTrack(), lar_content::ClusterCharacterisationBaseAlgorithm::m_inputClusterListNames, lar_content::ClusterCharacterisationBaseAlgorithm::m_overwriteExistingId, lar_content::ClusterCharacterisationBaseAlgorithm::m_useUnavailableClusters, and lar_content::ClusterCharacterisationBaseAlgorithm::m_zeroMode.

37 {
38  for (const std::string &clusterListName : m_inputClusterListNames)
39  {
40  const ClusterList *pClusterList = NULL;
41  PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_INITIALIZED, !=, PandoraContentApi::GetList(*this, clusterListName, pClusterList));
42 
43  if (!pClusterList || pClusterList->empty())
44  {
45  if (PandoraContentApi::GetSettings(*this)->ShouldDisplayAlgorithmInfo())
46  std::cout << "ClusterCharacterisationBaseAlgorithm: unable to find cluster list " << clusterListName << std::endl;
47 
48  continue;
49  }
50 
51  if (m_zeroMode)
52  {
53  for (const Cluster *const pCluster : *pClusterList)
54  {
55  PandoraContentApi::Cluster::Metadata metadata;
56  metadata.m_particleId = UNKNOWN_PARTICLE_TYPE;
57  PANDORA_RETURN_RESULT_IF(STATUS_CODE_SUCCESS, !=, PandoraContentApi::Cluster::AlterMetadata(*this, pCluster, metadata));
58  }
59 
60  return STATUS_CODE_SUCCESS;
61  }
62 
63  for (const Cluster *const pCluster : *pClusterList)
64  {
65  if (!m_overwriteExistingId && (UNKNOWN_PARTICLE_TYPE != pCluster->GetParticleId()))
66  continue;
67 
68  if (!m_useUnavailableClusters && !PandoraContentApi::IsAvailable(*this, pCluster))
69  continue;
70 
71  PandoraContentApi::Cluster::Metadata metadata;
72 
73  if (this->IsClearTrack(pCluster))
74  {
75  metadata.m_particleId = MU_MINUS;
76  }
77  else
78  {
79  metadata.m_particleId = E_MINUS;
80  }
81 
82  if (pCluster->GetParticleId() != metadata.m_particleId.Get())
83  PANDORA_RETURN_RESULT_IF(STATUS_CODE_SUCCESS, !=, PandoraContentApi::Cluster::AlterMetadata(*this, pCluster, metadata));
84  }
85  }
86 
87  return STATUS_CODE_SUCCESS;
88 }
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
protectedinherited
bool lar_content::ClusterCharacterisationBaseAlgorithm::m_overwriteExistingId
protectedinherited

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

Definition at line 49 of file ClusterCharacterisationBaseAlgorithm.h.

Referenced by lar_content::ClusterCharacterisationBaseAlgorithm::ReadSettings(), and lar_content::ClusterCharacterisationBaseAlgorithm::Run().

bool lar_content::ClusterCharacterisationBaseAlgorithm::m_useUnavailableClusters
protectedinherited

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

Definition at line 50 of file ClusterCharacterisationBaseAlgorithm.h.

Referenced by lar_content::ClusterCharacterisationBaseAlgorithm::ReadSettings(), and lar_content::ClusterCharacterisationBaseAlgorithm::Run().

bool lar_content::ClusterCharacterisationBaseAlgorithm::m_zeroMode
protectedinherited

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

Definition at line 47 of file ClusterCharacterisationBaseAlgorithm.h.

Referenced by lar_content::ClusterCharacterisationBaseAlgorithm::ReadSettings(), and lar_content::ClusterCharacterisationBaseAlgorithm::Run().


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