CMS 3D CMS Logo

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

#include <DDDividedTrd.h>

Inheritance diagram for DDDividedTrdY:
DDDividedGeometryObject

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 ()
 
- 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 33 of file DDDividedTrd.h.

Constructor & Destructor Documentation

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

Definition at line 177 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::y1().

178  : DDDividedGeometryObject( div, cpv )
179 {
181  setType( "DivisionTrdY" );
182  DDTrap mtrd = (DDTrap)(div_.parent().solid());
183 
184  if( divisionType_ == DivWIDTH )
185  {
186  compNDiv_ = calculateNDiv( 2 * mtrd.y1(), div_.width(), div_.offset() );
187  }
188  else if( divisionType_ == DivNDIV )
189  {
190  compWidth_ = calculateWidth( 2 * mtrd.y1(), div_.nReplicas(), div_.offset() );
191  }
192 
193  DCOUT_V ('P', " DDDividedTrdY no divisions " << compNDiv_ << " = " << div_.nReplicas() << "\n Offset " << div_.offset() << "\n width " << compWidth_ << " = " << div_.width() << std::endl);
194 }
const int nReplicas() const
Definition: DDDivision.cc:90
int calculateNDiv(double motherDim, double width, double offset) const
double calculateWidth(double motherDim, int nDiv, double offset) const
DDDividedGeometryObject(const DDDivision &div, DDCompactView *cpv)
Interface to a Trapezoid.
Definition: DDSolid.h:115
virtual void setType(const std::string &type)
double y1() const
Half-length along y of the face at -pDz.
Definition: DDSolid.cc:176
#define DCOUT_V(M_v_Y, M_v_S)
Definition: DDdebug.h:54
const double width() const
Definition: DDDivision.cc:95
const DDSolid & solid() const
Returns a reference object of the solid being the shape of this LogicalPart.
const double offset() const
Definition: DDDivision.cc:100
const DDLogicalPart & parent() const
Definition: DDDivision.cc:105
virtual void checkParametersValidity()
DDDividedTrdY::~DDDividedTrdY ( void  )
virtual

Definition at line 196 of file DDDividedTrd.cc.

197 {}

Member Function Documentation

void DDDividedTrdY::checkParametersValidity ( void  )
virtual

Reimplemented from DDDividedGeometryObject.

Definition at line 280 of file DDDividedTrd.cc.

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

Referenced by DDDividedTrdY().

281 {
283 
284  DDTrap mtrd = (DDTrap)(div_.parent().solid());
285 
286  double mpDy1 = mtrd.y1(); //->GetYHalfLength1();
287  double mpDy2 = mtrd.y2(); //->GetYHalfLength2();
288  double mpTheta = mtrd.theta();
289  double mpPhi = mtrd.phi();
290  double mpAlpha1 = mtrd.alpha1();
291  double mpAlpha2 = mtrd.alpha2();
292 
293  if( fabs(mpDy1 - mpDy2) > tolerance() )
294  {
295  std::string s= "ERROR - DDDividedTrdY::checkParametersValidity()";
296  s += "\n Making a division of a TRD along axis Y while";
297  s += "\n the Y half lengths are not equal is not (yet)";
298  s += "\n supported. It will result in non-equal";
299  s += "\n division solids.";
300  throw DDException(s);
301  }
302  // mec: we only have traps, not trds in DDD, so I added this check
303  // to make sure it is only a trd (I think! :-))
304  if (mpAlpha1 != 0.*deg || mpAlpha2 != 0.*deg || mpTheta != 0.*deg || mpPhi != 0.*deg)
305  {
306  std::string s = "ERROR - DDDividedTrdY::checkParametersValidity()";
307  s+= "\n Making a division of a TRD along axis X,";
308  s+= "\n while the theta, phi and aplhpa2 are not zero,";
309  s+= "\n is not (yet) supported. It will result";
310  s+= "\n in non-equal division solids.";
311  throw DDException(s);
312  }
313 }
double y2() const
Half-length along y of the face at +pDz.
Definition: DDSolid.cc:184
double alpha1() 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:182
An exception for DDD errors.
Definition: DDException.h:23
double alpha2() 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:190
virtual void checkParametersValidity(void)
static const double tolerance(void)
double phi() const
Azimuthal angle of the line joining the centres of the faces at -/+pDz.
Definition: DDSolid.cc:174
double theta() const
Polar angle of the line joining the centres of the faces at -/+pDz.
Definition: DDSolid.cc:172
Interface to a Trapezoid.
Definition: DDSolid.h:115
double y1() const
Half-length along y of the face at -pDz.
Definition: DDSolid.cc:176
const DDSolid & solid() const
Returns a reference object of the solid being the shape of this LogicalPart.
const DDLogicalPart & parent() const
Definition: DDDivision.cc:105
string s
Definition: asciidump.py:422
double DDDividedTrdY::getMaxParameter ( void  ) const
virtual

Reimplemented from DDDividedGeometryObject.

Definition at line 200 of file DDDividedTrd.cc.

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

201 {
202  DDTrap mtrd = (DDTrap)(div_.parent().solid());
203  return 2 * mtrd.y1();
204 }
Interface to a Trapezoid.
Definition: DDSolid.h:115
double y1() const
Half-length along y of the face at -pDz.
Definition: DDSolid.cc:176
const DDSolid & solid() const
Returns a reference object of the solid being the shape of this LogicalPart.
const DDLogicalPart & parent() const
Definition: DDDivision.cc:105
DDLogicalPart DDDividedTrdY::makeDDLogicalPart ( const int  copyNo) const
virtual

Reimplemented from DDDividedGeometryObject.

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

