CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Friends
DDSolid Class Reference

A DDSolid represents the shape of a part. More...

#include <DDSolid.h>

Inheritance diagram for DDSolid:
DDBase< DDName, std::unique_ptr< DDI::Solid > > DDBooleanSolid DDBox DDCons DDCutTubs DDEllipsoid DDEllipticalTube DDMultiUnionSolid DDOrb DDParallelepiped DDPolySolid DDPseudoTrap DDShapelessSolid DDSphere DDTorus DDTrap DDTruncTubs DDTubs

Public Member Functions

 DDSolid (const DDName &name)
 Creates a reference-object to a solid named name. More...
 
 DDSolid (void)
 Uninitialilzed solid reference-object; for further details on reference-objects see documentation of DDLogicalPart. More...
 
const std::vector< double > & parameters (void) const
 Give the parameters of the solid. More...
 
DDSolidShape shape (void) const
 The type of the solid. More...
 
double volume (void) const
 Returns the volume of the given solid (does not work with boolean soids !) More...
 
- Public Member Functions inherited from DDBase< DDName, std::unique_ptr< DDI::Solid > >
void create (const DDName &name)
 
void create (const DDName &name, std::unique_ptr< DDI::Solid > vals)
 
 DDBase ()
 
const DDNameddname () const
 
def_type isDefined () const
 
bool isValid () const
 true, if the wrapped pointer is valid More...
 
const DDNamename () const
 
 operator bool () const
 
bool operator< (const DDBase &b) const
 
bool operator== (const DDBase &b) const
 
bool operator> (const DDBase &b) const
 
DDI::rep_traits< DDName, std::unique_ptr< DDI::Solid > >::reference rep ()
 
const DDI::rep_traits< DDName, std::unique_ptr< DDI::Solid > >::reference rep () const
 
std::string toString () const
 
const DDI::rep_traits< DDName, std::unique_ptr< DDI::Solid > >::reference val ()
 
const DDI::rep_traits< DDName, std::unique_ptr< DDI::Solid > >::reference val () const
 
virtual ~DDBase ()
 

Private Member Functions

 DDSolid (const DDName &, DDSolidShape, const std::vector< double > &)
 
 DDSolid (const DDName &, std::unique_ptr< DDI::Solid >)
 

Friends

struct DDSolidFactory
 
std::ostream & operator<< (std::ostream &, const DDSolid &)
 

Additional Inherited Members

- Public Types inherited from DDBase< DDName, std::unique_ptr< DDI::Solid > >
using def_type = std::pair< const DDName *, bool >
 
using StoreT = DDI::Singleton< DDI::Store< DDName, std::unique_ptr< DDI::Solid > > >
 
- Static Public Member Functions inherited from DDBase< DDName, std::unique_ptr< DDI::Solid > >
static auto begin ()
 
static auto end ()
 

Detailed Description

A DDSolid represents the shape of a part.

An object of this class is a reference-object and thus is a lightweight class. It can be copied by value without having a large overhead. Assignment to the reference-object invalidates the object to which it was referred. Assignment also affects all other instances of this class which were created using the same value of DDName. In fact, the value of DDName identifies a DDSolid uniquely.

For further details concerning the usage of reference-objects refer to the documentation of DDLogicalPart.

Definition at line 39 of file DDSolid.h.

Constructor & Destructor Documentation

◆ DDSolid() [1/4]

DDSolid::DDSolid ( void  )

Uninitialilzed solid reference-object; for further details on reference-objects see documentation of DDLogicalPart.

Definition at line 49 of file DDSolid.cc.

◆ DDSolid() [2/4]

DDSolid::DDSolid ( const DDName name)

Creates a reference-object to a solid named name.

If the solid was not yet created using one of the solid generating factory functions DDbox(), DDtub , ... this constructor creates a (default) initialized reference object named name. It can be used as placeholder everywhere and becomes a reference to a valid solid as soon as one of the factory functions DDBox, ... has been called (using the same value for DDName).

For further details concerning reference-objects refer to the documentation of DDLogicalPart.

Definition at line 51 of file DDSolid.cc.

