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 58 of file DDSolid.cc.

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

60 {
61  create( name );
62 }
Definition: DDBase.h:10
void create(const DDName &name, std::unique_ptr< DDI::Solid > vals)
Definition: DDBase.h:121
DDSolid::DDSolid ( const DDName name,
std::unique_ptr< DDI::Solid solid 
)
private

Definition at line 64 of file DDSolid.cc.

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

66 {
67  create( name, std::move( solid ));
68 }
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:121
DDSolid::DDSolid ( const DDName name,
DDSolidShape  shape,
const std::vector< double > &  pars 
)
private

Definition at line 70 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, funct::false, and eostools::move().

71 {
72  std::unique_ptr<DDI::Solid> solid( nullptr );
73  std::vector<double> dummy;
74  switch( shape ) {
76  solid = std::make_unique< DDI::Box >( 0, 0, 0 );
77  break;
79  solid = std::make_unique< DDI::Tubs >( 0, 0, 0, 0, 0 );
80  break;
82  solid = std::make_unique< DDI::Cons >( 0, 0, 0, 0, 0, 0, 0 );
83  break;
85  solid = std::make_unique< DDI::PseudoTrap >( 0, 0, 0, 0, 0, 0, false );
86  break;
88  solid = std::make_unique< DDI::Shapeless >( );
89  break;
91  solid = std::make_unique< DDI::Trap >( 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 );
92  break;
94  solid = std::make_unique< DDI::Polyhedra >( 0, 0, 0, dummy, dummy );
95  break;
97  solid = std::make_unique< DDI::Polyhedra >( 0, 0, 0, dummy, dummy, dummy );
98  break;
100  solid = std::make_unique< DDI::Polycone >( 0, 0, dummy, dummy );
101  break;
103  solid = std::make_unique< DDI::Polycone >( 0, 0, dummy, dummy, dummy );
104  break;
106  solid = std::make_unique< DDI::TruncTubs >( 0, 0, 0, 0, 0, 0, 0, false );
107  break;
109  solid = std::make_unique< DDI::Torus >( 0, 0, 0, 0, 0 );
110  break;
112  solid = std::make_unique< DDI::Sphere >( 0, 0, 0, 0, 0, 0 );
113  break;
115  solid = std::make_unique< DDI::EllipticalTube >( 0, 0, 0 );
116  break;
118  solid = std::make_unique< DDI::CutTubs >( 0., 0., 0., 0., 0., 0., 0., 1., 0., 0., -1. );
119  break;
121  solid = std::make_unique< DDI::ExtrudedPolygon >( dummy, dummy, dummy, dummy, dummy, dummy );
122  break;
123  default:
124  throw cms::Exception( "DDException" )
125  << "DDSolid::DDSolid( DDName, DDSolidShape, std::vector<double> ): wrong shape.";
126  }
127  solid->setParameters( pars );
128  create( name, std::move( solid ));
129 }
DDSolidShape shape(void) const
The type of the solid.
Definition: DDSolid.cc:138
def move(src, dest)
Definition: eostools.py:511
void create(const DDName &name, std::unique_ptr< DDI::Solid > vals)
Definition: DDBase.h:121

Member Function Documentation

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

Give the parameters of the solid.

Definition at line 144 of file DDSolid.cc.

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

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

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

The type of the solid.

Definition at line 138 of file DDSolid.cc.

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

Referenced by PrintGeomSummary::addSolid(), OutputMagneticFieldDDToDDL::addToSolStore(), OutputDDToDDL::addToSolStore(), 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(), DTGeometryBuilderFromDDD::extractParameters(), DTGeometryParsFromDD::extractParameters(), DreamSD::initMap(), HcalTB02SD::initMap(), ECalSD::initMap(), HcalGeomParameters::loadGeometry(), DDLDivision::makeDivider(), EcalTBHodoscopeGeometryLoaderFromDDD::makeGeometry(), operator<<(), MagGeoBuilderFromDDD::volumeHandle::referencePlane(), DDPolycone::rMaxVec(), DDPolyhedra::rMaxVec(), DDPolycone::rMinVec(), DDPolyhedra::rMinVec(), DDPolycone::rVec(), DDPolyhedra::rVec(), MagGeoBuilderFromDDD::volumeHandle::shape(), MagGeoBuilderFromDDD::volumeHandle::sides(), DDErrorDetection::so(), DDCoreToDDXMLOutput::solid(), DDG4SolidConverter::trunctubs(), MagGeoBuilderFromDDD::volumeHandle::volumeHandle(), DDPolycone::zVec(), and DDPolyhedra::zVec().

139 {
140  return rep().shape();
141 }
const DDI::rep_traits< DDName, std::unique_ptr< DDI::Solid > >::reference rep() const
Definition: DDBase.h:80
double DDSolid::volume ( void  ) const

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

Definition at line 132 of file DDSolid.cc.

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

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

Friends And Related Function Documentation

friend struct DDSolidFactory
friend

Definition at line 42 of file DDSolid.h.

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

Definition at line 36 of file DDSolid.cc.

37 {
39  if (defined.first) {
40  os << *(defined.first) << " ";
41  if (defined.second) {
42  os << " " << DDSolidShapesName::name(solid.shape()) << ": ";
43  solid.rep().stream(os);
44  }
45  else {
46  os << "* solid not defined * ";
47  }
48  }
49  else {
50  os << "* solid not declared * ";
51  }
52  return os;
53 }
def_type isDefined() const
Definition: DDBase.h:107
const DDI::rep_traits< N, C >::reference rep() const
Definition: DDBase.h:80
static const char *const name(DDSolidShape s)
Definition: DDSolidShapes.h:17
DDSolidShape shape(void) const
The type of the solid.
Definition: DDSolid.cc:138
std::pair< const N *, bool > def_type
Definition: DDBase.h:66