CMS 3D CMS Logo

List of all members | Public Member Functions
DDDividedPolyhedraZ Class Referencefinal

#include <DDDividedPolyhedra.h>

Inheritance diagram for DDDividedPolyhedraZ:
DDDividedGeometryObject

Public Member Functions

void checkParametersValidity () override
 
 DDDividedPolyhedraZ (const DDDivision &div, DDCompactView *cpv)
 
double getMaxParameter () const override
 
DDLogicalPart makeDDLogicalPart (int copyNo) const override
 
DDRotation makeDDRotation (int copyNo) const override
 
DDTranslation makeDDTranslation (int copyNo) const override
 
- 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)=default
 

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
 
std::unique_ptr< 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 38 of file DDDividedPolyhedra.h.

Constructor & Destructor Documentation

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

Definition at line 258 of file DDDividedPolyhedra.cc.

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

259  : DDDividedGeometryObject( div, cpv )
260 {
262  setType( "DivisionPolyhedraZ" );
263 
264  DDPolyhedra msol = (DDPolyhedra)(div_.parent().solid());
265 
266  std::vector<double> zvec = msol.zVec();
267 
268  if ( divisionType_ == DivWIDTH )
269  {
270  compNDiv_ =
271  calculateNDiv( zvec[zvec.size() - 1] - zvec[0], div_.width(), div_.offset() );
272  }
273  else if( divisionType_ == DivNDIV )
274  {
275  compWidth_ = calculateWidth( zvec[zvec.size() - 1] - zvec[0],
276  div_.nReplicas(),
277  div_.offset());
278  }
279 }
int nReplicas() const
Definition: DDDivision.cc:75
double offset() const
Definition: DDDivision.cc:87
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.
void checkParametersValidity() override
DDDividedGeometryObject(const DDDivision &div, DDCompactView *cpv)
virtual void setType(const std::string &type)
std::vector< double > zVec(void) const
Definition: DDSolid.cc:414
double width() const
Definition: DDDivision.cc:81
const DDLogicalPart & parent() const
Definition: DDDivision.cc:93

Member Function Documentation

void DDDividedPolyhedraZ::checkParametersValidity ( void  )
overridevirtual

Reimplemented from DDDividedGeometryObject.

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

292 {
294 
295  DDPolyhedra msol = (DDPolyhedra)(div_.parent().solid());
296 
298  {
299  std::cout << "WARNING - "
300  << "DDDividedPolyhedraZ::checkParametersValidity()"
301  << std::endl
302  << " Solid " << msol << std::endl
303  << " Division along Z will be done splitting "
304  << "in the defined z_planes." << std::endl
305  << " WIDTH will not be used !" << std::endl;
306  }
307 
308  if( div_.offset() != 0. )
309  {
310  std::cout << "WARNING - "
311  << "DDDividedPolyhedraZ::checkParametersValidity()"
312  << std::endl
313  << " Solid " << msol << std::endl
314  << " Division along Z will be done splitting "
315  << "in the defined z_planes." << std::endl
316  << " OFFSET will not be used !" << std::endl;
317  }
318 
319  std::vector<double> zvec = msol.zVec();
320 
321  if ( zvec.size() - 1 != size_t(compNDiv_) )
322  {
323  std::cout << "ERROR - "
324  << "DDDividedPolyhedraZ::checkParametersValidity()"
325  << std::endl
326  << " Division along Z can only be done by splitting in the defined"
327  << std::endl
328  << " z_planes, i.e, the number of division would be :"
329  << " " << zvec.size() - 1
330  << " instead of " << compNDiv_ << " !"
331  << std::endl;
332  std::string s = "DDDividedPolyhedraZ::checkParametersValidity()";
333  s += "Illegal Construct. Not a supported configuration.";
334  throw cms::Exception("DDException") << s;
335  }
336 }
double offset() const
Definition: DDDivision.cc:87
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:414
const DDLogicalPart & parent() const
Definition: DDDivision.cc:93
double DDDividedPolyhedraZ::getMaxParameter ( void  ) const
overridevirtual

Reimplemented from DDDividedGeometryObject.

Definition at line 282 of file DDDividedPolyhedra.cc.

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

