Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
lar_content::PfoCharacterisationBaseAlgorithm Class Referenceabstract

PfoCharacterisationBaseAlgorithm class. More...

#include <PfoCharacterisationBaseAlgorithm.h>

Inheritance diagram for lar_content::PfoCharacterisationBaseAlgorithm:
lar_content::CheatingPfoCharacterisationAlgorithm lar_content::CutPfoCharacterisationAlgorithm lar_content::MvaPfoCharacterisationAlgorithm< T > lar_dl_content::DlPfoCharacterisationAlgorithm

Public Member Functions

 PfoCharacterisationBaseAlgorithm ()
 Default constructor. More...
 
virtual ~PfoCharacterisationBaseAlgorithm ()
 Destructor. More...
 

Protected Member Functions

pandora::StatusCode Run ()
 
virtual bool IsClearTrack3x2D (const pandora::ParticleFlowObject *const pPfo) const
 Whether pfo is identified as a clear track using its three clusters. More...
 
virtual bool IsClearTrack (const pandora::ParticleFlowObject *const pPfo) const =0
 Whether pfo is identified as a clear track. More...
 
virtual bool IsClearTrack (const pandora::Cluster *const pCluster) const =0
 Whether cluster is identified as a clear track. More...
 
pandora::StatusCode ReadSettings (const pandora::TiXmlHandle xmlHandle)
 

Protected Attributes

std::string m_trackPfoListName
 The track pfo list name. More...
 
std::string m_showerPfoListName
 The shower pfo list name. More...
 
pandora::StringVector m_inputPfoListNames
 The names of the input pfo lists. More...
 
bool m_updateClusterIds
 Whether to update daughter cluster particle id labels to match pfo id. More...
 
bool m_postBranchAddition
 Whether to use configuration for shower clusters post branch addition. More...
 
bool m_useThreeDInformation
 Whether to use PFO and 3D information or clusters for characterisation. More...
 
unsigned int m_minTrackLikeViews
 The minimum number of track-like views to declare a pfo as track-like. More...
 

Detailed Description

PfoCharacterisationBaseAlgorithm class.

Definition at line 19 of file PfoCharacterisationBaseAlgorithm.h.

Constructor & Destructor Documentation

lar_content::PfoCharacterisationBaseAlgorithm::PfoCharacterisationBaseAlgorithm ( )

Default constructor.

Definition at line 23 of file PfoCharacterisationBaseAlgorithm.cc.

23  :
24  m_updateClusterIds(true),
25  m_postBranchAddition(false),
28 {
29 }
unsigned int m_minTrackLikeViews
The minimum number of track-like views to declare a pfo as track-like.
bool m_postBranchAddition
Whether to use configuration for shower clusters post branch addition.
bool m_updateClusterIds
Whether to update daughter cluster particle id labels to match pfo id.
bool m_useThreeDInformation
Whether to use PFO and 3D information or clusters for characterisation.
lar_content::PfoCharacterisationBaseAlgorithm::~PfoCharacterisationBaseAlgorithm ( )
virtual

Destructor.

Definition at line 33 of file PfoCharacterisationBaseAlgorithm.cc.

34 {
35 }

Member Function Documentation

virtual bool lar_content::PfoCharacterisationBaseAlgorithm::IsClearTrack ( const pandora::ParticleFlowObject *const  pPfo) const
protectedpure virtual

Whether pfo is identified as a clear track.

Parameters
pPfoaddress of the relevant pfo
Returns
boolean

Implemented in lar_content::MvaPfoCharacterisationAlgorithm< T >, lar_content::CutPfoCharacterisationAlgorithm, lar_dl_content::DlPfoCharacterisationAlgorithm, and lar_content::CheatingPfoCharacterisationAlgorithm.

virtual bool lar_content::PfoCharacterisationBaseAlgorithm::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::MvaPfoCharacterisationAlgorithm< T >, lar_content::CutPfoCharacterisationAlgorithm, lar_dl_content::DlPfoCharacterisationAlgorithm, and lar_content::CheatingPfoCharacterisationAlgorithm.

bool lar_content::PfoCharacterisationBaseAlgorithm::IsClearTrack3x2D ( const pandora::ParticleFlowObject *const  pPfo) const
protectedvirtual

Whether pfo is identified as a clear track using its three clusters.

Parameters
pPfoaddress of the relevant pfo
Returns
boolean

