Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:05:32

0001 #include "DetectorDescription/Parser/src/DDLMaterial.h"
0002 #include "DetectorDescription/Parser/interface/DDLElementRegistry.h"
0003 #include "DetectorDescription/Parser/src/DDXMLElement.h"
0004 
0005 #include <map>
0006 #include <utility>
0007 #include <vector>
0008 
0009 class DDCompactView;
0010 
0011 DDLMaterial::DDLMaterial(DDLElementRegistry* myreg) : DDXMLElement(myreg) {}
0012 
0013 void DDLMaterial::setReference(const std::string& nmspace, DDCompactView& cpv) {
0014   // in case it there were any rMaterials
0015   myRegistry_->getElement("rMaterial")->clear();
0016 
0017   // Attempt to make sure Material elements can be in LogicalPart elements.
0018   if (myRegistry_->getElement("LogicalPart")->size() > 0) {
0019     auto refmat = myRegistry_->getElement("rMaterial");
0020     std::vector<std::string> names;
0021     std::vector<std::string> values;
0022     names.emplace_back("name");
0023     DDXMLAttribute atts = getAttributeSet();
0024     values.emplace_back(atts.find("name")->second);
0025     refmat->loadAttributes("rMaterial", names, values, nmspace, cpv);
0026   }
0027   // clear THIS material's values.
0028   clear();
0029 }