CMS 3D CMS Logo

DDDividedTrdZ Class Reference

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

Inheritance diagram for DDDividedTrdZ:

DDDividedGeometryObject

List of all members.

Public Member Functions

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


Detailed Description

Definition at line 53 of file DDDividedTrd.h.


Constructor & Destructor Documentation

DDDividedTrdZ::DDDividedTrdZ ( const DDDivision div  ) 

Definition at line 328 of file DDDividedTrd.cc.

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

00329   : DDDividedGeometryObject ( div )
00330 { 
00331   checkParametersValidity();
00332   setType( "DivTrdZ" );
00333   DDTrap mtrd = (DDTrap)(div_.parent().solid());
00334 
00335   if ( divisionType_ == DivWIDTH )
00336     {
00337       compNDiv_ = calculateNDiv( 2*mtrd.halfZ(), div_.width(), div_.offset() );
00338     }
00339   else if( divisionType_ == DivNDIV )
00340   {
00341     compWidth_ = calculateWidth( 2*mtrd.halfZ(), div_.nReplicas(), div_.offset() );
00342   }
00343   DCOUT_V ('P', " DDDividedTrdY no divisions " << compNDiv_ << " = " << div_.nReplicas() << "\n Offset " << div_.offset() << "\n width " << compWidth_ << " = " << div_.width() << std::endl);
00344 }

DDDividedTrdZ::~DDDividedTrdZ (  )  [virtual]

Definition at line 347 of file DDDividedTrd.cc.

00348 {
00349 }


Member Function Documentation

void DDDividedTrdZ::checkParametersValidity (  )  [virtual]

Reimplemented from DDDividedGeometryObject.

Definition at line 438 of file DDDividedTrd.cc.

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

Referenced by DDDividedTrdZ().

00439 {
00440   DDDividedGeometryObject::checkParametersValidity();
00441 
00442   DDTrap mtrd = (DDTrap)(div_.parent().solid());
00443 
00444   double mpTheta = mtrd.theta();
00445   double mpPhi = mtrd.phi();
00446   double mpAlpha1 = mtrd.alpha1();
00447   double mpAlpha2 = mtrd.alpha2();
00448 
00449   // mec:  we only have traps, not trds in DDD, so I added this check
00450   // to make sure it is only a trd (I think! :-))
00451   if (mpAlpha1 != 0.*deg || mpAlpha2 != 0.*deg || mpTheta != 0.*deg || mpPhi != 0.*deg)
00452     {
00453       std::string s = "ERROR - DDDividedTrdZ::checkParametersValidity()";
00454       s+= "\n        Making a division of a TRD along axis X,";
00455       s+= "\n        while the theta, phi and aplhpa2 are not zero,";
00456       s+= "\n        is not (yet) supported. It will result";
00457       s+= "\n        in non-equal division solids.";
00458       throw DDException(s);
00459     }
00460 }

double DDDividedTrdZ::getMaxParameter (  )  const [virtual]

Reimplemented from DDDividedGeometryObject.

Definition at line 352 of file DDDividedTrd.cc.

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

00353 {
00354   DDTrap mtrd = (DDTrap)(div_.parent().solid());
00355   return 2 * mtrd.halfZ();
00356 }

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

Reimplemented from DDDividedGeometryObject.

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

00395 {
00396   //---- The division along Z of a Trd will result a Trd
00397   DDTrap mtrd = (DDTrap)(div_.parent().solid());
00398   DDMaterial usemat = div_.parent().material();
00399 
00400   double pDx1 = mtrd.x1(); //->GetXHalfLength1();
00401   //(mtrd->GetXHalfLength2() - mtrd->GetXHalfLength1() );
00402   double DDx = (mtrd.x2() - mtrd.x1() );
00403   double pDy1 = mtrd.y1(); // ->GetYHalfLength1();
00404   //(mtrd->GetYHalfLength2() - mtrd->GetYHalfLength1() );
00405   double DDy = (mtrd.y2() - mtrd.y1() );
00406   double pDz = compWidth_/2.;
00407   double zLength = 2*mtrd.halfZ(); //->GetZHalfLength();
00408  
00409 //    trd.SetAllParameters ( pDx1+DDx*(div_.offset()+copyNo*compWidth_)/zLength,
00410 //                           pDx1+DDx*(div_.offset()+(copyNo+1)*compWidth_)/zLength, 
00411 //                           pDy1+DDy*(div_.offset()+copyNo*compWidth_)/zLength,
00412 //                           pDy1+DDy*(div_.offset()+(copyNo+1)*compWidth_)/zLength, pDz );
00413 
00414   DDName solname(div_.parent().ddname().name() + "_DIVCHILD" 
00415                  + DDXMLElement::itostr(copyNo)
00416                  , div_.parent().ddname().ns());
00417   DDSolid  dsol = 
00418     DDSolidFactory::trap(solname
00419                          , pDz
00420                          , 0.*deg
00421                          , 0.*deg
00422                          , pDy1+DDy*(div_.offset()+copyNo*compWidth_)/zLength
00423                          , pDx1+DDx*(div_.offset()+copyNo*compWidth_)/zLength
00424                          , pDx1+DDx*(div_.offset()+copyNo*compWidth_)/zLength
00425                          , 0.*deg
00426                          , pDy1+DDy*(div_.offset()+(copyNo+1)*compWidth_)/zLength
00427                          , pDx1+DDx*(div_.offset()+(copyNo+1)*compWidth_)/zLength
00428                          , pDx1+DDx*(div_.offset()+(copyNo+1)*compWidth_)/zLength
00429                          , 0*deg
00430                          );
00431 
00432   DDLogicalPart ddlp(solname, usemat, dsol);
00433   DCOUT_V ('P', "DDDividedTrdZ::makeDDLogicalPart lp = " << ddlp);
00434   return ddlp;
00435 }

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

Reimplemented from DDDividedGeometryObject.

Definition at line 388 of file DDDividedTrd.cc.

00389 {
00390   return DDRotation();
00391 }

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

Reimplemented from DDDividedGeometryObject.

Definition at line 359 of file DDDividedTrd.cc.

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

00360 {
00361   DDTrap mtrd = (DDTrap)(div_.parent().solid() );
00362   double mdz = mtrd.halfZ();
00363 
00364   //----- translation 
00365   double posi = -mdz + div_.offset() + (copyNo+0.5)*compWidth_;
00366 
00367   DCOUT_V ('P', " DDDividedTrdZ: " << copyNo << "\n Position: z=" << posi << "  Axis= " << DDAxesNames::name(div_.axis()) << "\n");
00368 
00369   if( div_.axis() == z )
00370   {
00371     return DDTranslation(0.0, 0.0, posi);
00372   }
00373   else
00374   { 
00375     std::string s = "ERROR - DDDividedTrdZ::makeDDTranslation()";
00376     s += "\n        Axis is along ";
00377     s += DDAxesNames::name(div_.axis());
00378     s += " !\n" ;
00379     s += "DDDividedTrdY::makeDDTranslation()";
00380     s += " IllegalConstruct: Only axes along z are allowed !";
00381     throw DDException(s);
00382 
00383   }
00384   return DDTranslation();
00385 }


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