Definition at line 108 of file PfoCharacterisationBaseAlgorithm.cc.

109 {
110  ClusterList twoDClusterList;
111  LArPfoHelper::GetTwoDClusterList(pPfo, twoDClusterList);
112 
113  typedef std::set<pandora::HitType> HitTypeSet;
114  HitTypeSet hitTypeSet;
115 
116  unsigned int nTrackLikeViews(0);
117  for (const Cluster *const pCluster : twoDClusterList)
118  {
119  const HitType hitType(LArClusterHelper::GetClusterHitType(pCluster));
120  if (!hitTypeSet.insert(hitType).second)
121  continue;
122 
123  if (this->IsClearTrack(pCluster))
124  ++nTrackLikeViews;
125 
126  if (nTrackLikeViews >= m_minTrackLikeViews)
127  return true;
128  }
129 
130  return false;
131 }
enum cvn::HType HitType
static void GetTwoDClusterList(const pandora::ParticleFlowObject *const pPfo, pandora::ClusterList &clusterList)
Get the list of 2D clusters from an input pfo.
static pandora::HitType GetClusterHitType(const pandora::Cluster *const pCluster)
Get the hit type associated with a two dimensional cluster.
virtual bool IsClearTrack(const pandora::ParticleFlowObject *const pPfo) const =0
Whether pfo is identified as a clear track.
unsigned int m_minTrackLikeViews
The minimum number of track-like views to declare a pfo as track-like.
StatusCode lar_content::PfoCharacterisationBaseAlgorithm::ReadSettings ( const pandora::TiXmlHandle  xmlHandle)
protected

Definition at line 135 of file PfoCharacterisationBaseAlgorithm.cc.

136 {
137  PANDORA_RETURN_RESULT_IF(STATUS_CODE_SUCCESS, !=, XmlHelper::ReadValue(xmlHandle, "TrackPfoListName", m_trackPfoListName));
139 
140  PANDORA_RETURN_RESULT_IF(STATUS_CODE_SUCCESS, !=, XmlHelper::ReadValue(xmlHandle, "ShowerPfoListName", m_showerPfoListName));
142 
143  PANDORA_RETURN_RESULT_IF_AND_IF(
144  STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle, "UpdateClusterIds", m_updateClusterIds));
145 
146  PANDORA_RETURN_RESULT_IF_AND_IF(
147  STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle, "MinTrackLikeViews", m_minTrackLikeViews));
148 
149  PANDORA_RETURN_RESULT_IF_AND_IF(
150  STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle, "UseThreeDInformation", m_useThreeDInformation));
151 
152  return STATUS_CODE_SUCCESS;
153 }
pandora::StringVector m_inputPfoListNames
The names of the input pfo lists.
unsigned int m_minTrackLikeViews
The minimum number of track-like views to declare a pfo as track-like.
bool m_updateClusterIds
Whether to update daughter cluster particle id labels to match pfo id.
bool m_useThreeDInformation
Whether to use PFO and 3D information or clusters for characterisation.
std::string m_showerPfoListName
The shower pfo list name.
StatusCode lar_content::PfoCharacterisationBaseAlgorithm::Run ( )
protected

Definition at line 39 of file PfoCharacterisationBaseAlgorithm.cc.

