LArSoft  v06_85_00
Liquid Argon Software toolkit - http://larsoft.org/
PostProcessingAlgorithm.cc
Go to the documentation of this file.
1 
9 #include "Pandora/AlgorithmHeaders.h"
10 
12 
13 using namespace pandora;
14 
15 namespace lar_content
16 {
17 
18 PostProcessingAlgorithm::PostProcessingAlgorithm() :
19  m_listCounter(0)
20 {
21 }
22 
23 //------------------------------------------------------------------------------------------------------------------------------------------
24 
26 {
27  m_listCounter = 0;
28  return STATUS_CODE_SUCCESS;
29 }
30 
31 //------------------------------------------------------------------------------------------------------------------------------------------
32 
34 {
35  for (const std::string &listName : m_pfoListNames)
36  PANDORA_RETURN_RESULT_IF(STATUS_CODE_SUCCESS, !=, this->RenameList<PfoList>(listName));
37 
38  for (const std::string &listName : m_clusterListNames)
39  PANDORA_RETURN_RESULT_IF(STATUS_CODE_SUCCESS, !=, this->RenameList<ClusterList>(listName));
40 
41  for (const std::string &listName : m_vertexListNames)
42  PANDORA_RETURN_RESULT_IF(STATUS_CODE_SUCCESS, !=, this->RenameList<VertexList>(listName));
43 
44  for (const std::string &listName : m_caloHitListNames)
45  PANDORA_RETURN_RESULT_IF(STATUS_CODE_SUCCESS, !=, this->RenameList<CaloHitList>(listName));
46 
47  PANDORA_RETURN_RESULT_IF(STATUS_CODE_SUCCESS, !=, PandoraContentApi::DropCurrentList<CaloHit>(*this));
48  PANDORA_RETURN_RESULT_IF(STATUS_CODE_SUCCESS, !=, PandoraContentApi::DropCurrentList<Track>(*this));
49  PANDORA_RETURN_RESULT_IF(STATUS_CODE_SUCCESS, !=, PandoraContentApi::DropCurrentList<MCParticle>(*this));
50  PANDORA_RETURN_RESULT_IF(STATUS_CODE_SUCCESS, !=, PandoraContentApi::DropCurrentList<Cluster>(*this));
51  PANDORA_RETURN_RESULT_IF(STATUS_CODE_SUCCESS, !=, PandoraContentApi::DropCurrentList<ParticleFlowObject>(*this));
52  PANDORA_RETURN_RESULT_IF(STATUS_CODE_SUCCESS, !=, PandoraContentApi::DropCurrentList<Vertex>(*this));
53 
54  if (!m_currentPfoListReplacement.empty())
55  {
56  const std::string replacementListName(m_currentPfoListReplacement + TypeToString(m_listCounter));
57 
58  if (STATUS_CODE_SUCCESS != PandoraContentApi::ReplaceCurrentList<Pfo>(*this, replacementListName))
59  {
60  if (PandoraContentApi::GetSettings(*this)->ShouldDisplayAlgorithmInfo())
61  std::cout << "PostProcessingAlgorithm: could not replace current pfo list with list named: " << replacementListName << std::endl;
62 
63  PANDORA_RETURN_RESULT_IF(STATUS_CODE_SUCCESS, !=, PandoraContentApi::DropCurrentList<Pfo>(*this));
64  }
65  }
66 
67  ++m_listCounter;
68  return STATUS_CODE_SUCCESS;
69 }
70 
71 //------------------------------------------------------------------------------------------------------------------------------------------
72 
73 template <typename T>
74 StatusCode PostProcessingAlgorithm::RenameList(const std::string &oldListName) const
75 {
76  const std::string newListName(oldListName + TypeToString(m_listCounter));
77  PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, PandoraContentApi::RenameList<T>(*this, oldListName, newListName));
78  return STATUS_CODE_SUCCESS;
79 }
80 
81 //------------------------------------------------------------------------------------------------------------------------------------------
82 
83 StatusCode PostProcessingAlgorithm::ReadSettings(const TiXmlHandle xmlHandle)
84 {
85  PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadVectorOfValues(xmlHandle,
86  "PfoListNames", m_pfoListNames));
87 
88  PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadVectorOfValues(xmlHandle,
89  "ClusterListNames", m_clusterListNames));
90 
91  PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadVectorOfValues(xmlHandle,
92  "VertexListNames", m_vertexListNames));
93 
94  PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadVectorOfValues(xmlHandle,
95  "CaloHitListNames", m_caloHitListNames));
96 
97  PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle,
98  "CurrentPfoListReplacement", m_currentPfoListReplacement));
99 
100  return STATUS_CODE_SUCCESS;
101 }
102 
103 
104 //------------------------------------------------------------------------------------------------------------------------------------------
105 //------------------------------------------------------------------------------------------------------------------------------------------
106 
107 template pandora::StatusCode PostProcessingAlgorithm::RenameList<PfoList>(const std::string &) const;
108 template pandora::StatusCode PostProcessingAlgorithm::RenameList<ClusterList>(const std::string &) const;
109 template pandora::StatusCode PostProcessingAlgorithm::RenameList<VertexList>(const std::string &) const;
110 template pandora::StatusCode PostProcessingAlgorithm::RenameList<CaloHitList>(const std::string &) const;
111 
112 } // namespace lar_content
std::string m_currentPfoListReplacement
The name of the pfo list to replace the current list.
pandora::StringVector m_clusterListNames
The list of cluster list names.
Header file for the post processing algorithm class.
unsigned int m_listCounter
The counter appended to output (and replacement current) list names and reset each event...
pandora::StringVector m_caloHitListNames
The list of calo hit list names.
pandora::StringVector m_vertexListNames
The list of vertex list names.
pandora::StringVector m_pfoListNames
The list of pfo list names.
pandora::StatusCode ReadSettings(const pandora::TiXmlHandle xmlHandle)
pandora::StatusCode RenameList(const std::string &oldListName) const
Rename a list of relevant type with specified name - the new name will be the old name with appended ...