Pandora
Pandora source code navigator
Loading...
Searching...
No Matches
PostProcessingAlgorithm.cc
Go to the documentation of this file.
1
10
12
13using namespace pandora;
14
15namespace lar_content
16{
17
21
22//------------------------------------------------------------------------------------------------------------------------------------------
23
25{
26 m_listCounter = 0;
27 return STATUS_CODE_SUCCESS;
28}
29
30//------------------------------------------------------------------------------------------------------------------------------------------
31
33{
34 for (const std::string &listName : m_pfoListNames)
35 PANDORA_RETURN_RESULT_IF(STATUS_CODE_SUCCESS, !=, this->RenameList<PfoList>(listName));
36
37 for (const std::string &listName : m_clusterListNames)
38 PANDORA_RETURN_RESULT_IF(STATUS_CODE_SUCCESS, !=, this->RenameList<ClusterList>(listName));
39
40 for (const std::string &listName : m_vertexListNames)
41 PANDORA_RETURN_RESULT_IF(STATUS_CODE_SUCCESS, !=, this->RenameList<VertexList>(listName));
42
43 for (const std::string &listName : m_caloHitListNames)
44 PANDORA_RETURN_RESULT_IF(STATUS_CODE_SUCCESS, !=, this->RenameList<CaloHitList>(listName));
45
52
53 if (!m_currentPfoListReplacement.empty())
54 {
55 const std::string replacementListName(m_currentPfoListReplacement + TypeToString(m_listCounter));
56
57 if (STATUS_CODE_SUCCESS != PandoraContentApi::ReplaceCurrentList<Pfo>(*this, replacementListName))
58 {
60 std::cout << "PostProcessingAlgorithm: could not replace current pfo list with list named: " << replacementListName << std::endl;
61
63 }
64 }
65
67 return STATUS_CODE_SUCCESS;
68}
69
70//------------------------------------------------------------------------------------------------------------------------------------------
71
72template <typename T>
73StatusCode PostProcessingAlgorithm::RenameList(const std::string &oldListName) const
74{
75 const std::string newListName(oldListName + TypeToString(m_listCounter));
76 PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, PandoraContentApi::RenameList<T>(*this, oldListName, newListName));
77 return STATUS_CODE_SUCCESS;
78}
79
80//------------------------------------------------------------------------------------------------------------------------------------------
81
83{
85 STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadVectorOfValues(xmlHandle, "PfoListNames", m_pfoListNames));
86
88 STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadVectorOfValues(xmlHandle, "ClusterListNames", m_clusterListNames));
89
91 STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadVectorOfValues(xmlHandle, "VertexListNames", m_vertexListNames));
92
94 STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadVectorOfValues(xmlHandle, "CaloHitListNames", m_caloHitListNames));
95
96 PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=,
97 XmlHelper::ReadValue(xmlHandle, "CurrentPfoListReplacement", m_currentPfoListReplacement));
98
99 return STATUS_CODE_SUCCESS;
100}
101
102//------------------------------------------------------------------------------------------------------------------------------------------
103//------------------------------------------------------------------------------------------------------------------------------------------
104
105template pandora::StatusCode PostProcessingAlgorithm::RenameList<PfoList>(const std::string &) const;
106template pandora::StatusCode PostProcessingAlgorithm::RenameList<ClusterList>(const std::string &) const;
107template pandora::StatusCode PostProcessingAlgorithm::RenameList<VertexList>(const std::string &) const;
108template pandora::StatusCode PostProcessingAlgorithm::RenameList<CaloHitList>(const std::string &) const;
109
110} // namespace lar_content
Grouping of header files for many classes of use in particle flow algorithms.
Header file for the post processing 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 const pandora::PandoraSettings * GetSettings(const pandora::Algorithm &algorithm)
Get the pandora settings instance.
unsigned int m_listCounter
The counter appended to output (and replacement current) list names and reset each event.
PostProcessingAlgorithm()
Default constructor.
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 ...
pandora::StatusCode ReadSettings(const pandora::TiXmlHandle xmlHandle)
Read the algorithm settings.
pandora::StringVector m_caloHitListNames
The list of calo hit list names.
pandora::StatusCode Run()
Run the algorithm.
pandora::StatusCode Reset()
Perform any operations when pandora is reset, typically at the end of each event.
std::string m_currentPfoListReplacement
The name of the pfo list to replace the current list.
pandora::StringVector m_pfoListNames
The list of pfo list names.
pandora::StringVector m_vertexListNames
The list of vertex list names.
pandora::StringVector m_clusterListNames
The list of cluster list names.
bool ShouldDisplayAlgorithmInfo() const
Whether to display algorithm information during processing.
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
static StatusCode ReadValue(const TiXmlHandle &xmlHandle, const std::string &xmlElementName, T &t)
Read a value from an xml element.
Definition XmlHelper.h:136
std::string TypeToString(const T &t)
StatusCode
The StatusCode enum.