CMS 3D CMS Logo

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

#include <DDDividedPolyhedra.h>

Inheritance diagram for DDDividedPolyhedraPhi:
DDDividedGeometryObject

Public Member Functions

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

Constructor & Destructor Documentation

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

Definition at line 149 of file DDDividedPolyhedra.cc.

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

150  : DDDividedGeometryObject( div, cpv )
151 {
153  setType( "DivisionPolyhedraPhi" );
154 
155  DDPolyhedra msol = (DDPolyhedra)(div_.parent().solid());
156  // double deltaPhi = msol->GetEndPhi() - msol->GetStartPhi();
157 
158  if( divisionType_ == DivWIDTH )
159  {
160  //If you divide a tube of 360 degrees the offset displaces the starting angle, but you still fill the 360 degrees
161  if( msol.deltaPhi() == 360.*deg ) {
162  compNDiv_ = calculateNDiv( msol.deltaPhi(), div_.width(), 0. );
163  }else {
165  }
166  }
167  else if( divisionType_ == DivNDIV )
168  {
169  if( msol.deltaPhi() == 360.*deg ) {
170  compWidth_ = calculateWidth( msol.deltaPhi(), div_.nReplicas(), 0. );
171  }else {
172  // original line looks wrong!
174  }
175  }
176 
177  DCOUT_V ('P', " DDDividedPolyhedraRho - # divisions " << compNDiv_ << " = " << div_.nReplicas() << "\n Offset " << div_.offset() << " Width " << compWidth_ << " = " << div_.width() << "\n");
178 }
const int nReplicas() const
Definition: DDDivision.cc:90
double deltaPhi() const
Definition: DDSolid.cc:420
virtual void checkParametersValidity()
int calculateNDiv(double motherDim, double width, double offset) const
double calculateWidth(double motherDim, int nDiv, double offset) const
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
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
DDDividedPolyhedraPhi::~DDDividedPolyhedraPhi ( void  )
virtual

Definition at line 180 of file DDDividedPolyhedra.cc.

181 {}

Member Function Documentation

void DDDividedPolyhedraPhi::checkParametersValidity ( void  )
virtual

Reimplemented from DDDividedGeometryObject.

Definition at line 191 of file DDDividedPolyhedra.cc.

References DDDividedGeometryObject::checkParametersValidity(), DDDividedGeometryObject::compNDiv_, gather_cfg::cout, DDDividedGeometryObject::div_, DDDividedGeometryObject::divisionType_, DivNDIVandWIDTH, DivWIDTH, DDDivision::offset(), DDDivision::parent(), asciidump::s, DDPolyhedra::sides(), and DDLogicalPart::solid().

Referenced by DDDividedPolyhedraPhi().

192 {
194 
195  DDPolyhedra msol = (DDPolyhedra)(div_.parent().solid());
196 
198  {
199  std::cout << "WARNING - "
200  << "DDDividedPolyhedraPhi::checkParametersValidity()"
201  << std::endl
202  << " Solid " << msol << std::endl
203  << " Division along PHI will be done splitting "
204  << "in the defined numSide." << std::endl
205  << " WIDTH will not be used !" << std::endl;
206  }
207  if( div_.offset() != 0. )
208  {
209  std::cout << "WARNING - "
210  << "DDDividedPolyhedraPhi::checkParametersValidity()"
211  << std::endl
212  << " Solid " << msol << std::endl
213  << " Division along PHI will be done splitting "
214  << "in the defined numSide." << std::endl
215  << " OFFSET will not be used !" << std::endl;
216  }
217 
218  if ( msol.sides() != compNDiv_ )
219  {
220  std::cout << "ERROR - "
221  << "DDDividedPolyhedraPhi::checkParametersValidity()"
222  << std::endl
223  << " Division along PHI will be done splitting in the defined"
224  << std::endl
225  << " numSide, i.e, the number of division would be :"
226  << " " << msol.sides()
227  << " instead of " << compNDiv_ << " !"
228  << std::endl;
229  std::string s = "DDDividedPolyhedraPhi::checkParametersValidity() Not supported configuration.";
230  throw DDException(s);
231  }
232 }
int sides() const
Definition: DDSolid.cc:416
An exception for DDD errors.
Definition: DDException.h:23
virtual void checkParametersValidity(void)
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
tuple cout
Definition: gather_cfg.py:41
const DDLogicalPart & parent() const
Definition: DDDivision.cc:105
string s
Definition: asciidump.py:422
double DDDividedPolyhedraPhi::getMaxParameter ( void  ) const
virtual

Reimplemented from DDDividedGeometryObject.

Definition at line 184 of file DDDividedPolyhedra.cc.

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

