CMS 3D CMS Logo

DDDividedBox.cc
Go to the documentation of this file.
11 
12 #include <ostream>
13 #include <string>
14 #include <utility>
15 
16 class DDCompactView;
17 
20 {
22  setType( "DivisionBoxX" );
23  DDBox mbox = (DDBox)(div_.parent().solid());
24 
25  if( divisionType_ == DivWIDTH ) {
26  compNDiv_ = calculateNDiv( 2*mbox.halfX(), div_.width(), div_.offset() );
27  } else if( divisionType_ == DivNDIV ) {
29  }
30 
31  // somehow here, I want to iterate over the nDivs or nReplicas
32  // and make the solid, make the logical part, then position it.
33  // since DDBox is special, I will not make the solid and logical
34  // part but once. We'll see how bad the others go.
35  // ihatethisihatethisihatethis
36  // for (int i = 0; i < compNDiv_; ++i)
37  // {
38  // DDpos(makeDDLogicalPart(i) // child logical part
39  // , div_.parent() // parent logical part
40  // , i // copy number
41  // , makeDDTranslation(i) // translation
42  // , makeDDRotation(i) // rotation. box is default (i.e. identity).
43  // );
44  // }
45 }
46 
47 double
49 {
50  DDBox msol = (DDBox)(div_.parent().solid());
51  return 2*msol.halfX();
52 }
53 
55 DDDividedBoxX::makeDDRotation( const int copyNo ) const
56 {
57  return DDRotation();
58 }
59 
61 DDDividedBoxX::makeDDTranslation( const int copyNo ) const
62 {
63  DDBox msol = (DDBox)(div_.parent().solid());
64  double mdx = msol.halfX();
65 
66  //----- translation
67  DDTranslation translation;
68  double posi = -mdx + div_.offset() + (copyNo+0.5) * compWidth_;
69  translation.SetX( posi );
70 
71  return translation;
72 }
73 
75 DDDividedBoxX::makeDDLogicalPart( const int copyNo ) const
76 {
77  // in other cases, this solid will have 1, 2, 3, etc. after it.
78  DDName solname(div_.parent().ddname().name() + "_DIVCHILD", div_.parent().ddname().ns());
79  DDSolid ddbox(solname);
80  DDMaterial usemat(div_.parent().material());
81  DDBox msol = (DDBox) (div_.parent().solid());
82  DDLogicalPart ddlp(solname);
83  if (!ddbox.isDefined().second) //This solid has NOT been defined.
84  {
85  double pDx = msol.halfX();
86  double pDy = compWidth_/2.;
87  double pDz = msol.halfZ();
88 
89  ddbox = DDSolidFactory::box(solname, pDx, pDy, pDz);
90  ddlp = DDLogicalPart(solname, usemat, ddbox);
91  }
92  return ddlp;
93 }
94 
97 {
99  setType( "DivisionBoxY" );
100  DDBox mbox = (DDBox)(div_.parent().solid());
101 
102  if( divisionType_ == DivWIDTH ) {
103  compNDiv_ = calculateNDiv( 2*mbox.halfY(), div_.width(), div_.offset() );
104  } else if( divisionType_ == DivNDIV ) {
106  }
107 
108 
109  // somehow here, I want to iterate over the nDivs or nReplicas
110  // and make the solid, make the logical part, then position it.
111  // since DDBox is special, I will not make the solid and logical
112  // part but once. We'll see how bad the others go.
113  // ihatethisihatethisihatethis
114  // for (int i = 0; i < compNDiv_; ++i)
115  // {
116  // DDpos(makeDDLogicalPart(i) // child logical part
117  // , div_.parent() // parent logical part
118  // , i // copy number
119  // , makeDDTranslation(i) // translation
120  // , makeDDRotation(i) // rotation. box is default (i.e. identity).
121  // );
122  // }
123 }
124 
125 double
127 {
128  DDBox msol = (DDBox)(div_.parent().solid());
129  return 2*msol.halfY();
130 }
131 
133 DDDividedBoxY::makeDDRotation( const int copyNo ) const
134 {
135  return DDRotation();
136 }
137 
139 DDDividedBoxY::makeDDTranslation( const int copyNo ) const
140 {
141  DDBox msol = (DDBox)(div_.parent().solid());
142  double mdx = msol.halfY();
143 
144  //----- translation
145  DDTranslation translation;
146 
147  double posi = -mdx + div_.offset() + (copyNo+0.5) * compWidth_;
148  translation.SetY( posi );
149 
150  return translation;
151 }
152 
154 DDDividedBoxY::makeDDLogicalPart( const int copyNo ) const
155 {
156  // in other cases, this solid will have 1, 2, 3, etc. after it.
157  DDName solname(div_.parent().ddname().name() + "_DIVCHILD", div_.parent().ddname().ns());
158  DDSolid ddbox(solname);
159  DDMaterial usemat(div_.parent().material());
160  DDBox msol = (DDBox) (div_.parent().solid());
161  DDLogicalPart ddlp(solname);
162  if (!ddbox.isDefined().second) //This solid has NOT been defined.
163  {
164  double pDx = msol.halfX();
165  double pDy = compWidth_/2.;
166  double pDz = msol.halfZ();
167  ddbox = DDSolidFactory::box(solname, pDx, pDy, pDz);
168  ddlp = DDLogicalPart(solname, usemat, ddbox);
169  }
170  return ddlp;
171 }
172 
175 {
177  setType( "DivisionBoxZ" );
178  DDBox mbox = (DDBox)(div_.parent().solid());
179 
180  if( divisionType_ == DivWIDTH ) {
181  compNDiv_ = calculateNDiv( 2*mbox.halfZ(), div_.width(), div_.offset() );
182  } else if( divisionType_ == DivNDIV ) {
184  }
185 
186  // somehow here, I want to iterate over the nDivs or nReplicas
187  // and make the solid, make the logical part, then position it.
188  // since DDBox is special, I will not make the solid and logical
189  // part but once. We'll see how bad the others go.
190  // ihatethisihatethisihatethis
191  // for (int i = 0; i < compNDiv_; ++i)
192  // {
193  // DDpos(makeDDLogicalPart(i) // child logical part
194  // , div_.parent() // parent logical part
195  // , i // copy number
196  // , makeDDTranslation(i) // translation
197  // , makeDDRotation(i) // rotation. box is default (i.e. identity).
198  // );
199  // }
200 }
201 
202 double
204 {
205  DDBox msol = (DDBox)(div_.parent().solid());
206  return 2*msol.halfZ();
207 }
208 
210 DDDividedBoxZ::makeDDRotation( const int copyNo ) const
211 {
212  return DDRotation();
213 }
214 
216 DDDividedBoxZ::makeDDTranslation( const int copyNo ) const
217 {
218  DDBox msol = (DDBox)(div_.parent().solid());
219  double mdx = msol.halfZ();
220 
221  //----- translation
222  DDTranslation translation;
223 
224  double posi = -mdx + div_.offset() + (copyNo+0.5) * compWidth_;
225  translation.SetZ( posi );
226 
227  return translation;
228 }
229 
231 DDDividedBoxZ::makeDDLogicalPart( const int copyNo ) const
232 {
233  // in other cases, this solid will have 1, 2, 3, etc. after it.
234  DDName solname(div_.parent().ddname().name() + "_DIVCHILD", div_.parent().ddname().ns());
235  DDSolid ddbox(solname);
236  DDMaterial usemat(div_.parent().material());
237  DDBox msol = (DDBox) (div_.parent().solid());
238  DDLogicalPart ddlp(solname);
239  if (!ddbox.isDefined().second) //This solid has NOT been defined.
240  {
241  double pDx = msol.halfX();
242  double pDy = msol.halfY();
243  double pDz = compWidth_/2.;
244  ddbox = DDSolidFactory::box(solname, pDx, pDy, pDz);
245  ddlp = DDLogicalPart(solname, usemat, ddbox);
246  }
247  return ddlp;
248 }
DDLogicalPart makeDDLogicalPart(int copyNo) const override
double halfZ(void) const
Definition: DDSolid.cc:274
double halfY(void) const
Definition: DDSolid.cc:270
int nReplicas() const
Definition: DDDivision.cc:75
DDMaterial is used to define and access material information.
Definition: DDMaterial.h:43
DDRotation makeDDRotation(int copyNo) const override
double offset() const
Definition: DDDivision.cc:87
DDLogicalPart makeDDLogicalPart(int copyNo) const override
Definition: DDDividedBox.cc:75
int calculateNDiv(double motherDim, double width, double offset) const
DDTranslation makeDDTranslation(int copyNo) const override
const std::string & ns() const
Returns the namespace.
Definition: DDName.cc:67
DDName is used to identify DDD entities uniquely.
Definition: DDName.h:15
double calculateWidth(double motherDim, int nDiv, double offset) const
const DDSolid & solid(void) const
Returns a reference object of the solid being the shape of this LogicalPart.
Compact representation of the geometrical detector hierarchy.
Definition: DDCompactView.h:80
A DDSolid represents the shape of a part.
Definition: DDSolid.h:39
virtual void checkParametersValidity(void)
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< double > > DDTranslation
Definition: DDTranslation.h:7
Represents a uniquely identifyable rotation matrix.
Definition: DDTransform.h:68
double getMaxParameter() const override
Definition: DDDividedBox.cc:48
DDRotation makeDDRotation(int copyNo) const override
Definition: DDDividedBox.cc:55
A DDLogicalPart aggregates information concerning material, solid and sensitveness ...
Definition: DDLogicalPart.h:93
virtual void setType(const std::string &type)
static DDSolid box(const DDName &name, double xHalf, double yHalf, double zHalf)
Creates a box with side length 2*xHalf, 2*yHalf, 2*zHalf.
Definition: DDSolid.cc:704
DDDividedBoxX(const DDDivision &div, DDCompactView *cpv)
Definition: DDDividedBox.cc:18
DDDividedBoxY(const DDDivision &div, DDCompactView *cpv)
Definition: DDDividedBox.cc:95
double halfX(void) const
Definition: DDSolid.cc:266
DDDividedBoxZ(const DDDivision &div, DDCompactView *cpv)
DDTranslation makeDDTranslation(int copyNo) const override
Interface to a Box.
Definition: DDSolid.h:163
double getMaxParameter() const override
double width() const
Definition: DDDivision.cc:81
DDTranslation makeDDTranslation(int copyNo) const override
Definition: DDDividedBox.cc:61
const DDLogicalPart & parent() const
Definition: DDDivision.cc:93
DDLogicalPart makeDDLogicalPart(int copyNo) const override
double getMaxParameter() const override
DDRotation makeDDRotation(int copyNo) const override
const std::string & name() const
Returns the name.
Definition: DDName.cc:53
const DDMaterial & material(void) const
Returns a reference object of the material this LogicalPart is made of.
const N & ddname() const
Definition: DDBase.h:76