CMS 3D CMS Logo

Functions
StandaloneTrackerTopology Namespace Reference

Functions

TrackerTopology fromTrackerParametersXMLFile (const std::string &xmlFileName)
 
TrackerTopology fromTrackerParametersXMLString (const std::string &xmlContent)
 

Function Documentation

TrackerTopology StandaloneTrackerTopology::fromTrackerParametersXMLFile ( const std::string &  xmlFileName)

Construct a TrackerTopology from a trackerParameters.xml file, from the name of the file

WARNING: this method has been introduced to construct a TrackerTopology object only for the rare cases where it cannot be retrieved from an edm::EventSetup (e.g. ROOT macros).

Definition at line 167 of file StandaloneTrackerTopology.cc.

References Exception, and AlCaHLTBitMon_QueryRunRegistry::string.

167  {
168  tinyxml2::XMLDocument xmlDoc;
169  xmlDoc.LoadFile(xmlFileName.c_str());
170  if (!xmlDoc.Error()) {
171  TrackerTopologyExtractor extr{};
172  xmlDoc.Accept(&extr);
173  return extr.getTrackerTopology();
174  } else {
175  throw cms::Exception("StandaloneTrackerTopology",
176  std::string{"Failed to parse file "} + xmlFileName + ": " + xmlDoc.ErrorStr());
177  }
178  }
TrackerTopology StandaloneTrackerTopology::fromTrackerParametersXMLString ( const std::string &  xmlContent)

Construct a TrackerTopology from a trackerParameters.xml file, from the contents read into a std::string

WARNING: this method has been introduced to construct a TrackerTopology object only for the rare cases where it cannot be retrieved from an edm::EventSetup (e.g. ROOT macros).

Definition at line 179 of file StandaloneTrackerTopology.cc.

References Exception, and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by FWGeometry::loadMap().

179  {
180  tinyxml2::XMLDocument xmlDoc;
181  xmlDoc.Parse(xmlContent.c_str());
182  if (!xmlDoc.Error()) {
183  TrackerTopologyExtractor extr{};
184  xmlDoc.Accept(&extr);
185  return extr.getTrackerTopology();
186  } else {
187  throw cms::Exception("StandaloneTrackerTopology", std::string{"Error while parsing XML: "} + xmlDoc.ErrorStr());
188  }
189  }