Pandora
Pandora source code navigator
Loading...
Searching...
No Matches
PfoHitCleaningAlgorithm.cc
Go to the documentation of this file.
1
10
14
15using namespace pandora;
16
17namespace lar_content
18{
19
21{
22 for (unsigned int i = 0; i < m_pfoListNames.size(); ++i)
23 {
24 // ATTN - one-to-one correspondance required between PFO and cluster lists
25 const std::string &pfoListName{m_pfoListNames.at(i)};
26 const std::string &clusterListName{m_clusterListNames.at(i)};
27 const PfoList *pList(nullptr);
28 PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_INITIALIZED, !=, PandoraContentApi::GetList(*this, pfoListName, pList));
29
30 if (pList && !pList->empty())
31 {
32 for (const ParticleFlowObject *pPfo : *pList)
33 {
34 ClusterList clustersToRemove;
35 LArPfoHelper::GetClusters(pPfo, TPC_3D, clustersToRemove);
36
37 for (const Cluster *pCluster : clustersToRemove)
38 {
39 PANDORA_RETURN_RESULT_IF(STATUS_CODE_SUCCESS, !=, PandoraContentApi::RemoveFromPfo(*this, pPfo, pCluster));
40 PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=,
41 PandoraContentApi::Delete<Cluster>(*this, pCluster, clusterListName));
42 }
43 }
44 }
45 }
46
47 return STATUS_CODE_SUCCESS;
48}
49
50//------------------------------------------------------------------------------------------------------------------------------------------
51
53{
55 STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadVectorOfValues(xmlHandle, "PfoListNames", m_pfoListNames));
57 STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadVectorOfValues(xmlHandle, "ClusterListNames", m_clusterListNames));
58
59 if (m_pfoListNames.size() != m_clusterListNames.size())
60 {
61 std::cout << "PfoHitCleaningAlgorithm: Mismatch between PFO and Cluster list sizes" << std::endl;
62 return STATUS_CODE_INVALID_PARAMETER;
63 }
64
65 return STATUS_CODE_SUCCESS;
66}
67
68} // namespace lar_content
Grouping of header files for many classes of use in particle flow algorithms.
Header file for the cluster helper class.
Header file for the pfo helper class.
Header file for the pfo hit cleaning algorithm 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 pandora::StatusCode ReplaceCurrentList(const pandora::Algorithm &algorithm, const std::string &newListName)
Replace the current list with a pre-saved list; use this new list as a permanent replacement for the ...
static pandora::StatusCode RemoveFromPfo(const pandora::Algorithm &algorithm, const pandora::ParticleFlowObject *const pPfo, const T *const pT)
Remove a cluster from a particle flow object. Note this function will not remove the final object (tr...
static pandora::StatusCode GetList(const pandora::Algorithm &algorithm, const std::string &listName, const T *&pT)
Get a named list.
static void GetClusters(const pandora::PfoList &pfoList, const pandora::HitType &hitType, pandora::ClusterList &clusterList)
Get a list of clusters of a particular hit type from a list of pfos.
pandora::StringVector m_clusterListNames
The list of cluster list names.
pandora::StringVector m_pfoListNames
The list of pfo list names.
pandora::StatusCode ReadSettings(const pandora::TiXmlHandle xmlHandle)
Read the algorithm settings.
pandora::StatusCode Run()
Run the algorithm.
Cluster class.
Definition Cluster.h:31
ParticleFlowObject class.
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
MANAGED_CONTAINER< const Cluster * > ClusterList
StatusCode
The StatusCode enum.
MANAGED_CONTAINER< const ParticleFlowObject * > PfoList