18 string mother =
args.parentName();
19 string genMat =
args.str(
"GeneralMaterial");
20 double detectorTilt =
args.dble(
"DetectorTilt");
21 double layerL =
args.dble(
"LayerL");
23 double radiusLo =
args.dble(
"RadiusLo");
24 int stringsLo =
args.integer(
"StringsLo");
25 string detectorLo =
args.str(
"StringDetLoName");
27 double radiusUp =
args.dble(
"RadiusUp");
28 int stringsUp =
args.integer(
"StringsUp");
29 string detectorUp =
args.str(
"StringDetUpName");
31 double cylinderT =
args.dble(
"CylinderThickness");
32 double cylinderInR =
args.dble(
"CylinderInnerRadius");
33 string cylinderMat =
args.str(
"CylinderMaterial");
34 double MFRingInR =
args.dble(
"MFRingInnerRadius");
35 double MFRingOutR =
args.dble(
"MFRingOuterRadius");
36 double MFRingT =
args.dble(
"MFRingThickness");
37 double MFRingDz =
args.dble(
"MFRingDeltaz");
38 string MFIntRingMat =
args.str(
"MFIntRingMaterial");
39 string MFExtRingMat =
args.str(
"MFExtRingMaterial");
41 double supportT =
args.dble(
"SupportThickness");
43 string centMat =
args.str(
"CentRingMaterial");
47 string fillerMat =
args.str(
"FillerMaterial");
48 double fillerDz =
args.dble(
"FillerDeltaz");
50 string ribMat =
args.str(
"RibMaterial");
57 double dohmtoMF =
args.dble(
"DOHMtoMFDist");
58 double dohmCarrierPhiOff =
args.dble(
"DOHMCarrierPhiOffset");
59 string dohmPrimName =
args.str(
"StringDOHMPrimName");
60 string dohmAuxName =
args.str(
"StringDOHMAuxName");
62 string dohmCarrierMaterial =
args.str(
"DOHMCarrierMaterial");
63 string dohmCableMaterial =
args.str(
"DOHMCableMaterial");
64 double dohmPrimL =
args.dble(
"DOHMPRIMLength");
65 string dohmPrimMaterial =
args.str(
"DOHMPRIMMaterial");
66 double dohmAuxL =
args.dble(
"DOHMAUXLength");
67 string dohmAuxMaterial =
args.str(
"DOHMAUXMaterial");
69 string pillarMaterial =
args.str(
"PillarMaterial");
71 double fwIntPillarDz =
args.dble(
"FWIntPillarDz");
72 double fwIntPillarDPhi =
args.dble(
"FWIntPillarDPhi");
75 double bwIntPillarDz =
args.dble(
"BWIntPillarDz");
76 double bwIntPillarDPhi =
args.dble(
"BWIntPillarDPhi");
80 double fwExtPillarDz =
args.dble(
"FWExtPillarDz");
81 double fwExtPillarDPhi =
args.dble(
"FWExtPillarDPhi");
84 double bwExtPillarDz =
args.dble(
"BWExtPillarDz");
85 double bwExtPillarDPhi =
args.dble(
"BWExtPillarDPhi");
93 <<
" positioned: " << pvl.motherVol()->GetName() <<
" " << pvl.position();
96 edm::LogVerbatim(
"TIBGeom") <<
"Parent " << mother <<
" NameSpace " << ns.name() <<
" General Material " << genMat;
97 edm::LogVerbatim(
"TIBGeom") <<
"Lower layer Radius " << radiusLo <<
" Number " << stringsLo <<
" String " 99 edm::LogVerbatim(
"TIBGeom") <<
"Upper layer Radius " << radiusUp <<
" Number " << stringsUp <<
" String " 101 edm::LogVerbatim(
"TIBGeom") <<
"Cylinder Material/thickness " << cylinderMat <<
" " << cylinderT <<
" Rib Material " 102 << ribMat <<
" at " << ribW.size() <<
" positions with width/phi";
103 for (
unsigned int i = 0;
i < ribW.size();
i++) {
108 <<
" Material " << dohmPrimMaterial <<
" Length " << dohmPrimL;
110 <<
" Material " << dohmAuxMaterial <<
" Length " << dohmAuxL;
111 for (
double i : dohmListFW) {
117 for (
double i : dohmListBW) {
123 edm::LogVerbatim(
"TIBGeom") <<
"FW Internal Pillar [Dz, DPhi] " << fwIntPillarDz <<
", " << fwIntPillarDPhi;
124 for (
unsigned int i = 0;
i < fwIntPillarZ.size();
i++) {
125 if (fwIntPillarPhi[
i] > 0.) {
126 edm::LogVerbatim(
"TIBGeom") <<
" at positions [z, phi] " << fwIntPillarZ[
i] <<
" " << fwIntPillarPhi[
i];
129 edm::LogVerbatim(
"TIBGeom") <<
"BW Internal Pillar [Dz, DPhi] " << bwIntPillarDz <<
", " << bwIntPillarDPhi;
130 for (
unsigned int i = 0;
i < bwIntPillarZ.size();
i++) {
131 if (bwIntPillarPhi[
i] > 0.) {
132 edm::LogVerbatim(
"TIBGeom") <<
" at positions [z, phi] " << bwIntPillarZ[
i] <<
" " << bwIntPillarPhi[
i];
135 edm::LogVerbatim(
"TIBGeom") <<
"FW External Pillar [Dz, DPhi] " << fwExtPillarDz <<
", " << fwExtPillarDPhi;
136 for (
unsigned int i = 0;
i < fwExtPillarZ.size();
i++) {
137 if (fwExtPillarPhi[
i] > 0.) {
138 edm::LogVerbatim(
"TIBGeom") <<
" at positions [z, phi] " << fwExtPillarZ[
i] <<
" " << fwExtPillarPhi[
i];
141 edm::LogVerbatim(
"TIBGeom") <<
"BW External Pillar [Dz, DPhi] " << bwExtPillarDz <<
", " << bwExtPillarDPhi;
142 for (
unsigned int i = 0;
i < bwExtPillarZ.size();
i++) {
143 if (bwExtPillarPhi[
i] > 0.) {
144 edm::LogVerbatim(
"TIBGeom") <<
" at positions [z, phi] " << bwExtPillarZ[
i] <<
" " << bwExtPillarPhi[
i];
148 const string&
idName = mother;
149 double rmin = MFRingInR;
150 double rmax = MFRingOutR;
151 Solid solid = ns.addSolidNS(ns.prepend(
idName), Tube(rmin, rmax, 0.5 * layerL));
153 <<
" with Rin " << rmin <<
" Rout " << rmax <<
" ZHalf " << 0.5 * layerL;
157 double rin = rmin + MFRingT;
159 double rout = cylinderInR;
161 solid = ns.addSolidNS(ns.prepend(
name), Tube(rin, rout, 0.5 * layerL));
163 <<
" with Rin " << rin <<
" Rout " << rout <<
" ZHalf " << 0.5 * layerL;
164 Volume layerIn = ns.addVolumeNS(
Volume(ns.prepend(
name), solid, ns.material(genMat)));
165 pv =
layer.placeVolume(layerIn, 1);
168 double rposdet = radiusLo;
169 double dphi = 2_pi / stringsLo;
170 Volume detIn = ns.volume(detectorLo);
171 for (
int n = 0;
n < stringsLo;
n++) {
172 double phi = (
n + 0.5) * dphi;
173 double phix =
phi - detectorTilt + 90_deg;
174 double theta = 90_deg;
175 double phiy = phix + 90._deg;
178 pv = layerIn.placeVolume(detIn,
n + 1, Transform3D(
rotation, trdet));
182 rin = cylinderInR + cylinderT;
183 rout = rmax - MFRingT;
185 solid = ns.addSolidNS(ns.prepend(
name), Tube(rin, rout, 0.5 * layerL));
187 <<
" with Rin " << rin <<
" Rout " << rout <<
" ZHalf " << 0.5 * layerL;
188 Volume layerOut = ns.addVolumeNS(
Volume(ns.prepend(
name), solid, ns.material(genMat)));
189 pv =
layer.placeVolume(layerOut, 1);
193 dphi = 2_pi / stringsUp;
194 Volume detOut = ns.volume(detectorUp);
195 for (
int n = 0;
n < stringsUp;
n++) {
196 double phi = (
n + 0.5) * dphi;
197 double phix =
phi - detectorTilt - 90_deg;
198 double theta = 90_deg;
199 double phiy = phix + 90._deg;
202 pv = layerOut.placeVolume(detOut,
n + 1, Transform3D(
rotation, trdet));
211 rout = cylinderInR + cylinderT;
213 solid = ns.addSolidNS(ns.prepend(
name), Tube(rin, rout, 0.5 * layerL));
214 edm::LogVerbatim(
"TIBGeom") << solid.name() <<
" Tubs made of " << cylinderMat <<
" from 0 to " 215 <<
convertRadToDeg(2_pi) <<
" with Rin " << rin <<
" Rout " << rout <<
" ZHalf " 217 Volume cylinder = ns.addVolumeNS(
Volume(ns.prepend(
name), solid, ns.material(cylinderMat)));
218 pv =
layer.placeVolume(cylinder, 1);
227 solid = ns.addSolidNS(ns.prepend(
name), Tube(rin, rout, 0.5 * layerL));
229 <<
" with Rin " << rin <<
" Rout " << rout <<
" ZHalf " << 0.5 * layerL;
230 Volume cylinderIn = ns.addVolumeNS(
Volume(ns.prepend(
name), solid, ns.material(genMat)));
231 pv = cylinder.placeVolume(cylinderIn, 1);
238 solid = ns.addSolidNS(ns.prepend(
name), Tube(rin, rout, fillerDz));
239 edm::LogVerbatim(
"TIBGeom") << solid.name() <<
" Tubs made of " << fillerMat <<
" from " << 0. <<
" to " 240 <<
convertRadToDeg(2_pi) <<
" with Rin " << rin <<
" Rout " << rout <<
" ZHalf " 242 Volume cylinderFiller = ns.addVolumeNS(
Volume(ns.prepend(
name), solid, ns.material(fillerMat)));
243 pv = cylinderIn.placeVolume(cylinderFiller, 1,
Position(0.0, 0.0, 0.5 * layerL - fillerDz));
246 pv = cylinderIn.placeVolume(cylinderFiller, 2,
Position(0.0, 0.0, -0.5 * layerL + fillerDz));
252 Material matrib = ns.material(ribMat);
253 for (
size_t i = 0;
i < ribW.size();
i++) {
255 double width = 2. * ribW[
i] / (rin + rout);
256 double dz = 0.5 * layerL - 2. * fillerDz;
257 double _rmi =
std::min(rin + 0.5 * dd4hep::mm, rout - 0.5 * dd4hep::mm);
258 double _rma =
std::max(rin + 0.5 * dd4hep::mm, rout - 0.5 * dd4hep::mm);
259 solid = ns.addSolidNS(ns.prepend(
name), Tube(_rmi, _rma,
dz, -0.5 *
width, 0.5 *
width));
260 edm::LogVerbatim(
"TIBGeom") << solid.name() <<
" Tubs made of " << ribMat <<
" from " 262 <<
" with Rin " << rin + 0.5 * dd4hep::mm <<
" Rout " << rout - 0.5 * dd4hep::mm
264 Volume cylinderRib = ns.addVolumeNS(
Volume(ns.prepend(
name), solid, matrib));
265 double phix = ribPhi[
i];
266 double theta = 90_deg;
267 double phiy = phix + 90._deg;
270 pv = cylinderIn.placeVolume(cylinderRib, 1, Transform3D(
rotation, tran));
279 rout = rin + MFRingT;
281 solid = ns.addSolidNS(ns.prepend(
name), Tube(rin, rout, MFRingDz));
282 edm::LogVerbatim(
"TIBGeom") << solid.name() <<
" Tubs made of " << MFIntRingMat <<
" from 0 to " 283 <<
convertRadToDeg(2_pi) <<
" with Rin " << rin <<
" Rout " << rout <<
" ZHalf " 286 Volume inmfr = ns.addVolumeNS(
Volume(ns.prepend(
name), solid, ns.material(MFIntRingMat)));
288 pv =
layer.placeVolume(inmfr, 1,
Position(0.0, 0.0, -0.5 * layerL + MFRingDz));
291 pv =
layer.placeVolume(inmfr, 2,
Position(0.0, 0.0, +0.5 * layerL - MFRingDz));
296 rin = rout - MFRingT;
298 solid = ns.addSolidNS(ns.prepend(
name), Tube(rin, rout, MFRingDz));
299 edm::LogVerbatim(
"TIBGeom") << solid.name() <<
" Tubs made of " << MFExtRingMat <<
" from 0 to " 300 <<
convertRadToDeg(2_pi) <<
" with Rin " << rin <<
" Rout " << rout <<
" ZHalf " 303 Volume outmfr = ns.addVolumeNS(
Volume(ns.prepend(
name), solid, ns.material(MFExtRingMat)));
304 pv =
layer.placeVolume(outmfr, 1,
Position(0.0, 0.0, -0.5 * layerL + MFRingDz));
306 pv =
layer.placeVolume(outmfr, 2,
Position(0.0, 0.0, +0.5 * layerL - MFRingDz));
313 double centZ = centRing1par[0];
314 double centDz = 0.5 * centRing1par[1];
315 rin = centRing1par[2];
316 rout = centRing1par[3];
318 solid = ns.addSolidNS(ns.prepend(
name), Tube(rin, rout, centDz));
321 <<
" with Rin " << rin <<
" Rout " << rout <<
" ZHalf " << centDz;
323 Volume cent1 = ns.addVolumeNS(
Volume(ns.prepend(
name), solid, ns.material(centMat)));
327 centZ = centRing2par[0];
328 centDz = 0.5 * centRing2par[1];
329 rin = centRing2par[2];
330 rout = centRing2par[3];
332 solid = ns.addSolidNS(ns.prepend(
name), Tube(rin, rout, centDz));
334 <<
" with Rin " << rin <<
" Rout " << rout <<
" ZHalf " << centDz;
336 Volume cent2 = ns.addVolumeNS(
Volume(ns.prepend(
name), solid, ns.material(centMat)));
346 double dohmCarrierRin = MFRingOutR - MFRingT;
347 double dohmCarrierRout = MFRingOutR;
348 double dohmCarrierDz = 0.5 * (dohmPrimL + dohmtoMF);
349 double dohmCarrierZ = 0.5 * layerL - 2. * MFRingDz - dohmCarrierDz;
351 solid = ns.addSolidNS(
353 Tube(dohmCarrierRin, dohmCarrierRout, dohmCarrierDz, dohmCarrierPhiOff, 180._deg - dohmCarrierPhiOff));
354 edm::LogVerbatim(
"TIBGeom") << solid.name() <<
" Tubs made of " << dohmCarrierMaterial <<
" from " 355 << dohmCarrierPhiOff <<
" to " << 180._deg - dohmCarrierPhiOff <<
" with Rin " 356 << dohmCarrierRin <<
" Rout " << MFRingOutR <<
" ZHalf " << dohmCarrierDz;
360 dphi = 2_pi / stringsUp;
362 Rotation3D dohmRotation;
363 double dohmR = 0.5 * (dohmCarrierRin + dohmCarrierRout);
365 for (
int j = 0;
j < 4;
j++) {
366 vector<double> dohmList;
370 int dohmCarrierReplica = 0;
378 dohmCarrier = ns.addVolumeNS(
Volume(ns.prepend(
name), solid, ns.material(dohmCarrierMaterial)));
379 dohmList = dohmListFW;
380 tran =
Position(0., 0., dohmCarrierZ);
383 dohmCarrierReplica = 1;
388 dohmCarrier = ns.volume(
name);
389 dohmList = dohmListFW;
390 tran =
Position(0., 0., dohmCarrierZ);
391 rotstr =
idName +
"FwDown";
393 dohmCarrierReplica = 2;
398 dohmCarrier = ns.addVolumeNS(
Volume(ns.prepend(
name), solid, ns.material(dohmCarrierMaterial)));
399 dohmList = dohmListBW;
400 tran =
Position(0., 0., -dohmCarrierZ);
403 dohmCarrierReplica = 1;
408 dohmCarrier = ns.volume(
name);
409 dohmList = dohmListBW;
410 tran =
Position(0., 0., -dohmCarrierZ);
411 rotstr =
idName +
"BwDown";
413 dohmCarrierReplica = 2;
421 for (
size_t i = 0;
i < placeDohm * dohmList.size();
i++) {
423 double phix =
phi + 90_deg;
426 double theta = 90_deg;
427 double phiy = phix + 90._deg;
434 if (dohmList[
i] < 0.) {
436 dohm = ns.volume(dohmAuxName);
437 dohmZ = dohmCarrierDz - 0.5 * dohmAuxL - dohmtoMF;
439 dohmReplica = primReplica;
442 dohm = ns.volume(dohmPrimName);
443 dohmZ = dohmCarrierDz - 0.5 * dohmPrimL - dohmtoMF;
445 dohmReplica = auxReplica;
448 pv = dohmCarrier.placeVolume(dohm, dohmReplica, Transform3D(dohmRotation, dohmTrasl));
452 pv =
layer.placeVolume(dohmCarrier, dohmCarrierReplica, Transform3D(
rotation, tran));
457 for (
int j = 0;
j < 4;
j++) {
458 vector<double> pillarZ;
459 vector<double> pillarPhi;
460 double pillarDz = 0, pillarDPhi = 0, pillarRin = 0, pillarRout = 0;
465 pillarZ = fwIntPillarZ;
466 pillarPhi = fwIntPillarPhi;
467 pillarRin = MFRingInR;
468 pillarRout = MFRingInR + MFRingT;
469 pillarDz = fwIntPillarDz;
470 pillarDPhi = fwIntPillarDPhi;
474 pillarZ = bwIntPillarZ;
475 pillarPhi = bwIntPillarPhi;
476 pillarRin = MFRingInR;
477 pillarRout = MFRingInR + MFRingT;
478 pillarDz = bwIntPillarDz;
479 pillarDPhi = bwIntPillarDPhi;
483 pillarZ = fwExtPillarZ;
484 pillarPhi = fwExtPillarPhi;
485 pillarRin = MFRingOutR - MFRingT;
486 pillarRout = MFRingOutR;
487 pillarDz = fwExtPillarDz;
488 pillarDPhi = fwExtPillarDPhi;
492 pillarZ = bwExtPillarZ;
493 pillarPhi = bwExtPillarPhi;
494 pillarRin = MFRingOutR - MFRingT;
495 pillarRout = MFRingOutR;
496 pillarDz = bwExtPillarDz;
497 pillarDPhi = bwExtPillarDPhi;
501 solid = ns.addSolidNS(ns.prepend(
name), Tube(pillarRin, pillarRout, pillarDz, -pillarDPhi, pillarDPhi));
502 Volume Pillar = ns.addVolumeNS(
Volume(ns.prepend(
name), solid, ns.material(pillarMaterial)));
503 edm::LogVerbatim(
"TIBGeom") << solid.name() <<
" Tubs made of " << pillarMaterial <<
" from " << -pillarDPhi
504 <<
" to " << pillarDPhi <<
" with Rin " << pillarRin <<
" Rout " << pillarRout
505 <<
" ZHalf " << pillarDz;
507 Rotation3D pillarRota;
508 for (
unsigned int i = 0;
i < pillarZ.size();
i++) {
509 if (pillarPhi[
i] > 0.) {
510 pillarTran =
Position(0., 0., pillarZ[
i]);
511 pillarRota =
makeRotation3D(90._deg, pillarPhi[
i], 90._deg, 90._deg + pillarPhi[
i], 0., 0.);
512 pv =
layer.placeVolume(Pillar,
i, Transform3D(pillarRota, pillarTran));
Log< level::Info, true > LogVerbatim
constexpr NumType convertRadToDeg(NumType radians)
Sin< T >::type sin(const T &t)
DDRotationMatrix makeRotation3D(double thetaX, double phiX, double thetaY, double phiY, double thetaZ, double phiZ)
static std::string to_string(const XMLCh *ch)
dd4hep::PlacedVolume PlacedVolume
Cos< T >::type cos(const T &t)
Abs< T >::type abs(const T &t)
Geom::Theta< T > theta() const
vector< double > VecDouble