CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions
DDDividedTrdX Class Reference

#include <DDDividedTrd.h>

Inheritance diagram for DDDividedTrdX:
DDDividedGeometryObject

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 ()
 
- Public Member Functions inherited from DDDividedGeometryObject
 DDDividedGeometryObject (const DDDivision &div, DDCompactView *cpv)
 
virtual void execute (void)
 
virtual const std::string & getType (void) const
 
virtual void setType (const std::string &type)
 
int volumeFirstCopyNo (void) const
 
virtual ~DDDividedGeometryObject (void)
 

Additional Inherited Members

- Static Public Member Functions inherited from DDDividedGeometryObject
static const double tolerance (void)
 
- Protected Member Functions inherited from DDDividedGeometryObject
int calculateNDiv (double motherDim, double width, double offset) const
 
double calculateWidth (double motherDim, int nDiv, double offset) const
 
DDRotationMatrixchangeRotMatrix (double rotZ=0.) const
 
void checkNDivAndWidth (double maxPar)
 
void checkOffset (double maxPar)
 
- Protected Attributes inherited from DDDividedGeometryObject
int compNDiv_
 
double compWidth_
 
DDCompactViewcpv_
 
DDDivision div_
 
DivisionType divisionType_
 
std::string ftype_
 
int theVoluFirstCopyNo_
 

Detailed Description

Definition at line 13 of file DDDividedTrd.h.

Constructor & Destructor Documentation

DDDividedTrdX::DDDividedTrdX ( const DDDivision div,
DDCompactView cpv 
)

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

23  : DDDividedGeometryObject(div,cpv)
24 {
26  setType( "DivisionTrdX" );
27  DDTrap mtrd = (DDTrap)( div_.parent().solid() );
28 
29  if ( divisionType_ == DivWIDTH )
30  {
31  compNDiv_ = calculateNDiv( 2 * mtrd.x1(), div_.width(), div_.offset() );
32  }
33  else if( divisionType_ == DivNDIV )
34  {
35  compWidth_ = calculateWidth( 2*mtrd.x1(), div_.nReplicas(), div_.offset() );
36  }
37 
38  DCOUT_V ('P', " DDDividedTrdX - ## divisions " << compNDiv_ << " = " << div_.nReplicas() << "\n Offset " << div_.offset() << "\n Width " << compWidth_ << " = " << div_.width());
39 }
double x1(void) const
Half-length along x of the side at y=-pDy1 of the face at -pDz.
Definition: DDSolid.cc:175
int nReplicas() const
Definition: DDDivision.cc:90
double offset() const
Definition: DDDivision.cc:100
int calculateNDiv(double motherDim, double width, double offset) const
double calculateWidth(double motherDim, int nDiv, double offset) const
const DDSolid & solid(void) const
Returns a reference object of the solid being the shape of this LogicalPart.
DDDividedGeometryObject(const DDDivision &div, DDCompactView *cpv)
Interface to a Trapezoid.
Definition: DDSolid.h:77
virtual void setType(const std::string &type)
#define DCOUT_V(M_v_Y, M_v_S)
Definition: DDdebug.h:54
double width() const
Definition: DDDivision.cc:95
const DDLogicalPart & parent() const
Definition: DDDivision.cc:105
virtual void checkParametersValidity()
DDDividedTrdX::~DDDividedTrdX ( void  )
virtual

Definition at line 41 of file DDDividedTrd.cc.

42 {}

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::checkParametersValidity(), DDDividedGeometryObject::div_, edm::hlt::Exception, DDDivision::parent(), DDTrap::phi(), alignCSCRings::s, DDLogicalPart::solid(), DDTrap::theta(), DDDividedGeometryObject::tolerance(), DDTrap::x1(), DDTrap::x2(), DDTrap::x3(), and DDTrap::x4().

Referenced by DDDividedTrdX().

