CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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 }
DDLElementRegistry * myRegistry_
Definition: DDXMLElement.h:173
DDMaterial is used to define and access material information.
Definition: DDMaterial.h:45
virtual const DDXMLAttribute & getAttributeSet(size_t aIndex=0) const
Get a &quot;row&quot; of attributes, i.e. one attribute set.
Definition: DDXMLElement.cc:54
Compact representation of the geometrical detector hierarchy.
Definition: DDCompactView.h:81
std::map< std::string, std::string > DDXMLAttribute
Definition: DDXMLElement.h:45
A DDSolid represents the shape of a part.
Definition: DDSolid.h:39
void processElement(const std::string &name, const std::string &nmspace, DDCompactView &cpv) override
Processing the element.
def cat
Definition: eostools.py:401
std::shared_ptr< DDXMLElement > getElement(const std::string &name)
THE most important part. Getting the pointer to a given element type.
Category
Definition: DDEnums.h:7
A DDLogicalPart aggregates information concerning material, solid and sensitveness ...
Definition: DDLogicalPart.h:93
This is a base class for processing XML elements in the DDD.
Definition: DDXMLElement.h:48
void preProcessElement(const std::string &name, const std::string &nmspace, DDCompactView &cpv) override
Called by loadAttributes AFTER attributes are loaded.
std::map< std::string, DDEnums::Category > catMap_
The main class for processing parsed elements.
virtual void clear(void)
clear this element&#39;s contents.
Definition: DDXMLElement.cc:40
virtual const DDName getDDName(const std::string &defaultNS, const std::string &attname=std::string("name"), size_t aIndex=0)
Definition: DDXMLElement.cc:56
DDLLogicalPart(DDLElementRegistry *myreg)