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 34 of file DDDividedPolyhedra.h.

Constructor & Destructor Documentation

◆ DDDividedPolyhedraZ()

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

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

193  : DDDividedGeometryObject(div, cpv) {
195  setType("DivisionPolyhedraZ");
196 
197  DDPolyhedra msol = (DDPolyhedra)(div_.parent().solid());
198 
199  std::vector<double> zvec = msol.zVec();
200 
201  if (divisionType_ == DivWIDTH) {
202  compNDiv_ = calculateNDiv(zvec[zvec.size() - 1] - zvec[0], div_.width(), div_.offset());
203  } else if (divisionType_ == DivNDIV) {
204  compWidth_ = calculateWidth(zvec[zvec.size() - 1] - zvec[0], div_.nReplicas(), div_.offset());
205  }
206 }
int nReplicas() const
Definition: DDDivision.cc:51
std::vector< double > zVec(void) const
Definition: DDSolid.cc:328
double offset() const
Definition: DDDivision.cc:55
void checkParametersValidity() override
const DDLogicalPart & parent() const
Definition: DDDivision.cc:57
DDDividedGeometryObject(const DDDivision &div, DDCompactView *cpv)
int calculateNDiv(double motherDim, double width, double offset) const
virtual void setType(const std::string &type)
const DDSolid & solid(void) const
Returns a reference object of the solid being the shape of this LogicalPart.
double width() const
Definition: DDDivision.cc:53
double calculateWidth(double motherDim, int nDiv, double offset) const

Member Function Documentation

◆ checkParametersValidity()

void DDDividedPolyhedraZ::checkParametersValidity ( void  )
overridevirtual

Reimplemented from DDDividedGeometryObject.

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

215  {
217 
218  DDPolyhedra msol = (DDPolyhedra)(div_.parent().solid());
219 
221  std::cout << "WARNING - "
222  << "DDDividedPolyhedraZ::checkParametersValidity()" << std::endl
223  << " Solid " << msol << std::endl
224  << " Division along Z will be done splitting "
225  << "in the defined z_planes." << std::endl
226  << " WIDTH will not be used !" << std::endl;
227  }
228 
229  if (div_.offset() != 0.) {
230  std::cout << "WARNING - "
231  << "DDDividedPolyhedraZ::checkParametersValidity()" << std::endl
232  << " Solid " << msol << std::endl
233  << " Division along Z will be done splitting "
234  << "in the defined z_planes." << std::endl
235  << " OFFSET will not be used !" << std::endl;
236  }
237 
238  std::vector<double> zvec = msol.zVec();
239 
240  if (zvec.size() - 1 != size_t(compNDiv_)) {
241  std::cout << "ERROR - "
242  << "DDDividedPolyhedraZ::checkParametersValidity()" << std::endl
243  << " Division along Z can only be done by splitting in the defined" << std::endl
244  << " z_planes, i.e, the number of division would be :"
245  << " " << zvec.size() - 1 << " instead of " << compNDiv_ << " !" << std::endl;
246  std::string s = "DDDividedPolyhedraZ::checkParametersValidity()";
247  s += "Illegal Construct. Not a supported configuration.";
248  throw cms::Exception("DDException") << s;
249  }
250 }
std::vector< double > zVec(void) const
Definition: DDSolid.cc:328
double offset() const
Definition: DDDivision.cc:55
const DDLogicalPart & parent() const
Definition: DDDivision.cc:57
virtual void checkParametersValidity(void)
const DDSolid & solid(void) const
Returns a reference object of the solid being the shape of this LogicalPart.

◆ getMaxParameter()

double DDDividedPolyhedraZ::getMaxParameter ( void  ) const
overridevirtual

Reimplemented from DDDividedGeometryObject.

Definition at line 208 of file DDDividedPolyhedra.cc.

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

208  {
209  DDPolyhedra msol = (DDPolyhedra)(div_.parent().solid());
210 
211  std::vector<double> zvec = msol.zVec();
212  return (zvec[zvec.size() - 1] - zvec[0]);
213 }
std::vector< double > zVec(void) const
Definition: DDSolid.cc:328
const DDLogicalPart & parent() const
Definition: DDDivision.cc:57
const DDSolid & solid(void) const
Returns a reference object of the solid being the shape of this LogicalPart.