283 {
284  DDPolyhedra msol = (DDPolyhedra)(div_.parent().solid());
285 
286  std::vector<double> zvec = msol.zVec();
287  return (zvec[zvec.size() - 1] - zvec[0]);
288 }
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:414
const DDLogicalPart & parent() const
Definition: DDDivision.cc:93
DDLogicalPart DDDividedPolyhedraZ::makeDDLogicalPart ( int  copyNo) const
overridevirtual

Reimplemented from DDDividedGeometryObject.

Definition at line 359 of file DDDividedPolyhedra.cc.

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

360 {
361  // only for mother number of planes = 2!!
362  // mec: what? why? comment above and = 2 below straight from G4 impl.
363  DDPolyhedra msol = (DDPolyhedra)( div_.parent().solid());
364  DDMaterial usemat = div_.parent().material();
365 
366  std::vector<double> zvec = msol.zVec();
367  std::vector<double> rminvec = msol.rMinVec();
368  std::vector<double> rmaxvec = msol.rMaxVec();
369 
370  double posi = ( zvec[ copyNo ] + zvec[ copyNo + 1 ] ) / 2.0;
371 
372  DDName solname( div_.parent().ddname().name() + "_DIVCHILD" + std::to_string( copyNo ),
373  div_.parent().ddname().ns());
374  std::vector<double> newRmin, newRmax, newZ;
375  newZ.emplace_back( zvec[ copyNo ] - posi );
376  newZ.emplace_back( zvec[ copyNo + 1 ] - posi );
377  newRmin.emplace_back( rminvec[ copyNo ]);
378  newRmin.emplace_back( rminvec[ copyNo + 1 ]);
379  newRmax.emplace_back( rmaxvec[ copyNo ]);
380  newRmax.emplace_back( rmaxvec[ copyNo + 1 ]);
381 
382  DDSolid dsol = DDSolidFactory::polyhedra( solname,
383  msol.sides(),
384  msol.startPhi(),
385  msol.deltaPhi(),
386  newZ,
387  newRmin,
388  newRmax );
389  DDLogicalPart lp( solname, usemat, dsol );
390  return lp;
391 }
double startPhi(void) const
Definition: DDSolid.cc:400
std::vector< double > rMaxVec(void) const
Definition: DDSolid.cc:430
DDMaterial is used to define and access material information.
Definition: DDMaterial.h:43
const std::string & ns() const
Returns the namespace.
Definition: DDName.cc:67
DDName is used to identify DDD entities uniquely.
Definition: DDName.h:15
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:39
A DDLogicalPart aggregates information concerning material, solid and sensitveness ...
Definition: DDLogicalPart.h:93
std::vector< double > rMinVec(void) const
Definition: DDSolid.cc:422
int sides(void) const
Definition: DDSolid.cc:397
std::vector< double > zVec(void) const
Definition: DDSolid.cc:414
double deltaPhi(void) const
Definition: DDSolid.cc:403
const DDLogicalPart & parent() const
Definition: DDDivision.cc:93
const std::string & name() const
Returns the name.
Definition: DDName.cc:53
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:730
const DDMaterial & material(void) const
Returns a reference object of the material this LogicalPart is made of.
const N & ddname() const
Definition: DDBase.h:76
DDRotation DDDividedPolyhedraZ::makeDDRotation ( int  copyNo) const
overridevirtual

Reimplemented from DDDividedGeometryObject.

Definition at line 353 of file DDDividedPolyhedra.cc.

354 {
355  return DDRotation();
356 }
Represents a uniquely identifyable rotation matrix.
Definition: DDTransform.h:68
DDTranslation DDDividedPolyhedraZ::makeDDTranslation ( int  copyNo) const
overridevirtual

Reimplemented from DDDividedGeometryObject.

Definition at line 339 of file DDDividedPolyhedra.cc.

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

340 {
341  DDPolyhedra msol = (DDPolyhedra)(div_.parent().solid());
342  std::vector<double> zvec = msol.zVec();
343 
344  //----- set translation: along Z axis
345  double posi = (zvec[copyNo] + zvec[copyNo+1])/2;
346 
347  DDTranslation tr(0,0,posi);
348  //----- calculate rotation matrix: unit
349  return tr;
350 }
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
std::vector< double > zVec(void) const
Definition: DDSolid.cc:414
const DDLogicalPart & parent() const
Definition: DDDivision.cc:93