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

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

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

Definition at line 67 of file DDSolid.cc.

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

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

Definition at line 73 of file DDSolid.cc.

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

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

158 {
159  return rep().parameters();
160 }
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 151 of file DDSolid.cc.

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

Referenced by OutputMagneticFieldDDToDDL::addToSolStore(), OutputDDToDDL::addToSolStore(), CSCGeometryParsFromDD::build(), DDG4SolidConverter::convert(), TGeoFromDddService::createShape(), DDBox::DDBox(), DDCheckLP(), DDCons::DDCons(), DDCutTubs::DDCutTubs(), DDEllipsoid::DDEllipsoid(), DDEllipticalTube::DDEllipticalTube(), DDIntersection::DDIntersection(), 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(), DDStreamer::solids_write(), DDG4SolidConverter::trunctubs(), MagGeoBuilderFromDDD::volumeHandle::volumeHandle(), DDPolycone::zVec(), and DDPolyhedra::zVec().

152 {
153  return rep().shape();
154 }
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 140 of file DDSolid.cc.

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

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

141 {
142  return rep().volume();
143 }
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 41 of file DDSolid.h.

friend class DDPersToDDDFactory
friend

Definition at line 42 of file DDSolid.h.

friend struct DDSolidFactory
friend

Definition at line 40 of file DDSolid.h.

friend class DDStreamer
friend

Definition at line 43 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:21
DDSolidShape shape(void) const
The type of the solid.
Definition: DDSolid.cc:151