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 {
22  if( div_.nReplicas() == 0 || div_.width() < tolerance())
23  {
24  if( div_.width() < tolerance())
26  else
28  }
29 }
30 
31 std::unique_ptr<DDRotationMatrix>
33 {
34  return std::make_unique<DDRotationMatrix>(ROOT::Math::RotationZ(rotZ));
35 }
36 
37 int
38 DDDividedGeometryObject::calculateNDiv( double motherDim, double width, double offset ) const
39 {
40  return int( ( motherDim - offset ) / width );
41 }
42 
43 double
44 DDDividedGeometryObject::calculateWidth( double motherDim, int nDiv, double offset ) const
45 {
46  return ( motherDim - offset ) / nDiv;
47 }
48 
49 void
51 {
52  double maxPar = getMaxParameter();
53  checkOffset( maxPar );
54  checkNDivAndWidth( maxPar );
55  if (!div_.parent().isDefined().second) {
56  std::string s = "DDDividedGeometryObject::checkParametersValidity() :";
57  s+= "\n ERROR - the LogicalPart of the parent must be ";
58  s+= "\n defined before a division can occur.";
59  s+= "\n Parent= " + div_.parent().toString();
60  throw cms::Exception("DDException") << s;
61  }
62 }
63 
64 void
66 {
67  if( div_.offset() >= maxPar )
68  {
69  std::string s = "DDDividedGeometryObject::checkOffset() IllegalConstruct";
70  s += "\nERROR - DDDividedGeometryObject::checkOffset()";
71  s += "\n failed.";
72  s += " Too big an offset.";
73  throw cms::Exception("DDException") << s;
74  }
75 }
76 
77 void
79 {
81  && (div_.offset() + compWidth_*compNDiv_ - maxPar > tolerance() ) )
82  {
83  std::string s = "ERROR - DDDividedGeometryObject::checkNDivAndWidth()";
84  s+= "\n Division of LogicalPart " + div_.parent().name().name();
85  s+= " has too big an offset.";
86 
87  std::cout << compWidth_ << std::endl;
88  throw cms::Exception("DDException") << s;
89  }
90 }
91 
92 const double
94 {
95  // this can come from some global tolerance if you want.
96  static const double tol = 1.0/1000.00;
97  return tol;
98 }
99 
100 void
102 {
103  ftype_ = s;
104 }
105 
106 const std::string&
108 {
109  return ftype_;
110 }
111 
112 void
114 {
116  {
118  div_.parent(),
119  i,
120  makeDDTranslation( i ),
121  makeDDRotation( i ),
122  &div_ );
123  }
124 }
125 
126 double
128 {
129  return 0.0;
130 }
131 
134 {
135  return DDRotation();
136 }
137 
140 {
141  return DDTranslation();
142 }
143 
146 {
147  // just return the parent... this is USELESS
148  return div_.parent();
149 }
def_type isDefined() const
Definition: DDBase.h:107
const N & name() const
Definition: DDBase.h:74
int nReplicas() const
Definition: DDDivision.cc:75
virtual DDTranslation makeDDTranslation(int copyNo) const
double offset() const
Definition: DDDivision.cc:87
virtual double getMaxParameter(void) const
int calculateNDiv(double motherDim, double width, double offset) const
double calculateWidth(double motherDim, int nDiv, double offset) const
Compact representation of the geometrical detector hierarchy.
Definition: DDCompactView.h:80
virtual DDRotation makeDDRotation(int copyNo) const
virtual void checkParametersValidity(void)
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< double > > DDTranslation
Definition: DDTranslation.h:7
DDDividedGeometryObject(const DDDivision &div, DDCompactView *cpv)
Represents a uniquely identifyable rotation matrix.
Definition: DDTransform.h:68
static const double tolerance(void)
virtual DDLogicalPart makeDDLogicalPart(int copyNo) const
A DDLogicalPart aggregates information concerning material, solid and sensitveness ...
Definition: DDLogicalPart.h:93
virtual void setType(const std::string &type)
virtual const std::string & getType(void) const
std::unique_ptr< DDRotationMatrix > changeRotMatrix(double rotZ=0.) const
std::string toString() const
Definition: DDBase.h:78
void position(const DDLogicalPart &self, const DDLogicalPart &parent, const std::string &copyno, const DDTranslation &trans, const DDRotation &rot, const DDDivision *div=0)
double width() const
Definition: DDDivision.cc:81
const DDLogicalPart & parent() const
Definition: DDDivision.cc:93
const std::string & name() const
Returns the name.
Definition: DDName.cc:53
void checkNDivAndWidth(double maxPar)