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 (void)
 Uninitialilzed solid reference-object; for further details on reference-objects see documentation of DDLogicalPart. More...
 
 DDSolid (const DDName &name)
 Creates a reference-object to a solid named name. 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, std::unique_ptr< DDI::Solid > vals)
 
void create (const DDName &name)
 
 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
 
const DDI::rep_traits< DDName, std::unique_ptr< DDI::Solid > >::reference rep () const
 
DDI::rep_traits< DDName, std::unique_ptr< DDI::Solid > >::reference rep ()
 
std::string toString () const
 
const DDI::rep_traits< DDName, std::unique_ptr< DDI::Solid > >::reference val () const
 
const DDI::rep_traits< DDName, std::unique_ptr< DDI::Solid > >::reference val ()
 
virtual ~DDBase ()
 

Private Member Functions

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

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::DDSolid ( void  )
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().

Definition: DDBase.h:10
void create(const DDName &name, std::unique_ptr< DDI::Solid > vals)
Definition: DDBase.h:96
DDSolid::DDSolid ( const DDName name,
std::unique_ptr< DDI::Solid solid 
)
private

Definition at line 53 of file DDSolid.cc.

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

54  create(name, std::move(solid));
55 }
Definition: DDBase.h:10
def move(src, dest)
Definition: eostools.py:511
void create(const DDName &name, std::unique_ptr< DDI::Solid > vals)
Definition: DDBase.h:96
DDSolid::DDSolid ( const DDName name,
DDSolidShape  shape,
const std::vector< double > &  pars 
)
private

Definition at line 57 of file DDSolid.cc.

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, and eostools::move().

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 }
DDSolidShape shape(void) const
The type of the solid.
Definition: DDSolid.cc:119
def move(src, dest)
Definition: eostools.py:511
void create(const DDName &name, std::unique_ptr< DDI::Solid > vals)
Definition: DDBase.h:96

Member Function Documentation

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

Give the parameters of the solid.

Definition at line 121 of file DDSolid.cc.

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

Referenced by EcalSimParametersFromDD::build(), CSCGeometryParsFromDD::build(), GEMGeometryParsFromDD::buildChamber(), ME0GeometryBuilderFromDDD::buildChamber(), GEMGeometryBuilderFromDDD::buildChamber(), GEMGeometryParsFromDD::buildEtaPartition(), ME0GeometryBuilderFromDDD::buildEtaPartition(), GEMGeometryBuilderFromDDD::buildEtaPartition(), ME0GeometryBuilderFromDDD::buildGeometry(), RPCGeometryParsFromDD::buildGeometry(), RPCGeometryBuilderFromDDD::buildGeometry(), ME0GeometryBuilderFromDDD::buildLayer(), GEMGeometryParsFromDD::buildSuperChamber(), GEMGeometryBuilderFromDDD::buildSuperChamber(), DDG4SolidConverter::convert(), TGeoFromDddService::createShape(), DDTruncTubs::cutInside(), DDCompareBoolSol(), DDCompareSolid(), ddstats(), DDEcalBarrelNewAlgo::execute(), DDEcalBarrelAlgo::execute(), DDEcalEndcapAlgo::execute(), DTGeometryParsFromDD::extractParameters(), DTGeometryBuilderFromDDD::extractParameters(), ME0GeometryParsFromDD::getDimension(), DDPolySolid::getVec(), DreamSD::initMap(), HcalTB02SD::initMap(), ECalSD::initMap(), Vispa.Plugins.ConfigEditor.ConfigDataAccessor.ConfigDataAccessor::inputTags(), HcalGeomParameters::loadGeometry(), EcalTBHodoscopeGeometryLoaderFromDDD::makeGeometry(), DDFilteredView::parameters(), Vispa.Plugins.ConfigEditor.ConfigDataAccessor.ConfigDataAccessor::properties(), Vispa.Plugins.ConfigEditor.ConfigDataAccessor.ConfigDataAccessor::recursePSetProperties(), DDPolyhedra::sides(), and DDExtrudedPolygon::xyPointsSize().

121 { return rep().parameters(); }
const DDI::rep_traits< DDName, std::unique_ptr< DDI::Solid > >::reference rep() const
Definition: DDBase.h:65
DDSolidShape DDSolid::shape ( void  ) const

The type of the solid.

Definition at line 119 of file DDSolid.cc.

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

Referenced by PrintGeomSummary::addSolid(), OutputMagneticFieldDDToDDL::addToSolStore(), OutputDDToDDL::addToSolStore(), EcalSimParametersFromDD::build(), CSCGeometryParsFromDD::build(), DDG4SolidConverter::convert(), TGeoFromDddService::createShape(), DDBox::DDBox(), DDCheckLP(), DDCompareBoolSol(), DDCompareSolid(), DDCons::DDCons(), DDCutTubs::DDCutTubs(), DDEllipticalTube::DDEllipticalTube(), DDExtrudedPolygon::DDExtrudedPolygon(), DDIntersection::DDIntersection(), DDPolycone::DDPolycone(), DDPolyhedra::DDPolyhedra(), DDPseudoTrap::DDPseudoTrap(), DDShapelessSolid::DDShapelessSolid(), DDSphere::DDSphere(), DDSubtraction::DDSubtraction(), DDTorus::DDTorus(), DDTrap::DDTrap(), DDTruncTubs::DDTruncTubs(), DDTubs::DDTubs(), DDUnion::DDUnion(), DTGeometryParsFromDD::extractParameters(), DTGeometryBuilderFromDDD::extractParameters(), DreamSD::initMap(), HcalTB02SD::initMap(), ECalSD::initMap(), HcalGeomParameters::loadGeometry(), HGCalGeomParameters::loadGeometryHexagon(), DDLDivision::makeDivider(), EcalTBHodoscopeGeometryLoaderFromDDD::makeGeometry(), operator<<(), MagGeoBuilderFromDDD::volumeHandle::referencePlane(), DDPolycone::rMaxVec(), DDPolyhedra::rMaxVec(), DDPolycone::rMinVec(), DDPolyhedra::rMinVec(), DDPolycone::rVec(), DDPolyhedra::rVec(), MagGeoBuilderFromDDD::volumeHandle::shape(), DDFilteredView::shape(), MagGeoBuilderFromDDD::volumeHandle::sides(), DDErrorDetection::so(), DDCoreToDDXMLOutput::solid(), DDG4SolidConverter::trunctubs(), MagGeoBuilderFromDDD::volumeHandle::volumeHandle(), DDPolycone::zVec(), and DDPolyhedra::zVec().

119 { return rep().shape(); }
const DDI::rep_traits< DDName, std::unique_ptr< DDI::Solid > >::reference rep() const
Definition: DDBase.h:65
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.

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

117 { return rep().volume(); }
const DDI::rep_traits< DDName, std::unique_ptr< DDI::Solid > >::reference rep() const
Definition: DDBase.h:65

Friends And Related Function Documentation

friend struct DDSolidFactory
friend

Definition at line 41 of file DDSolid.h.

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 }
def_type isDefined() const
Definition: DDBase.h:90
const DDI::rep_traits< N, C >::reference rep() const
Definition: DDBase.h:65
static const char *const name(DDSolidShape s)
Definition: DDSolidShapes.h:32
DDSolidShape shape(void) const
The type of the solid.
Definition: DDSolid.cc:119
std::pair< const N *, bool > def_type
Definition: DDBase.h:51