test
CMS 3D CMS Logo

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

#include <DDDividedPolyhedra.h>

Inheritance diagram for DDDividedPolyhedraZ:
DDDividedGeometryObject

Public Member Functions

virtual void checkParametersValidity ()
 
 DDDividedPolyhedraZ (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 ~DDDividedPolyhedraZ ()
 
- 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 64 of file DDDividedPolyhedra.h.

Constructor & Destructor Documentation

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

Definition at line 285 of file DDDividedPolyhedra.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 DDPolyhedra::zVec().

286  : DDDividedGeometryObject( div, cpv )
287 {
289  setType( "DivisionPolyhedraZ" );
290 
291  DDPolyhedra msol = (DDPolyhedra)(div_.parent().solid());
292 
293  std::vector<double> zvec = msol.zVec();
294 
295  if ( divisionType_ == DivWIDTH )
296  {
297  compNDiv_ =
298  calculateNDiv( zvec[zvec.size() - 1] - zvec[0], div_.width(), div_.offset() );
299  }
300  else if( divisionType_ == DivNDIV )
301  {
302  compWidth_ = calculateWidth( zvec[zvec.size() - 1] - zvec[0],
303  div_.nReplicas(),
304  div_.offset());
305  // ?what? CalculateNDiv( zvec[zvec.size() - 1] - zvec[0], origparamMother->Z_values[origparamMother->Num_z_planes-1]
306  // - origparamMother->Z_values[0] , nDiv, offset );
307  }
308 
309  DCOUT_V ('P', " DDDividedPolyhedraZ - # divisions " << compNDiv_ << " = " << div_.nReplicas() << "\n Offset " << " = " << div_.offset() << "\n Width " << compWidth_ << " = " << div_.width());
310 }
virtual void checkParametersValidity()
int nReplicas() const
Definition: DDDivision.cc:71
double offset() const
Definition: DDDivision.cc:81
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)
virtual void setType(const std::string &type)
#define DCOUT_V(M_v_Y, M_v_S)
Definition: DDdebug.h:54
std::vector< double > zVec(void) const
Definition: DDSolid.cc:426
double width() const
Definition: DDDivision.cc:76
const DDLogicalPart & parent() const
Definition: DDDivision.cc:86
DDDividedPolyhedraZ::~DDDividedPolyhedraZ ( void  )
virtual

Definition at line 312 of file DDDividedPolyhedra.cc.

313 {}

Member Function Documentation

void DDDividedPolyhedraZ::checkParametersValidity ( void  )
virtual

Reimplemented from DDDividedGeometryObject.

Definition at line 325 of file DDDividedPolyhedra.cc.

References DDDividedGeometryObject::checkParametersValidity(), DDDividedGeometryObject::compNDiv_, gather_cfg::cout, DDDividedGeometryObject::div_, DDDividedGeometryObject::divisionType_, DivNDIVandWIDTH, DivWIDTH, Exception, DDDivision::offset(), DDDivision::parent(), alignCSCRings::s, DDLogicalPart::solid(), AlCaHLTBitMon_QueryRunRegistry::string, and DDPolyhedra::zVec().

Referenced by DDDividedPolyhedraZ().

