CMS 3D CMS Logo

Public Member Functions

DDDividedTrdZ Class Reference

#include <DDDividedTrd.h>

Inheritance diagram for DDDividedTrdZ:
DDDividedGeometryObject

List of all members.

Public Member Functions

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

Detailed Description

Definition at line 53 of file DDDividedTrd.h.


Constructor & Destructor Documentation

DDDividedTrdZ::DDDividedTrdZ ( const DDDivision div,
DDCompactView cpv 
)
DDDividedTrdZ::~DDDividedTrdZ ( void  ) [virtual]

Definition at line 333 of file DDDividedTrd.cc.

{}

Member Function Documentation

void DDDividedTrdZ::checkParametersValidity ( void  ) [virtual]

Reimplemented from DDDividedGeometryObject.

Definition at line 423 of file DDDividedTrd.cc.

References DDTrap::alpha1(), DDTrap::alpha2(), DDDividedGeometryObject::div_, DDDivision::parent(), DDTrap::phi(), alignCSCRings::s, DDLogicalPart::solid(), and DDTrap::theta().

Referenced by DDDividedTrdZ().

{
  DDDividedGeometryObject::checkParametersValidity();

  DDTrap mtrd = (DDTrap)(div_.parent().solid());

  double mpTheta = mtrd.theta();
  double mpPhi = mtrd.phi();
  double mpAlpha1 = mtrd.alpha1();
  double mpAlpha2 = mtrd.alpha2();

  // mec:  we only have traps, not trds in DDD, so I added this check
  // to make sure it is only a trd (I think! :-))
  if (mpAlpha1 != 0.*deg || mpAlpha2 != 0.*deg || mpTheta != 0.*deg || mpPhi != 0.*deg)
  {
    std::string s = "ERROR - DDDividedTrdZ::checkParametersValidity()";
    s+= "\n        Making a division of a TRD along axis X,";
    s+= "\n        while the theta, phi and aplhpa2 are not zero,";
    s+= "\n        is not (yet) supported. It will result";
    s+= "\n        in non-equal division solids.";
    throw DDException(s);
  }
}
double DDDividedTrdZ::getMaxParameter ( void  ) const [virtual]

Reimplemented from DDDividedGeometryObject.

Definition at line 337 of file DDDividedTrd.cc.

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

{
  DDTrap mtrd = (DDTrap)(div_.parent().solid());
  return 2 * mtrd.halfZ();
}
DDLogicalPart DDDividedTrdZ::makeDDLogicalPart ( const int  copyNo) const [virtual]

Reimplemented from DDDividedGeometryObject.

Definition at line 379 of file DDDividedTrd.cc.

References DDDividedGeometryObject::compWidth_, DCOUT_V, DDBase< N, C >::ddname(), DDDividedGeometryObject::div_, DDTrap::halfZ(), DDXMLElement::itostr(), DDLogicalPart::material(), DDName::name(), DDName::ns(), DDDivision::offset(), DDDivision::parent(), DDLogicalPart::solid(), DDSolidFactory::trap(), DDTrap::x1(), DDTrap::x2(), DDTrap::y1(), and DDTrap::y2().

{
  //---- The division along Z of a Trd will result a Trd
  DDTrap mtrd = (DDTrap)(div_.parent().solid());
  DDMaterial usemat = div_.parent().material();

  double pDx1 = mtrd.x1(); //->GetXHalfLength1();
  //(mtrd->GetXHalfLength2() - mtrd->GetXHalfLength1() );
  double DDx = (mtrd.x2() - mtrd.x1() );
  double pDy1 = mtrd.y1(); // ->GetYHalfLength1();
  //(mtrd->GetYHalfLength2() - mtrd->GetYHalfLength1() );
  double DDy = (mtrd.y2() - mtrd.y1() );
  double pDz = compWidth_/2.;
  double zLength = 2*mtrd.halfZ(); //->GetZHalfLength();
 
  //    trd.SetAllParameters ( pDx1+DDx*(div_.offset()+copyNo*compWidth_)/zLength,
  //                           pDx1+DDx*(div_.offset()+(copyNo+1)*compWidth_)/zLength, 
  //                           pDy1+DDy*(div_.offset()+copyNo*compWidth_)/zLength,
  //                           pDy1+DDy*(div_.offset()+(copyNo+1)*compWidth_)/zLength, pDz );

  DDName solname(div_.parent().ddname().name() + "_DIVCHILD" 
                 + DDXMLElement::itostr(copyNo)
                 , div_.parent().ddname().ns());
  DDSolid  dsol = 
    DDSolidFactory::trap(solname
                         , pDz
                         , 0.*deg
                         , 0.*deg
                         , pDy1+DDy*(div_.offset()+copyNo*compWidth_)/zLength
                         , pDx1+DDx*(div_.offset()+copyNo*compWidth_)/zLength
                         , pDx1+DDx*(div_.offset()+copyNo*compWidth_)/zLength
                         , 0.*deg
                         , pDy1+DDy*(div_.offset()+(copyNo+1)*compWidth_)/zLength
                         , pDx1+DDx*(div_.offset()+(copyNo+1)*compWidth_)/zLength
                         , pDx1+DDx*(div_.offset()+(copyNo+1)*compWidth_)/zLength
                         , 0*deg
      );

  DDLogicalPart ddlp(solname, usemat, dsol);
  DCOUT_V ('P', "DDDividedTrdZ::makeDDLogicalPart lp = " << ddlp);
  return ddlp;
}
DDRotation DDDividedTrdZ::makeDDRotation ( const int  copyNo) const [virtual]

Reimplemented from DDDividedGeometryObject.

Definition at line 373 of file DDDividedTrd.cc.

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

Reimplemented from DDDividedGeometryObject.

Definition at line 344 of file DDDividedTrd.cc.

References DDDivision::axis(), DDDividedGeometryObject::compWidth_, DCOUT_V, DDDividedGeometryObject::div_, DDTrap::halfZ(), DDAxesNames::name(), mergeVDriftHistosByStation::name, DDDivision::offset(), DDDivision::parent(), alignCSCRings::s, DDLogicalPart::solid(), and z.

{
  DDTrap mtrd = (DDTrap)(div_.parent().solid() );
  double mdz = mtrd.halfZ();

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

  DCOUT_V ('P', " DDDividedTrdZ: " << copyNo << "\n Position: z=" << posi << "  Axis= " << DDAxesNames::name(div_.axis()) << "\n");

  if( div_.axis() == z )
  {
    return DDTranslation(0.0, 0.0, posi);
  }
  else
  { 
    std::string s = "ERROR - DDDividedTrdZ::makeDDTranslation()";
    s += "\n        Axis is along ";
    s += DDAxesNames::name(div_.axis());
    s += " !\n" ;
    s += "DDDividedTrdY::makeDDTranslation()";
    s += " IllegalConstruct: Only axes along z are allowed !";
    throw DDException(s);

  }
  return DDTranslation();
}