test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
DDLLogicalPart.cc
Go to the documentation of this file.
2 
3 #include <utility>
4 
10 
11 class DDCompactView;
12 
14  : DDXMLElement( myreg )
15 {
16  // initialize category map
17  catMap_["sensitive"] = DDEnums::sensitive;
18  catMap_["cable"] = DDEnums::cable;
19  catMap_["cooling"] = DDEnums::cooling;
20  catMap_["support"] = DDEnums::support;
21  catMap_["envelope"] = DDEnums::envelope;
22  catMap_["unspecified"] = DDEnums::unspecified;
23 }
24 
25 // upon initialization, we want to clear rMaterial and rSolid.
26 void
28 {
29  myRegistry_->getElement( "rMaterial" )->clear();
30  myRegistry_->getElement( "rSolid" )->clear();
31 }
32 
33 // Upon encountering the end of the LogicalPart element, retrieve all
34 // relevant information from its sub-elements and put it all together to
35 // call the DDCore appropriately.
36 //
37 // History: Initially only rSolid and rMaterial elements worked. Now,
38 // a Material or a Solid element inside the LogicalPart also works but
39 // this is handled outside this class. Each Solid inherits from DDLSolid
40 // and in each Solid, the processElement method must call the setReference
41 // of the DDLSolid. The Material element also works similarly. Thus,
42 // by retrieving the rMaterial and the rSolid it actually will be handling
43 // Material and Solid subelements as well.
44 
45 void
47 {
48  // rMaterial and rSolid
49  DDXMLElement* myrMaterial = myRegistry_->getElement("rMaterial"); // get Material reference child
50  DDXMLElement* myrSolid = myRegistry_->getElement("rSolid"); // get Solid reference child
51 
53 
54  DDSolid mySolid = DDSolid(myrSolid->getDDName(nmspace));
55  DDMaterial myMaterial = DDMaterial(myrMaterial->getDDName(nmspace));
56 
58 
59  if (atts.find("category") != atts.end())
60  cat = catMap_[atts.find("category")->second];
61  else
62  cat = catMap_["unspecified"];
63 
64  DDLogicalPart lp( getDDName( nmspace ), myMaterial, mySolid, cat );
65 
66  // clear all "children" and attributes
67  myrMaterial->clear();
68  myrSolid->clear();
69 
70  // after each logical part is made, we can clear it
71  clear();
72 }
DDLElementRegistry * myRegistry_
Definition: DDXMLElement.h:172
DDMaterial is used to define and access material information.
Definition: DDMaterial.h:41
virtual const DDXMLAttribute & getAttributeSet(size_t aIndex=0) const
Get a &quot;row&quot; of attributes, i.e. one attribute set.
Definition: DDXMLElement.cc:73
type of data representation of DDCompactView
Definition: DDCompactView.h:90
std::map< std::string, std::string > DDXMLAttribute
Definition: DDXMLElement.h:45
A DDSolid represents the shape of a part.
Definition: DDSolid.h:37
void processElement(const std::string &name, const std::string &nmspace, DDCompactView &cpv) override
Processing the element.
DDXMLElement * getElement(const std::string &name)
THE most important part. Getting the pointer to a given element type.
def cat
Definition: eostools.py:400
Category
Definition: DDEnums.h:7
A DDLogicalPart aggregates information concerning material, solid and sensitveness ...
Definition: DDLogicalPart.h:92
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:55
virtual const DDName getDDName(const std::string &defaultNS, const std::string &attname=std::string("name"), size_t aIndex=0)
Definition: DDXMLElement.cc:80
DDLLogicalPart(DDLElementRegistry *myreg)