File indexing completed on 2024-04-06 12:05:32
0001 #include "DetectorDescription/Parser/src/DDLLogicalPart.h"
0002 #include "DetectorDescription/Core/interface/DDLogicalPart.h"
0003 #include "DetectorDescription/Core/interface/DDMaterial.h"
0004 #include "DetectorDescription/Core/interface/DDSolid.h"
0005 #include "DetectorDescription/Parser/interface/DDLElementRegistry.h"
0006 #include "DetectorDescription/Parser/src/DDXMLElement.h"
0007
0008 #include <utility>
0009
0010 class DDCompactView;
0011
0012 DDLLogicalPart::DDLLogicalPart(DDLElementRegistry* myreg) : DDXMLElement(myreg) {
0013
0014 catMap_["sensitive"] = DDEnums::sensitive;
0015 catMap_["cable"] = DDEnums::cable;
0016 catMap_["cooling"] = DDEnums::cooling;
0017 catMap_["support"] = DDEnums::support;
0018 catMap_["envelope"] = DDEnums::envelope;
0019 catMap_["unspecified"] = DDEnums::unspecified;
0020 }
0021
0022
0023 void DDLLogicalPart::preProcessElement(const std::string& name, const std::string& nmspace, DDCompactView& cpv) {
0024 myRegistry_->getElement("rMaterial")->clear();
0025 myRegistry_->getElement("rSolid")->clear();
0026 }
0027
0028
0029
0030
0031
0032
0033
0034
0035
0036
0037
0038
0039
0040 void DDLLogicalPart::processElement(const std::string& name, const std::string& nmspace, DDCompactView& cpv) {
0041
0042 auto myrMaterial = myRegistry_->getElement("rMaterial");
0043 auto myrSolid = myRegistry_->getElement("rSolid");
0044
0045 DDXMLAttribute atts = getAttributeSet();
0046
0047 DDSolid mySolid = DDSolid(myrSolid->getDDName(nmspace));
0048 DDMaterial myMaterial = DDMaterial(myrMaterial->getDDName(nmspace));
0049
0050 DDEnums::Category cat;
0051
0052 if (atts.find("category") != atts.end())
0053 cat = catMap_[atts.find("category")->second];
0054 else
0055 cat = catMap_["unspecified"];
0056
0057 DDLogicalPart lp(getDDName(nmspace), myMaterial, mySolid, cat);
0058
0059
0060 myrMaterial->clear();
0061 myrSolid->clear();
0062
0063
0064 clear();
0065 }