CMS 3D CMS Logo

DDDividedTrdX Class Reference

#include <DetectorDescription/Parser/src/DDDividedTrd.h>

Inheritance diagram for DDDividedTrdX:

DDDividedGeometryObject

List of all members.

Public Member Functions

virtual void checkParametersValidity ()
 DDDividedTrdX (const DDDivision &div)
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  ) 

Definition at line 28 of file DDDividedTrd.cc.

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

00029   :  DDDividedGeometryObject ( div )
00030 {
00031   checkParametersValidity();
00032   setType( "DivisionTrdX" );
00033   DDTrap mtrd = (DDTrap)( div_.parent().solid() );
00034 
00035   if ( divisionType_ == DivWIDTH )
00036   {
00037     compNDiv_ = calculateNDiv( 2 * mtrd.x1(), div_.width(), div_.offset() );
00038   }
00039   else if( divisionType_ == DivNDIV )
00040   {
00041     compWidth_ = calculateWidth( 2*mtrd.x1(), div_.nReplicas(), div_.offset() );
00042   }
00043 
00044   DCOUT_V ('P', " DDDividedTrdX - ## divisions " << compNDiv_ << " = " << div_.nReplicas() << "\n Offset " << div_.offset() << "\n Width " << compWidth_ << " = " << div_.width());
00045 }

DDDividedTrdX::~DDDividedTrdX (  )  [virtual]

Definition at line 48 of file DDDividedTrd.cc.

00049 {
00050 }


Member Function Documentation

void DDDividedTrdX::checkParametersValidity (  )  [virtual]

Reimplemented from DDDividedGeometryObject.

Definition at line 133 of file DDDividedTrd.cc.

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

Referenced by DDDividedTrdX().

00134 {
00135   DDDividedGeometryObject::checkParametersValidity();
00136   
00137   DDTrap mtrd = (DDTrap)(div_.parent().solid());
00138 
00139   double mpDx1 = mtrd.x1(); //->GetXHalfLength1();
00140   double mpDx2 = mtrd.x2(); //->GetXHalfLength2();
00141   double mpDx3 = mtrd.x3(); 
00142   double mpDx4 = mtrd.x4();
00143   double mpTheta = mtrd.theta();
00144   double mpPhi = mtrd.phi();
00145   double mpAlpha1 = mtrd.alpha1();  
00146   double mpAlpha2 = mtrd.alpha2();
00147 //    double mpDy1 = mtrd.y1();
00148 //    double mpDy2 = mtrd.y2();
00149 //   double x1Tol = mpDx1 - mpDx2;
00150 //   if (x1Tol < 0.0) x1Tol = x1Tol * -1.0;
00151 
00152   if ( fabs(mpDx1 - mpDx2) > tolerance()  || fabs(mpDx3 - mpDx4) > tolerance()
00153        || fabs(mpDx1 - mpDx4) > tolerance())
00154     {
00155       std::string s = "ERROR - DDDividedTrdX::checkParametersValidity()";
00156       s+= "\n        Making a division of a TRD along axis X,";
00157       s+= "\n        while the X half lengths are not equal,";
00158       s+= "\n        is not (yet) supported. It will result";
00159       s+= "\n        in non-equal division solids.";
00160       throw DDException(s);
00161     }
00162 //    if (fabs(mpDy1 - mpDy2) > tolerance())
00163 //      {
00164 //        std::string s = "ERROR - DDDividedTrdX::checkParametersValidity()";
00165 //        s+= "\n        Making a division of a TRD along axis X,";
00166 //        s+= "\n        while the Y half lengths are not equal,";
00167 //        s+= "\n        is not (yet) supported. It will result";
00168 //        s+= "\n        in non-equal division solids.";
00169 //        throw DDException(s);
00170 //      }
00171   // mec:  we only have traps, not trds in DDD, so I added this check
00172   // to make sure it is only a trd (I think! :-))
00173   if (mpAlpha1 != 0.*deg || mpAlpha2 != 0.*deg || mpTheta != 0.*deg || mpPhi != 0.*deg)
00174     {
00175       std::string s = "ERROR - DDDividedTrdX::checkParametersValidity()";
00176       s+= "\n        Making a division of a TRD along axis X,";
00177       s+= "\n        while the theta, phi and aplhpa2 are not zero,";
00178       s+= "\n        is not (yet) supported. It will result";
00179       s+= "\n        in non-equal division solids.";
00180       throw DDException(s);
00181     }
00182 
00183 }