126 {
128 
129  DDTrap mtrd = (DDTrap)(div_.parent().solid());
130 
131  double mpDx1 = mtrd.x1(); //->GetXHalfLength1();
132  double mpDx2 = mtrd.x2(); //->GetXHalfLength2();
133  double mpDx3 = mtrd.x3();
134  double mpDx4 = mtrd.x4();
135  double mpTheta = mtrd.theta();
136  double mpPhi = mtrd.phi();
137  double mpAlpha1 = mtrd.alpha1();
138  double mpAlpha2 = mtrd.alpha2();
139  // double mpDy1 = mtrd.y1();
140  // double mpDy2 = mtrd.y2();
141  // double x1Tol = mpDx1 - mpDx2;
142  // if (x1Tol < 0.0) x1Tol = x1Tol * -1.0;
143 
144  if ( fabs(mpDx1 - mpDx2) > tolerance() || fabs(mpDx3 - mpDx4) > tolerance()
145  || fabs(mpDx1 - mpDx4) > tolerance())
146  {
147  std::string s = "ERROR - DDDividedTrdX::checkParametersValidity()";
148  s+= "\n Making a division of a TRD along axis X,";
149  s+= "\n while the X half lengths are not equal,";
150  s+= "\n is not (yet) supported. It will result";
151  s+= "\n in non-equal division solids.";
152  throw cms::Exception("DDException") << s;
153  }
154  // if (fabs(mpDy1 - mpDy2) > tolerance())
155  // {
156  // std::string s = "ERROR - DDDividedTrdX::checkParametersValidity()";
157  // s+= "\n Making a division of a TRD along axis X,";
158  // s+= "\n while the Y half lengths are not equal,";
159  // s+= "\n is not (yet) supported. It will result";
160  // s+= "\n in non-equal division solids.";
161  // throw cms::Exception("DDException") << s;
162  // }
163  // mec: we only have traps, not trds in DDD, so I added this check
164  // to make sure it is only a trd (I think! :-))
165  if (mpAlpha1 != 0.*deg || mpAlpha2 != 0.*deg || mpTheta != 0.*deg || mpPhi != 0.*deg)
166  {
167  std::string s = "ERROR - DDDividedTrdX::checkParametersValidity()";
168  s+= "\n Making a division of a TRD along axis X,";
169  s+= "\n while the theta, phi and aplhpa2 are not zero,";
170  s+= "\n is not (yet) supported. It will result";
171  s+= "\n in non-equal division solids.";
172  throw cms::Exception("DDException") << s;
173  }
174 }
double x1(void) const
Half-length along x of the side at y=-pDy1 of the face at -pDz.
Definition: DDSolid.cc:175
double phi(void) const
Azimuthal angle of the line joining the centres of the faces at -/+pDz.
Definition: DDSolid.cc:171
const DDSolid & solid(void) const
Returns a reference object of the solid being the shape of this LogicalPart.
virtual void checkParametersValidity(void)
static const double tolerance(void)
double x4(void) const
Half-length along x of the side at y=+pDy2 of the face at +pDz.
Definition: DDSolid.cc:185
Interface to a Trapezoid.
Definition: DDSolid.h:77
double alpha1(void) const
Angle with respect to the y axis from the centre of the side at y=-pDy1 to the centre at y=+pDy1 of t...
Definition: DDSolid.cc:179
double alpha2(void) const
Angle with respect to the y axis from the centre of the side at y=-pDy2 to the centre at y=+pDy2 of t...
Definition: DDSolid.cc:187
double x2(void) const
Half-length along x of the side at y=+pDy1 of the face at -pDz.
Definition: DDSolid.cc:177
const DDLogicalPart & parent() const
Definition: DDDivision.cc:105
double theta(void) const
Polar angle of the line joining the centres of the faces at -/+pDz.
Definition: DDSolid.cc:169
double x3(void) const
Half-length along x of the side at y=-pDy2 of the face at +pDz.
Definition: DDSolid.cc:183
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().

46 {
47  DDTrap mtrd = (DDTrap)(div_.parent().solid());
48  return 2 * mtrd.x1();
49 }
double x1(void) const
Half-length along x of the side at y=-pDy1 of the face at -pDz.
Definition: DDSolid.cc:175
const DDSolid & solid(void) const
Returns a reference object of the solid being the shape of this LogicalPart.
Interface to a Trapezoid.
Definition: DDSolid.h:77
const DDLogicalPart & parent() const
Definition: DDDivision.cc:105
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().

