CMS 3D CMS Logo

DDDividedGeometryObject.cc
Go to the documentation of this file.
2 
3 #include <iostream>
4 #include <utility>
5 
12 #include "Math/GenVector/RotationZ.h"
13 
15  : div_( div ),
16  ftype_(),
17  compNDiv_( div.nReplicas()),
18  compWidth_( div.width()),
19  divisionType_( DivNDIVandWIDTH ),
20  theVoluFirstCopyNo_( 1 ),
21  cpv_( cpv )
22 {
23  if( div_.nReplicas() == 0 || div_.width() < tolerance())
24  {
25  if( div_.width() < tolerance())
27  else
29  }
30 }
31 
34 {
35  DDRotationMatrix * rm = new DDRotationMatrix(ROOT::Math::RotationZ(rotZ));
36  return rm;
37 }
38 
39 int
40 DDDividedGeometryObject::calculateNDiv( double motherDim, double width, double offset ) const
41 {
42  return int( ( motherDim - offset ) / width );
43 }
44 
45 double
46 DDDividedGeometryObject::calculateWidth( double motherDim, int nDiv, double offset ) const
47 {
48  return ( motherDim - offset ) / nDiv;
49 }
50 
51 void
53 {
54  double maxPar = getMaxParameter();
55  checkOffset( maxPar );
56  checkNDivAndWidth( maxPar );
57  if (!div_.parent().isDefined().second) {
58  std::string s = "DDDividedGeometryObject::checkParametersValidity() :";
59  s+= "\n ERROR - the LogicalPart of the parent must be ";
60  s+= "\n defined before a division can occur.";
61  s+= "\n Parent= " + div_.parent().toString();
62  throw cms::Exception("DDException") << s;
63  }
64 }
65 
66 void
68 {
69  if( div_.offset() >= maxPar )
70  {
71  std::string s = "DDDividedGeometryObject::checkOffset() IllegalConstruct";
72  s += "\nERROR - DDDividedGeometryObject::checkOffset()";
73  s += "\n failed.";
74  s += " Too big an offset.";
75  throw cms::Exception("DDException") << s;
76  }
77 }
78 
79 void
81 {
83  && (div_.offset() + compWidth_*compNDiv_ - maxPar > tolerance() ) )
84  {
85  std::string s = "ERROR - DDDividedGeometryObject::checkNDivAndWidth()";
86  s+= "\n Division of LogicalPart " + div_.parent().name().name();
87  s+= " has too big an offset.";
88 
89  std::cout << compWidth_ << std::endl;
90  throw cms::Exception("DDException") << s;
91  }
92 }
93 
94 const double
96 {
97  // this can come from some global tolerance if you want.
98  static const double tol = 1.0/1000.00;
99  return tol;
100 }
101 
102 void
104 {
105  ftype_ = s;
106 }
107 
108 const std::string&
110 {
111  return ftype_;
112 }
113 
114 void
116 {
118  {
120  div_.parent(),
121  i,
122  makeDDTranslation( i ),
123  makeDDRotation( i ),
124  &div_ );
125  }
126 }
127 
128 double
130 {
131  return 0.0;
132 }
133 
136 {
137  return DDRotation();
138 }
139 
142 {
143  return DDTranslation();
144 }
145 
148 {
149  // just return the parent... this is USELESS
150  return div_.parent();
151 }
virtual DDLogicalPart makeDDLogicalPart(const int copyNo) const
def_type isDefined() const
Definition: DDBase.h:110
const N & name() const
Definition: DDBase.h:78
int nReplicas() const
Definition: DDDivision.cc:71
double offset() const
Definition: DDDivision.cc:81
virtual double getMaxParameter(void) const
int calculateNDiv(double motherDim, double width, double offset) const
void position(const DDLogicalPart &self, const DDLogicalPart &parent, std::string copyno, const DDTranslation &trans, const DDRotation &rot, const DDDivision *div=NULL)
double calculateWidth(double motherDim, int nDiv, double offset) const
type of data representation of DDCompactView
Definition: DDCompactView.h:90
virtual void checkParametersValidity(void)
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< double > > DDTranslation
Definition: DDTranslation.h:7
DDDividedGeometryObject(const DDDivision &div, DDCompactView *cpv)
virtual DDTranslation makeDDTranslation(const int copyNo) const
Represents a uniquely identifyable rotation matrix.
Definition: DDTransform.h:64
static const double tolerance(void)
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
double width() const
Definition: DDDivision.cc:76
virtual DDRotation makeDDRotation(const int copyNo) const
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:90
void checkNDivAndWidth(double maxPar)
DDRotationMatrix * changeRotMatrix(double rotZ=0.) const