CMS 3D CMS Logo

DDDividedGeometryObject.cc
Go to the documentation of this file.
8 #include "Math/GenVector/RotationZ.h"
9 
10 #include <iostream>
11 #include <utility>
12 
14  : div_(div),
15  ftype_(),
16  compNDiv_(div.nReplicas()),
17  compWidth_(div.width()),
18  divisionType_(DivNDIVandWIDTH),
19  theVoluFirstCopyNo_(1),
20  cpv_(cpv) {
21  if (div_.nReplicas() == 0 || div_.width() < tolerance()) {
22  if (div_.width() < tolerance())
24  else
26  }
27 }
28 
29 std::unique_ptr<DDRotationMatrix> DDDividedGeometryObject::changeRotMatrix(double rotZ) const {
30  return std::make_unique<DDRotationMatrix>(ROOT::Math::RotationZ(rotZ));
31 }
32 
33 int DDDividedGeometryObject::calculateNDiv(double motherDim, double width, double offset) const {
34  return int((motherDim - offset) / width);
35 }
36 
37 double DDDividedGeometryObject::calculateWidth(double motherDim, int nDiv, double offset) const {
38  return (motherDim - offset) / nDiv;
39 }
40 
42  double maxPar = getMaxParameter();
43  checkOffset(maxPar);
44  checkNDivAndWidth(maxPar);
45  if (!div_.parent().isDefined().second) {
46  std::string s = "DDDividedGeometryObject::checkParametersValidity() :";
47  s += "\n ERROR - the LogicalPart of the parent must be ";
48  s += "\n defined before a division can occur.";
49  s += "\n Parent= " + div_.parent().toString();
50  throw cms::Exception("DDException") << s;
51  }
52 }
53 
55  if (div_.offset() >= maxPar) {
56  std::string s = "DDDividedGeometryObject::checkOffset() IllegalConstruct";
57  s += "\nERROR - DDDividedGeometryObject::checkOffset()";
58  s += "\n failed.";
59  s += " Too big an offset.";
60  throw cms::Exception("DDException") << s;
61  }
62 }
63 
65  if ((divisionType_ == DivNDIVandWIDTH) && (div_.offset() + compWidth_ * compNDiv_ - maxPar > tolerance())) {
66  std::string s = "ERROR - DDDividedGeometryObject::checkNDivAndWidth()";
67  s += "\n Division of LogicalPart " + div_.parent().name().name();
68  s += " has too big an offset.";
69 
70  std::cout << compWidth_ << std::endl;
71  throw cms::Exception("DDException") << s;
72  }
73 }
74 
76  // this can come from some global tolerance if you want.
77  static const double tol = 1.0 / 1000.00;
78  return tol;
79 }
80 
82 
83 const std::string& DDDividedGeometryObject::getType(void) const { return ftype_; }
84 
88  }
89 }
90 
91 double DDDividedGeometryObject::getMaxParameter(void) const { return 0.0; }
92 
93 DDRotation DDDividedGeometryObject::makeDDRotation(const int copyNo) const { return DDRotation(); }
94 
96 
98  // just return the parent... this is USELESS
99  return div_.parent();
100 }
void position(const DDLogicalPart &self, const DDLogicalPart &parent, const std::string &copyno, const DDTranslation &trans, const DDRotation &rot, const DDDivision *div=nullptr)
int nReplicas() const
Definition: DDDivision.cc:51
virtual DDRotation makeDDRotation(int copyNo) const
double offset() const
Definition: DDDivision.cc:55
Compact representation of the geometrical detector hierarchy.
Definition: DDCompactView.h:81
const DDLogicalPart & parent() const
Definition: DDDivision.cc:57
virtual DDLogicalPart makeDDLogicalPart(int copyNo) const
virtual void checkParametersValidity(void)
DDDividedGeometryObject(const DDDivision &div, DDCompactView *cpv)
Represents a uniquely identifyable rotation matrix.
Definition: DDTransform.h:57
static const double tolerance(void)
virtual const std::string & getType(void) const
const std::string & name() const
Returns the name.
Definition: DDName.cc:41
int calculateNDiv(double motherDim, double width, double offset) const
virtual double getMaxParameter(void) const
A DDLogicalPart aggregates information concerning material, solid and sensitveness ...
Definition: DDLogicalPart.h:93
std::string toString() const
Definition: DDBase.h:63
virtual void setType(const std::string &type)
std::unique_ptr< DDRotationMatrix > changeRotMatrix(double rotZ=0.) const
const N & name() const
Definition: DDBase.h:59
double width() const
Definition: DDDivision.cc:53
double calculateWidth(double motherDim, int nDiv, double offset) const
virtual DDTranslation makeDDTranslation(int copyNo) const
def_type isDefined() const
Definition: DDBase.h:90
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< double > > DDTranslation
Definition: DDTranslation.h:7
void checkNDivAndWidth(double maxPar)