CMS 3D CMS Logo

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

List of all members.

Public Member Functions

 DDSolid (void)
 Uninitialilzed solid reference-object; for further details on reference-objects see documentation of DDLogicalPart.
 DDSolid (const DDName &name)
 Creates a reference-object to a solid named name.
const std::vector< double > & parameters (void) const
 Give the parameters of the solid.
DDSolidShape shape (void) const
 The type of the solid.
double volume (void) const
 Returns the volume of the given solid (does not work with boolean soids !)

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 &)

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.

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

DDSolid::DDSolid ( const DDName n,
DDI::Solid s 
) [private]
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().

{
  DDI::Solid * solid(0);
  std::vector<double> dummy;
  switch(s) {
       case ddbox:
        solid = new DDI::Box(0,0,0);
        break;
       case ddtubs:
        solid = new DDI::Tubs(0,0,0,0,0);
        break;
       case ddcons:
        solid = new DDI::Cons(0,0,0,0,0,0,0);
        break;
       case ddpseudotrap:
        solid = new DDI::PseudoTrap(0,0,0,0,0,0,0);
        break;
       case ddshapeless:
        solid = new DDI::Shapeless();
        break;
       case ddtrap:
        solid = new DDI::Trap(0,0,0,0,0,0,0,0,0,0,0);
        break;
       case ddpolyhedra_rz:
        solid = new DDI::Polyhedra(0,0,0,dummy,dummy);
        break;
       case ddpolyhedra_rrz:
        solid = new DDI::Polyhedra(0,0,0,dummy,dummy,dummy);
        break;
       case ddpolycone_rz:
        solid = new DDI::Polycone(0,0,dummy,dummy);
        break;
       case ddpolycone_rrz:
        solid = new DDI::Polycone(0,0,dummy,dummy,dummy);
        break;                  
       case ddtrunctubs:
         solid = new DDI::TruncTubs(0,0,0,0,0,0,0,0);
         break;
       case ddtorus:
         solid = new DDI::Torus(0,0,0,0,0);
         break;
       case ddsphere:
         solid = new DDI::Sphere(0,0,0,0,0,0);
         break;
       case ddorb:
         solid = new DDI::Orb(0);
         break;
       case ddellipticaltube:
         solid = new DDI::EllipticalTube(0,0,0);
         break;
       case ddellipsoid:
         solid = new DDI::Ellipsoid(0,0,0,0,0);
         break;
       case ddparallelepiped:
         solid = new DDI::Parallelepiped(0,0,0,0,0,0);
         break;
       default:
        throw cms::Exception("DDException") << "DDSolid::DDSolid(DDName,DDSolidShape,std::vector<double>: wrong shape";   
  }
  solid->setParameters(p);
  prep_ = StoreT::instance().create(n,solid);
}

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(), SolidsForOnline::beginRun(), 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(), DTGeometryParsFromDD::extractParameters(), DTGeometryBuilderFromDDD::extractParameters(), HcalTB02SD::initMap(), ECalSD::initMap(), DreamSD::initMap(), HcalNumberingFromDDD::loadGeometry(), DDLDivision::makeDivider(), EcalTBHodoscopeGeometryLoaderFromDDD::makeGeometry(), DDCompareSolid::operator()(), DDCompareBoolSol::operator()(), operator<<(), DDPolyhedra::rMaxVec(), DDPolycone::rMaxVec(), DDPolycone::rMinVec(), DDPolyhedra::rMinVec(), DDPolyhedra::rVec(), DDPolycone::rVec(), MagGeoBuilderFromDDD::volumeHandle::shape(), DDErrorDetection::so(), DDCoreToDDXMLOutput::solid(), DDStreamer::solids_write(), streamSolid(), DDG4SolidConverter::trunctubs(), MagGeoBuilderFromDDD::volumeHandle::volumeHandle(), DDPolyhedra::zVec(), and DDPolycone::zVec().

{
  return rep().shape();
}
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().

{
  return rep().volume();
}

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.

{ 
  DDBase<DDName,DDI::Solid*>::def_type defined(solid.isDefined());
  if (defined.first) {
    os << *(defined.first) << " ";
    if (defined.second) {
      os << "  " << DDSolidShapesName::name(solid.shape()) << ": ";
      solid.rep().stream(os); 
    }
    else {
      os << "* solid not defined * ";  
    }
  }  
  else {
    os << "* solid not declared * ";  
  }  
  return os;
}