CMS 3D CMS Logo

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

#include <DDDividedPolycone.h>

Inheritance diagram for DDDividedPolyconeZ:
DDDividedGeometryObject

Public Member Functions

virtual void checkParametersValidity ()
 
 DDDividedPolyconeZ (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 ~DDDividedPolyconeZ ()
 
- 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 56 of file DDDividedPolycone.h.

Constructor & Destructor Documentation

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

Definition at line 247 of file DDDividedPolycone.cc.

References DDDividedGeometryObject::calculateNDiv(), checkParametersValidity(), DDDividedGeometryObject::compNDiv_, DDDividedGeometryObject::compWidth_, DCOUT_V, DDDividedGeometryObject::div_, DDDividedGeometryObject::divisionType_, DivNDIV, DivWIDTH, DDDivision::nReplicas(), DDDivision::offset(), DDDivision::parent(), DDPolycone::rMaxVec(), DDPolycone::rMinVec(), DDLogicalPart::solid(), DDDivision::width(), and DDPolycone::zVec().

249 {
251  DDPolycone msol = (DDPolycone)(div_.parent().solid());
252  std::vector<double> localrMaxVec = msol.rMaxVec();
253  std::vector<double> localrMinVec = msol.rMinVec();
254  std::vector<double> localzVec = msol.zVec();
255 
256  if( divisionType_ == DivWIDTH )
257  {
258  compNDiv_ =
259  calculateNDiv( localzVec[localzVec.size() - 1]
260  - localzVec[0] , div_.width(), div_.offset() );
261  }
262  else if( divisionType_ == DivNDIV )
263  {
264  compWidth_ =
265  calculateNDiv( localzVec[localzVec.size()-1]
266  - localzVec[0] , div_.nReplicas(), div_.offset() );
267  }
268 
269  DCOUT_V ('P', " DDDividedPolyconeZ - # divisions " << compNDiv_ << " = " << div_.nReplicas() << "/n Offset " << div_.offset() << " Width " << compWidth_ << " = " << div_.width() << "\n");
270 }
const int nReplicas() const
Definition: DDDivision.cc:90
int calculateNDiv(double motherDim, double width, double offset) const
DDDividedGeometryObject(const DDDivision &div, DDCompactView *cpv)
#define DCOUT_V(M_v_Y, M_v_S)
Definition: DDdebug.h:54
std::vector< double > zVec() const
Definition: DDSolid.cc:382
const double width() const
Definition: DDDivision.cc:95
virtual void checkParametersValidity()
std::vector< double > rMinVec() const
Definition: DDSolid.cc:389
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
std::vector< double > rMaxVec() const
Definition: DDSolid.cc:396
DDDividedPolyconeZ::~DDDividedPolyconeZ ( void  )
virtual

Definition at line 272 of file DDDividedPolycone.cc.

273 {}

Member Function Documentation

void DDDividedPolyconeZ::checkParametersValidity ( void  )
virtual

Reimplemented from DDDividedGeometryObject.

Definition at line 276 of file DDDividedPolycone.cc.

References DDDividedGeometryObject::calculateNDiv(), DDDividedGeometryObject::checkParametersValidity(), DDDividedGeometryObject::div_, DDXMLElement::itostr(), DDDivision::nReplicas(), DDDivision::offset(), DDDivision::parent(), asciidump::s, DDLogicalPart::solid(), DDDivision::width(), and DDPolycone::zVec().

Referenced by DDDividedPolyconeZ().

277 {
279 
280  DDPolycone msol = (DDPolycone)(div_.parent().solid());
281  std::vector<double> localzVec = msol.zVec();
282  // CHANGE FROM G4 a polycone can be divided in Z by specifying
283  // nReplicas IF they happen to coincide with the number of
284  // z plans.
285  size_t tempNDiv = div_.nReplicas();
286  if (tempNDiv == 0)
287  tempNDiv = calculateNDiv( localzVec[localzVec.size() - 1] - localzVec[0]
288  , div_.width()
289  , div_.offset() );
290  if ((msol.zVec().size() - 1) != tempNDiv)
291  {
292  std::string s = "ERROR - DDDividedPolyconeZ::checkParametersValidity()";
293  s += "\n\tDivision along Z will be done splitting in the defined";
294  s += "\n\tz_planes, i.e, the number of division would be :";
295  s += "\n\t" + DDXMLElement::itostr( msol.zVec().size() - 1 );
296  s += "\n\tinstead of " + DDXMLElement::itostr(tempNDiv) + " !\n";
297 
298  throw DDException(s);
299  }
300 }
const int nReplicas() const
Definition: DDDivision.cc:90
static std::string itostr(int i)
WARNING: abused by other classes in this system: yet another conversion from int to std::string...
int calculateNDiv(double motherDim, double width, double offset) const
An exception for DDD errors.
Definition: DDException.h:23
virtual void checkParametersValidity(void)
std::vector< double > zVec() const
Definition: DDSolid.cc:382
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
string s
Definition: asciidump.py:422
double DDDividedPolyconeZ::getMaxParameter ( void  ) const
virtual

Reimplemented from DDDividedGeometryObject.

Definition at line 303 of file DDDividedPolycone.cc.

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

304 {
305  DDPolycone msol = (DDPolycone)(div_.parent().solid());
306  std::vector<double> localzVec = msol.zVec();
307 
308  return (localzVec[ localzVec.size() - 1] - localzVec[0]);
309 }
std::vector< double > zVec() const
Definition: DDSolid.cc:382
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 DDDividedPolyconeZ::makeDDLogicalPart ( const int  copyNo) const
virtual

Reimplemented from DDDividedGeometryObject.

Definition at line 331 of file DDDividedPolycone.cc.

References DDDividedGeometryObject::compWidth_, DDSolidFactory::cons(), DCOUT_V, DDBase< N, C >::ddname(), DDDividedGeometryObject::div_, DDXMLElement::itostr(), DDLogicalPart::material(), DDName::name(), DDName::ns(), DDDivision::parent(), DDPolycone::rMaxVec(), and DDLogicalPart::solid().

332 {
333  DDName solname;
334  DDSolid ddpolycone;
335  DDMaterial usemat(div_.parent().material());
336 
337  DDPolycone msol = (DDPolycone)(div_.parent().solid());
338  std::vector<double> localrMaxVec = msol.rMaxVec();
339  std::vector<double> localrMinVec = msol.rMinVec();
340  std::vector<double> localzVec = msol.zVec();
341 
342  solname = DDName( div_.parent().ddname().name() + "_DIVCHILD" + DDXMLElement::itostr(copyNo),
343  div_.parent().ddname().ns());
344  ddpolycone = DDSolidFactory::cons( solname,
345  compWidth_ / 2,
346  localrMinVec[copyNo],
347  localrMaxVec[copyNo],
348  localrMinVec[copyNo+1],
349  localrMaxVec[copyNo+1],
350  msol.startPhi(),
351  msol.deltaPhi());
352 
353  DDLogicalPart ddlp = DDLogicalPart( solname, usemat, ddpolycone );
354 
355  DCOUT_V( 'P', " DDDividedPolyconeZ::makeDDLogicalPart() lp:" << ddlp );
356 
357  return ddlp;
358 }
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:45
static DDSolid cons(const DDName &name, double zhalf, double rInMinusZ, double rOutMinusZ, double rInPlusZ, double rOutPlusZ, double phiFrom, double deltaPhi)
Definition: DDSolid.cc:766
const std::string & ns() const
Returns the namespace.
Definition: DDName.cc:101
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
A DDLogicalPart aggregates information concerning material, solid and sensitveness ...
Definition: DDLogicalPart.h:95
#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 DDLogicalPart & parent() const
Definition: DDDivision.cc:105
std::vector< double > rMaxVec() const
Definition: DDSolid.cc:396
const std::string & name() const
Returns the name.
Definition: DDName.cc:87
const N & ddname() const
Definition: DDBase.h:90
DDRotation DDDividedPolyconeZ::makeDDRotation ( const int  copyNo) const
virtual

Reimplemented from DDDividedGeometryObject.

Definition at line 312 of file DDDividedPolycone.cc.

References DCOUT_V.

313 {
314  DDRotation myddrot; // sets to identity.
315  DCOUT_V ('P', "DDDividedPolyconeZ::makeDDRotation : " << myddrot);
316  return myddrot;
317 }
Represents a uniquely identifyable rotation matrix.
Definition: DDTransform.h:66
#define DCOUT_V(M_v_Y, M_v_S)
Definition: DDdebug.h:54
DDTranslation DDDividedPolyconeZ::makeDDTranslation ( const int  copyNo) const
virtual

Reimplemented from DDDividedGeometryObject.

Definition at line 320 of file DDDividedPolycone.cc.

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

321 {
322  DDTranslation translation;
323  DDPolycone msol = (DDPolycone)(div_.parent().solid());
324  std::vector<double> localzVec = msol.zVec();
325  double posi = (localzVec[copyNo] + localzVec[copyNo+1]) / 2;
326  translation.SetZ(posi);
327  return translation;
328 }
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< double > > DDTranslation
Definition: DDTranslation.h:7
std::vector< double > zVec() const
Definition: DDSolid.cc:382
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