89 {
90  DDTrap mtrd = (DDTrap)(div_.parent().solid());
91  DDMaterial usemat = div_.parent().material();
92 
93  double pDy1 = mtrd.y1(); //GetYHalfLength1();
94  double pDy2 = mtrd.y2(); //->GetYHalfLength2();
95  double pDz = mtrd.halfZ(); //->GetZHalfLength();
96  double pDx = compWidth_/2.;
97 
98  //trd.SetAllParameters ( pDx, pDx, pDy1, pDy2, pDz );
99 
100  DDName solname(div_.parent().ddname().name() + "_DIVCHILD"
101  , div_.parent().ddname().ns());
102  DDSolid dsol(solname);
103  DDLogicalPart ddlp(solname);
104  if (!dsol.isDefined().second)
105  {
106  dsol = DDSolidFactory::trap(solname
107  , pDz
108  , 0.*deg
109  , 0.*deg
110  , pDy1
111  , pDx
112  , pDx
113  , 0.*deg
114  , pDy2
115  , pDx
116  , pDx
117  , 0.*deg);
118  ddlp = DDLogicalPart(solname, usemat, dsol);
119  }
120  DCOUT_V ('P', "DDDividedTrdX::makeDDLogicalPart lp = " << ddlp);
121  return ddlp;
122 }
double halfZ(void) const
half of the z-Axis
Definition: DDSolid.cc:167
DDMaterial is used to define and access material information.
Definition: DDMaterial.h:41
const std::string & ns() const
Returns the namespace.
Definition: DDName.cc:101
DDName is used to identify DDD entities uniquely.
Definition: DDName.h:18
const DDSolid & solid(void) const
Returns a reference object of the solid being the shape of this LogicalPart.
A DDSolid represents the shape of a part.
Definition: DDSolid.h:35
Interface to a Trapezoid.
Definition: DDSolid.h:77
double y1(void) const
Half-length along y of the face at -pDz.
Definition: DDSolid.cc:173
A DDLogicalPart aggregates information concerning material, solid and sensitveness ...
Definition: DDLogicalPart.h:88
static DDSolid trap(const DDName &name, double pDz, double pTheta, double pPhi, double pDy1, double pDx1, double pDx2, double pAlp1, double pDy2, double pDx3, double pDx4, double pAlp2)
Definition: DDSolid.cc:723
#define DCOUT_V(M_v_Y, M_v_S)
Definition: DDdebug.h:54
double y2(void) const
Half-length along y of the face at +pDz.
Definition: DDSolid.cc:181
const DDLogicalPart & parent() const
Definition: DDDivision.cc:105
const std::string & name() const
Returns the name.
Definition: DDName.cc:87
const DDMaterial & material(void) const
Returns a reference object of the material this LogicalPart is made of.
const N & ddname() const
Definition: DDBase.h:84
DDRotation DDDividedTrdX::makeDDRotation ( const int  copyNo) const
virtual

Reimplemented from DDDividedGeometryObject.

Definition at line 82 of file DDDividedTrd.cc.

83 {
84  return DDRotation();
85 }
Represents a uniquely identifyable rotation matrix.
Definition: DDTransform.h:66
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_, edm::hlt::Exception, DDAxesNames::name(), DDDivision::offset(), DDDivision::parent(), alignCSCRings::s, DDLogicalPart::solid(), vdt::x, and DDTrap::x1().

53 {
54  DDTrap mtrd = (DDTrap)(div_.parent().solid());
55  double mdx = mtrd.x1();
56 
57 
58  //----- translation
59  double posi = -mdx + div_.offset() + (copyNo+0.5)*compWidth_;
60 
61  DCOUT_V ('P', " DDDividedTrdX: " << copyNo << "\n Position: x=" << posi << " Axis= " << DDAxesNames::name(div_.axis()) << "\n");
62 
63  if( div_.axis() == x )
64  {
65  return DDTranslation(posi, 0.0, 0.0);
66  }
67  else
68  {
69  std::string s = "ERROR - DDDividedTrdX::makeDDTranslation()";
70  s += "\n Axis is along ";
71  s += DDAxesNames::name(div_.axis());
72  s += " !\n" ;
73  s += "DDDividedTrdX::makeDDTranslation()";
74  s += " IllegalConstruct: Only axes along x are allowed !";
75  throw cms::Exception("DDException") << s;
76  }
77 
78  return DDTranslation();
79 }
double x1(void) const
Half-length along x of the side at y=-pDy1 of the face at -pDz.
Definition: DDSolid.cc:175
double offset() const
Definition: DDDivision.cc:100
const DDSolid & solid(void) const
Returns a reference object of the solid being the shape of this LogicalPart.
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< double > > DDTranslation
Definition: DDTranslation.h:7
Interface to a Trapezoid.
Definition: DDSolid.h:77
#define DCOUT_V(M_v_Y, M_v_S)
Definition: DDdebug.h:54
DDAxes axis() const
Definition: DDDivision.cc:85
const DDLogicalPart & parent() const
Definition: DDDivision.cc:105
static const std::string name(const DDAxes &s)
Definition: DDAxes.cc:37
x
Definition: VDTMath.h:216