CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
DDDividedBox.cc
Go to the documentation of this file.
11 
12 #include <ostream>
13 #include <string>
14 #include <utility>
15 
16 class DDCompactView;
17 
21  setType("DivisionBoxX");
22  DDBox mbox = (DDBox)(div_.parent().solid());
23 
24  if (divisionType_ == DivWIDTH) {
25  compNDiv_ = calculateNDiv(2 * mbox.halfX(), div_.width(), div_.offset());
26  } else if (divisionType_ == DivNDIV) {
28  }
29 
30  // somehow here, I want to iterate over the nDivs or nReplicas
31  // and make the solid, make the logical part, then position it.
32  // since DDBox is special, I will not make the solid and logical
33  // part but once. We'll see how bad the others go.
34  // ihatethisihatethisihatethis
35  // for (int i = 0; i < compNDiv_; ++i)
36  // {
37  // DDpos(makeDDLogicalPart(i) // child logical part
38  // , div_.parent() // parent logical part
39  // , i // copy number
40  // , makeDDTranslation(i) // translation
41  // , makeDDRotation(i) // rotation. box is default (i.e. identity).
42  // );
43  // }
44 }
45 
46 double DDDividedBoxX::getMaxParameter(void) const {
47  DDBox msol = (DDBox)(div_.parent().solid());
48  return 2 * msol.halfX();
49 }
50 
51 DDRotation DDDividedBoxX::makeDDRotation(const int copyNo) const { return DDRotation(); }
52 
54  DDBox msol = (DDBox)(div_.parent().solid());
55  double mdx = msol.halfX();
56 
57  //----- translation
58  DDTranslation translation;
59  double posi = -mdx + div_.offset() + (copyNo + 0.5) * compWidth_;
60  translation.SetX(posi);
61 
62  return translation;
63 }
64 
66  // in other cases, this solid will have 1, 2, 3, etc. after it.
67  DDName solname(div_.parent().ddname().name() + "_DIVCHILD", div_.parent().ddname().ns());
68  DDSolid ddbox(solname);
69  DDMaterial usemat(div_.parent().material());
70  DDBox msol = (DDBox)(div_.parent().solid());
71  DDLogicalPart ddlp(solname);
72  if (!ddbox.isDefined().second) //This solid has NOT been defined.
73  {
74  double pDx = msol.halfX();
75  double pDy = compWidth_ / 2.;
76  double pDz = msol.halfZ();
77 
78  ddbox = DDSolidFactory::box(solname, pDx, pDy, pDz);
79  ddlp = DDLogicalPart(solname, usemat, ddbox);
80  }
81  return ddlp;
82 }
83 
87  setType("DivisionBoxY");
88  DDBox mbox = (DDBox)(div_.parent().solid());
89 
90  if (divisionType_ == DivWIDTH) {
91  compNDiv_ = calculateNDiv(2 * mbox.halfY(), div_.width(), div_.offset());
92  } else if (divisionType_ == DivNDIV) {
94  }
95 
96  // somehow here, I want to iterate over the nDivs or nReplicas
97  // and make the solid, make the logical part, then position it.
98  // since DDBox is special, I will not make the solid and logical
99  // part but once. We'll see how bad the others go.
100  // ihatethisihatethisihatethis
101  // for (int i = 0; i < compNDiv_; ++i)
102  // {
103  // DDpos(makeDDLogicalPart(i) // child logical part
104  // , div_.parent() // parent logical part
105  // , i // copy number
106  // , makeDDTranslation(i) // translation
107  // , makeDDRotation(i) // rotation. box is default (i.e. identity).
108  // );
109  // }
110 }
111 
112 double DDDividedBoxY::getMaxParameter(void) const {
113  DDBox msol = (DDBox)(div_.parent().solid());
114  return 2 * msol.halfY();
115 }
116 
117 DDRotation DDDividedBoxY::makeDDRotation(const int copyNo) const { return DDRotation(); }
118 
120  DDBox msol = (DDBox)(div_.parent().solid());
121  double mdx = msol.halfY();
122 
123  //----- translation
124  DDTranslation translation;
125 
126  double posi = -mdx + div_.offset() + (copyNo + 0.5) * compWidth_;
127  translation.SetY(posi);
128 
129  return translation;
130 }
131 
133  // in other cases, this solid will have 1, 2, 3, etc. after it.
134  DDName solname(div_.parent().ddname().name() + "_DIVCHILD", div_.parent().ddname().ns());
135  DDSolid ddbox(solname);
136  DDMaterial usemat(div_.parent().material());
137  DDBox msol = (DDBox)(div_.parent().solid());
138  DDLogicalPart ddlp(solname);
139  if (!ddbox.isDefined().second) //This solid has NOT been defined.
140  {
141  double pDx = msol.halfX();
142  double pDy = compWidth_ / 2.;
143  double pDz = msol.halfZ();
144  ddbox = DDSolidFactory::box(solname, pDx, pDy, pDz);
145  ddlp = DDLogicalPart(solname, usemat, ddbox);
146  }
147  return ddlp;
148 }
149 
153  setType("DivisionBoxZ");
154  DDBox mbox = (DDBox)(div_.parent().solid());
155 
156  if (divisionType_ == DivWIDTH) {
157  compNDiv_ = calculateNDiv(2 * mbox.halfZ(), div_.width(), div_.offset());
158  } else if (divisionType_ == DivNDIV) {
160  }
161 
162  // somehow here, I want to iterate over the nDivs or nReplicas
163  // and make the solid, make the logical part, then position it.
164  // since DDBox is special, I will not make the solid and logical
165  // part but once. We'll see how bad the others go.
166  // ihatethisihatethisihatethis
167  // for (int i = 0; i < compNDiv_; ++i)
168  // {
169  // DDpos(makeDDLogicalPart(i) // child logical part
170  // , div_.parent() // parent logical part
171  // , i // copy number
172  // , makeDDTranslation(i) // translation
173  // , makeDDRotation(i) // rotation. box is default (i.e. identity).
174  // );
175  // }
176 }
177 
178 double DDDividedBoxZ::getMaxParameter(void) const {
179  DDBox msol = (DDBox)(div_.parent().solid());
180  return 2 * msol.halfZ();
181 }
182 
183 DDRotation DDDividedBoxZ::makeDDRotation(const int copyNo) const { return DDRotation(); }
184 
186  DDBox msol = (DDBox)(div_.parent().solid());
187  double mdx = msol.halfZ();
188 
189  //----- translation
190  DDTranslation translation;
191 
192  double posi = -mdx + div_.offset() + (copyNo + 0.5) * compWidth_;
193  translation.SetZ(posi);
194 
195  return translation;
196 }
197 
199  // in other cases, this solid will have 1, 2, 3, etc. after it.
200  DDName solname(div_.parent().ddname().name() + "_DIVCHILD", div_.parent().ddname().ns());
201  DDSolid ddbox(solname);
202  DDMaterial usemat(div_.parent().material());
203  DDBox msol = (DDBox)(div_.parent().solid());
204  DDLogicalPart ddlp(solname);
205  if (!ddbox.isDefined().second) //This solid has NOT been defined.
206  {
207  double pDx = msol.halfX();
208  double pDy = msol.halfY();
209  double pDz = compWidth_ / 2.;
210  ddbox = DDSolidFactory::box(solname, pDx, pDy, pDz);
211  ddlp = DDLogicalPart(solname, usemat, ddbox);
212  }
213  return ddlp;
214 }
double halfZ(void) const
Definition: DDSolid.cc:216
double halfY(void) const
Definition: DDSolid.cc:214
DDLogicalPart makeDDLogicalPart(int copyNo) const override
int nReplicas() const
Definition: DDDivision.cc:51
DDMaterial is used to define and access material information.
Definition: DDMaterial.h:45
double offset() const
Definition: DDDivision.cc:55
double getMaxParameter() const override
int calculateNDiv(double motherDim, double width, double offset) const
const std::string & ns() const
Returns the namespace.
Definition: DDName.cc:52
DDName is used to identify DDD entities uniquely.
Definition: DDName.h:17
double calculateWidth(double motherDim, int nDiv, double offset) const
DDRotation makeDDRotation(int copyNo) const override
Definition: DDDividedBox.cc:51
DDTranslation makeDDTranslation(int copyNo) const override
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:81
DDRotation makeDDRotation(int copyNo) const override
DDTranslation makeDDTranslation(int copyNo) const override
Definition: DDDividedBox.cc:53
A DDSolid represents the shape of a part.
Definition: DDSolid.h:39
virtual void checkParametersValidity(void)
Represents a uniquely identifyable rotation matrix.
Definition: DDTransform.h:57
DDLogicalPart makeDDLogicalPart(int copyNo) const override
A DDLogicalPart aggregates information concerning material, solid and sensitveness ...
Definition: DDLogicalPart.h:93
dd4hep::Box DDBox
double getMaxParameter() const override
Definition: DDDividedBox.cc:46
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:547
DDDividedBoxX(const DDDivision &div, DDCompactView *cpv)
Definition: DDDividedBox.cc:18
DDDividedBoxY(const DDDivision &div, DDCompactView *cpv)
Definition: DDDividedBox.cc:84
double halfX(void) const
Definition: DDSolid.cc:212
DDDividedBoxZ(const DDDivision &div, DDCompactView *cpv)
Interface to a Box.
Definition: DDSolid.h:167
DDRotation makeDDRotation(int copyNo) const override
DDLogicalPart makeDDLogicalPart(int copyNo) const override
Definition: DDDividedBox.cc:65
double width() const
Definition: DDDivision.cc:53
DDTranslation makeDDTranslation(int copyNo) const override
const DDLogicalPart & parent() const
Definition: DDDivision.cc:57
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< double > > DDTranslation
Definition: DDTranslation.h:7
double getMaxParameter() const override
const std::string & name() const
Returns the name.
Definition: DDName.cc:41
const DDMaterial & material(void) const
Returns a reference object of the material this LogicalPart is made of.
const N & ddname() const
Definition: DDBase.h:61