CMS 3D CMS Logo

DDDividedCons.cc
Go to the documentation of this file.
12 
13 #include <iostream>
14 #include <string>
15 #include <utility>
16 
17 class DDCompactView;
18 
19 using namespace geant_units::operators;
20 
24  setType("DivisionConsRho");
25  DDCons msol = (DDCons)(div_.parent().solid());
26 
27  if (msol.rInPlusZ() == 0.) {
28  std::cout << "WARNING - DDDividedConsRho, rOutMinusZ = 0. " << std::endl
29  << " Width is calculated as that of rOutMinusZ !" << std::endl;
30  }
31 
32  if (divisionType_ == DivWIDTH) {
34  } else if (divisionType_ == DivNDIV) {
35  DDCons msol = (DDCons)(div_.parent().solid());
37  }
38 }
39 
41  DDCons msol = (DDCons)(div_.parent().solid());
42  return msol.rOutMinusZ() - msol.rInMinusZ();
43 }
44 
46  DDRotation myddrot; // sets to identity.
47  return myddrot;
48 }
49 
51  DDTranslation translation;
52  return translation;
53 }
54 
56  DDName solname(div_.parent().ddname().name() + "_DIVCHILD" + std::to_string(copyNo), div_.parent().ddname().ns());
57  DDSolid ddcons(solname);
58  DDMaterial usemat(div_.parent().material());
59  DDCons msol = (DDCons)(div_.parent().solid());
60 
61  double pRMin1 = msol.rInMinusZ() + div_.offset() + compWidth_ * copyNo;
62  double pRMax1 = msol.rInMinusZ() + div_.offset() + compWidth_ * (copyNo + 1);
63 
64  //width at Z Plus
65  //- double compWidth_Plus =
66  // compWidth_ * ( msol.rOutPlusZ()/ msol.rInPlusZ())
67  //- / ( msol.rOutMinusZ() - msol.rInMinusZ());
68  double compWidth_Plus = calculateWidth(msol.rOutPlusZ() - msol.rInPlusZ(), compNDiv_, div_.offset());
69  double pRMin2 = msol.rInPlusZ() + div_.offset() + compWidth_Plus * copyNo;
70  double pRMax2 = msol.rInPlusZ() + div_.offset() + compWidth_Plus * (copyNo + 1);
71  double pDz = msol.zhalf();
72 
73  double pSPhi = msol.phiFrom();
74  double pDPhi = msol.deltaPhi();
75 
76  ddcons = DDSolidFactory::cons(DDName(solname), pDz, pRMin1, pRMax1, pRMin2, pRMax2, pSPhi, pDPhi);
77 
78  DDLogicalPart ddlp = DDLogicalPart(solname, usemat, ddcons);
79  return ddlp;
80 }
81 
85  setType("DivisionConsPhi");
86  DDCons msol = (DDCons)(div_.parent().solid());
87 
88  if (divisionType_ == DivWIDTH) {
89  DDCons msol = (DDCons)(div_.parent().solid());
90  //If you divide a tube of 360 degrees the offset displaces the starting angle, but you still fill the 360 degrees
91  if (msol.deltaPhi() == 360._deg) {
92  compNDiv_ = calculateNDiv(msol.deltaPhi(), div_.width(), 0.);
93  } else {
95  }
96  } else if (divisionType_ == DivNDIV) {
97  DDCons msol = (DDCons)(div_.parent().solid());
98  if (msol.deltaPhi() == 360._deg) {
100  } else {
102  }
103  }
104 }
105 
107  DDCons msol = (DDCons)(div_.parent().solid());
108  return msol.deltaPhi();
109 }
110 
112  DDRotation myddrot; // sets to identity.
113  double posi = (copyNo - 1) * compWidth_;
114  // how to name the rotation??
115  // i hate this crap :-)
116  DDName ddrotname(div_.parent().ddname().name() + "_DIVCHILD_ROT" + std::to_string(copyNo),
117  div_.parent().ddname().ns());
118  myddrot = DDrot(ddrotname, changeRotMatrix(posi));
119 
120  return myddrot;
121 }
122 
124  DDTranslation translation;
125  return translation;
126 }
127 
129  DDName solname(div_.parent().ddname().name() + "_DIVCHILD", div_.parent().ddname().ns());
130  DDSolid ddcons(solname);
131  DDMaterial usemat(div_.parent().material());
132  DDCons msol = (DDCons)(div_.parent().solid());
133 
134  if (!ddcons.isDefined().second) {
135  double pRMin1 = msol.rInMinusZ();
136  double pRMax1 = msol.rOutMinusZ();
137  double pRMin2 = msol.rInPlusZ();
138  double pRMax2 = msol.rOutPlusZ();
139  double pDz = msol.zhalf();
140 
141  //- already rotated double pSPhi = div_.offset() + copyNo*compWidth_;
142  double pSPhi = div_.offset() + msol.phiFrom();
143  double pDPhi = compWidth_;
144  ddcons = DDSolidFactory::cons(DDName(solname), pDz, pRMin1, pRMax1, pRMin2, pRMax2, pSPhi, pDPhi);
145  }
146 
147  DDLogicalPart ddlp = DDLogicalPart(solname, usemat, ddcons);
148 
149  return ddlp;
150 }
151 
155 
156  DDCons msol = (DDCons)(div_.parent().solid());
157  setType("DivisionConsZ");
158 
159  if (divisionType_ == DivWIDTH) {
160  DDCons msol = (DDCons)(div_.parent().solid());
161  compNDiv_ = calculateNDiv(2 * msol.zhalf(), div_.width(), div_.offset());
162  } else if (divisionType_ == DivNDIV) {
163  DDCons msol = (DDCons)(div_.parent().solid());
165  }
166 }
167 
169  DDCons msol = (DDCons)(div_.parent().solid());
170  return 2 * msol.zhalf();
171 }
172 
174  DDRotation myddrot; // sets to identity.
175  return myddrot;
176 }
177 
179  DDTranslation translation;
180 
181  DDCons motherCons = (DDCons)(div_.parent().solid());
182  double posi = -motherCons.zhalf() + div_.offset() + compWidth_ / 2 + copyNo * compWidth_;
183  translation.SetZ(posi);
184 
185  return translation;
186 }
187 
189  DDName solname(div_.parent().ddname().name() + "_DIVCHILD" + std::to_string(copyNo), div_.parent().ddname().ns());
190  DDSolid ddcons(solname);
191  DDMaterial usemat(div_.parent().material());
192  DDCons msol = (DDCons)(div_.parent().solid());
193 
194  double mHalfLength = msol.zhalf();
195  double aRInner = (msol.rInPlusZ() - msol.rInMinusZ()) / (2 * mHalfLength);
196  double bRInner = (msol.rInPlusZ() + msol.rInMinusZ()) / 2;
197  double aROuter = (msol.rOutPlusZ() - msol.rOutMinusZ()) / (2 * mHalfLength);
198  double bROuter = (msol.rOutPlusZ() + msol.rOutMinusZ()) / 2;
199  double xMinusZ = -mHalfLength + div_.offset() + compWidth_ * copyNo;
200  double xPlusZ = -mHalfLength + div_.offset() + compWidth_ * (copyNo + 1);
201 
202  double pDz = compWidth_ / 2.;
203  double pSPhi = msol.phiFrom();
204  double pDPhi = msol.deltaPhi();
205 
207  pDz,
208  aRInner * xMinusZ + bRInner,
209  aROuter * xMinusZ + bROuter,
210  aRInner * xPlusZ + bRInner,
211  aROuter * xPlusZ + bROuter,
212  pSPhi,
213  pDPhi);
214 
215  DDLogicalPart ddlp = DDLogicalPart(solname, usemat, ddcons);
216 
217  return ddlp;
218 }
DDDividedGeometryObject::compWidth_
double compWidth_
Definition: DDDividedGeometryObject.h:56
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
DDCons
Definition: DDSolid.h:292
DDDividedConsPhi::makeDDLogicalPart
DDLogicalPart makeDDLogicalPart(int copyNo) const override
Definition: DDDividedCons.cc:128
DDCons::deltaPhi
double deltaPhi(void) const
Definition: DDSolid.cc:426
DDDivision::width
double width() const
Definition: DDDivision.cc:53
DDName
DDName is used to identify DDD entities uniquely.
Definition: DDName.h:17
gather_cfg.cout
cout
Definition: gather_cfg.py:144
DDDividedConsPhi::getMaxParameter
double getMaxParameter() const override
Definition: DDDividedCons.cc:106
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
DDSolidFactory::cons
static DDSolid cons(const DDName &name, double zhalf, double rInMinusZ, double rOutMinusZ, double rInPlusZ, double rOutPlusZ, double phiFrom, double deltaPhi)
Definition: DDSolid.cc:650
geant_units::operators
Definition: GeantUnits.h:18
DDCons::rInMinusZ
double rInMinusZ(void) const
Definition: DDSolid.cc:416
DDDividedGeometryObject
Definition: DDDividedGeometryObject.h:20
DivWIDTH
Definition: DDDividedGeometryObject.h:14
DDCons::rInPlusZ
double rInPlusZ(void) const
Definition: DDSolid.cc:420
DDDividedConsRho::makeDDRotation
DDRotation makeDDRotation(int copyNo) const override
Definition: DDDividedCons.cc:45
DDDividedConsZ::getMaxParameter
double getMaxParameter() const override
Definition: DDDividedCons.cc:168
DDDividedConsZ::makeDDRotation
DDRotation makeDDRotation(int copyNo) const override
Definition: DDDividedCons.cc:173
DDMaterial
DDMaterial is used to define and access material information.
Definition: DDMaterial.h:45
DDDividedGeometryObject::checkParametersValidity
virtual void checkParametersValidity(void)
Definition: DDDividedGeometryObject.cc:41
DDCons::rOutMinusZ
double rOutMinusZ(void) const
Definition: DDSolid.cc:418
DDDividedConsRho::DDDividedConsRho
DDDividedConsRho(const DDDivision &div, DDCompactView *cpv)
Definition: DDDividedCons.cc:21
DDTranslation
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< double > > DDTranslation
Definition: DDTranslation.h:7
DDCons
dd4hep::ConeSegment DDCons
Definition: DD4hep_volumeHandle.cc:30
DDDividedConsRho::makeDDLogicalPart
DDLogicalPart makeDDLogicalPart(int copyNo) const override
Definition: DDDividedCons.cc:55
DivNDIV
Definition: DDDividedGeometryObject.h:14
DDCompactView
Compact representation of the geometrical detector hierarchy.
Definition: DDCompactView.h:81
DDDividedCons.h
DDDividedConsZ::makeDDLogicalPart
DDLogicalPart makeDDLogicalPart(int copyNo) const override
Definition: DDDividedCons.cc:188
DDSolid.h
DDDividedConsPhi::makeDDTranslation
DDTranslation makeDDTranslation(int copyNo) const override
Definition: DDDividedCons.cc:123
DDDividedGeometryObject::calculateNDiv
int calculateNDiv(double motherDim, double width, double offset) const
Definition: DDDividedGeometryObject.cc:33
DDDividedConsRho::makeDDTranslation
DDTranslation makeDDTranslation(int copyNo) const override
Definition: DDDividedCons.cc:50
DDDividedConsZ::DDDividedConsZ
DDDividedConsZ(const DDDivision &div, DDCompactView *cpv)
Definition: DDDividedCons.cc:152
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
DDSolidShape::ddcons
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
DDLogicalPart.h
DDDivision::nReplicas
int nReplicas() const
Definition: DDDivision.cc:51
DDDividedConsZ::makeDDTranslation
DDTranslation makeDDTranslation(int copyNo) const override
Definition: DDDividedCons.cc:178
DDDivision
Definition: DDDivision.h:78
DDRotationMatrix.h
DDDividedConsPhi::DDDividedConsPhi
DDDividedConsPhi(const DDDivision &div, DDCompactView *cpv)
Definition: DDDividedCons.cc:82
DDName::ns
const std::string & ns() const
Returns the namespace.
Definition: DDName.cc:52
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
DDDividedConsPhi::makeDDRotation
DDRotation makeDDRotation(int copyNo) const override
Definition: DDDividedCons.cc:111
DDCons::zhalf
double zhalf(void) const
Definition: DDSolid.cc:414
DDDividedConsRho::getMaxParameter
double getMaxParameter() const override
Definition: DDDividedCons.cc:40
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