CMS 3D CMS Logo

DDSolid Class Reference

A DDSolid represents the shape of a part. More...

#include <DetectorDescription/Core/interface/DDSolid.h>

Inheritance diagram for DDSolid:

DDBase< DDName, DDI::Solid * > DDBooleanSolid DDBox DDCons DDPolySolid DDPseudoTrap DDReflectionSolid DDShapelessSolid DDTorus DDTrap DDTruncTubs DDTubs

List of all members.

Public Member Functions

 DDSolid (const DDName &name)
 Creates a reference-object to a solid named name.
 DDSolid ()
 Uninitialilzed solid reference-object; for further details on reference-objects see documentation of DDLogicalPart.
const std::vector< double > & parameters () const
 Don't use (only meant to be used by DDbox(), DDtub(), ...)
DDSolidShape shape () const
 The type of the solid.
double volume () const
 Returns the volume of the given solid (does not work with boolean soids !).

Static Public Member Functions

static void clear ()
 True, if the solid is a boolean solid. Then it consists of 2 boolean compounds.

Private Member Functions

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

Friends

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


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 42 of file DDSolid.h.


Constructor & Destructor Documentation

DDSolid::DDSolid (  ) 

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

Definition at line 53 of file DDSolid.cc.

00053 : DDBase<DDName,Solid*>() { }

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_.

00056                                  : DDBase<DDName,Solid*>()
00057 {
00058   prep_ = StoreT::instance().create(n);
00059 }

DDSolid::DDSolid ( const DDName n,
DDI::Solid s 
) [private]

Definition at line 61 of file DDSolid.cc.

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

00061                                             : DDBase<DDName,Solid*>()
00062 {
00063   prep_ = StoreT::instance().create(n,s);
00064 }

DDSolid::DDSolid ( const DDName n,
DDSolidShape  s,
const std::vector< double > &  p 
) [private]

Definition at line 67 of file DDSolid.cc.

References ddbox, ddcons, ddpolycone_rrz, ddpolycone_rz, ddpolyhedra_rrz, ddpolyhedra_rz, ddpseudotrap, ddshapeless, ddtorus, ddtrap, ddtrunctubs, ddtubs, dummy, DDI::Singleton< I >::instance(), DDBase< DDName, DDI::Solid * >::prep_, and DDI::Solid::setParameters().

00068 {
00069   DDI::Solid * solid(0);
00070   std::vector<double> dummy;
00071   switch(s) {
00072        case ddbox:
00073         solid = new DDI::Box(0,0,0);
00074         break;
00075        case ddtubs:
00076         solid = new DDI::Tubs(0,0,0,0,0);
00077         break;
00078        case ddcons:
00079         solid = new DDI::Cons(0,0,0,0,0,0,0);
00080         break;
00081        case ddpseudotrap:
00082         solid = new DDI::PseudoTrap(0,0,0,0,0,0,0);
00083         break;
00084        case ddshapeless:
00085         solid = new DDI::Shapeless();
00086         break;
00087        case ddtrap:
00088         solid = new DDI::Trap(0,0,0,0,0,0,0,0,0,0,0);
00089         break;
00090        case ddpolyhedra_rz:
00091         solid = new DDI::Polyhedra(0,0,0,dummy,dummy);
00092         break;
00093        case ddpolyhedra_rrz:
00094         solid = new DDI::Polyhedra(0,0,0,dummy,dummy,dummy);
00095         break;
00096        case ddpolycone_rz:
00097         solid = new DDI::Polycone(0,0,dummy,dummy);
00098         break;
00099        case ddpolycone_rrz:
00100         solid = new DDI::Polycone(0,0,dummy,dummy,dummy);
00101         break;                  
00102        case ddtrunctubs:
00103          solid = new DDI::TruncTubs(0,0,0,0,0,0,0,0);
00104          break;
00105        case ddtorus:
00106          solid = new DDI::Torus(0,0,0,0,0);
00107          break;
00108        default:
00109         throw DDException("DDSolid::DDSolid(DDName,DDSolidShape,std::vector<double>: wrong shape");   
00110   }
00111   solid->setParameters(p);
00112   prep_ = StoreT::instance().create(n,solid);
00113 }


Member Function Documentation

void DDSolid::clear ( void   )  [static]

True, if the solid is a boolean solid. Then it consists of 2 boolean compounds.

Returns the compounds of a boolean solid If DDSolid::boolean() == true, this method provides access to the boolean compounds of the solid. The type of the boolean solid (intersection, union or subtraction solid) is the return value and the compounds are assigned to the arguments A and B. Further the relative position of solid B towards A is assigned to the arguments DDRotation& and DDTranslation&.

Reimplemented from DDBase< DDName, DDI::Solid * >.