242 {
243  //---- The division along Y of a Trd will result a Trd, only
244  //--- if Y at -Z and +Z are equal, else use the G4Trap version
245  DDTrap mtrd = (DDTrap)(div_.parent().solid());
246  DDMaterial usemat = div_.parent().material();
247 
248  double pDx1 = mtrd.x1(); //->GetXHalfLength1() at Y+;
249  double pDx2 = mtrd.x2(); //->GetXHalfLength2() at Y+;
250  double pDx3 = mtrd.x3(); //->GetXHalfLength1() at Y-;
251  double pDx4 = mtrd.x4(); //->GetXHalfLength2() at Y-;
252  double pDz = mtrd.halfZ(); //->GetZHalfLength();
253  double pDy = compWidth_/2.;
254 
255  //trd.SetAllParameters ( pDx1, pDx2, pDy, pDy, pDz );
256  DDName solname(div_.name() );
257  DDSolid dsol(solname);
258  DDLogicalPart ddlp(solname);
259  if (!dsol.isDefined().second)
260  {
261  dsol = DDSolidFactory::trap(solname
262  , pDz
263  , 0.*deg
264  , 0.*deg
265  , pDy
266  , pDx1
267  , pDx2
268  , 0*deg
269  , pDy
270  , pDx3
271  , pDx4
272  , 0.*deg);
273  DDLogicalPart ddlp(solname, usemat, dsol);
274  }
275  DCOUT_V ('P', "DDDividedTrdY::makeDDLogicalPart lp = " << ddlp);
276  return ddlp;
277 }
double halfZ() const
half of the z-Axis
Definition: DDSolid.cc:170
const N & name() const
Definition: DDBase.h:88
double x2() const
Half-length along x of the side at y=+pDy1 of the face at -pDz.
Definition: DDSolid.cc:180
DDMaterial is used to define and access material information.
Definition: DDMaterial.h:45
DDName is used to identify DDD entities uniquely.
Definition: DDName.h:18
const DDMaterial & material() const
Returns a reference object of the material this LogicalPart is made of.
A DDSolid represents the shape of a part.
Definition: DDSolid.h:42
Interface to a Trapezoid.
Definition: DDSolid.h:115
A DDLogicalPart aggregates information concerning material, solid and sensitveness ...
Definition: DDLogicalPart.h:95
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:726
#define DCOUT_V(M_v_Y, M_v_S)
Definition: DDdebug.h:54
double x4() const
Half-length along x of the side at y=+pDy2 of the face at +pDz.
Definition: DDSolid.cc:188
double x3() const
Half-length along x of the side at y=-pDy2 of the face at +pDz.
Definition: DDSolid.cc:186
const DDSolid & solid() const
Returns a reference object of the solid being the shape of this LogicalPart.
const DDLogicalPart & parent() const
Definition: DDDivision.cc:105
double x1() const
Half-length along x of the side at y=-pDy1 of the face at -pDz.
Definition: DDSolid.cc:178
DDRotation DDDividedTrdY::makeDDRotation ( const int  copyNo) const
virtual

Reimplemented from DDDividedGeometryObject.

Definition at line 235 of file DDDividedTrd.cc.

236 {
237  return DDRotation();
238 }
Represents a uniquely identifyable rotation matrix.
Definition: DDTransform.h:66
DDTranslation DDDividedTrdY::makeDDTranslation ( const int  copyNo) const
virtual

Reimplemented from DDDividedGeometryObject.

Definition at line 207 of file DDDividedTrd.cc.

References DDDivision::axis(), DDDividedGeometryObject::compWidth_, DCOUT_V, DDDividedGeometryObject::div_, DDAxesNames::name(), DDDivision::offset(), DDDivision::parent(), asciidump::s, DDLogicalPart::solid(), detailsBasic3DVector::y, and DDTrap::y1().

208 {
209  DDTrap mtrd = (DDTrap)(div_.parent().solid() );
210  double mdy = mtrd.y1();
211 
212  //----- translation
213  double posi = -mdy + div_.offset() + (copyNo+0.5)*compWidth_;
214 
215  DCOUT_V ('P', " DDDividedTrdY: " << copyNo << "\n Position: y=" << posi << " Axis= " << DDAxesNames::name(div_.axis()) << "\n");
216 
217  if( div_.axis() == y )
218  {
219  return DDTranslation(0.0, posi, 0.0);
220  }
221  else
222  {
223  std::string s = "ERROR - DDDividedTrdY::makeDDTranslation()";
224  s += "\n Axis is along ";
225  s += DDAxesNames::name(div_.axis());
226  s += " !\n" ;
227  s += "DDDividedTrdY::makeDDTranslation()";
228  s += " IllegalConstruct: Only axes along y are allowed !";
229  throw DDException(s);
230  }
231  return DDTranslation();
232 }
const DDAxes axis() const
Definition: DDDivision.cc:85
An exception for DDD errors.
Definition: DDException.h:23
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< double > > DDTranslation
Definition: DDTranslation.h:7
Interface to a Trapezoid.
Definition: DDSolid.h:115
double y1() const
Half-length along y of the face at -pDz.
Definition: DDSolid.cc:176
#define DCOUT_V(M_v_Y, M_v_S)
Definition: DDdebug.h:54
const DDSolid & solid() const
Returns a reference object of the solid being the shape of this LogicalPart.
const double offset() const
Definition: DDDivision.cc:100
const DDLogicalPart & parent() const
Definition: DDDivision.cc:105
string s
Definition: asciidump.py:422
static const std::string name(const DDAxes &s)
Definition: DDAxes.cc:37