References DDBase< DDName, std::unique_ptr< DDI::Solid > >::create(), and DDBase< DDName, std::unique_ptr< DDI::Solid > >::name().

◆ DDSolid() [3/4]

DDSolid::DDSolid ( const DDName name,
std::unique_ptr< DDI::Solid solid 
)
private

◆ DDSolid() [4/4]

DDSolid::DDSolid ( const DDName name,
DDSolidShape  shape,
const std::vector< double > &  pars 
)
private

Definition at line 57 of file DDSolid.cc.

57  {
58  std::unique_ptr<DDI::Solid> solid(nullptr);
59  std::vector<double> dummy;
60  switch (shape) {
62  solid = std::make_unique<DDI::Box>(0, 0, 0);
63  break;
65  solid = std::make_unique<DDI::Tubs>(0, 0, 0, 0, 0);
66  break;
68  solid = std::make_unique<DDI::Cons>(0, 0, 0, 0, 0, 0, 0);
69  break;
71  solid = std::make_unique<DDI::PseudoTrap>(0, 0, 0, 0, 0, 0, false);
72  break;
74  solid = std::make_unique<DDI::Shapeless>();
75  break;
77  solid = std::make_unique<DDI::Trap>(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
78  break;
80  solid = std::make_unique<DDI::Polyhedra>(0, 0, 0, dummy, dummy);
81  break;
83  solid = std::make_unique<DDI::Polyhedra>(0, 0, 0, dummy, dummy, dummy);
84  break;
86  solid = std::make_unique<DDI::Polycone>(0, 0, dummy, dummy);
87  break;
89  solid = std::make_unique<DDI::Polycone>(0, 0, dummy, dummy, dummy);
90  break;
92  solid = std::make_unique<DDI::TruncTubs>(0, 0, 0, 0, 0, 0, 0, false);
93  break;
95  solid = std::make_unique<DDI::Torus>(0, 0, 0, 0, 0);
96  break;
98  solid = std::make_unique<DDI::Sphere>(0, 0, 0, 0, 0, 0);
99  break;
101  solid = std::make_unique<DDI::EllipticalTube>(0, 0, 0);
102  break;
104  solid = std::make_unique<DDI::CutTubs>(0., 0., 0., 0., 0., 0., 0., 1., 0., 0., -1.);
105  break;
107  solid = std::make_unique<DDI::ExtrudedPolygon>(dummy, dummy, dummy, dummy, dummy, dummy);
108  break;
109  default:
110  throw cms::Exception("DDException")
111  << "DDSolid::DDSolid( DDName, DDSolidShape, std::vector<double> ): wrong shape.";
112  }
113  solid->setParameters(pars);
114  create(name, std::move(solid));
115 }

References DDBase< DDName, std::unique_ptr< DDI::Solid > >::create(), ddbox, ddcons, ddcuttubs, ddellipticaltube, ddextrudedpolygon, ddpolycone_rrz, ddpolycone_rz, ddpolyhedra_rrz, ddpolyhedra_rz, ddpseudotrap, ddshapeless, ddsphere, ddtorus, ddtrap, ddtrunctubs, ddtubs, Exception, eostools::move(), DDBase< DDName, std::unique_ptr< DDI::Solid > >::name(), and shape().

Member Function Documentation

◆ parameters()

const std::vector< double > & DDSolid::parameters ( void  ) const

Give the parameters of the solid.

Definition at line 121 of file DDSolid.cc.

121 { return rep().parameters(); }

References DDBase< DDName, std::unique_ptr< DDI::Solid > >::rep().

Referenced by HcalTB02ParametersFromDD::build(), EcalSimParametersFromDD::build(), CSCGeometryParsFromDD::build(), GEMGeometryParsFromDD::buildChamber(), ME0GeometryBuilder::buildChamber(), GEMGeometryBuilderFromDDD::buildChamber(), GEMGeometryParsFromDD::buildEtaPartition(), ME0GeometryBuilder::buildEtaPartition(), GEMGeometryBuilderFromDDD::buildEtaPartition(), RPCGeometryParsFromDD::buildGeometry(), ME0GeometryBuilder::buildGeometry(), RPCGeometryBuilderFromDDD::buildGeometry(), ME0GeometryBuilder::buildLayer(), GEMGeometryParsFromDD::buildSuperChamber(), GEMGeometryBuilderFromDDD::buildSuperChamber(), DDG4SolidConverter::convert(), TGeoFromDddService::createShape(), DDTruncTubs::cutInside(), DDCompareBoolSol(), DDCompareSolid(), DDEcalBarrelNewAlgo::execute(), DDEcalBarrelAlgo::execute(), DDEcalEndcapAlgo::execute(), DTGeometryParsFromDD::extractParameters(), DTGeometryBuilderFromDDD::extractParameters(), ME0GeometryParsFromDD::getDimension(), DDPolySolid::getVec(), DreamSD::initMap(), HcalGeomParameters::loadGeometry(), EcalTBHodoscopeGeometryLoaderFromDDD::makeGeometry(), DDFilteredView::parameters(), DDPolyhedra::sides(), DDExtrudedPolygon::xVec(), DDExtrudedPolygon::yVec(), DDExtrudedPolygon::zscaleVec(), DDExtrudedPolygon::zVec(), DDExtrudedPolygon::zxVec(), and DDExtrudedPolygon::zyVec().

◆ shape()

DDSolidShape DDSolid::shape ( void  ) const

◆ volume()

double DDSolid::volume ( void  ) const

Returns the volume of the given solid (does not work with boolean soids !)

Definition at line 117 of file DDSolid.cc.

117 { return rep().volume(); }

References DDBase< DDName, std::unique_ptr< DDI::Solid > >::rep().

Friends And Related Function Documentation

◆ DDSolidFactory

friend struct DDSolidFactory
friend

Definition at line 41 of file DDSolid.h.

◆ operator<<

std::ostream& operator<< ( std::ostream &  os,
const DDSolid solid 
)
friend

Definition at line 33 of file DDSolid.cc.

33  {
35  if (defined.first) {
36  os << *(defined.first) << " ";
37  if (defined.second) {
38  os << " " << DDSolidShapesName::name(solid.shape()) << ": ";
39  solid.rep().stream(os);
40  } else {
41  os << "* solid not defined * ";
42  }
43  } else {
44  os << "* solid not declared * ";
45  }
46  return os;
47 }
DDBase::def_type
std::pair< const N *, bool > def_type
Definition: DDBase.h:51
DDSolidShape::ddtrap
DDSolidShape::ddtorus
DDBase::isDefined
def_type isDefined() const
Definition: DDBase.h:90
DDSolidShape::ddpseudotrap
DDSolidShape::ddpolyhedra_rrz
DDSolid::shape
DDSolidShape shape(void) const
The type of the solid.
Definition: DDSolid.cc:119
DDSolidShape::ddtubs
DDSolidShape::ddtrunctubs
DDSolidShape::ddpolyhedra_rz
DDBase< DDName, std::unique_ptr< DDI::Solid > >::name
const DDName & name() const
Definition: DDBase.h:59
DDBase< DDName, std::unique_ptr< DDI::Solid > >::rep
const DDI::rep_traits< DDName, std::unique_ptr< DDI::Solid > >::reference rep() const
Definition: DDBase.h:65
DDSolidShapesName::name
static const char *const name(DDSolidShape s)
Definition: DDSolidShapes.h:32
DDSolidShape::ddellipticaltube
DDSolidShape::ddsphere
DDSolidShape::ddcons
eostools.move
def move(src, dest)
Definition: eostools.py:511
DDSolidShape::ddbox
DDBase< DDName, std::unique_ptr< DDI::Solid > >::create
void create(const DDName &name, std::unique_ptr< DDI::Solid > vals)
Definition: DDBase.h:96
Exception
Definition: hltDiff.cc:246
DDSolidShape::ddextrudedpolygon
DDSolidShape::ddshapeless
DDSolidShape::ddcuttubs
DDSolidShape::ddpolycone_rrz
dummy
Definition: DummySelector.h:38
DDBase
Definition: DDBase.h:10
DDSolidShape::ddpolycone_rz