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 
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 }
DDDividedGeometryObject::compWidth_
double compWidth_
Definition: DDDividedGeometryObject.h:56
DDDividedBoxY::makeDDTranslation
DDTranslation makeDDTranslation(int copyNo) const override
Definition: DDDividedBox.cc:119
DDTransform.h
MessageLogger.h
DDDivision::width
double width() const
Definition: DDDivision.cc:53
DDName
DDName is used to identify DDD entities uniquely.
Definition: DDName.h:17
DDBox::halfZ
double halfZ(void) const
Definition: DDSolid.cc:216
DDDividedBoxX::makeDDRotation
DDRotation makeDDRotation(int copyNo) const override
Definition: DDDividedBox.cc:51
DDLogicalPart::material
const DDMaterial & material(void) const
Returns a reference object of the material this LogicalPart is made of.
Definition: DDLogicalPart.cc:118
DDDividedBoxZ::makeDDTranslation
DDTranslation makeDDTranslation(int copyNo) const override
Definition: DDDividedBox.cc:185
DDDividedBoxZ::getMaxParameter
double getMaxParameter() const override
Definition: DDDividedBox.cc:178
DDAxes.h
DDBox
dd4hep::Box DDBox
Definition: DD4hep_volumeHandle.cc:27
DDDividedGeometryObject
Definition: DDDividedGeometryObject.h:20
DivWIDTH
Definition: DDDividedGeometryObject.h:14
DDMaterial
DDMaterial is used to define and access material information.
Definition: DDMaterial.h:45
DDDividedGeometryObject::checkParametersValidity
virtual void checkParametersValidity(void)
Definition: DDDividedGeometryObject.cc:41
DDTranslation
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< double > > DDTranslation
Definition: DDTranslation.h:7
DDBox
Interface to a Box.
Definition: DDSolid.h:167
DivNDIV
Definition: DDDividedGeometryObject.h:14
DDCompactView
Compact representation of the geometrical detector hierarchy.
Definition: DDCompactView.h:81
DDSolid.h
DDDividedGeometryObject::calculateNDiv
int calculateNDiv(double motherDim, double width, double offset) const
Definition: DDDividedGeometryObject.cc:33
DDDividedBoxY::DDDividedBoxY
DDDividedBoxY(const DDDivision &div, DDCompactView *cpv)
Definition: DDDividedBox.cc:84
DDDividedGeometryObject::div_
DDDivision div_
Definition: DDDividedGeometryObject.h:53
DDDividedGeometryObject::compNDiv_
int compNDiv_
Definition: DDDividedGeometryObject.h:55
DDBase::ddname
const N & ddname() const
Definition: DDBase.h:61
DDDividedBoxY::makeDDRotation
DDRotation makeDDRotation(int copyNo) const override
Definition: DDDividedBox.cc:117
DDLogicalPart
A DDLogicalPart aggregates information concerning material, solid and sensitveness ....
Definition: DDLogicalPart.h:93
DDDividedGeometryObject::divisionType_
DivisionType divisionType_
Definition: DDDividedGeometryObject.h:57
DDMaterial.h
DDDividedBoxZ::makeDDRotation
DDRotation makeDDRotation(int copyNo) const override
Definition: DDDividedBox.cc:183
DDDividedGeometryObject::setType
virtual void setType(const std::string &type)
Definition: DDDividedGeometryObject.cc:81
DDDividedGeometryObject.h
DDDivision::offset
double offset() const
Definition: DDDivision.cc:55
DDBox::halfX
double halfX(void) const
Definition: DDSolid.cc:212
DDName::name
const std::string & name() const
Returns the name.
Definition: DDName.cc:41
DDDividedBoxX::makeDDLogicalPart
DDLogicalPart makeDDLogicalPart(int copyNo) const override
Definition: DDDividedBox.cc:65
DDBox::halfY
double halfY(void) const
Definition: DDSolid.cc:214
DDDividedBoxZ::makeDDLogicalPart
DDLogicalPart makeDDLogicalPart(int copyNo) const override
Definition: DDDividedBox.cc:198
DDLogicalPart.h
DDDivision::nReplicas
int nReplicas() const
Definition: DDDivision.cc:51
DDDividedBoxX::DDDividedBoxX
DDDividedBoxX(const DDDivision &div, DDCompactView *cpv)
Definition: DDDividedBox.cc:18
DDDividedBoxX::getMaxParameter
double getMaxParameter() const override
Definition: DDDividedBox.cc:46
DDDividedBoxY::getMaxParameter
double getMaxParameter() const override
Definition: DDDividedBox.cc:112
DDDivision
Definition: DDDivision.h:78
DDSolidShape::ddbox
DDDivision.h
DDDividedBoxY::makeDDLogicalPart
DDLogicalPart makeDDLogicalPart(int copyNo) const override
Definition: DDDividedBox.cc:132
DDName::ns
const std::string & ns() const
Returns the namespace.
Definition: DDName.cc:52
DDDividedBox.h
DDName.h
DDSolid
A DDSolid represents the shape of a part.
Definition: DDSolid.h:39
DDRotation
Represents a uniquely identifyable rotation matrix.
Definition: DDTransform.h:57
DDSolidFactory::box
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
DDLogicalPart::solid
const DDSolid & solid(void) const
Returns a reference object of the solid being the shape of this LogicalPart.
Definition: DDLogicalPart.cc:120
DDDivision::parent
const DDLogicalPart & parent() const
Definition: DDDivision.cc:57
DDDividedGeometryObject::calculateWidth
double calculateWidth(double motherDim, int nDiv, double offset) const
Definition: DDDividedGeometryObject.cc:37
DDDividedBoxX::makeDDTranslation
DDTranslation makeDDTranslation(int copyNo) const override
Definition: DDDividedBox.cc:53
DDDividedBoxZ::DDDividedBoxZ
DDDividedBoxZ(const DDDivision &div, DDCompactView *cpv)
Definition: DDDividedBox.cc:150