CMS 3D CMS Logo

DDLTrapezoid.cc
Go to the documentation of this file.
2 
3 #include <map>
4 #include <utility>
5 
11 
12 class DDCompactView;
13 
15  : DDLSolid( myreg )
16 {}
17 
18 // Upon encountering an end of the tag, call DDCore's Trap.
19 void
21 {
23 
25 
26  double phi = 0.0;
27  double theta = 0.0;
28  double dy2 = 0.0;
29 
30  if (atts.find("phi") != atts.end())
31  phi = ev.eval(nmspace, atts.find("phi")->second);
32 
33  if (atts.find("theta") != atts.end())
34  theta = ev.eval(nmspace, atts.find("theta")->second);
35 
36  if (atts.find("dy2") != atts.end())
37  dy2 = ev.eval(nmspace, atts.find("dy2")->second);
38  else if (atts.find("dy1") != atts.end())
39  dy2 = ev.eval(nmspace, atts.find("dy1")->second);
40 
41  if (name == "Trapezoid")
42  {
43  DDSolid myTrap =
45  ev.eval(nmspace, atts.find("dz")->second),
46  theta,
47  phi,
48  ev.eval(nmspace, atts.find("h1")->second),
49  ev.eval(nmspace, atts.find("bl1")->second),
50  ev.eval(nmspace, atts.find("tl1")->second),
51  ev.eval(nmspace, atts.find("alp1")->second),
52  ev.eval(nmspace, atts.find("h2")->second),
53  ev.eval(nmspace, atts.find("bl2")->second),
54  ev.eval(nmspace, atts.find("tl2")->second),
55  ev.eval(nmspace, atts.find("alp2")->second));
56  }
57  else if (name == "Trd1")
58  {
59  DDSolid myTrd1 =
61  ev.eval(nmspace, atts.find("dz")->second),
62  0,
63  0,
64  ev.eval(nmspace, atts.find("dy1")->second),
65  ev.eval(nmspace, atts.find("dx1")->second),
66  ev.eval(nmspace, atts.find("dx1")->second),
67  0,
68  dy2,
69  ev.eval(nmspace, atts.find("dx2")->second),
70  ev.eval(nmspace, atts.find("dx2")->second),
71  0 );
72  }
73  else
74  {
75  std::string msg = "\nDDLTrapezoid::processElement failed to process element of name: "
76  + name
77  + ". It can only process Trapezoid and Trd1.";
78  throwError(msg);
79  }
80 
81  DDLSolid::setReference( nmspace, cpv );
82 }
DDLTrapezoid(DDLElementRegistry *myreg)
Definition: DDLTrapezoid.cc:14
DDLElementRegistry * myRegistry_
Definition: DDXMLElement.h:172
void processElement(const std::string &name, const std::string &nmspace, DDCompactView &cpv) override
Processing the element.
Definition: DDLTrapezoid.cc:20
virtual const DDXMLAttribute & getAttributeSet(size_t aIndex=0) const
Get a "row" of attributes, i.e. one attribute set.
Definition: DDXMLElement.cc:73
Geom::Theta< T > theta() const
void throwError(const std::string &keyMessage) const
format std::string for throw an error.
bool ev
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:38
ClhepEvaluator & evaluator()
static DDSolid trap(const DDName &name, double pDz, double pTheta, double pPhi, double pDy1, double pDx1, double pDx2, double pAlp1, double pDy2, double pDx3, double pDx4, double pAlp2)
Definition: DDSolid.cc:914
DDLSolid processes Box elements.
Definition: DDLSolid.h:30
double eval(const std::string &ns, const std::string &expr)
The main class for processing parsed elements.
virtual const DDName getDDName(const std::string &defaultNS, const std::string &attname=std::string("name"), size_t aIndex=0)
Definition: DDXMLElement.cc:80
void setReference(const std::string &nmspace, DDCompactView &cpv)
Definition: DDLSolid.cc:17