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 }
DDDividedGeometryObject::checkNDivAndWidth
void checkNDivAndWidth(double maxPar)
Definition: DDDividedGeometryObject.cc:64
DDDividedGeometryObject::compWidth_
double compWidth_
Definition: DDDividedGeometryObject.h:56
ApeEstimator_cff.width
width
Definition: ApeEstimator_cff.py:24
mps_fire.i
i
Definition: mps_fire.py:428
DDTransform.h
MessageLogger.h
DDDivision::width
double width() const
Definition: DDDivision.cc:53
DDDividedGeometryObject::makeDDRotation
virtual DDRotation makeDDRotation(int copyNo) const
Definition: DDDividedGeometryObject.cc:93
DDBase::isDefined
def_type isDefined() const
Definition: DDBase.h:90
DDDividedGeometryObject::cpv_
DDCompactView * cpv_
Definition: DDDividedGeometryObject.h:59
gather_cfg.cout
cout
Definition: gather_cfg.py:144
DDDividedGeometryObject::DDDividedGeometryObject
DDDividedGeometryObject(const DDDivision &div, DDCompactView *cpv)
Definition: DDDividedGeometryObject.cc:13
DDDividedGeometryObject::tolerance
static const double tolerance(void)
Definition: DDDividedGeometryObject.cc:75
DDDividedGeometryObject::checkOffset
void checkOffset(double maxPar)
Definition: DDDividedGeometryObject.cc:54
DDDividedGeometryObject::ftype_
std::string ftype_
Definition: DDDividedGeometryObject.h:54
DDDividedGeometryObject::makeDDLogicalPart
virtual DDLogicalPart makeDDLogicalPart(int copyNo) const
Definition: DDDividedGeometryObject.cc:97
DDCompactView.h
DivWIDTH
Definition: DDDividedGeometryObject.h:14
DDDividedGeometryObject::execute
virtual void execute(void)
Definition: DDDividedGeometryObject.cc:85
alignCSCRings.s
s
Definition: alignCSCRings.py:92
DDDividedGeometryObject::checkParametersValidity
virtual void checkParametersValidity(void)
Definition: DDDividedGeometryObject.cc:41
DDTranslation
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< double > > DDTranslation
Definition: DDTranslation.h:7
DivNDIV
Definition: DDDividedGeometryObject.h:14
DDBase::toString
std::string toString() const
Definition: DDBase.h:63
DivNDIVandWIDTH
Definition: DDDividedGeometryObject.h:14
DDDividedGeometryObject::getMaxParameter
virtual double getMaxParameter(void) const
Definition: DDDividedGeometryObject.cc:91
DDCompactView
Compact representation of the geometrical detector hierarchy.
Definition: DDCompactView.h:81
DDDividedGeometryObject::getType
virtual const std::string & getType(void) const
Definition: DDDividedGeometryObject.cc:83
DDBase::name
const N & name() const
Definition: DDBase.h:59
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
DDDividedGeometryObject::calculateNDiv
int calculateNDiv(double motherDim, double width, double offset) const
Definition: DDDividedGeometryObject.cc:33
DDDividedGeometryObject::div_
DDDivision div_
Definition: DDDividedGeometryObject.h:53
DDDividedGeometryObject::changeRotMatrix
std::unique_ptr< DDRotationMatrix > changeRotMatrix(double rotZ=0.) const
Definition: DDDividedGeometryObject.cc:29
DDDividedGeometryObject::compNDiv_
int compNDiv_
Definition: DDDividedGeometryObject.h:55
DDLogicalPart
A DDLogicalPart aggregates information concerning material, solid and sensitveness ....
Definition: DDLogicalPart.h:93
DDDividedGeometryObject::divisionType_
DivisionType divisionType_
Definition: DDDividedGeometryObject.h:57
createfilelist.int
int
Definition: createfilelist.py:10
DDDividedGeometryObject::setType
virtual void setType(const std::string &type)
Definition: DDDividedGeometryObject.cc:81
DDDividedGeometryObject.h
DDDivision::offset
double offset() const
Definition: DDDivision.cc:55
DDName::name
const std::string & name() const
Returns the name.
Definition: DDName.cc:41
DDLogicalPart.h
DDDivision::nReplicas
int nReplicas() const
Definition: DDDivision.cc:51
DDDivision
Definition: DDDivision.h:78
DDName.h
Exception
Definition: hltDiff.cc:245
DDRotation
Represents a uniquely identifyable rotation matrix.
Definition: DDTransform.h:57
Exception.h
hltrates_dqm_sourceclient-live_cfg.offset
offset
Definition: hltrates_dqm_sourceclient-live_cfg.py:82
DDDividedGeometryObject::theVoluFirstCopyNo_
int theVoluFirstCopyNo_
Definition: DDDividedGeometryObject.h:58
DDCompactView::position
void position(const DDLogicalPart &self, const DDLogicalPart &parent, const std::string &copyno, const DDTranslation &trans, const DDRotation &rot, const DDDivision *div=nullptr)
Definition: DDCompactView.cc:76
DDDivision::parent
const DDLogicalPart & parent() const
Definition: DDDivision.cc:57
DDRotation
ROOT::Math::Rotation3D DDRotation
Definition: DDEcalEndcapAlgo.cc:16
DDDividedGeometryObject::calculateWidth
double calculateWidth(double motherDim, int nDiv, double offset) const
Definition: DDDividedGeometryObject.cc:37
DDDividedGeometryObject::makeDDTranslation
virtual DDTranslation makeDDTranslation(int copyNo) const
Definition: DDDividedGeometryObject.cc:95