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, 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, DDI::Solid * >
 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, DDI::Solid * >::reference rep () const
 
DDI::rep_traits< DDName, DDI::Solid * >::reference rep ()
 
std::string toString () const
 
const DDI::rep_traits< DDName, DDI::Solid * >::reference val () const
 
const DDI::rep_traits< DDName, DDI::Solid * >::reference val ()
 
virtual ~DDBase ()
 

Private Member Functions

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

Friends

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

Additional Inherited Members

- Public Types inherited from DDBase< DDName, DDI::Solid * >
typedef std::pair< const DDName *, bool > def_type
 
typedef DDI::Solidpimpl_type
 
typedef DDI::rep_type< DDName, pimpl_type > * prep_type
 
typedef DDI::Singleton< DDI::Store< DDName, DDI::Solid * > > StoreT
 
- Static Public Member Functions inherited from DDBase< DDName, DDI::Solid * >
static auto begin ()
 
static void clear ()
 
static auto end ()
 
static size_t size ()
 
- Protected Attributes inherited from DDBase< DDName, DDI::Solid * >
prep_type prep_
 

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

References DDI::Singleton< I >::instance(), and DDBase< DDName, DDI::Solid * >::prep_.

61 {
62  prep_ = StoreT::instance().create(n);
63 }
Definition: DDBase.h:10
static value_type & instance()
DDSolid::DDSolid ( const DDName n,
DDI::Solid s 
)
private

Definition at line 65 of file DDSolid.cc.

References DDI::Singleton< I >::instance(), and DDBase< DDName, DDI::Solid * >::prep_.

67 {
68  prep_ = StoreT::instance().create(n,s);
69 }
Definition: DDBase.h:10
static value_type & instance()
DDSolid::DDSolid ( const DDName n,
DDSolidShape  s,
const std::vector< double > &  p 
)
private

Definition at line 71 of file DDSolid.cc.

References ddbox, ddcons, ddcuttubs, ddellipticaltube, ddextrudedpolygon, ddpolycone_rrz, ddpolycone_rz, ddpolyhedra_rrz, ddpolyhedra_rz, ddpseudotrap, ddshapeless, ddsphere, ddtorus, ddtrap, ddtrunctubs, ddtubs, Exception, HGCalGeometryMode::ExtrudedPolygon, DDI::Singleton< I >::instance(), HGCalGeometryMode::Polyhedra, DDBase< DDName, DDI::Solid * >::prep_, and DDI::Solid::setParameters().

72 {
73  DDI::Solid * solid(nullptr);
74  std::vector<double> dummy;
75  switch(s) {
77  solid = new DDI::Box(0,0,0);
78  break;
80  solid = new DDI::Tubs(0,0,0,0,0);
81  break;
83  solid = new DDI::Cons(0,0,0,0,0,0,0);
84  break;
86  solid = new DDI::PseudoTrap(0,0,0,0,0,0,false);
87  break;
89  solid = new DDI::Shapeless();
90  break;
92  solid = new DDI::Trap(0,0,0,0,0,0,0,0,0,0,0);
93  break;
95  solid = new DDI::Polyhedra(0,0,0,dummy,dummy);
96  break;
98  solid = new DDI::Polyhedra(0,0,0,dummy,dummy,dummy);
99  break;
101  solid = new DDI::Polycone(0,0,dummy,dummy);
102  break;
104  solid = new DDI::Polycone(0,0,dummy,dummy,dummy);
105  break;
107  solid = new DDI::TruncTubs(0,0,0,0,0,0,0,false);
108  break;
110  solid = new DDI::Torus(0,0,0,0,0);
111  break;
113  solid = new DDI::Sphere(0,0,0,0,0,0);
114  break;
116  solid = new DDI::EllipticalTube(0,0,0);
117  break;
119  solid = new DDI::CutTubs(0.,0.,0.,0.,0.,0.,0.,1.,0.,0.,-1.);
120  break;
122  solid = new DDI::ExtrudedPolygon( dummy, dummy, dummy, dummy, dummy, dummy );
123  break;
124  default:
125  throw cms::Exception("DDException") << "DDSolid::DDSolid(DDName,DDSolidShape,std::vector<double>: wrong shape";
126  }
127  solid->setParameters(p);
128  prep_ = StoreT::instance().create(n,solid);
129 }
Definition: Trap.h:9
Definition: Tubs.h:9
static value_type & instance()
Definition: Cons.h:9
Definition: Box.h:13

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, 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(), 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(), DDCompareSolid::operator()(), DDCompareBoolSol::operator()(), 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, DDI::Solid * >::reference rep() const
Definition: DDBase.h:84
DDSolidShape DDSolid::shape ( void  ) const

The type of the solid.

Definition at line 138 of file DDSolid.cc.

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

Referenced by PrintGeomSummary::addSolid(), OutputMagneticFieldDDToDDL::addToSolStore(), OutputDDToDDL::addToSolStore(), CSCGeometryParsFromDD::build(), DDG4SolidConverter::convert(), TGeoFromDddService::createShape(), DDBox::DDBox(), DDCheckLP(), 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(), DDCompareSolid::operator()(), DDCompareBoolSol::operator()(), 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, DDI::Solid * >::reference rep() const
Definition: DDBase.h:84
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, DDI::Solid * >::rep().

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

Friends And Related Function Documentation

friend class DDDToPersFactory
friend

Definition at line 42 of file DDSolid.h.

friend class DDPersToDDDFactory
friend

Definition at line 43 of file DDSolid.h.

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

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