326 {
328 
329  DDPolyhedra msol = (DDPolyhedra)(div_.parent().solid());
330 
332  {
333  std::cout << "WARNING - "
334  << "DDDividedPolyhedraZ::checkParametersValidity()"
335  << std::endl
336  << " Solid " << msol << std::endl
337  << " Division along Z will be done splitting "
338  << "in the defined z_planes." << std::endl
339  << " WIDTH will not be used !" << std::endl;
340  }
341 
342  if( div_.offset() != 0. )
343  {
344  std::cout << "WARNING - "
345  << "DDDividedPolyhedraZ::checkParametersValidity()"
346  << std::endl
347  << " Solid " << msol << std::endl
348  << " Division along Z will be done splitting "
349  << "in the defined z_planes." << std::endl
350  << " OFFSET will not be used !" << std::endl;
351  }
352 
353  std::vector<double> zvec = msol.zVec();
354 
355  if ( zvec.size() - 1 != size_t(compNDiv_) )
356  {
357  std::cout << "ERROR - "
358  << "DDDividedPolyhedraZ::checkParametersValidity()"
359  << std::endl
360  << " Division along Z can only be done by splitting in the defined"
361  << std::endl
362  << " z_planes, i.e, the number of division would be :"
363  << " " << zvec.size() - 1
364  << " instead of " << compNDiv_ << " !"
365  << std::endl;
366  std::string s = "DDDividedPolyhedraZ::checkParametersValidity()";
367  s += "Illegal Construct. Not a supported configuration.";
368  throw cms::Exception("DDException") << s;
369  }
370 }
double offset() const
Definition: DDDivision.cc:81
const DDSolid & solid(void) const
Returns a reference object of the solid being the shape of this LogicalPart.
virtual void checkParametersValidity(void)
std::vector< double > zVec(void) const
Definition: DDSolid.cc:426
tuple cout
Definition: gather_cfg.py:145
const DDLogicalPart & parent() const
Definition: DDDivision.cc:86
double DDDividedPolyhedraZ::getMaxParameter ( void  ) const
virtual

Reimplemented from DDDividedGeometryObject.

Definition at line 316 of file DDDividedPolyhedra.cc.

References DDDividedGeometryObject::div_, DDDivision::parent(), DDLogicalPart::solid(), and DDPolyhedra::zVec().

317 {
318  DDPolyhedra msol = (DDPolyhedra)(div_.parent().solid());
319 
320  std::vector<double> zvec = msol.zVec();
321  return (zvec[zvec.size() - 1] - zvec[0]);
322 }
const DDSolid & solid(void) const
Returns a reference object of the solid being the shape of this LogicalPart.
std::vector< double > zVec(void) const
Definition: DDSolid.cc:426
const DDLogicalPart & parent() const
Definition: DDDivision.cc:86
DDLogicalPart DDDividedPolyhedraZ::makeDDLogicalPart ( const int  copyNo) const
virtual

Reimplemented from DDDividedGeometryObject.

Definition at line 395 of file DDDividedPolyhedra.cc.

References DCOUT_V, DDBase< N, C >::ddname(), DDPolyhedra::deltaPhi(), DDDividedGeometryObject::div_, DDXMLElement::itostr(), DDLogicalPart::material(), DDName::name(), DDName::ns(), DDDivision::parent(), DDSolidFactory::polyhedra(), DDPolyhedra::rMaxVec(), DDPolyhedra::rMinVec(), DDPolyhedra::sides(), DDLogicalPart::solid(), DDPolyhedra::startPhi(), and DDPolyhedra::zVec().

