LArSoft  v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
PfoHitCleaningAlgorithm.cc
Go to the documentation of this file.
1 
9 #include "Pandora/AlgorithmHeaders.h"
10 
14 
15 using namespace pandora;
16 
17 namespace lar_content
18 {
19 
20 StatusCode PfoHitCleaningAlgorithm::Run()
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 
52 StatusCode PfoHitCleaningAlgorithm::ReadSettings(const TiXmlHandle xmlHandle)
53 {
54  PANDORA_RETURN_RESULT_IF_AND_IF(
55  STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadVectorOfValues(xmlHandle, "PfoListNames", m_pfoListNames));
56  PANDORA_RETURN_RESULT_IF_AND_IF(
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
Header file for the pfo helper class.
Header file for the cluster helper class.
Header file for the pfo hit cleaning algorithm class.