185 {
186  DDPolyhedra msol = (DDPolyhedra)(div_.parent().solid());
187  return msol.deltaPhi(); //msol->GetEndPhi() - msol->GetStartPhi();
188 }
double deltaPhi() const
Definition: DDSolid.cc:420
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 DDDividedPolyhedraPhi::makeDDLogicalPart ( const int  copyNo) const
virtual

Reimplemented from DDDividedGeometryObject.

Definition at line 261 of file DDDividedPolyhedra.cc.

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

262 {
263  DDPolyhedra msol = (DDPolyhedra)(div_.parent().solid());
264  DDMaterial usemat = div_.parent().material();
265 
266  DDName solname( div_.parent().ddname().name() + "_DIVCHILD",
267  div_.parent().ddname().ns());
268  DDSolid dsol(solname);
269  if (!dsol.isDefined().second)
270  {
271  dsol = DDSolidFactory::polyhedra( solname,
272  msol.sides(),
273  msol.startPhi()+div_.offset(),
274  compWidth_,
275  msol.zVec(),
276  msol.rMinVec(),
277  msol.rMaxVec());
278  }
279  DDLogicalPart ddlp(solname);
280  if (!ddlp.isDefined().second)
281  DDLogicalPart ddlp2 = DDLogicalPart(solname, usemat, dsol);
282  DCOUT_V ('P', "DDDividedPolyhedraPhi::makeDDLogicalPart() ddlp = " << ddlp);
283  return ddlp;
284 }
std::vector< double > zVec() const
Definition: DDSolid.cc:429
DDMaterial is used to define and access material information.
Definition: DDMaterial.h:45
std::vector< double > rMinVec() const
Definition: DDSolid.cc:436
int sides() const
Definition: DDSolid.cc:416
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.
double startPhi() const
Definition: DDSolid.cc:418
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
std::vector< double > rMaxVec() const
Definition: DDSolid.cc:443
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
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) //! Creates a polycone (refere to Gean...
Definition: DDSolid.cc:676
const N & ddname() const
Definition: DDBase.h:90
DDRotation DDDividedPolyhedraPhi::makeDDRotation ( const int  copyNo) const
virtual

Reimplemented from DDDividedGeometryObject.

Definition at line 241 of file DDDividedPolyhedra.cc.

References DDDividedGeometryObject::changeRotMatrix(), DDDividedGeometryObject::compWidth_, DCOUT_V, DDBase< N, C >::ddname(), DDrot(), DDDividedGeometryObject::div_, DDXMLElement::itostr(), DDName::name(), DDName::ns(), and DDDivision::parent().

242 {
243 
244  double posi = ( copyNo - 1 ) * compWidth_;
245 
246  DCOUT_V ('P', " DDDividedPolyhedraPhi - position: " << posi/deg << "\n copyNo: " << copyNo << " - compWidth_: " << compWidth_/deg << "\n");
247 
248  // ChangeRotMatrix( physVol, -posi );
249  DDRotationMatrix* rotMat = changeRotMatrix( posi);
250  // how to name the rotation??
251  // i do not like this...
252  DDName ddrotname(div_.parent().ddname().name() + "_DIVCHILD_ROT" + DDXMLElement::itostr(copyNo)
253  , div_.parent().ddname().ns());
254  DDRotation myddrot = DDrot(ddrotname, rotMat);
255  DCOUT_V ('P', "DDDividedPolyhedra::makeDDRotation: copyNo = " << copyNo << " rotation = " << myddrot);
256  return myddrot;
257 
258 }
static std::string itostr(int i)
WARNING: abused by other classes in this system: yet another conversion from int to std::string...
const std::string & ns() const
Returns the namespace.
Definition: DDName.cc:101
DDName is used to identify DDD entities uniquely.
Definition: DDName.h:18
Represents a uniquely identifyable rotation matrix.
Definition: DDTransform.h:66
DDRotation DDrot(const DDName &name, DDRotationMatrix *rot)
Definition of a uniquely identifiable rotation matrix named by DDName name.
Definition: DDRotation.cc:94
#define DCOUT_V(M_v_Y, M_v_S)
Definition: DDdebug.h:54
const DDLogicalPart & parent() const
Definition: DDDivision.cc:105
ROOT::Math::Rotation3D DDRotationMatrix
A DDRotationMatrix is currently implemented with a ROOT Rotation3D.
const std::string & name() const
Returns the name.
Definition: DDName.cc:87
const N & ddname() const
Definition: DDBase.h:90
DDRotationMatrix * changeRotMatrix(double rotZ=0.) const
DDTranslation DDDividedPolyhedraPhi::makeDDTranslation ( const int  copyNo) const
virtual

Reimplemented from DDDividedGeometryObject.

Definition at line 235 of file DDDividedPolyhedra.cc.

236 {
237  return DDTranslation();
238 }
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< double > > DDTranslation
Definition: DDTranslation.h:7