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

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

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

Definition at line 60 of file DDSolid.cc.

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

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

Definition at line 65 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().

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

148 {
149  return rep().parameters();
150 }
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 141 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(), ECalSD::initMap(), HcalTB02SD::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().

142 {
143  return rep().shape();
144 }
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 135 of file DDSolid.cc.

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

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

136 {
137  return rep().volume();
138 }
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:141