Pandora
Pandora source code navigator
Loading...
Searching...
No Matches
LArMvaHelper.cc
Go to the documentation of this file.
1
10
11using namespace pandora;
12
13namespace lar_content
14{
15
17 const std::string &listName, StringVector &algorithmToolNameVector, AlgorithmToolMap &algorithmToolMap)
18{
19 // Fill a vector with names in the desired run order as well as the map
20
21 if ("algorithm" != xmlHandle.ToNode()->ValueStr())
22 return STATUS_CODE_NOT_ALLOWED;
23
24 const TiXmlHandle algorithmListHandle = TiXmlHandle(xmlHandle.FirstChild(listName).Element());
25
26 for (TiXmlElement *pXmlElement = algorithmListHandle.FirstChild("tool").Element(); nullptr != pXmlElement;
27 pXmlElement = pXmlElement->NextSiblingElement("tool"))
28 {
29 AlgorithmTool *pAlgorithmTool(nullptr);
30 PANDORA_RETURN_RESULT_IF(STATUS_CODE_SUCCESS, !=, PandoraContentApi::CreateAlgorithmTool(algorithm, pXmlElement, pAlgorithmTool));
31 std::string toolName = pXmlElement->Attribute("type");
32 // If already exists, then make the second have the instance name attached
33 if (algorithmToolMap.find(toolName) != algorithmToolMap.end())
34 toolName += "_" + pAlgorithmTool->GetInstanceName();
35 algorithmToolMap[toolName] = pAlgorithmTool;
36 algorithmToolNameVector.push_back(toolName);
37 }
38
39 return STATUS_CODE_SUCCESS;
40}
41
42} // namespace lar_content
#define PANDORA_RETURN_RESULT_IF(StatusCode1, Operator, Command)
Definition StatusCodes.h:19
static pandora::StatusCode CreateAlgorithmTool(const pandora::Algorithm &algorithm, pandora::TiXmlElement *const pXmlElement, pandora::AlgorithmTool *&pAlgorithmTool)
Create an algorithm tool instance, via one of the algorithm tool factories registered with pandora....
static pandora::StatusCode ProcessAlgorithmToolListToMap(const pandora::Algorithm &algorithm, const pandora::TiXmlHandle &xmlHandle, const std::string &listName, pandora::StringVector &algorithToolNameVector, AlgorithmToolMap &algorithmToolMap)
Process a list of algorithms tools in an xml file, using a map. Idea is for this to go to XmlHelper i...
std::map< std::string, pandora::AlgorithmTool * > AlgorithmToolMap
Algorithm class. Algorithm addresses are held only by the algorithm manager. They have a fully define...
Definition Algorithm.h:21
AlgorithmTool class. Algorithm tools will tend to be tailored for specific parent algorithms,...
const std::string & GetInstanceName() const
Get the instance name.
Definition Process.h:109
TiXmlElement * Element() const
Definition tinyxml.h:1710
TiXmlHandle FirstChild() const
Return a handle to the first child node.
Definition tinyxml.cc:1635
TiXmlNode * ToNode() const
Definition tinyxml.h:1692
const std::string & ValueStr() const
Definition tinyxml.h:501
std::vector< std::string > StringVector
StatusCode
The StatusCode enum.