CMS 3D CMS Logo

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