CMS 3D CMS Logo

Public Member Functions

DDDividedConsPhi Class Reference

#include <DDDividedCons.h>

Inheritance diagram for DDDividedConsPhi:
DDDividedGeometryObject

List of all members.

Public Member Functions

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

Detailed Description

Definition at line 32 of file DDDividedCons.h.


Constructor & Destructor Documentation

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

Definition at line 120 of file DDDividedCons.cc.

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

  : DDDividedGeometryObject::DDDividedGeometryObject( div, cpv )
{
  checkParametersValidity();
  setType( "DivisionConsPhi" );
  DDCons msol = (DDCons)(div_.parent().solid());

  if( divisionType_ == DivWIDTH )
  {
    DDCons msol = (DDCons)(div_.parent().solid());
    //If you divide a tube of 360 degrees the offset displaces the starting angle, but you still fill the 360 degrees
    if( msol.deltaPhi() == 360.*deg )
    {
      compNDiv_ = calculateNDiv( msol.deltaPhi(), div_.width(), 0. );
    }
    else
    {
      compNDiv_ = calculateNDiv( msol.deltaPhi(), div_.width(), div_.offset() );
    }
  }
  else if( divisionType_ == DivNDIV )
  {
    DDCons msol = (DDCons)(div_.parent().solid());
    if( msol.deltaPhi() == 360.*deg )
    {
      compWidth_ = calculateWidth( msol.deltaPhi(), div_.nReplicas(), 0. );
    }
    else
    {
      compWidth_ = calculateWidth( msol.deltaPhi(), div_.nReplicas(), div_.offset() );
    }
  }

  DCOUT_V( 'P', " DDDividedConsPhi - no divisions " << compNDiv_ << " = " << div_.nReplicas()
           << "\n Offset " << div_.offset()
           << "\n Width " << compWidth_ << " = " << div_.width()
           << "\n DivType " << divisionType_); 
}
DDDividedConsPhi::~DDDividedConsPhi ( void  ) [virtual]

Definition at line 159 of file DDDividedCons.cc.

{}

Member Function Documentation

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

Reimplemented from DDDividedGeometryObject.

Definition at line 163 of file DDDividedCons.cc.

References DDCons::deltaPhi(), DDDividedGeometryObject::div_, DDDivision::parent(), and DDLogicalPart::solid().

{
  DDCons msol = (DDCons)(div_.parent().solid());
  return msol.deltaPhi();
}
DDLogicalPart DDDividedConsPhi::makeDDLogicalPart ( const int  copyNo) const [virtual]

Reimplemented from DDDividedGeometryObject.

Definition at line 197 of file DDDividedCons.cc.

References DDDividedGeometryObject::compWidth_, DDSolidFactory::cons(), DCOUT_V, ddcons, DDBase< N, C >::ddname(), DDDividedGeometryObject::div_, DDLogicalPart::material(), DDName::name(), DDName::ns(), DDDivision::offset(), DDDivision::parent(), DDCons::rInMinusZ(), and DDLogicalPart::solid().

{ 
  DDName solname(div_.parent().ddname().name() + "_DIVCHILD"
                 , div_.parent().ddname().ns());
  DDSolid ddcons(solname);
  DDMaterial usemat(div_.parent().material());
  DDCons msol = (DDCons)(div_.parent().solid());

  if (!ddcons.isDefined().second)
  {
    double pRMin1 = msol.rInMinusZ();
    double pRMax1 = msol.rOutMinusZ();
    double pRMin2 = msol.rInPlusZ();
    double pRMax2 = msol.rOutPlusZ();
    double pDz = msol.zhalf();
          
    //- already rotated  double pSPhi = div_.offset() + copyNo*compWidth_;
    double pSPhi = div_.offset() + msol.phiFrom();
    double pDPhi = compWidth_;
    ddcons = DDSolidFactory::cons(DDName(solname), pDz, pRMin1, pRMax1
                                  , pRMin2, pRMax2, pSPhi, pDPhi);      
  }
  
  DDLogicalPart ddlp = DDLogicalPart(solname, usemat, ddcons);
  DCOUT_V ('P', " DDDividedConsPhi::makeDDLogicalPart() lp:" << ddlp);
  return ddlp;
}
DDRotation DDDividedConsPhi::makeDDRotation ( const int  copyNo) const [virtual]

Reimplemented from DDDividedGeometryObject.

Definition at line 170 of file DDDividedCons.cc.

References DDDividedGeometryObject::changeRotMatrix(), DDDividedGeometryObject::compWidth_, DCOUT_V, DDBase< N, C >::ddname(), DDrot(), DDDividedGeometryObject::div_, DDXMLElement::itostr(), DDName::name(), DDName::ns(), and DDDivision::parent().

{
  DDRotation myddrot; // sets to identity.
  double posi = ( copyNo - 1 ) * compWidth_;
  DDRotationMatrix* rotMat = changeRotMatrix( posi );
  // how to name the rotation??
  // i hate this crap :-)
  DDName ddrotname(div_.parent().ddname().name() + "_DIVCHILD_ROT" + DDXMLElement::itostr(copyNo)
                   , div_.parent().ddname().ns());
  myddrot = DDrot(ddrotname, rotMat);

  DCOUT_V ('P', "DDDividedConsPhi::makeDDRotation : " << myddrot);
  return myddrot;
}
DDTranslation DDDividedConsPhi::makeDDTranslation ( const int  copyNo) const [virtual]

Reimplemented from DDDividedGeometryObject.

Definition at line 186 of file DDDividedCons.cc.

References DDDivision::axis(), DDDividedGeometryObject::compWidth_, DCOUT_V, DDDividedGeometryObject::div_, and DDAxesNames::name().

{
  //----- translation 
  DDTranslation translation;  
  DCOUT_V( 'P', " DDDividedConsPhi " << "\n\t Position: " << translation
           << " - Width: " << compWidth_
           << " - Axis " << DDAxesNames::name(div_.axis()));
  return translation;
}