Pandora
Pandora source code navigator
Loading...
Searching...
No Matches
MopUpBaseAlgorithm.cc
Go to the documentation of this file.
1
10
12
13using namespace pandora;
14
15namespace lar_content
16{
17
18template <typename T>
19const std::string MopUpBaseAlgorithm::GetListName(const T *const pT) const
20{
21 std::string currentListName;
22 const MANAGED_CONTAINER<const T *> *pCurrentList(nullptr);
23 (void)PandoraContentApi::GetCurrentList(*this, pCurrentList, currentListName);
24
25 if (pCurrentList && (pCurrentList->end() != std::find(pCurrentList->begin(), pCurrentList->end(), pT)))
26 return currentListName;
27
28 for (const std::string &listName : m_daughterListNames)
29 {
30 const MANAGED_CONTAINER<const T *> *pList(nullptr);
31 (void)PandoraContentApi::GetList(*this, listName, pList);
32
33 if (pList && (pList->end() != std::find(pList->begin(), pList->end(), pT)))
34 return listName;
35 }
36
37 throw StatusCodeException(STATUS_CODE_NOT_FOUND);
38}
39
40//------------------------------------------------------------------------------------------------------------------------------------------
41
43{
45 STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadVectorOfValues(xmlHandle, "DaughterListNames", m_daughterListNames));
46
47 if (m_daughterListNames.empty())
48 {
49 std::cout << "MopUpBaseAlgorithm::ReadSettings - Must provide names of daughter object lists for use in mop up." << std::endl;
50 return STATUS_CODE_INVALID_PARAMETER;
51 }
52
53 return STATUS_CODE_SUCCESS;
54}
55
56//------------------------------------------------------------------------------------------------------------------------------------------
57//------------------------------------------------------------------------------------------------------------------------------------------
58
59template const std::string MopUpBaseAlgorithm::GetListName(const CaloHit *const) const;
60template const std::string MopUpBaseAlgorithm::GetListName(const MCParticle *const) const;
61template const std::string MopUpBaseAlgorithm::GetListName(const Track *const) const;
62template const std::string MopUpBaseAlgorithm::GetListName(const Cluster *const) const;
63template const std::string MopUpBaseAlgorithm::GetListName(const ParticleFlowObject *const) const;
64template const std::string MopUpBaseAlgorithm::GetListName(const Vertex *const) const;
65
66} // namespace lar_content
Grouping of header files for many classes of use in particle flow algorithms.
Header file for the mop up algorithm base class.
#define PANDORA_RETURN_RESULT_IF_AND_IF(StatusCode1, StatusCode2, Operator, Command)
Definition StatusCodes.h:31
static pandora::StatusCode GetCurrentList(const pandora::Algorithm &algorithm, const T *&pT)
Get the current list.
static pandora::StatusCode GetList(const pandora::Algorithm &algorithm, const std::string &listName, const T *&pT)
Get a named list.
virtual pandora::StatusCode ReadSettings(const pandora::TiXmlHandle xmlHandle)
Read the algorithm settings.
const std::string GetListName(const T *const pT) const
Find the name of the list hosting a specific object.
pandora::StringVector m_daughterListNames
The list of potential daughter object list names.
CaloHit class.
Definition CaloHit.h:26
Cluster class.
Definition Cluster.h:31
MCParticle class.
Definition MCParticle.h:26
ParticleFlowObject class.
StatusCodeException class.
Track class.
Definition Track.h:26
Vertex class.
Definition Vertex.h:26
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
StatusCode
The StatusCode enum.