CMS 3D CMS Logo

Public Member Functions

DDDividedBoxX Class Reference

#include <DDDividedBox.h>

Inheritance diagram for DDDividedBoxX:
DDDividedGeometryObject

List of all members.

Public Member Functions

 DDDividedBoxX (const DDDivision &div, DDCompactView *cpv)
virtual double getMaxParameter () const
virtual DDLogicalPart makeDDLogicalPart (const int copyNo) const
virtual DDRotation makeDDRotation (const int copyNo) const
virtual DDTranslation makeDDTranslation (const int copyNo) const
virtual ~DDDividedBoxX ()

Detailed Description

Definition at line 15 of file DDDividedBox.h.


Constructor & Destructor Documentation

DDDividedBoxX::DDDividedBoxX ( const DDDivision div,
DDCompactView cpv 
)

Definition at line 19 of file DDDividedBox.cc.

References DDDividedGeometryObject::calculateNDiv(), DDDividedGeometryObject::calculateWidth(), DDDividedGeometryObject::checkParametersValidity(), DDDividedGeometryObject::compNDiv_, DDDividedGeometryObject::compWidth_, DCOUT_V, DDDividedGeometryObject::div_, DDDividedGeometryObject::divisionType_, DivNDIV, DivWIDTH, DDBox::halfX(), DDDivision::nReplicas(), DDDivision::offset(), DDDivision::parent(), DDDividedGeometryObject::setType(), DDLogicalPart::solid(), and DDDivision::width().

  : DDDividedGeometryObject::DDDividedGeometryObject( div, cpv )
{
  checkParametersValidity();
  setType( "DivisionBoxX" );
  DDBox mbox = (DDBox)(div_.parent().solid());

  if( divisionType_ == DivWIDTH ) {
    compNDiv_ = calculateNDiv( 2*mbox.halfX(), div_.width(), div_.offset() );
  } else if( divisionType_ == DivNDIV ) {
    compWidth_ = calculateWidth( 2*mbox.halfX(), div_.nReplicas(), div_.offset() );
  }
  
  // somehow here, I want to iterate over the nDivs or nReplicas 
  // and make the solid, make the logical part, then position it.
  // since DDBox is special, I will not make the solid and logical
  // part but once.  We'll see how bad the others go.
  // ihatethisihatethisihatethis
  //    for (int i = 0; i < compNDiv_; ++i)
  //      {
  //         DDpos(makeDDLogicalPart(i)  // child logical part
  //        , div_.parent()        // parent logical part
  //        , i                    // copy number
  //        , makeDDTranslation(i) // translation
  //        , makeDDRotation(i)    // rotation.  box is default (i.e. identity).
  //        );
  //      }

  DCOUT_V ('P', " DDDividedBoxX:DDDividedBoxX"  << std::endl);
}
DDDividedBoxX::~DDDividedBoxX ( void  ) [virtual]

Definition at line 50 of file DDDividedBox.cc.

{}

Member Function Documentation

double DDDividedBoxX::getMaxParameter ( void  ) const [virtual]

Reimplemented from DDDividedGeometryObject.

Definition at line 54 of file DDDividedBox.cc.

References DDDividedGeometryObject::div_, DDBox::halfX(), DDDivision::parent(), and DDLogicalPart::solid().

{
  DDBox msol = (DDBox)(div_.parent().solid());
  return 2*msol.halfX();
}
DDLogicalPart DDDividedBoxX::makeDDLogicalPart ( const int  copyNo) const [virtual]

Reimplemented from DDDividedGeometryObject.

Definition at line 82 of file DDDividedBox.cc.

References DDSolidFactory::box(), DDDividedGeometryObject::compWidth_, DCOUT_V, ddbox, DDBase< N, C >::ddname(), DDDividedGeometryObject::div_, DDLogicalPart::material(), DDName::name(), DDName::ns(), DDDivision::parent(), and DDLogicalPart::solid().

{
  // in other cases, this solid will have 1, 2, 3, etc. after it.
  DDName solname(div_.parent().ddname().name() + "_DIVCHILD", div_.parent().ddname().ns());
  DDSolid ddbox(solname);
  DDMaterial usemat(div_.parent().material());
  DDBox msol = (DDBox) (div_.parent().solid());
  DDLogicalPart ddlp(solname);
  if (!ddbox.isDefined().second) //This solid has NOT been defined. 
  {
    double pDx = msol.halfX();
    double pDy = compWidth_/2.;
    double pDz = msol.halfZ();
    
    ddbox = DDSolidFactory::box(solname, pDx, pDy, pDz);
    ddlp =  DDLogicalPart(solname, usemat, ddbox);
  }
  DCOUT_V ('P', " DDDividedBoxX::computeDimensions() lp:\n" << ddlp); 
  return ddlp;
}
DDRotation DDDividedBoxX::makeDDRotation ( const int  copyNo) const [virtual]

Reimplemented from DDDividedGeometryObject.

Definition at line 61 of file DDDividedBox.cc.

{
  return DDRotation();
}
DDTranslation DDDividedBoxX::makeDDTranslation ( const int  copyNo) const [virtual]

Reimplemented from DDDividedGeometryObject.

Definition at line 67 of file DDDividedBox.cc.

References DDDivision::axis(), DDDividedGeometryObject::compWidth_, DCOUT_V, DDDividedGeometryObject::div_, DDBox::halfX(), DDAxesNames::name(), DDDivision::offset(), DDDivision::parent(), and DDLogicalPart::solid().

{
  DDBox msol = (DDBox)(div_.parent().solid());
  double mdx = msol.halfX();

  //----- translation 
  DDTranslation translation;
  double posi = -mdx + div_.offset() + (copyNo+0.5) * compWidth_;
  translation.SetX( posi );

  DCOUT_V ('P', " DDDividedBoxX: " << copyNo << "\n Position " << translation << " Axis " << DDAxesNames::name(div_.axis()) << "\n");
  return translation;
}