CMS 3D CMS Logo

DDDividedTubs.cc
Go to the documentation of this file.
12 
13 #include <string>
14 #include <utility>
15 
16 class DDCompactView;
17 using namespace geant_units::operators;
18 
22  setType("DivisionTubsRho");
23  DDTubs msol = (DDTubs)(div_.parent().solid());
24 
25  if (divisionType_ == DivWIDTH) {
26  compNDiv_ = calculateNDiv(msol.rIn() - msol.rOut(), div_.width(), div_.offset());
27  } else if (divisionType_ == DivNDIV) {
28  compWidth_ = calculateWidth(msol.rIn() - msol.rOut(), div_.nReplicas(), div_.offset());
29  }
30 }
31 
33  DDTubs msol = (DDTubs)(div_.parent().solid());
34  return msol.rOut() - msol.rIn();
35 }
36 
38  DDRotation myddrot; // sets to identity.
39  return myddrot;
40 }
41 
43  DDTranslation translation;
44  return translation;
45 }
46 
48  // must always make new name and new solid
49  DDName solname(div_.parent().ddname().name() + "_DIVCHILD" + std::to_string(copyNo), div_.parent().ddname().ns());
50  DDSolid ddtubs(solname);
51  DDMaterial usemat(div_.parent().material());
52  DDTubs msol = (DDTubs)(div_.parent().solid());
53  DDLogicalPart ddlp;
54 
55  double pRMin = msol.rIn() + div_.offset() + compWidth_ * copyNo;
56  double pRMax = msol.rIn() + div_.offset() + compWidth_ * (copyNo + 1);
57  double pDz = msol.zhalf();
58  double pSPhi = msol.startPhi();
59  double pDPhi = msol.deltaPhi();
60  ddtubs = DDSolidFactory::tubs(DDName(solname), pDz, pRMin, pRMax, pSPhi, pDPhi);
61  ddlp = DDLogicalPart(solname, usemat, ddtubs);
62  return ddlp;
63 }
64 
68  setType("DivisionTubsPhi");
69 
70  DDTubs msol = (DDTubs)(div_.parent().solid());
71  if (divisionType_ == DivWIDTH) {
72  //If you divide a tube of 360 degrees the offset displaces the starting angle, but you still fill the 360 degrees
73  if (msol.deltaPhi() == 360._deg) {
74  compNDiv_ = calculateNDiv(msol.deltaPhi(), div_.width(), 0.);
75  } else {
77  }
78 
79  } else if (divisionType_ == DivNDIV) {
80  if (msol.deltaPhi() == 360._deg) {
82  } else {
84  }
85  }
86 }
87 
89  DDTubs msol = (DDTubs)(div_.parent().solid());
90  return msol.deltaPhi();
91 }
92 
94  DDRotation myddrot; // sets to identity.
95  double posi = (copyNo - 1) * compWidth_; // This should put the first one at the 0 of the parent.
96  DDName ddrotname(div_.parent().ddname().name() + "_DIVCHILD_ROT" + std::to_string(copyNo),
97  div_.parent().ddname().ns());
98  myddrot = DDrot(ddrotname, changeRotMatrix(posi));
99 
100  return myddrot;
101 }
102 
104  DDTranslation translation;
105  return translation;
106 }
107 
109  DDName solname(div_.name());
110  DDSolid ddtubs(solname);
111  DDMaterial usemat(div_.parent().material());
112  DDTubs msol = (DDTubs)(div_.parent().solid());
113  DDLogicalPart ddlp(solname);
114 
115  if (!ddtubs.isDefined().second) // only if it is not defined, make new dimensions and solid.
116  {
117  double pRMin = msol.rIn();
118  double pRMax = msol.rOut();
119  double pDz = msol.zhalf();
120  double pSPhi = msol.startPhi() + div_.offset();
121  double pDPhi = compWidth_;
122  ddtubs = DDSolidFactory::tubs(DDName(solname), pDz, pRMin, pRMax, pSPhi, pDPhi);
123  ddlp = DDLogicalPart(solname, usemat, ddtubs);
124  }
125  return ddlp;
126 }
127 
131 
132  DDTubs msol = (DDTubs)(div_.parent().solid());
133 
134  setType("DivisionTubsZ");
135  if (divisionType_ == DivWIDTH) {
136  compNDiv_ = calculateNDiv(2 * msol.zhalf(), div_.width(), div_.offset());
137  } else if (divisionType_ == DivNDIV) {
139  }
140 }
141 
143  DDTubs msol = (DDTubs)(div_.parent().solid());
144  return 2 * msol.zhalf();
145 }
146 
148  DDRotation myddrot; // sets to identity.
149  return myddrot;
150 }
151 
153  DDTranslation translation;
154 
155  DDTubs msol = (DDTubs)(div_.parent().solid());
156  double posi = -msol.zhalf() + div_.offset() + compWidth_ / 2 + copyNo * compWidth_;
157  translation.SetZ(posi);
158 
159  return translation;
160 }
161 
163  DDMaterial usemat(div_.parent().material());
164  DDTubs msol = (DDTubs)(div_.parent().solid());
165  DDLogicalPart ddlp;
166 
167  DDName solname(div_.parent().ddname().name() + "_DIVCHILD", div_.parent().ddname().ns());
168  DDSolid ddtubs(solname);
169 
170  if (!ddtubs.isDefined().second) // only if it is not defined, make new dimensions and solid.
171  {
172  double pRMin = msol.rIn();
173  double pRMax = msol.rOut();
174  double pDz = compWidth_ / 2.;
175  double pSPhi = msol.startPhi();
176  double pDPhi = msol.deltaPhi();
177  ddtubs = DDSolidFactory::tubs(DDName(solname), pDz, pRMin, pRMax, pSPhi, pDPhi);
178  ddlp = DDLogicalPart(solname, usemat, ddtubs);
179  } else {
180  ddlp = DDLogicalPart(solname);
181  }
182  return ddlp;
183 }
DDLogicalPart makeDDLogicalPart(int copyNo) const override
DDTranslation makeDDTranslation(int copyNo) const override
int nReplicas() const
Definition: DDDivision.cc:51
double rIn(void) const
Definition: DDSolid.cc:456
DDMaterial is used to define and access material information.
Definition: DDMaterial.h:45
DDTranslation makeDDTranslation(int copyNo) const override
double rOut(void) const
Definition: DDSolid.cc:458
DDName is used to identify DDD entities uniquely.
Definition: DDName.h:17
DDDividedTubsRho(const DDDivision &div, DDCompactView *cpv)
std::string to_string(const V &value)
Definition: OMSAccess.h:71
DDTranslation makeDDTranslation(int copyNo) const override
double getMaxParameter() const override
double offset() const
Definition: DDDivision.cc:55
Compact representation of the geometrical detector hierarchy.
Definition: DDCompactView.h:81
const DDLogicalPart & parent() const
Definition: DDDivision.cc:57
A DDSolid represents the shape of a part.
Definition: DDSolid.h:39
virtual void checkParametersValidity(void)
DDDividedTubsPhi(const DDDivision &div, DDCompactView *cpv)
Represents a uniquely identifyable rotation matrix.
Definition: DDTransform.h:57
dd4hep::Tube DDTubs
const std::string & name() const
Returns the name.
Definition: DDName.cc:41
int calculateNDiv(double motherDim, double width, double offset) const
DDDividedTubsZ(const DDDivision &div, DDCompactView *cpv)
A DDLogicalPart aggregates information concerning material, solid and sensitveness ...
Definition: DDLogicalPart.h:93
DDRotation DDrot(const DDName &name, std::unique_ptr< DDRotationMatrix > rot)
Definition of a uniquely identifiable rotation matrix named by DDName name.
Definition: DDRotation.cc:67
double getMaxParameter() const override
static DDSolid tubs(const DDName &name, double zhalf, double rIn, double rOut, double startPhi, double deltaPhi)
Definition: DDSolid.cc:667
double getMaxParameter() const override
virtual void setType(const std::string &type)
std::unique_ptr< DDRotationMatrix > changeRotMatrix(double rotZ=0.) const
const DDMaterial & material(void) const
Returns a reference object of the material this LogicalPart is made of.
const N & name() const
Definition: DDBase.h:59
DDRotation makeDDRotation(int copyNo) const override
double deltaPhi(void) const
Definition: DDSolid.cc:462
const N & ddname() const
Definition: DDBase.h:61
DDLogicalPart makeDDLogicalPart(int copyNo) const override
const DDSolid & solid(void) const
Returns a reference object of the solid being the shape of this LogicalPart.
DDRotation makeDDRotation(int copyNo) const override
double width() const
Definition: DDDivision.cc:53
DDRotation makeDDRotation(int copyNo) const override
double zhalf(void) const
Definition: DDSolid.cc:454
double calculateWidth(double motherDim, int nDiv, double offset) const
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< double > > DDTranslation
Definition: DDTranslation.h:7
DDLogicalPart makeDDLogicalPart(int copyNo) const override
const std::string & ns() const
Returns the namespace.
Definition: DDName.cc:52