MopUpBaseAlgorithm.cc
Go to the documentation of this file.
1 /**
2  * @file larpandoracontent/LArUtility/MopUpBaseAlgorithm.cc
3  *
4  * @brief Implementation of the mop up algorithm base class.
5  *
6  * $Log: $
7  */
8 
9 #include "Pandora/AlgorithmHeaders.h"
10 
12 
13 using namespace pandora;
14 
15 namespace lar_content
16 {
17 
18 template <typename T>
19 const 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 
42 StatusCode MopUpBaseAlgorithm::ReadSettings(const TiXmlHandle xmlHandle)
43 {
44  PANDORA_RETURN_RESULT_IF_AND_IF(
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 
59 template const std::string MopUpBaseAlgorithm::GetListName(const CaloHit *const) const;
60 template const std::string MopUpBaseAlgorithm::GetListName(const MCParticle *const) const;
61 template const std::string MopUpBaseAlgorithm::GetListName(const Track *const) const;
62 template const std::string MopUpBaseAlgorithm::GetListName(const Cluster *const) const;
63 template const std::string MopUpBaseAlgorithm::GetListName(const ParticleFlowObject *const) const;
64 template const std::string MopUpBaseAlgorithm::GetListName(const Vertex *const) const;
65 
66 } // namespace lar_content
std::string string
Definition: nybbler.cc:12
Header file for the mop up algorithm base class.
boost::graph_traits< ModuleGraph >::vertex_descriptor Vertex
Definition: ModuleGraph.h:25
TrackCollectionProxyElement< TrackCollProxy > Track
Proxy to an element of a proxy collection of recob::Track objects.
Definition: Track.h:1036
QTextStream & endl(QTextStream &s)