Definition at line 121 of file DDSolid.cc.

References DDI::Singleton< I >::instance().

Referenced by DDCompactView::clear().

00122 {
00123  StoreT::instance().clear();
00124 }

const std::vector< double > & DDSolid::parameters ( void   )  const

Don't use (only meant to be used by DDbox(), DDtub(), ...)

Todo:
make it private and add friends DDbox(), ... DDSolid(DDSolidImpl* p) : DDRegistered<DDSolidImpl>(p) { }
Give the parameters of the solid

Definition at line 133 of file DDSolid.cc.

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

Referenced by CSCGeometryBuilderFromDDD::buildEndcaps(), RPCGeometryBuilderFromDDD::buildGeometry(), DDG4SolidConverter::convert(), DDTruncTubs::cutInside(), ddstats(), DDEcalBarrelAlgo::execute(), DDEcalEndcapAlgo::execute(), DTGeometryBuilderFromDDD::extractParameters(), DDPolySolid::getVec(), HFShower::HFShower(), HcalTB02SD::initMap(), ECalSD::initMap(), DreamSD::initMap(), HcalNumberingFromDDD::loadGeometry(), EcalTBHodoscopeGeometryLoaderFromDDD::makeGeometry(), DDPolyhedra::sides(), DDDToPersFactory::solid(), DDStreamer::solids_write(), and streamSolid().

00134 { 
00135   return rep().parameters(); 
00136 }

DDSolidShape DDSolid::shape (  )  const

The type of the solid.

Definition at line 127 of file DDSolid.cc.

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

Referenced by SolidsForOnline::beginJob(), CSCGeometryBuilderFromDDD::buildEndcaps(), DDG4SolidConverter::convert(), DDBox::DDBox(), DDCheckLP(), DDCons::DDCons(), DDIntersection::DDIntersection(), DDPolycone::DDPolycone(), DDPolyhedra::DDPolyhedra(), DDPseudoTrap::DDPseudoTrap(), DDShapelessSolid::DDShapelessSolid(), DDSubtraction::DDSubtraction(), DDTorus::DDTorus(), DDTrap::DDTrap(), DDTruncTubs::DDTruncTubs(), DDTubs::DDTubs(), DDUnion::DDUnion(), DTGeometryBuilderFromDDD::extractParameters(), HFShower::HFShower(), HcalTB02SD::initMap(), ECalSD::initMap(), DreamSD::initMap(), HcalNumberingFromDDD::loadGeometry(), DDLDivision::makeDivider(), EcalTBHodoscopeGeometryLoaderFromDDD::makeGeometry(), operator<<(), MagGeoBuilderFromDDD::volumeHandle::referencePlane(), DDPolyhedra::rMaxVec(), DDPolycone::rMaxVec(), DDPolycone::rMinVec(), DDPolyhedra::rMinVec(), DDPolyhedra::rVec(), DDPolycone::rVec(), MagGeoBuilderFromDDD::volumeHandle::shape(), MagGeoBuilderFromDDD::volumeHandle::sides(), DDErrorDetection::so(), DDDToPersFactory::solid(), DDStreamer::solids_write(), streamSolid(), DDG4SolidConverter::trunctubs(), MagGeoBuilderFromDDD::volumeHandle::volumeHandle(), DDPolyhedra::zVec(), and DDPolycone::zVec().

00128 {
00129   return rep().shape();
00130 }

double DDSolid::volume (  )  const

Returns the volume of the given solid (does not work with boolean soids !).

Definition at line 116 of file DDSolid.cc.

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

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

00117 {
00118   return rep().volume();
00119 }


Friends And Related Function Documentation

friend class DDDToPersFactory [friend]

Definition at line 46 of file DDSolid.h.

friend class DDPersToDDDFactory [friend]

Definition at line 47 of file DDSolid.h.

friend class DDSolidFactory [friend]

Definition at line 45 of file DDSolid.h.

friend class DDStreamer [friend]

Definition at line 48 of file DDSolid.h.

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

Definition at line 31 of file DDSolid.cc.

00032 { 
00033   DDBase<DDName,DDI::Solid*>::def_type defined(solid.isDefined());
00034   if (defined.first) {
00035     os << *(defined.first) << " ";
00036     if (defined.second) {
00037       os << "  " << DDSolidShapesName::name(solid.shape()) << ": ";
00038       solid.rep().stream(os); 
00039     }
00040     else {
00041       os << "* solid not defined * ";  
00042     }
00043   }  
00044   else {
00045     os << "* solid not declared * ";  
00046   }  
00047   return os;
00048 }


The documentation for this class was generated from the following files:
Generated on Tue Jun 9 18:18:12 2009 for CMSSW by  doxygen 1.5.4