LArSoft  v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
LArMvaHelper.cc
Go to the documentation of this file.
1 
10 
11 using namespace pandora;
12 
13 namespace lar_content
14 {
15 
16 StatusCode LArMvaHelper::ProcessAlgorithmToolListToMap(const Algorithm &algorithm, const TiXmlHandle &xmlHandle,
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
std::map< std::string, pandora::AlgorithmTool * > AlgorithmToolMap
Definition: LArMvaHelper.h:79