9 #include "Pandora/AlgorithmHeaders.h" 23 PfoCharacterisationBaseAlgorithm::PfoCharacterisationBaseAlgorithm() :
24 m_updateClusterIds(true),
25 m_postBranchAddition(false),
26 m_useThreeDInformation(true),
27 m_minTrackLikeViews(2)
41 PfoList tracksToShowers, showersToTracks;
45 const PfoList *pPfoList(
nullptr);
46 PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_INITIALIZED, !=, PandoraContentApi::GetList(*
this, pfoListName, pPfoList));
48 if (!pPfoList || pPfoList->empty())
50 if (PandoraContentApi::GetSettings(*this)->ShouldDisplayAlgorithmInfo())
51 std::cout <<
"PfoCharacterisationBaseAlgorithm: unable to find pfo list " << pfoListName << std::endl;
56 for (
const ParticleFlowObject *
const pPfo : *pPfoList)
58 PandoraContentApi::ParticleFlowObject::Metadata pfoMetadata;
63 pfoMetadata.m_particleId = MU_MINUS;
66 showersToTracks.push_back(pPfo);
70 pfoMetadata.m_particleId = E_MINUS;
73 tracksToShowers.push_back(pPfo);
76 if (pPfo->GetParticleId() != pfoMetadata.m_particleId.Get())
77 PANDORA_RETURN_RESULT_IF(STATUS_CODE_SUCCESS, !=, PandoraContentApi::ParticleFlowObject::AlterMetadata(*
this, pPfo, pfoMetadata));
82 ClusterList twoDClusterList;
85 for (
const Cluster *
const pCluster : twoDClusterList)
87 if (pCluster->GetParticleId() == pfoMetadata.m_particleId.Get())
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));
97 if (!tracksToShowers.empty())
100 if (!showersToTracks.empty())
103 return STATUS_CODE_SUCCESS;
110 ClusterList twoDClusterList;
113 typedef std::set<pandora::HitType> HitTypeSet;
114 HitTypeSet hitTypeSet;
116 unsigned int nTrackLikeViews(0);
117 for (
const Cluster *
const pCluster : twoDClusterList)
120 if (!hitTypeSet.insert(hitType).second)
137 PANDORA_RETURN_RESULT_IF(STATUS_CODE_SUCCESS, !=, XmlHelper::ReadValue(xmlHandle,
"TrackPfoListName",
m_trackPfoListName));
140 PANDORA_RETURN_RESULT_IF(STATUS_CODE_SUCCESS, !=, XmlHelper::ReadValue(xmlHandle,
"ShowerPfoListName",
m_showerPfoListName));
143 PANDORA_RETURN_RESULT_IF_AND_IF(
144 STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle,
"UpdateClusterIds",
m_updateClusterIds));
146 PANDORA_RETURN_RESULT_IF_AND_IF(
147 STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle,
"MinTrackLikeViews",
m_minTrackLikeViews));
149 PANDORA_RETURN_RESULT_IF_AND_IF(
150 STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle,
"UseThreeDInformation",
m_useThreeDInformation));
152 return STATUS_CODE_SUCCESS;
virtual bool IsClearTrack3x2D(const pandora::ParticleFlowObject *const pPfo) const
Whether pfo is identified as a clear track using its three clusters.
Header file for the pfo helper class.
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.
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.
virtual ~PfoCharacterisationBaseAlgorithm()
Destructor.
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.
Header file for the cluster helper class.
Header file for the pfo characterisation base algorithm class.
pandora::StatusCode ReadSettings(const pandora::TiXmlHandle xmlHandle)
std::string m_trackPfoListName
The track pfo list name.
pandora::StatusCode Run()
bool m_useThreeDInformation
Whether to use PFO and 3D information or clusters for characterisation.
std::string m_showerPfoListName
The shower pfo list name.