396 {
397  // only for mother number of planes = 2!!
398  // mec: what? why? comment above and = 2 below straight from G4 impl.
399  DDPolyhedra msol = (DDPolyhedra)( div_.parent().solid());
400  DDMaterial usemat = div_.parent().material();
401 
402  std::vector<double> zvec = msol.zVec();
403  std::vector<double> rminvec = msol.rMinVec();
404  std::vector<double> rmaxvec = msol.rMaxVec();
405 
406  double posi = ( zvec[ copyNo ] + zvec[ copyNo + 1 ] ) / 2.0;
407 
408  DDName solname( div_.parent().ddname().name() + "_DIVCHILD" + DDXMLElement::itostr( copyNo ),
409  div_.parent().ddname().ns());
410  std::vector<double> newRmin, newRmax, newZ;
411  newZ.push_back( zvec[ copyNo ] - posi );
412  newZ.push_back( zvec[ copyNo + 1 ] - posi );
413  newRmin.push_back( rminvec[ copyNo ]);
414  newRmin.push_back( rminvec[ copyNo + 1 ]);
415  newRmax.push_back( rmaxvec[ copyNo ]);
416  newRmax.push_back( rmaxvec[ copyNo + 1 ]);
417 
418  DDSolid dsol = DDSolidFactory::polyhedra( solname,
419  msol.sides(),
420  msol.startPhi(),
421  msol.deltaPhi(),
422  newZ,
423  newRmin,
424  newRmax );
425  DDLogicalPart lp( solname, usemat, dsol );
426 
427  DCOUT_V( 'P', "DDDividedPolyhedraZ::makeDDLogicalPart" << "\n-- Parametrised phedra copy-number: " << copyNo << "\n-- DDLogicalPart " << lp );
428  return lp;
429 }
double startPhi(void) const
Definition: DDSolid.cc:415
std::vector< double > rMaxVec(void) const
Definition: DDSolid.cc:440
static std::string itostr(int i)
WARNING: abused by other classes in this system: yet another conversion from int to std::string...
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:14
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
A DDLogicalPart aggregates information concerning material, solid and sensitveness ...
Definition: DDLogicalPart.h:88
std::vector< double > rMinVec(void) const
Definition: DDSolid.cc:433
int sides(void) const
Definition: DDSolid.cc:413
#define DCOUT_V(M_v_Y, M_v_S)
Definition: DDdebug.h:54
std::vector< double > zVec(void) const
Definition: DDSolid.cc:426
double deltaPhi(void) const
Definition: DDSolid.cc:417
const DDLogicalPart & parent() const
Definition: DDDivision.cc:86
const std::string & name() const
Returns the name.
Definition: DDName.cc:87
static DDSolid polyhedra(const DDName &name, int sides, double startPhi, double deltaPhi, const std::vector< double > &z, const std::vector< double > &rmin, const std::vector< double > &rmax)
Creates a polyhedra (refere to Geant3 or Geant4 documentation)
Definition: DDSolid.cc:673
const DDMaterial & material(void) const
Returns a reference object of the material this LogicalPart is made of.
const N & ddname() const
Definition: DDBase.h:80
DDRotation DDDividedPolyhedraZ::makeDDRotation ( const int  copyNo) const
virtual

Reimplemented from DDDividedGeometryObject.

Definition at line 389 of file DDDividedPolyhedra.cc.

390 {
391  return DDRotation();
392 }
Represents a uniquely identifyable rotation matrix.
Definition: DDTransform.h:66
DDTranslation DDDividedPolyhedraZ::makeDDTranslation ( const int  copyNo) const
virtual

Reimplemented from DDDividedGeometryObject.

Definition at line 373 of file DDDividedPolyhedra.cc.

References DDDividedGeometryObject::compWidth_, DCOUT_V, DDDividedGeometryObject::div_, DDDivision::offset(), DDDivision::parent(), DDLogicalPart::solid(), and DDPolyhedra::zVec().

374 {
375  DDPolyhedra msol = (DDPolyhedra)(div_.parent().solid());
376  std::vector<double> zvec = msol.zVec();
377 
378  //----- set translation: along Z axis
379  double posi = (zvec[copyNo] + zvec[copyNo+1])/2;
380 
381  DDTranslation tr(0,0,posi);
382  //----- calculate rotation matrix: unit
383 
384  DCOUT_V ('P', " DDDividedPolyhedraZ - position: " << posi << "\n copyNo: " << copyNo << " - offset: " << div_.offset()/deg << " - compWidth_: " << compWidth_/deg << " translation = " << tr);
385  return tr;
386 }
double offset() const
Definition: DDDivision.cc:81
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
#define DCOUT_V(M_v_Y, M_v_S)
Definition: DDdebug.h:54
std::vector< double > zVec(void) const
Definition: DDSolid.cc:426
const DDLogicalPart & parent() const
Definition: DDDivision.cc:86