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

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

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

Definition at line 62 of file DDSolid.cc.

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

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

Definition at line 68 of file DDSolid.cc.

References ddbox, ddcons, ddcuttubs, ddellipsoid, ddellipticaltube, ddextrudedpolygon, ddorb, ddparallelepiped, 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().

69 {
70  DDI::Solid * solid(nullptr);
71  std::vector<double> dummy;
72  switch(s) {
73  case ddbox:
74  solid = new DDI::Box(0,0,0);
75  break;
76  case ddtubs:
77  solid = new DDI::Tubs(0,0,0,0,0);
78  break;
79  case ddcons:
80  solid = new DDI::Cons(0,0,0,0,0,0,0);
81  break;
82  case ddpseudotrap:
83  solid = new DDI::PseudoTrap(0,0,0,0,0,0,false);
84  break;
85  case ddshapeless:
86  solid = new DDI::Shapeless();
87  break;
88  case ddtrap:
89  solid = new DDI::Trap(0,0,0,0,0,0,0,0,0,0,0);
90  break;
91  case ddpolyhedra_rz:
92  solid = new DDI::Polyhedra(0,0,0,dummy,dummy);
93  break;
94  case ddpolyhedra_rrz:
95  solid = new DDI::Polyhedra(0,0,0,dummy,dummy,dummy);
96  break;
97  case ddpolycone_rz:
98  solid = new DDI::Polycone(0,0,dummy,dummy);
99  break;
100  case ddpolycone_rrz:
101  solid = new DDI::Polycone(0,0,dummy,dummy,dummy);
102  break;
103  case ddtrunctubs:
104  solid = new DDI::TruncTubs(0,0,0,0,0,0,0,false);
105  break;
106  case ddtorus:
107  solid = new DDI::Torus(0,0,0,0,0);
108  break;
109  case ddsphere:
110  solid = new DDI::Sphere(0,0,0,0,0,0);
111  break;
112  case ddorb:
113  solid = new DDI::Orb(0);
114  break;
115  case ddellipticaltube:
116  solid = new DDI::EllipticalTube(0,0,0);
117  break;
118  case ddellipsoid:
119  solid = new DDI::Ellipsoid(0,0,0,0,0);
120  break;
121  case ddparallelepiped:
122  solid = new DDI::Parallelepiped(0,0,0,0,0,0);
123  break;
124  case ddcuttubs:
125  solid = new DDI::CutTubs(0.,0.,0.,0.,0.,0.,0.,1.,0.,0.,-1.);
126  break;
127  case ddextrudedpolygon:
128  solid = new DDI::ExtrudedPolygon( dummy, dummy, dummy, dummy, dummy, dummy );
129  break;
130  default:
131  throw cms::Exception("DDException") << "DDSolid::DDSolid(DDName,DDSolidShape,std::vector<double>: wrong shape";
132  }
133  solid->setParameters(p);
134  prep_ = StoreT::instance().create(n,solid);
135 }
Definition: Trap.h:9
Definition: Tubs.h:9
static value_type & instance()
Definition: Orb.h:13
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 150 of file DDSolid.cc.

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

Referenced by CSCGeometryParsFromDD::build(), ME0GeometryBuilderFromDDD10EtaPart::buildChamber(), GEMGeometryBuilderFromDDD::buildChamber(), ME0GeometryBuilderFromDDD10EtaPart::buildEtaPartition(), GEMGeometryBuilderFromDDD::buildEtaPartition(), ME0GeometryParsFromDD::buildGeometry(), ME0GeometryBuilderFromDDD10EtaPart::buildGeometry(), GEMGeometryParsFromDD::buildGeometry(), ME0GeometryBuilderFromDDD::buildGeometry(), RPCGeometryBuilderFromDDD::buildGeometry(), RPCGeometryParsFromDD::buildGeometry(), ME0GeometryBuilderFromDDD10EtaPart::buildLayer(), GEMGeometryBuilderFromDDD::buildSuperChamber(), DDG4SolidConverter::convert(), TGeoFromDddService::createShape(), DDTruncTubs::cutInside(), ddstats(), DDEcalBarrelNewAlgo::execute(), DDEcalBarrelAlgo::execute(), DDEcalEndcapAlgo::execute(), DTGeometryBuilderFromDDD::extractParameters(), DTGeometryParsFromDD::extractParameters(), 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().

151 {
152  return rep().parameters();
153 }
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 144 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(), DDEllipsoid::DDEllipsoid(), DDEllipticalTube::DDEllipticalTube(), DDExtrudedPolygon::DDExtrudedPolygon(), DDIntersection::DDIntersection(), DDMultiUnion::DDMultiUnion(), DDOrb::DDOrb(), DDParallelepiped::DDParallelepiped(), 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().

145 {
146  return rep().shape();
147 }
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 138 of file DDSolid.cc.

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

Referenced by DDI::Reflection::volume(), and DDCompactViewImpl::weight().

139 {
140  return rep().volume();
141 }
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 34 of file DDSolid.cc.

35 {
37  if (defined.first) {
38  os << *(defined.first) << " ";
39  if (defined.second) {
40  os << " " << DDSolidShapesName::name(solid.shape()) << ": ";
41  solid.rep().stream(os);
42  }
43  else {
44  os << "* solid not defined * ";
45  }
46  }
47  else {
48  os << "* solid not declared * ";
49  }
50  return os;
51 }
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:22
DDSolidShape shape(void) const
The type of the solid.
Definition: DDSolid.cc:144