test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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 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 35 of file DDSolid.h.

Constructor & Destructor Documentation

DDSolid::DDSolid ( void  )

Uninitialilzed solid reference-object; for further details on reference-objects see documentation of DDLogicalPart.

Definition at line 55 of file DDSolid.cc.

Definition: DDBase.h:10
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 DDI::Singleton< I >::instance(), and DDBase< DDName, DDI::Solid * >::prep_.

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

Definition at line 63 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 69 of file DDSolid.cc.

References ddbox, ddcons, 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().

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

Member Function Documentation

const std::vector< double > & DDSolid::parameters ( void  ) const
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 OutputDDToDDL::addToSolStore(), OutputMagneticFieldDDToDDL::addToSolStore(), CSCGeometryParsFromDD::build(), DDG4SolidConverter::convert(), TGeoFromDddService::createShape(), DDBox::DDBox(), DDCheckLP(), DDCons::DDCons(), 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(), HcalTB02SD::initMap(), ECalSD::initMap(), HcalGeomParameters::loadGeometry(), DDLDivision::makeDivider(), EcalTBHodoscopeGeometryLoaderFromDDD::makeGeometry(), DDCompareSolid::operator()(), DDCompareBoolSol::operator()(), operator<<(), DDPolycone::rMaxVec(), DDPolyhedra::rMaxVec(), DDPolycone::rMinVec(), DDPolyhedra::rMinVec(), DDPolycone::rVec(), DDPolyhedra::rVec(), MagGeoBuilderFromDDD::volumeHandle::shape(), DDErrorDetection::so(), DDCoreToDDXMLOutput::solid(), DDStreamer::solids_write(), 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 133 of file DDSolid.cc.

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

Referenced by DDCompactViewImpl::weight().

134 {
135  return rep().volume();
136 }
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 39 of file DDSolid.h.

friend class DDPersToDDDFactory
friend

Definition at line 40 of file DDSolid.h.

friend struct DDSolidFactory
friend

Definition at line 38 of file DDSolid.h.

friend class DDStreamer
friend

Definition at line 41 of file DDSolid.h.

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

Definition at line 33 of file DDSolid.cc.

34 {
36  if (defined.first) {
37  os << *(defined.first) << " ";
38  if (defined.second) {
39  os << " " << DDSolidShapesName::name(solid.shape()) << ": ";
40  solid.rep().stream(os);
41  }
42  else {
43  os << "* solid not defined * ";
44  }
45  }
46  else {
47  os << "* solid not declared * ";
48  }
49  return os;
50 }
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:144