CMS 3D CMS Logo

DDLTubs.cc
Go to the documentation of this file.
7 #include "CLHEP/Units/GlobalSystemOfUnits.h"
8 #include "CLHEP/Units/SystemOfUnits.h"
9 
10 #include <map>
11 #include <utility>
12 
13 class DDCompactView;
14 
16  : DDLSolid( myreg )
17 {}
18 
19 // Upon encountering the end of a Tubs element, call DDCore.
20 void
22 {
25  bool cutInside(false);
26 
27  if (atts.find("cutInside") != atts.end()) {
28  cutInside = (atts.find("cutInside")->second == "true") ? true : false;
29  }
30 
31  if (name == "Tubs")
32  {
33  DDSolid myTubs = DDSolidFactory::tubs( getDDName(nmspace),
34  ev.eval(nmspace, atts.find("dz")->second),
35  ev.eval(nmspace, atts.find("rMin")->second),
36  ev.eval(nmspace, atts.find("rMax")->second),
37  ev.eval(nmspace, atts.find("startPhi")->second),
38  ev.eval(nmspace, atts.find("deltaPhi")->second));
39  }
40  else if (name == "Tube")
41  {
42  DDSolid myTubs = DDSolidFactory::tubs( getDDName(nmspace),
43  ev.eval(nmspace, atts.find("dz")->second),
44  ev.eval(nmspace, atts.find("rMin")->second),
45  ev.eval(nmspace, atts.find("rMax")->second),
46  0,
47  360*deg );
48  }
49  else if (name == "TruncTubs")
50  {
52  ev.eval(nmspace, atts.find("zHalf")->second),
53  ev.eval(nmspace, atts.find("rMin")->second),
54  ev.eval(nmspace, atts.find("rMax")->second),
55  ev.eval(nmspace, atts.find("startPhi")->second), //0. // startPhi
56  ev.eval(nmspace, atts.find("deltaPhi")->second),
57  ev.eval(nmspace, atts.find("cutAtStart")->second),
58  ev.eval(nmspace, atts.find("cutAtDelta")->second),
59  cutInside ); // cutInside
60  }
61  else if (name == "CutTubs")
62  {
63  DDSolid myTubs = DDSolidFactory::cuttubs( getDDName(nmspace),
64  ev.eval(nmspace, atts.find("dz")->second),
65  ev.eval(nmspace, atts.find("rMin")->second),
66  ev.eval(nmspace, atts.find("rMax")->second),
67  ev.eval(nmspace, atts.find("startPhi")->second),
68  ev.eval(nmspace, atts.find("deltaPhi")->second),
69  ev.eval(nmspace, atts.find("lx")->second),
70  ev.eval(nmspace, atts.find("ly")->second),
71  ev.eval(nmspace, atts.find("lz")->second),
72  ev.eval(nmspace, atts.find("tx")->second),
73  ev.eval(nmspace, atts.find("ty")->second),
74  ev.eval(nmspace, atts.find("tz")->second));
75  }
76  else
77  {
78  std::string msg = "\nDDLTubs::processElement could not process element.";
79  throwError(msg);
80  }
81  DDLSolid::setReference(nmspace, cpv);
82 }
DDLTubs(DDLElementRegistry *myreg)
Definition: DDLTubs.cc:15
DDLElementRegistry * myRegistry_
Definition: DDXMLElement.h:172
void processElement(const std::string &name, const std::string &nmspace, DDCompactView &cpv) override
Processing the element.
Definition: DDLTubs.cc:21
virtual const DDXMLAttribute & getAttributeSet(size_t aIndex=0) const
Get a "row" of attributes, i.e. one attribute set.
Definition: DDXMLElement.cc:72
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
static DDSolid cuttubs(const DDName &name, double zhalf, double rIn, double rOut, double startPhi, double deltaPhi, double lx, double ly, double lz, double tx, double ty, double tz)
Definition: DDSolid.cc:995
ClhepEvaluator & evaluator()
static DDSolid tubs(const DDName &name, double zhalf, double rIn, double rOut, double startPhi, double deltaPhi)
Definition: DDSolid.cc:986
static DDSolid truncTubs(const DDName &name, double zHalf, double rIn, double rOut, double startPhi, double deltaPhi, double cutAtStart, double cutAtDelta, bool cutInside)
Definition: DDSolid.cc:945
DDLSolid processes Box elements.
Definition: DDLSolid.h:30
tuple msg
Definition: mps_check.py:277
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:79
void setReference(const std::string &nmspace, DDCompactView &cpv)
Definition: DDLSolid.cc:16