CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
DDLTubs.cc
Go to the documentation of this file.
1 /***************************************************************************
2  DDLTubs.cpp - 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 
18 
20 #include "CLHEP/Units/GlobalSystemOfUnits.h"
21 
23  : DDLSolid( myreg )
24 {}
25 
27 {}
28 
29 // Upon encountering the end of a Tubs element, call DDCore.
30 void
32 {
33  DCOUT_V('P', "DDLTubs::processElement started");
34 
37  bool cutInside(false);
38 
39  if (atts.find("cutInside") != atts.end()) {
40  cutInside = (atts.find("cutInside")->second == "true") ? true : false;
41  }
42 
43  if (name == "Tubs")
44  {
45  DDSolid myTubs = DDSolidFactory::tubs( getDDName(nmspace),
46  ev.eval(nmspace, atts.find("dz")->second),
47  ev.eval(nmspace, atts.find("rMin")->second),
48  ev.eval(nmspace, atts.find("rMax")->second),
49  ev.eval(nmspace, atts.find("startPhi")->second),
50  ev.eval(nmspace, atts.find("deltaPhi")->second));
51  }
52  else if (name == "Tube")
53  {
54  DDSolid myTubs = DDSolidFactory::tubs( getDDName(nmspace),
55  ev.eval(nmspace, atts.find("dz")->second),
56  ev.eval(nmspace, atts.find("rMin")->second),
57  ev.eval(nmspace, atts.find("rMax")->second),
58  0,
59  360*deg );
60  }
61  else if (name == "TruncTubs")
62  {
64  ev.eval(nmspace, atts.find("zHalf")->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), //0. // startPhi
68  ev.eval(nmspace, atts.find("deltaPhi")->second),
69  ev.eval(nmspace, atts.find("cutAtStart")->second),
70  ev.eval(nmspace, atts.find("cutAtDelta")->second),
71  cutInside ); // cutInside
72  }
73  else
74  {
75  std::string msg = "\nDDLTubs::processElement could not process element.";
76  throwError(msg);
77  }
78  DDLSolid::setReference(nmspace, cpv);
79 
80  DCOUT_V('P', "DDLTubs::processElement completed");
81 
82 }
DDLTubs(DDLElementRegistry *myreg)
Constructor.
Definition: DDLTubs.cc:22
DDLElementRegistry * myRegistry_
Definition: DDXMLElement.h:186
void processElement(const std::string &name, const std::string &nmspace, DDCompactView &cpv)
Processing the element.
Definition: DDLTubs.cc:31
virtual const DDXMLAttribute & getAttributeSet(size_t aIndex=0) const
Get a "row" of attributes, i.e. one attribute set.
Definition: DDXMLElement.cc:79
void throwError(const std::string &keyMessage) const
format std::string for throw an error.
bool ev
~DDLTubs(void)
Destructor.
Definition: DDLTubs.cc:26
type of data representation of DDCompactView
Definition: DDCompactView.h:77
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 tubs(const DDName &name, double zhalf, double rIn, double rOut, double startPhi, double deltaPhi)
Definition: DDSolid.cc:788
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:750
#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