40 {
41  PfoList tracksToShowers, showersToTracks;
42 
43  for (const std::string &pfoListName : m_inputPfoListNames)
44  {
45  const PfoList *pPfoList(nullptr);
46  PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_INITIALIZED, !=, PandoraContentApi::GetList(*this, pfoListName, pPfoList));
47 
48  if (!pPfoList || pPfoList->empty())
49  {
50  if (PandoraContentApi::GetSettings(*this)->ShouldDisplayAlgorithmInfo())
51  std::cout << "PfoCharacterisationBaseAlgorithm: unable to find pfo list " << pfoListName << std::endl;
52 
53  continue;
54  }
55 
56  for (const ParticleFlowObject *const pPfo : *pPfoList)
57  {
58  PandoraContentApi::ParticleFlowObject::Metadata pfoMetadata;
59  const bool isTrackLike(m_useThreeDInformation ? this->IsClearTrack(pPfo) : this->IsClearTrack3x2D(pPfo));
60 
61  if (isTrackLike)
62  {
63  pfoMetadata.m_particleId = MU_MINUS;
64 
65  if (m_showerPfoListName == pfoListName)
66  showersToTracks.push_back(pPfo);
67  }
68  else
69  {
70  pfoMetadata.m_particleId = E_MINUS;
71 
72  if (m_trackPfoListName == pfoListName)
73  tracksToShowers.push_back(pPfo);
74  }
75 
76  if (pPfo->GetParticleId() != pfoMetadata.m_particleId.Get())
77  PANDORA_RETURN_RESULT_IF(STATUS_CODE_SUCCESS, !=, PandoraContentApi::ParticleFlowObject::AlterMetadata(*this, pPfo, pfoMetadata));
78 
79  if (!m_updateClusterIds)
80  continue;
81 
82  ClusterList twoDClusterList;
83  LArPfoHelper::GetTwoDClusterList(pPfo, twoDClusterList);
84 
85  for (const Cluster *const pCluster : twoDClusterList)
86  {
87  if (pCluster->GetParticleId() == pfoMetadata.m_particleId.Get())
88  continue;
89 
90  PandoraContentApi::Cluster::Metadata clusterMetadata;
91  clusterMetadata.m_particleId = pfoMetadata.m_particleId.Get();
92  PANDORA_RETURN_RESULT_IF(STATUS_CODE_SUCCESS, !=, PandoraContentApi::Cluster::AlterMetadata(*this, pCluster, clusterMetadata));
93  }
94  }
95  }
96 
97  if (!tracksToShowers.empty())
98  PANDORA_RETURN_RESULT_IF(STATUS_CODE_SUCCESS, !=, PandoraContentApi::SaveList(*this, m_trackPfoListName, m_showerPfoListName, tracksToShowers));
99 
100  if (!showersToTracks.empty())
101  PANDORA_RETURN_RESULT_IF(STATUS_CODE_SUCCESS, !=, PandoraContentApi::SaveList(*this, m_showerPfoListName, m_trackPfoListName, showersToTracks));
102 
103  return STATUS_CODE_SUCCESS;
104 }
virtual bool IsClearTrack3x2D(const pandora::ParticleFlowObject *const pPfo) const
Whether pfo is identified as a clear track using its three clusters.
std::string string
Definition: nybbler.cc:12
pandora::StringVector m_inputPfoListNames
The names of the input pfo lists.
static void GetTwoDClusterList(const pandora::ParticleFlowObject *const pPfo, pandora::ClusterList &clusterList)
Get the list of 2D clusters from an input pfo.
virtual bool IsClearTrack(const pandora::ParticleFlowObject *const pPfo) const =0
Whether pfo is identified as a clear track.
bool m_updateClusterIds
Whether to update daughter cluster particle id labels to match pfo id.
bool m_useThreeDInformation
Whether to use PFO and 3D information or clusters for characterisation.
std::string m_showerPfoListName
The shower pfo list name.
QTextStream & endl(QTextStream &s)

Member Data Documentation

pandora::StringVector lar_content::PfoCharacterisationBaseAlgorithm::m_inputPfoListNames
protected

The names of the input pfo lists.

Definition at line 66 of file PfoCharacterisationBaseAlgorithm.h.

unsigned int lar_content::PfoCharacterisationBaseAlgorithm::m_minTrackLikeViews
protected

The minimum number of track-like views to declare a pfo as track-like.

Definition at line 71 of file PfoCharacterisationBaseAlgorithm.h.

bool lar_content::PfoCharacterisationBaseAlgorithm::m_postBranchAddition
protected

Whether to use configuration for shower clusters post branch addition.

Definition at line 69 of file PfoCharacterisationBaseAlgorithm.h.

std::string lar_content::PfoCharacterisationBaseAlgorithm::m_showerPfoListName
protected

The shower pfo list name.

Definition at line 65 of file PfoCharacterisationBaseAlgorithm.h.

std::string lar_content::PfoCharacterisationBaseAlgorithm::m_trackPfoListName
protected

The track pfo list name.

Definition at line 64 of file PfoCharacterisationBaseAlgorithm.h.

bool lar_content::PfoCharacterisationBaseAlgorithm::m_updateClusterIds
protected

Whether to update daughter cluster particle id labels to match pfo id.

Definition at line 68 of file PfoCharacterisationBaseAlgorithm.h.

bool lar_content::PfoCharacterisationBaseAlgorithm::m_useThreeDInformation
protected

Whether to use PFO and 3D information or clusters for characterisation.

Definition at line 70 of file PfoCharacterisationBaseAlgorithm.h.


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