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 
33 {
34  DDRotationMatrix * rm = new DDRotationMatrix(ROOT::Math::RotationZ(rotZ));
35  return rm;
36 }
37 
38 int
39 DDDividedGeometryObject::calculateNDiv( double motherDim, double width, double offset ) const
40 {
41  return int( ( motherDim - offset ) / width );
42 }
43 
44 double
45 DDDividedGeometryObject::calculateWidth( double motherDim, int nDiv, double offset ) const
46 {
47  return ( motherDim - offset ) / nDiv;
48 }
49 
50 void
52 {
53  double maxPar = getMaxParameter();
54  checkOffset( maxPar );
55  checkNDivAndWidth( maxPar );
56  if (!div_.parent().isDefined().second) {
57  std::string s = "DDDividedGeometryObject::checkParametersValidity() :";
58  s+= "\n ERROR - the LogicalPart of the parent must be ";
59  s+= "\n defined before a division can occur.";
60  s+= "\n Parent= " + div_.parent().toString();
61  throw cms::Exception("DDException") << s;
62  }
63 }
64 
65 void
67 {
68  if( div_.offset() >= maxPar )
69  {
70  std::string s = "DDDividedGeometryObject::checkOffset() IllegalConstruct";
71  s += "\nERROR - DDDividedGeometryObject::checkOffset()";
72  s += "\n failed.";
73  s += " Too big an offset.";
74  throw cms::Exception("DDException") << s;
75  }
76 }
77 
78 void
80 {
82  && (div_.offset() + compWidth_*compNDiv_ - maxPar > tolerance() ) )
83  {
84  std::string s = "ERROR - DDDividedGeometryObject::checkNDivAndWidth()";
85  s+= "\n Division of LogicalPart " + div_.parent().name().name();
86  s+= " has too big an offset.";
87 
88  std::cout << compWidth_ << std::endl;
89  throw cms::Exception("DDException") << s;
90  }
91 }
92 
93 const double
95 {
96  // this can come from some global tolerance if you want.
97  static const double tol = 1.0/1000.00;
98  return tol;
99 }
100 
101 void
103 {
104  ftype_ = s;
105 }
106 
107 const std::string&
109 {
110  return ftype_;
111 }
112 
113 void
115 {
117  {
119  div_.parent(),
120  i,
121  makeDDTranslation( i ),
122  makeDDRotation( i ),
123  &div_ );
124  }
125 }
126 
127 double
129 {
130  return 0.0;
131 }
132 
135 {
136  return DDRotation();
137 }
138 
141 {
142  return DDTranslation();
143 }
144 
147 {
148  // just return the parent... this is USELESS
149  return div_.parent();
150 }
def_type isDefined() const
Definition: DDBase.h:110
const N & name() const
Definition: DDBase.h:78
int nReplicas() const
Definition: DDDivision.cc:71
virtual DDTranslation makeDDTranslation(int copyNo) const
double offset() const
Definition: DDDivision.cc:81
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:83
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:67
static const double tolerance(void)
virtual DDLogicalPart makeDDLogicalPart(int copyNo) const
A DDLogicalPart aggregates information concerning material, solid and sensitveness ...
Definition: DDLogicalPart.h:92
virtual void setType(const std::string &type)
virtual const std::string & getType(void) const
std::string toString() const
Definition: DDBase.h:82
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:76
const DDLogicalPart & parent() const
Definition: DDDivision.cc:86
rm
Definition: submit.py:76
ROOT::Math::Rotation3D DDRotationMatrix
A DDRotationMatrix is currently implemented with a ROOT Rotation3D.
const std::string & name() const
Returns the name.
Definition: DDName.cc:88
void checkNDivAndWidth(double maxPar)
DDRotationMatrix * changeRotMatrix(double rotZ=0.) const