CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
DDLTrapezoid.cc
Go to the documentation of this file.
1 /***************************************************************************
2  DDLTrapezoid.cc - description
3  -------------------
4  begin : Mon Oct 29 2001
5  email : case@ucdhep.ucdavis.edu
6  ***************************************************************************/
7 
8 /***************************************************************************
9  * *
10  * DDDParser sub-component of DDD *
11  * *
12  ***************************************************************************/
13 
15 
19 
21 
23  : DDLSolid( myreg )
24 {}
25 
27 {}
28 
29 // Upon encountering an end of the tag, call DDCore's Trap.
30 void
32 {
33  DCOUT_V('P', "DDLTrapezoid::processElement started");
34 
36 
38 
39  double phi = 0.0;
40  double theta = 0.0;
41  double dy2 = 0.0;
42 
43  if (atts.find("phi") != atts.end())
44  phi = ev.eval(nmspace, atts.find("phi")->second);
45 
46  if (atts.find("theta") != atts.end())
47  theta = ev.eval(nmspace, atts.find("theta")->second);
48 
49  if (atts.find("dy2") != atts.end())
50  dy2 = ev.eval(nmspace, atts.find("dy2")->second);
51  else if (atts.find("dy1") != atts.end())
52  dy2 = ev.eval(nmspace, atts.find("dy1")->second);
53 
54  if (name == "Trapezoid")
55  {
56  DDSolid myTrap =
58  ev.eval(nmspace, atts.find("dz")->second),
59  theta,
60  phi,
61  ev.eval(nmspace, atts.find("h1")->second),
62  ev.eval(nmspace, atts.find("bl1")->second),
63  ev.eval(nmspace, atts.find("tl1")->second),
64  ev.eval(nmspace, atts.find("alp1")->second),
65  ev.eval(nmspace, atts.find("h2")->second),
66  ev.eval(nmspace, atts.find("bl2")->second),
67  ev.eval(nmspace, atts.find("tl2")->second),
68  ev.eval(nmspace, atts.find("alp2")->second));
69  }
70  else if (name == "Trd1")
71  {
72  DDSolid myTrd1 =
74  ev.eval(nmspace, atts.find("dz")->second),
75  0,
76  0,
77  ev.eval(nmspace, atts.find("dy1")->second),
78  ev.eval(nmspace, atts.find("dx1")->second),
79  ev.eval(nmspace, atts.find("dx1")->second),
80  0,
81  dy2,
82  ev.eval(nmspace, atts.find("dx2")->second),
83  ev.eval(nmspace, atts.find("dx2")->second),
84  0 );
85  }
86  else
87  {
88  std::string msg = "\nDDLTrapezoid::processElement failed to process element of name: "
89  + name
90  + ". It can only process Trapezoid and Trd1.";
91  throwError(msg);
92  }
93 
94  DDLSolid::setReference( nmspace, cpv );
95 
96  DCOUT_V('P', "DDLTrapezoid::processElement completed");
97 }
DDLTrapezoid(DDLElementRegistry *myreg)
Constructor.
Definition: DDLTrapezoid.cc:22
DDLElementRegistry * myRegistry_
Definition: DDXMLElement.h:186
virtual const DDXMLAttribute & getAttributeSet(size_t aIndex=0) const
Get a "row" of attributes, i.e. one attribute set.
Definition: DDXMLElement.cc:79
Geom::Theta< T > theta() const
void throwError(const std::string &keyMessage) const
format std::string for throw an error.
void processElement(const std::string &name, const std::string &nmspace, DDCompactView &cpv)
Processing the element.
Definition: DDLTrapezoid.cc:31
bool ev
type of data representation of DDCompactView
Definition: DDCompactView.h:76
~DDLTrapezoid(void)
Destructor.
Definition: DDLTrapezoid.cc:26
std::map< std::string, std::string > DDXMLAttribute
Definition: DDXMLElement.h:55
A DDSolid represents the shape of a part.
Definition: DDSolid.h:35
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:723
#define DCOUT_V(M_v_Y, M_v_S)
Definition: DDdebug.h:54
DDLSolid processes Box elements.
Definition: DDLSolid.h:27
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:86
void setReference(const std::string &nmspace, DDCompactView &cpv)
Definition: DDLSolid.cc:26