CMS 3D CMS Logo

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