LDMX Software
det::utils Namespace Reference

Given a xml element with several daughters with the same name, e.g. More...

Functions

dd4hep::xml::Component getNodeByStrAttr (const dd4hep::xml::Handle_t &mother, const std::string &nodeName, const std::string &attrName, const std::string &attrValue)
 Retrieves the node component from a mother by the string names.
 
double getAttrValueWithFallback (const dd4hep::xml::Component &node, const std::string &attrName, const double &defaultValue)
 try to get attribute with double value, return defaultValue if attribute not found
 

Detailed Description

Given a xml element with several daughters with the same name, e.g.

<detector> <layer name="1" > <layer name="2"> </detector> this method returns the first daughter of type nodeName whose attribute has a given value e.g. returns <layer name="2"> when called with (detector, "layer", "name", "1")

Function Documentation

◆ getNodeByStrAttr()

dd4hep::xml::Component det::utils::getNodeByStrAttr ( const dd4hep::xml::Handle_t & mother,
const std::string & nodeName,
const std::string & attrName,
const std::string & attrValue )

Retrieves the node component from a mother by the string names.

Parameters
motherThe Handle to the mother volume
nodeNameThe name of the note
attrNameThe name of the Attribute
attrValueThe attribute value