CMS 3D CMS Logo

Public Member Functions

DDDividedTrdX Class Reference

#include <DDDividedTrd.h>

Inheritance diagram for DDDividedTrdX:
DDDividedGeometryObject

List of all members.

Public Member Functions

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

Detailed Description

Definition at line 13 of file DDDividedTrd.h.


Constructor & Destructor Documentation

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

Definition at line 41 of file DDDividedTrd.cc.

{}

Member Function Documentation

void DDDividedTrdX::checkParametersValidity ( void  ) [virtual]

Reimplemented from DDDividedGeometryObject.

Definition at line 125 of file DDDividedTrd.cc.

References DDTrap::alpha1(), DDTrap::alpha2(), DDDividedGeometryObject::div_, Exception, DDDivision::parent(), DDTrap::phi(), alignCSCRings::s, DDLogicalPart::solid(), AlCaHLTBitMon_QueryRunRegistry::string, DDTrap::theta(), DDDividedGeometryObject::tolerance(), DDTrap::x1(), DDTrap::x2(), DDTrap::x3(), and DDTrap::x4().

Referenced by DDDividedTrdX().

{
  DDDividedGeometryObject::checkParametersValidity();
  
  DDTrap mtrd = (DDTrap)(div_.parent().solid());

  double mpDx1 = mtrd.x1(); //->GetXHalfLength1();
  double mpDx2 = mtrd.x2(); //->GetXHalfLength2();
  double mpDx3 = mtrd.x3(); 
  double mpDx4 = mtrd.x4();
  double mpTheta = mtrd.theta();
  double mpPhi = mtrd.phi();
  double mpAlpha1 = mtrd.alpha1();  
  double mpAlpha2 = mtrd.alpha2();
  //    double mpDy1 = mtrd.y1();
  //    double mpDy2 = mtrd.y2();
  //   double x1Tol = mpDx1 - mpDx2;
  //   if (x1Tol < 0.0) x1Tol = x1Tol * -1.0;

  if ( fabs(mpDx1 - mpDx2) > tolerance()  || fabs(mpDx3 - mpDx4) > tolerance()
       || fabs(mpDx1 - mpDx4) > tolerance())
  {
    std::string s = "ERROR - DDDividedTrdX::checkParametersValidity()";
    s+= "\n        Making a division of a TRD along axis X,";
    s+= "\n        while the X half lengths are not equal,";
    s+= "\n        is not (yet) supported. It will result";
    s+= "\n        in non-equal division solids.";
    throw cms::Exception("DDException") << s;
  }
  //    if (fabs(mpDy1 - mpDy2) > tolerance())
  //      {
  //        std::string s = "ERROR - DDDividedTrdX::checkParametersValidity()";
  //        s+= "\n        Making a division of a TRD along axis X,";
  //        s+= "\n        while the Y half lengths are not equal,";
  //        s+= "\n        is not (yet) supported. It will result";
  //        s+= "\n        in non-equal division solids.";
  //        throw cms::Exception("DDException") << s;
  //      }
  // 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 - DDDividedTrdX::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 cms::Exception("DDException") << s;
  }
}
double DDDividedTrdX::getMaxParameter ( void  ) const [virtual]

Reimplemented from DDDividedGeometryObject.

Definition at line 45 of file DDDividedTrd.cc.

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

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

Reimplemented from DDDividedGeometryObject.

Definition at line 88 of file DDDividedTrd.cc.

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

{
  DDTrap mtrd = (DDTrap)(div_.parent().solid());
  DDMaterial usemat = div_.parent().material();

  double pDy1 = mtrd.y1(); //GetYHalfLength1();
  double pDy2 = mtrd.y2(); //->GetYHalfLength2();
  double pDz = mtrd.halfZ(); //->GetZHalfLength();
  double pDx = compWidth_/2.;
 
  //trd.SetAllParameters ( pDx, pDx, pDy1, pDy2, pDz );

  DDName solname(div_.parent().ddname().name() + "_DIVCHILD" 
                 , div_.parent().ddname().ns());
  DDSolid dsol(solname);
  DDLogicalPart ddlp(solname);
  if (!dsol.isDefined().second)
  {
    dsol = DDSolidFactory::trap(solname
                                , pDz
                                , 0.*deg
                                , 0.*deg
                                , pDy1
                                , pDx
                                , pDx
                                , 0.*deg
                                , pDy2
                                , pDx
                                , pDx
                                , 0.*deg);
    ddlp = DDLogicalPart(solname, usemat, dsol);
  }
  DCOUT_V ('P', "DDDividedTrdX::makeDDLogicalPart lp = " << ddlp);
  return ddlp;
}
DDRotation DDDividedTrdX::makeDDRotation ( const int  copyNo) const [virtual]

Reimplemented from DDDividedGeometryObject.

Definition at line 82 of file DDDividedTrd.cc.

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

Reimplemented from DDDividedGeometryObject.

Definition at line 52 of file DDDividedTrd.cc.

References DDDivision::axis(), DDDividedGeometryObject::compWidth_, DCOUT_V, DDDividedGeometryObject::div_, Exception, DDAxesNames::name(), mergeVDriftHistosByStation::name, DDDivision::offset(), DDDivision::parent(), alignCSCRings::s, DDLogicalPart::solid(), AlCaHLTBitMon_QueryRunRegistry::string, x, and DDTrap::x1().

{
  DDTrap mtrd = (DDTrap)(div_.parent().solid());
  double mdx = mtrd.x1();


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

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

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