CMS 3D CMS Logo

Public Member Functions

DDDividedPolyhedraPhi Class Reference

#include <DDDividedPolyhedra.h>

Inheritance diagram for DDDividedPolyhedraPhi:
DDDividedGeometryObject

List of all members.

Public Member Functions

virtual void checkParametersValidity ()
 DDDividedPolyhedraPhi (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 ~DDDividedPolyhedraPhi ()

Detailed Description

Definition at line 41 of file DDDividedPolyhedra.h.


Constructor & Destructor Documentation

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

Definition at line 148 of file DDDividedPolyhedra.cc.

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

  : DDDividedGeometryObject( div, cpv )
{ 
  checkParametersValidity();
  setType( "DivisionPolyhedraPhi" );

  DDPolyhedra msol = (DDPolyhedra)(div_.parent().solid());
  //  double deltaPhi = msol->GetEndPhi() - msol->GetStartPhi();
  
  if( divisionType_ == DivWIDTH )
  {
    //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 )
  {
    if( msol.deltaPhi() == 360.*deg ) {
      compWidth_ = calculateWidth( msol.deltaPhi(), div_.nReplicas(), 0. );
    }else {
      // original line looks wrong!
      compWidth_ = calculateWidth( msol.deltaPhi(), div_.nReplicas(), div_.offset() );
    }
  }
 
  DCOUT_V ('P', " DDDividedPolyhedraRho - # divisions " << compNDiv_  << " = " << div_.nReplicas() << "\n Offset " << div_.offset() << " Width " << compWidth_ << " = " << div_.width() << "\n");
}
DDDividedPolyhedraPhi::~DDDividedPolyhedraPhi ( void  ) [virtual]

Definition at line 179 of file DDDividedPolyhedra.cc.

{}

Member Function Documentation

void DDDividedPolyhedraPhi::checkParametersValidity ( void  ) [virtual]

Reimplemented from DDDividedGeometryObject.

Definition at line 190 of file DDDividedPolyhedra.cc.

References DDDividedGeometryObject::compNDiv_, gather_cfg::cout, DDDividedGeometryObject::div_, DDDividedGeometryObject::divisionType_, DivNDIVandWIDTH, DivWIDTH, Exception, DDDivision::offset(), DDDivision::parent(), alignCSCRings::s, DDPolyhedra::sides(), DDLogicalPart::solid(), and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by DDDividedPolyhedraPhi().

{
  DDDividedGeometryObject::checkParametersValidity();
  
  DDPolyhedra msol = (DDPolyhedra)(div_.parent().solid());
  
  if( divisionType_ == DivNDIVandWIDTH || divisionType_ == DivWIDTH )
  {
    std::cout << "WARNING - "
              << "DDDividedPolyhedraPhi::checkParametersValidity()"
              << std::endl
              << "          Solid " << msol << std::endl
              << "          Division along PHI will be done splitting "
              << "in the defined numSide." << std::endl
              << "          WIDTH will not be used !" << std::endl;
  }
  if( div_.offset() != 0. )
  {
    std::cout << "WARNING - "
              << "DDDividedPolyhedraPhi::checkParametersValidity()"
              << std::endl
              << "          Solid " << msol << std::endl
              << "          Division along PHI will be done splitting "
              << "in the defined numSide." << std::endl
              << "          OFFSET will not be used !" << std::endl;
  }
  
  if ( msol.sides() != compNDiv_ )
  { 
    std::cout << "ERROR - "
              << "DDDividedPolyhedraPhi::checkParametersValidity()"
              << std::endl
              << "        Division along PHI will be done splitting in the defined"
              << std::endl
              << "        numSide, i.e, the number of division would be :"
              << "        " << msol.sides()
              << " instead of " << compNDiv_ << " !"
              << std::endl; 
    std::string s = "DDDividedPolyhedraPhi::checkParametersValidity() Not supported configuration.";
    throw cms::Exception("DDException") << s;
  }
}
double DDDividedPolyhedraPhi::getMaxParameter ( void  ) const [virtual]

Reimplemented from DDDividedGeometryObject.

Definition at line 183 of file DDDividedPolyhedra.cc.

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

{
  DDPolyhedra msol = (DDPolyhedra)(div_.parent().solid());
  return msol.deltaPhi(); //msol->GetEndPhi() - msol->GetStartPhi();
}
DDLogicalPart DDDividedPolyhedraPhi::makeDDLogicalPart ( const int  copyNo) const [virtual]

Reimplemented from DDDividedGeometryObject.

Definition at line 260 of file DDDividedPolyhedra.cc.

References DDDividedGeometryObject::compWidth_, DCOUT_V, DDBase< N, C >::ddname(), DDDividedGeometryObject::div_, DDBase< N, C >::isDefined(), DDLogicalPart::material(), DDName::name(), DDName::ns(), DDDivision::offset(), DDDivision::parent(), DDSolidFactory::polyhedra(), DDPolyhedra::rMaxVec(), DDPolyhedra::rMinVec(), DDPolyhedra::sides(), DDLogicalPart::solid(), DDPolyhedra::startPhi(), and DDPolyhedra::zVec().

{
  DDPolyhedra msol = (DDPolyhedra)(div_.parent().solid());
  DDMaterial usemat = div_.parent().material();

  DDName solname( div_.parent().ddname().name() + "_DIVCHILD",
                  div_.parent().ddname().ns());
  DDSolid dsol(solname);
  if (!dsol.isDefined().second)
  {
    dsol = DDSolidFactory::polyhedra( solname,
                                      msol.sides(),
                                      msol.startPhi()+div_.offset(),
                                      compWidth_,
                                      msol.zVec(),
                                      msol.rMinVec(),
                                      msol.rMaxVec());
  }
  DDLogicalPart ddlp(solname);
  if (!ddlp.isDefined().second)
    DDLogicalPart ddlp2 = DDLogicalPart(solname, usemat, dsol);
  DCOUT_V ('P', "DDDividedPolyhedraPhi::makeDDLogicalPart() ddlp = " << ddlp);
  return ddlp;
}
DDRotation DDDividedPolyhedraPhi::makeDDRotation ( const int  copyNo) const [virtual]

Reimplemented from DDDividedGeometryObject.

Definition at line 240 of file DDDividedPolyhedra.cc.

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

{

  double posi = ( copyNo - 1 ) * compWidth_;

  DCOUT_V ('P', " DDDividedPolyhedraPhi - position: " << posi/deg << "\n copyNo: " << copyNo << " - compWidth_: " << compWidth_/deg << "\n");
  
  //  ChangeRotMatrix( physVol, -posi );
  DDRotationMatrix* rotMat = changeRotMatrix( posi);
  // how to name the rotation??
  // i do not like this...
  DDName ddrotname(div_.parent().ddname().name() + "_DIVCHILD_ROT" + DDXMLElement::itostr(copyNo)
                   , div_.parent().ddname().ns());
  DDRotation myddrot = DDrot(ddrotname, rotMat);
  DCOUT_V ('P', "DDDividedPolyhedra::makeDDRotation: copyNo = " << copyNo << " rotation = " << myddrot);
  return myddrot;

}
DDTranslation DDDividedPolyhedraPhi::makeDDTranslation ( const int  copyNo) const [virtual]

Reimplemented from DDDividedGeometryObject.

Definition at line 234 of file DDDividedPolyhedra.cc.

{
  return DDTranslation();
}