double DDDividedTrdX::getMaxParameter (  )  const [virtual]

Reimplemented from DDDividedGeometryObject.

Definition at line 53 of file DDDividedTrd.cc.

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

00054 {
00055   DDTrap mtrd = (DDTrap)(div_.parent().solid());
00056   return 2 * mtrd.x1();
00057 }

DDLogicalPart DDDividedTrdX::makeDDLogicalPart ( const int  copyNo  )  const [virtual]

Reimplemented from DDDividedGeometryObject.

Definition at line 96 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().

00097 {
00098   DDTrap mtrd = (DDTrap)(div_.parent().solid());
00099   DDMaterial usemat = div_.parent().material();
00100 
00101   double pDy1 = mtrd.y1(); //GetYHalfLength1();
00102   double pDy2 = mtrd.y2(); //->GetYHalfLength2();
00103   double pDz = mtrd.halfZ(); //->GetZHalfLength();
00104   double pDx = compWidth_/2.;
00105  
00106   //trd.SetAllParameters ( pDx, pDx, pDy1, pDy2, pDz );
00107 
00108   DDName solname(div_.parent().ddname().name() + "_DIVCHILD" 
00109                  , div_.parent().ddname().ns());
00110   DDSolid dsol(solname);
00111   DDLogicalPart ddlp(solname);
00112   if (!dsol.isDefined().second)
00113     {
00114       dsol = DDSolidFactory::trap(solname
00115                                   , pDz
00116                                   , 0.*deg
00117                                   , 0.*deg
00118                                   , pDy1
00119                                   , pDx
00120                                   , pDx
00121                                   , 0.*deg
00122                                   , pDy2
00123                                   , pDx
00124                                   , pDx
00125                                   , 0.*deg);
00126       ddlp = DDLogicalPart(solname, usemat, dsol);
00127     }
00128   DCOUT_V ('P', "DDDividedTrdX::makeDDLogicalPart lp = " << ddlp);
00129   return ddlp;
00130 }

DDRotation DDDividedTrdX::makeDDRotation ( const int  copyNo  )  const [virtual]

Reimplemented from DDDividedGeometryObject.

Definition at line 90 of file DDDividedTrd.cc.

00091 {
00092   return DDRotation();
00093 }

DDTranslation DDDividedTrdX::makeDDTranslation ( const int  copyNo  )  const [virtual]

Reimplemented from DDDividedGeometryObject.

Definition at line 60 of file DDDividedTrd.cc.

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

00061 {
00062   DDTrap mtrd = (DDTrap)(div_.parent().solid());
00063   double mdx = mtrd.x1();
00064 
00065 
00066   //----- translation 
00067   double posi = -mdx + div_.offset() + (copyNo+0.5)*compWidth_;
00068 
00069   DCOUT_V ('P', " DDDividedTrdX: " << copyNo << "\n Position: x=" << posi << "  Axis= " << DDAxesNames::name(div_.axis()) << "\n");
00070 
00071   if( div_.axis() == x )
00072   {
00073     return DDTranslation(posi, 0.0, 0.0);
00074   }
00075   else
00076   { 
00077     std::string s = "ERROR - DDDividedTrdX::makeDDTranslation()";
00078     s += "\n        Axis is along ";
00079     s += DDAxesNames::name(div_.axis());
00080     s += " !\n" ;
00081     s += "DDDividedTrdX::makeDDTranslation()";
00082     s += " IllegalConstruct: Only axes along x are allowed !";
00083     throw DDException(s);
00084   }
00085   
00086   return DDTranslation();
00087 }


The documentation for this class was generated from the following files:
Generated on Tue Jun 9 18:17:50 2009 for CMSSW by  doxygen 1.5.4