◆ makeDDLogicalPart()

DDLogicalPart DDDividedPolyhedraZ::makeDDLogicalPart ( int  copyNo) const
overridevirtual

Reimplemented from DDDividedGeometryObject.

Definition at line 266 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(), cond::impl::to_string(), and DDPolyhedra::zVec().

266  {
267  // only for mother number of planes = 2!!
268  // mec: what? why? comment above and = 2 below straight from G4 impl.
269  DDPolyhedra msol = (DDPolyhedra)(div_.parent().solid());
270  DDMaterial usemat = div_.parent().material();
271 
272  std::vector<double> zvec = msol.zVec();
273  std::vector<double> rminvec = msol.rMinVec();
274  std::vector<double> rmaxvec = msol.rMaxVec();
275 
276  double posi = (zvec[copyNo] + zvec[copyNo + 1]) / 2.0;
277 
278  DDName solname(div_.parent().ddname().name() + "_DIVCHILD" + std::to_string(copyNo), div_.parent().ddname().ns());
279  std::vector<double> newRmin, newRmax, newZ;
280  newZ.emplace_back(zvec[copyNo] - posi);
281  newZ.emplace_back(zvec[copyNo + 1] - posi);
282  newRmin.emplace_back(rminvec[copyNo]);
283  newRmin.emplace_back(rminvec[copyNo + 1]);
284  newRmax.emplace_back(rmaxvec[copyNo]);
285  newRmax.emplace_back(rmaxvec[copyNo + 1]);
286 
287  DDSolid dsol =
288  DDSolidFactory::polyhedra(solname, msol.sides(), msol.startPhi(), msol.deltaPhi(), newZ, newRmin, newRmax);
289  DDLogicalPart lp(solname, usemat, dsol);
290  return lp;
291 }
std::vector< double > rMinVec(void) const
Definition: DDSolid.cc:335
DDMaterial is used to define and access material information.
Definition: DDMaterial.h:45
std::vector< double > zVec(void) const
Definition: DDSolid.cc:328
std::vector< double > rMaxVec(void) const
Definition: DDSolid.cc:342
DDName is used to identify DDD entities uniquely.
Definition: DDName.h:17
std::string to_string(const V &value)
Definition: OMSAccess.h:77
const DDLogicalPart & parent() const
Definition: DDDivision.cc:57
A DDSolid represents the shape of a part.
Definition: DDSolid.h:39
const std::string & name() const
Returns the name.
Definition: DDName.cc:41
int sides(void) const
Definition: DDSolid.cc:315
A DDLogicalPart aggregates information concerning material, solid and sensitveness ...
Definition: DDLogicalPart.h:93
const DDMaterial & material(void) const
Returns a reference object of the material this LogicalPart is made of.
const N & ddname() const
Definition: DDBase.h:61
double startPhi(void) const
Definition: DDSolid.cc:317
const DDSolid & solid(void) const
Returns a reference object of the solid being the shape of this LogicalPart.
double deltaPhi(void) const
Definition: DDSolid.cc:319
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:565
const std::string & ns() const
Returns the namespace.
Definition: DDName.cc:52

◆ makeDDRotation()

DDRotation DDDividedPolyhedraZ::makeDDRotation ( int  copyNo) const
overridevirtual

Reimplemented from DDDividedGeometryObject.

Definition at line 264 of file DDDividedPolyhedra.cc.

264 { return DDRotation(); }
Represents a uniquely identifyable rotation matrix.
Definition: DDTransform.h:57

◆ makeDDTranslation()

DDTranslation DDDividedPolyhedraZ::makeDDTranslation ( int  copyNo) const
overridevirtual

Reimplemented from DDDividedGeometryObject.

Definition at line 252 of file DDDividedPolyhedra.cc.

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

252  {
253  DDPolyhedra msol = (DDPolyhedra)(div_.parent().solid());
254  std::vector<double> zvec = msol.zVec();
255 
256  //----- set translation: along Z axis
257  double posi = (zvec[copyNo] + zvec[copyNo + 1]) / 2;
258 
259  DDTranslation tr(0, 0, posi);
260  //----- calculate rotation matrix: unit
261  return tr;
262 }
std::vector< double > zVec(void) const
Definition: DDSolid.cc:328
const DDLogicalPart & parent() const
Definition: DDDivision.cc:57
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