CMS 3D CMS Logo

Public Member Functions

DDDividedBoxZ Class Reference

#include <DDDividedBox.h>

Inheritance diagram for DDDividedBoxZ:
DDDividedGeometryObject

List of all members.

Public Member Functions

 DDDividedBoxZ (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 ~DDDividedBoxZ ()

Detailed Description

Definition at line 49 of file DDDividedBox.h.


Constructor & Destructor Documentation

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

Definition at line 188 of file DDDividedBox.cc.

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

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

  if( divisionType_ == DivWIDTH ) {
    compNDiv_ = calculateNDiv( 2*mbox.halfZ(), div_.width(), div_.offset() );
  } else if( divisionType_ == DivNDIV ) {
    compWidth_ = calculateWidth( 2*mbox.halfY(), 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', " DDDividedBoxZ:DDDividedBoxZ"  << std::endl);
}
DDDividedBoxZ::~DDDividedBoxZ ( void  ) [virtual]

Definition at line 219 of file DDDividedBox.cc.

{}

Member Function Documentation

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

Reimplemented from DDDividedGeometryObject.

Definition at line 223 of file DDDividedBox.cc.

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

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

Reimplemented from DDDividedGeometryObject.

Definition at line 252 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 = msol.halfY();
    double pDz = compWidth_/2.;
    ddbox = DDSolidFactory::box(solname, pDx, pDy, pDz);
    ddlp =  DDLogicalPart(solname, usemat, ddbox);
  }
  DCOUT_V ('P', " DDDividedBoxZ::computeDimensions() lp:\n" << ddlp); 
  return ddlp;
}
DDRotation DDDividedBoxZ::makeDDRotation ( const int  copyNo) const [virtual]

Reimplemented from DDDividedGeometryObject.

Definition at line 230 of file DDDividedBox.cc.

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

Reimplemented from DDDividedGeometryObject.

Definition at line 236 of file DDDividedBox.cc.

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

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

  //----- translation 
  DDTranslation translation;

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

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