CMS 3D CMS Logo

Public Member Functions

DDDividedBoxY Class Reference

#include <DDDividedBox.h>

Inheritance diagram for DDDividedBoxY:
DDDividedGeometryObject

List of all members.

Public Member Functions

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

Detailed Description

Definition at line 32 of file DDDividedBox.h.


Constructor & Destructor Documentation

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

Definition at line 103 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(), DDDivision::nReplicas(), DDDivision::offset(), DDDivision::parent(), DDDividedGeometryObject::setType(), DDLogicalPart::solid(), and DDDivision::width().

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

  if( divisionType_ == DivWIDTH ) {
    compNDiv_ = calculateNDiv( 2*mbox.halfY(), 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', " DDDividedBoxY:DDDividedBoxY"  << std::endl);
}
DDDividedBoxY::~DDDividedBoxY ( void  ) [virtual]

Definition at line 135 of file DDDividedBox.cc.

{}

Member Function Documentation

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

Reimplemented from DDDividedGeometryObject.

Definition at line 139 of file DDDividedBox.cc.

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

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

Reimplemented from DDDividedGeometryObject.

Definition at line 168 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', " DDDividedBoxY::computeDimensions() lp:\n" << ddlp); 
  return ddlp;
}
DDRotation DDDividedBoxY::makeDDRotation ( const int  copyNo) const [virtual]

Reimplemented from DDDividedGeometryObject.

Definition at line 146 of file DDDividedBox.cc.

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

Reimplemented from DDDividedGeometryObject.

Definition at line 152 of file DDDividedBox.cc.

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

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

  //----- translation 
  DDTranslation translation;

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

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