CMS 3D CMS Logo

Public Member Functions

DDDividedTrdY Class Reference

#include <DDDividedTrd.h>

Inheritance diagram for DDDividedTrdY:
DDDividedGeometryObject

List of all members.

Public Member Functions

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

Detailed Description

Definition at line 33 of file DDDividedTrd.h.


Constructor & Destructor Documentation

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

Definition at line 195 of file DDDividedTrd.cc.

{}

Member Function Documentation

void DDDividedTrdY::checkParametersValidity ( void  ) [virtual]

Reimplemented from DDDividedGeometryObject.

Definition at line 279 of file DDDividedTrd.cc.

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

Referenced by DDDividedTrdY().

{
  DDDividedGeometryObject::checkParametersValidity();

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

  double mpDy1 = mtrd.y1(); //->GetYHalfLength1();
  double mpDy2 = mtrd.y2(); //->GetYHalfLength2();
  double mpTheta = mtrd.theta();
  double mpPhi = mtrd.phi();
  double mpAlpha1 = mtrd.alpha1();
  double mpAlpha2 = mtrd.alpha2();

  if( fabs(mpDy1 - mpDy2) > tolerance() )
  {
    std::string s= "ERROR - DDDividedTrdY::checkParametersValidity()";
    s += "\n        Making a division of a TRD along axis Y while";
    s += "\n        the Y half lengths are not equal is not (yet)";
    s += "\n        supported. It will result in non-equal";
    s += "\n        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 - DDDividedTrdY::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 DDDividedTrdY::getMaxParameter ( void  ) const [virtual]

Reimplemented from DDDividedGeometryObject.

Definition at line 199 of file DDDividedTrd.cc.

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

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

Reimplemented from DDDividedGeometryObject.

Definition at line 240 of file DDDividedTrd.cc.

References DDDividedGeometryObject::compWidth_, DCOUT_V, DDDividedGeometryObject::div_, DDTrap::halfZ(), DDLogicalPart::material(), DDBase< N, C >::name(), DDDivision::parent(), DDLogicalPart::solid(), DDSolidFactory::trap(), DDTrap::x1(), DDTrap::x2(), DDTrap::x3(), and DDTrap::x4().

{
  //---- The division along Y of a Trd will result a Trd, only 
  //--- if Y at -Z and +Z are equal, else use the G4Trap version
  DDTrap mtrd = (DDTrap)(div_.parent().solid());
  DDMaterial usemat = div_.parent().material();
  
  double pDx1 = mtrd.x1(); //->GetXHalfLength1() at Y+;
  double pDx2 = mtrd.x2(); //->GetXHalfLength2() at Y+;
  double pDx3 = mtrd.x3(); //->GetXHalfLength1() at Y-;
  double pDx4 = mtrd.x4(); //->GetXHalfLength2() at Y-;
  double pDz = mtrd.halfZ(); //->GetZHalfLength();
  double pDy = compWidth_/2.;
 
  //trd.SetAllParameters ( pDx1, pDx2, pDy, pDy, pDz );
  DDName solname(div_.name() );
  DDSolid  dsol(solname);
  DDLogicalPart ddlp(solname);
  if (!dsol.isDefined().second)
  {
    dsol = DDSolidFactory::trap(solname
                                , pDz
                                , 0.*deg
                                , 0.*deg
                                , pDy
                                , pDx1
                                , pDx2
                                , 0*deg
                                , pDy
                                , pDx3
                                , pDx4
                                , 0.*deg);
    DDLogicalPart ddlp(solname,  usemat, dsol);
  }
  DCOUT_V ('P', "DDDividedTrdY::makeDDLogicalPart lp = " << ddlp);
  return ddlp;
}
DDRotation DDDividedTrdY::makeDDRotation ( const int  copyNo) const [virtual]

Reimplemented from DDDividedGeometryObject.

Definition at line 234 of file DDDividedTrd.cc.

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

Reimplemented from DDDividedGeometryObject.

Definition at line 206 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(), detailsBasic3DVector::y, and DDTrap::y1().

{
  DDTrap mtrd = (DDTrap)(div_.parent().solid() );
  double mdy = mtrd.y1();

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

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

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