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 }
DDTubs::zhalf
double zhalf(void) const
Definition: DDSolid.cc:450
DDDividedGeometryObject::compWidth_
double compWidth_
Definition: DDDividedGeometryObject.h:56
DDDividedTubsRho::makeDDTranslation
DDTranslation makeDDTranslation(int copyNo) const override
Definition: DDDividedTubs.cc:42
DDTransform.h
MessageLogger.h
DDrot
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
DDDividedTubsPhi::makeDDTranslation
DDTranslation makeDDTranslation(int copyNo) const override
Definition: DDDividedTubs.cc:103
DDDivision::width
double width() const
Definition: DDDivision.cc:53
DDName
DDName is used to identify DDD entities uniquely.
Definition: DDName.h:15
DDDividedTubsPhi::makeDDRotation
DDRotation makeDDRotation(int copyNo) const override
Definition: DDDividedTubs.cc:93
DDLogicalPart::material
const DDMaterial & material(void) const
Returns a reference object of the material this LogicalPart is made of.
Definition: DDLogicalPart.cc:118
DDAxes.h
DDDividedTubs.h
DDDividedTubsZ::getMaxParameter
double getMaxParameter() const override
Definition: DDDividedTubs.cc:142
geant_units::operators
Definition: GeantUnits.h:18
DDDividedTubsZ::DDDividedTubsZ
DDDividedTubsZ(const DDDivision &div, DDCompactView *cpv)
Definition: DDDividedTubs.cc:128
DDDividedGeometryObject
Definition: DDDividedGeometryObject.h:20
DivWIDTH
Definition: DDDividedGeometryObject.h:14
DDMaterial
DDMaterial is used to define and access material information.
Definition: DDMaterial.h:45
DDDividedTubsRho::makeDDRotation
DDRotation makeDDRotation(int copyNo) const override
Definition: DDDividedTubs.cc:37
DDDividedGeometryObject::checkParametersValidity
virtual void checkParametersValidity(void)
Definition: DDDividedGeometryObject.cc:41
DDDividedTubsPhi::makeDDLogicalPart
DDLogicalPart makeDDLogicalPart(int copyNo) const override
Definition: DDDividedTubs.cc:108
DDTranslation
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< double > > DDTranslation
Definition: DDTranslation.h:7
DDSolidShape::ddtubs
DivNDIV
Definition: DDDividedGeometryObject.h:14
DDDividedTubsZ::makeDDTranslation
DDTranslation makeDDTranslation(int copyNo) const override
Definition: DDDividedTubs.cc:152
DDDividedTubsZ::makeDDRotation
DDRotation makeDDRotation(int copyNo) const override
Definition: DDDividedTubs.cc:147
DDCompactView
Compact representation of the geometrical detector hierarchy.
Definition: DDCompactView.h:81
DDDividedTubsRho::getMaxParameter
double getMaxParameter() const override
Definition: DDDividedTubs.cc:32
DDBase::name
const N & name() const
Definition: DDBase.h:59
DDSolidFactory::tubs
static DDSolid tubs(const DDName &name, double zhalf, double rIn, double rOut, double startPhi, double deltaPhi)
Definition: DDSolid.cc:653
DDSolid.h
DDDividedGeometryObject::calculateNDiv
int calculateNDiv(double motherDim, double width, double offset) const
Definition: DDDividedGeometryObject.cc:33
DDTubs::rIn
double rIn(void) const
Definition: DDSolid.cc:452
DDTubs::deltaPhi
double deltaPhi(void) const
Definition: DDSolid.cc:458
DDDividedGeometryObject::div_
DDDivision div_
Definition: DDDividedGeometryObject.h:53
DDDividedGeometryObject::changeRotMatrix
std::unique_ptr< DDRotationMatrix > changeRotMatrix(double rotZ=0.) const
Definition: DDDividedGeometryObject.cc:29
DDDividedGeometryObject::compNDiv_
int compNDiv_
Definition: DDDividedGeometryObject.h:55
DDBase::ddname
const N & ddname() const
Definition: DDBase.h:61
GeantUnits.h
DDTubs::rOut
double rOut(void) const
Definition: DDSolid.cc:454
DDLogicalPart
A DDLogicalPart aggregates information concerning material, solid and sensitveness ....
Definition: DDLogicalPart.h:93
DDDividedGeometryObject::divisionType_
DivisionType divisionType_
Definition: DDDividedGeometryObject.h:57
DDMaterial.h
DDDividedGeometryObject::setType
virtual void setType(const std::string &type)
Definition: DDDividedGeometryObject.cc:81
DDDividedGeometryObject.h
DDDivision::offset
double offset() const
Definition: DDDivision.cc:55
DDName::name
const std::string & name() const
Returns the name.
Definition: DDName.cc:41
DDDividedTubsPhi::getMaxParameter
double getMaxParameter() const override
Definition: DDDividedTubs.cc:88
DDLogicalPart.h
DDDivision::nReplicas
int nReplicas() const
Definition: DDDivision.cc:51
DDDivision
Definition: DDDivision.h:78
DDDividedTubsZ::makeDDLogicalPart
DDLogicalPart makeDDLogicalPart(int copyNo) const override
Definition: DDDividedTubs.cc:162
DDRotationMatrix.h
DDName::ns
const std::string & ns() const
Returns the namespace.
Definition: DDName.cc:52
DDName.h
DDDividedTubsPhi::DDDividedTubsPhi
DDDividedTubsPhi(const DDDivision &div, DDCompactView *cpv)
Definition: DDDividedTubs.cc:65
DDSolid
A DDSolid represents the shape of a part.
Definition: DDSolid.h:39
DDRotation
Represents a uniquely identifyable rotation matrix.
Definition: DDTransform.h:57
DDDividedTubsRho::DDDividedTubsRho
DDDividedTubsRho(const DDDivision &div, DDCompactView *cpv)
Definition: DDDividedTubs.cc:19
DDTubs
dd4hep::Tube DDTubs
Definition: DD4hep_volumeHandle.cc:27
DDDividedTubsRho::makeDDLogicalPart
DDLogicalPart makeDDLogicalPart(int copyNo) const override
Definition: DDDividedTubs.cc:47
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
DDTubs
Definition: DDSolid.h:255
DDDividedGeometryObject::calculateWidth
double calculateWidth(double motherDim, int nDiv, double offset) const
Definition: DDDividedGeometryObject.cc:37