CMS 3D CMS Logo

DDLLogicalPart.cc
Go to the documentation of this file.
7 
8 #include <utility>
9 
10 class DDCompactView;
11 
13  // initialize category map
14  catMap_["sensitive"] = DDEnums::sensitive;
15  catMap_["cable"] = DDEnums::cable;
16  catMap_["cooling"] = DDEnums::cooling;
17  catMap_["support"] = DDEnums::support;
18  catMap_["envelope"] = DDEnums::envelope;
19  catMap_["unspecified"] = DDEnums::unspecified;
20 }
21 
22 // upon initialization, we want to clear rMaterial and rSolid.
24  myRegistry_->getElement("rMaterial")->clear();
25  myRegistry_->getElement("rSolid")->clear();
26 }
27 
28 // Upon encountering the end of the LogicalPart element, retrieve all
29 // relevant information from its sub-elements and put it all together to
30 // call the DDCore appropriately.
31 //
32 // History: Initially only rSolid and rMaterial elements worked. Now,
33 // a Material or a Solid element inside the LogicalPart also works but
34 // this is handled outside this class. Each Solid inherits from DDLSolid
35 // and in each Solid, the processElement method must call the setReference
36 // of the DDLSolid. The Material element also works similarly. Thus,
37 // by retrieving the rMaterial and the rSolid it actually will be handling
38 // Material and Solid subelements as well.
39 
41  // rMaterial and rSolid
42  auto myrMaterial = myRegistry_->getElement("rMaterial"); // get Material reference child
43  auto myrSolid = myRegistry_->getElement("rSolid"); // get Solid reference child
44 
46 
47  DDSolid mySolid = DDSolid(myrSolid->getDDName(nmspace));
48  DDMaterial myMaterial = DDMaterial(myrMaterial->getDDName(nmspace));
49 
51 
52  if (atts.find("category") != atts.end())
53  cat = catMap_[atts.find("category")->second];
54  else
55  cat = catMap_["unspecified"];
56 
57  DDLogicalPart lp(getDDName(nmspace), myMaterial, mySolid, cat);
58 
59  // clear all "children" and attributes
60  myrMaterial->clear();
61  myrSolid->clear();
62 
63  // after each logical part is made, we can clear it
64  clear();
65 }
DDXMLElement::clear
virtual void clear(void)
clear this element's contents.
Definition: DDXMLElement.cc:40
DDEnums::support
Definition: DDEnums.h:7
DDEnums::sensitive
Definition: DDEnums.h:7
DDLLogicalPart::preProcessElement
void preProcessElement(const std::string &name, const std::string &nmspace, DDCompactView &cpv) override
Called by loadAttributes AFTER attributes are loaded.
Definition: DDLLogicalPart.cc:23
eostools.cat
def cat(path)
Definition: eostools.py:401
DDLElementRegistry
The main class for processing parsed elements.
Definition: DDLElementRegistry.h:23
DDEnums::cable
Definition: DDEnums.h:7
DDEnums::cooling
Definition: DDEnums.h:7
DDXMLElement::getAttributeSet
virtual const DDXMLAttribute & getAttributeSet(size_t aIndex=0) const
Get a "row" of attributes, i.e. one attribute set.
Definition: DDXMLElement.cc:54
DDMaterial
DDMaterial is used to define and access material information.
Definition: DDMaterial.h:45
DDEnums::envelope
Definition: DDEnums.h:7
DDCompactView
Compact representation of the geometrical detector hierarchy.
Definition: DDCompactView.h:81
DDSolid.h
DDXMLAttribute
std::map< std::string, std::string > DDXMLAttribute
Definition: DDXMLElement.h:45
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
DDEnums::Category
Category
Definition: DDEnums.h:7
DDLogicalPart
A DDLogicalPart aggregates information concerning material, solid and sensitveness ....
Definition: DDLogicalPart.h:93
DDXMLElement
This is a base class for processing XML elements in the DDD.
Definition: DDXMLElement.h:48
DDMaterial.h
DDLLogicalPart::DDLLogicalPart
DDLLogicalPart(DDLElementRegistry *myreg)
Definition: DDLLogicalPart.cc:12
DDLLogicalPart::processElement
void processElement(const std::string &name, const std::string &nmspace, DDCompactView &cpv) override
Processing the element.
Definition: DDLLogicalPart.cc:40
DDEnums::unspecified
Definition: DDEnums.h:7
DDLElementRegistry.h
DDLogicalPart.h
DDXMLElement::getDDName
const virtual DDName getDDName(const std::string &defaultNS, const std::string &attname=std::string("name"), size_t aIndex=0)
Definition: DDXMLElement.cc:56
DDLElementRegistry::getElement
std::shared_ptr< DDXMLElement > getElement(const std::string &name)
THE most important part. Getting the pointer to a given element type.
Definition: DDLElementRegistry.cc:42
DDXMLElement.h
DDLLogicalPart.h
Skims_PA_cff.name
name
Definition: Skims_PA_cff.py:17
DDSolid
A DDSolid represents the shape of a part.
Definition: DDSolid.h:39
DDXMLElement::myRegistry_
DDLElementRegistry * myRegistry_
Definition: DDXMLElement.h:173
DDLLogicalPart::catMap_
std::map< std::string, DDEnums::Category > catMap_
Definition: DDLLogicalPart.h:42