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
 
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 261 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().

262  : DDDividedGeometryObject( div, cpv )
263 {
265  setType( "DivisionPolyhedraZ" );
266 
267  DDPolyhedra msol = (DDPolyhedra)(div_.parent().solid());
268 
269  std::vector<double> zvec = msol.zVec();
270 
271  if ( divisionType_ == DivWIDTH )
272  {
273  compNDiv_ =
274  calculateNDiv( zvec[zvec.size() - 1] - zvec[0], div_.width(), div_.offset() );
275  }
276  else if( divisionType_ == DivNDIV )
277  {
278  compWidth_ = calculateWidth( zvec[zvec.size() - 1] - zvec[0],
279  div_.nReplicas(),
280  div_.offset());
281  // ?what? CalculateNDiv( zvec[zvec.size() - 1] - zvec[0], origparamMother->Z_values[origparamMother->Num_z_planes-1]
282  // - origparamMother->Z_values[0] , nDiv, offset );
283  }
284 }
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.
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:76
const DDLogicalPart & parent() const
Definition: DDDivision.cc:86

Member Function Documentation

void DDDividedPolyhedraZ::checkParametersValidity ( void  )
overridevirtual

Reimplemented from DDDividedGeometryObject.

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

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

Reimplemented from DDDividedGeometryObject.

Definition at line 287 of file DDDividedPolyhedra.cc.

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

288 {
289  DDPolyhedra msol = (DDPolyhedra)(div_.parent().solid());
290 
291  std::vector<double> zvec = msol.zVec();
292  return (zvec[zvec.size() - 1] - zvec[0]);
293 }
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:86
DDLogicalPart DDDividedPolyhedraZ::makeDDLogicalPart ( int  copyNo) const
overridevirtual

Reimplemented from DDDividedGeometryObject.

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

365 {
366  // only for mother number of planes = 2!!
367  // mec: what? why? comment above and = 2 below straight from G4 impl.
368  DDPolyhedra msol = (DDPolyhedra)( div_.parent().solid());
369  DDMaterial usemat = div_.parent().material();
370 
371  std::vector<double> zvec = msol.zVec();
372  std::vector<double> rminvec = msol.rMinVec();
373  std::vector<double> rmaxvec = msol.rMaxVec();
374 
375  double posi = ( zvec[ copyNo ] + zvec[ copyNo + 1 ] ) / 2.0;
376 
377  DDName solname( div_.parent().ddname().name() + "_DIVCHILD" + std::to_string( copyNo ),
378  div_.parent().ddname().ns());
379  std::vector<double> newRmin, newRmax, newZ;
380  newZ.emplace_back( zvec[ copyNo ] - posi );
381  newZ.emplace_back( zvec[ copyNo + 1 ] - posi );
382  newRmin.emplace_back( rminvec[ copyNo ]);
383  newRmin.emplace_back( rminvec[ copyNo + 1 ]);
384  newRmax.emplace_back( rmaxvec[ copyNo ]);
385  newRmax.emplace_back( rmaxvec[ copyNo + 1 ]);
386 
387  DDSolid dsol = DDSolidFactory::polyhedra( solname,
388  msol.sides(),
389  msol.startPhi(),
390  msol.deltaPhi(),
391  newZ,
392  newRmin,
393  newRmax );
394  DDLogicalPart lp( solname, usemat, dsol );
395  return lp;
396 }
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:41
const std::string & ns() const
Returns the namespace.
Definition: DDName.cc:102
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:38
A DDLogicalPart aggregates information concerning material, solid and sensitveness ...
Definition: DDLogicalPart.h:92
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:86
const std::string & name() const
Returns the name.
Definition: DDName.cc:88
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:732
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 ( int  copyNo) const
overridevirtual

Reimplemented from DDDividedGeometryObject.

Definition at line 358 of file DDDividedPolyhedra.cc.

359 {
360  return DDRotation();
361 }
Represents a uniquely identifyable rotation matrix.
Definition: DDTransform.h:67
DDTranslation DDDividedPolyhedraZ::makeDDTranslation ( int  copyNo) const
overridevirtual

Reimplemented from DDDividedGeometryObject.

Definition at line 344 of file DDDividedPolyhedra.cc.

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

345 {
346  DDPolyhedra msol = (DDPolyhedra)(div_.parent().solid());
347  std::vector<double> zvec = msol.zVec();
348 
349  //----- set translation: along Z axis
350  double posi = (zvec[copyNo] + zvec[copyNo+1])/2;
351 
352  DDTranslation tr(0,0,posi);
353  //----- calculate rotation matrix: unit
354  return tr;
355 }
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:86