20 string mother =
args.parentName();
21 string genMat =
args.str(
"GeneralMaterial");
22 double detectorTilt =
args.dble(
"DetectorTilt");
23 double layerL =
args.dble(
"LayerL");
25 double radiusLo =
args.dble(
"RadiusLo");
26 int stringsLo =
args.integer(
"StringsLo");
27 string detectorLo =
args.str(
"StringDetLoName");
29 double radiusUp =
args.dble(
"RadiusUp");
30 int stringsUp =
args.integer(
"StringsUp");
31 string detectorUp =
args.str(
"StringDetUpName");
33 double cylinderT =
args.dble(
"CylinderThickness");
34 double cylinderInR =
args.dble(
"CylinderInnerRadius");
35 string cylinderMat =
args.str(
"CylinderMaterial");
36 double MFRingInR =
args.dble(
"MFRingInnerRadius");
37 double MFRingOutR =
args.dble(
"MFRingOuterRadius");
38 double MFRingT =
args.dble(
"MFRingThickness");
39 double MFRingDz =
args.dble(
"MFRingDeltaz");
40 string MFIntRingMat =
args.str(
"MFIntRingMaterial");
41 string MFExtRingMat =
args.str(
"MFExtRingMaterial");
43 double supportT =
args.dble(
"SupportThickness");
45 string centMat =
args.str(
"CentRingMaterial");
49 string fillerMat =
args.str(
"FillerMaterial");
50 double fillerDz =
args.dble(
"FillerDeltaz");
52 string ribMat =
args.str(
"RibMaterial");
59 double dohmtoMF =
args.dble(
"DOHMtoMFDist");
60 double dohmCarrierPhiOff =
args.dble(
"DOHMCarrierPhiOffset");
61 string dohmPrimName =
args.str(
"StringDOHMPrimName");
62 string dohmAuxName =
args.str(
"StringDOHMAuxName");
64 string dohmCarrierMaterial =
args.str(
"DOHMCarrierMaterial");
65 string dohmCableMaterial =
args.str(
"DOHMCableMaterial");
66 double dohmPrimL =
args.dble(
"DOHMPRIMLength");
67 string dohmPrimMaterial =
args.str(
"DOHMPRIMMaterial");
68 double dohmAuxL =
args.dble(
"DOHMAUXLength");
69 string dohmAuxMaterial =
args.str(
"DOHMAUXMaterial");
71 string pillarMaterial =
args.str(
"PillarMaterial");
73 double fwIntPillarDz =
args.dble(
"FWIntPillarDz");
74 double fwIntPillarDPhi =
args.dble(
"FWIntPillarDPhi");
77 double bwIntPillarDz =
args.dble(
"BWIntPillarDz");
78 double bwIntPillarDPhi =
args.dble(
"BWIntPillarDPhi");
82 double fwExtPillarDz =
args.dble(
"FWExtPillarDz");
83 double fwExtPillarDPhi =
args.dble(
"FWExtPillarDPhi");
86 double bwExtPillarDz =
args.dble(
"BWExtPillarDz");
87 double bwExtPillarDPhi =
args.dble(
"BWExtPillarDPhi");
95 <<
" positioned: " << pvl.motherVol()->GetName() <<
" " << pvl.position();
98 LogDebug(
"TIBGeom") <<
"Parent " << mother <<
" NameSpace " << ns.name() <<
" General Material " << genMat;
99 LogDebug(
"TIBGeom") <<
"Lower layer Radius " << radiusLo <<
" Number " << stringsLo <<
" String " << detectorLo;
100 LogDebug(
"TIBGeom") <<
"Upper layer Radius " << radiusUp <<
" Number " << stringsUp <<
" String " << detectorUp;
101 LogDebug(
"TIBGeom") <<
"Cylinder Material/thickness " << cylinderMat <<
" " << cylinderT <<
" Rib Material " << ribMat
102 <<
" at " << ribW.size() <<
" positions with width/phi";
103 for (
unsigned int i = 0;
i < ribW.size();
i++) {
104 LogDebug(
"TIBGeom") <<
"\tribW[" <<
i <<
"] = " << ribW[
i] <<
"\tribPhi[" <<
i
107 LogDebug(
"TIBGeom") <<
"DOHM Primary "
108 <<
" Material " << dohmPrimMaterial <<
" Length " << dohmPrimL;
110 <<
" Material " << dohmAuxMaterial <<
" Length " << dohmAuxL;
111 for (
double i : dohmListFW) {
113 LogDebug(
"TIBGeom") <<
"DOHM Primary at FW Position " <<
i;
115 LogDebug(
"TIBGeom") <<
"DOHM Aux at FW Position " << -
i;
117 for (
double i : dohmListBW) {
119 LogDebug(
"TIBGeom") <<
"DOHM Primary at BW Position " <<
i;
121 LogDebug(
"TIBGeom") <<
"DOHM Aux at BW Position " << -
i;
123 LogDebug(
"TIBGeom") <<
"FW Internal Pillar [Dz, DPhi] " << fwIntPillarDz <<
", " << fwIntPillarDPhi;
124 for (
unsigned int i = 0;
i < fwIntPillarZ.size();
i++) {
125 if (fwIntPillarPhi[
i] > 0.) {
126 LogDebug(
"TIBGeom") <<
" at positions [z, phi] " << fwIntPillarZ[
i] <<
" " << fwIntPillarPhi[
i];
129 LogDebug(
"TIBGeom") <<
"BW Internal Pillar [Dz, DPhi] " << bwIntPillarDz <<
", " << bwIntPillarDPhi;
130 for (
unsigned int i = 0;
i < bwIntPillarZ.size();
i++) {
131 if (bwIntPillarPhi[
i] > 0.) {
132 LogDebug(
"TIBGeom") <<
" at positions [z, phi] " << bwIntPillarZ[
i] <<
" " << bwIntPillarPhi[
i];
135 LogDebug(
"TIBGeom") <<
"FW External Pillar [Dz, DPhi] " << fwExtPillarDz <<
", " << fwExtPillarDPhi;
136 for (
unsigned int i = 0;
i < fwExtPillarZ.size();
i++) {
137 if (fwExtPillarPhi[
i] > 0.) {
138 LogDebug(
"TIBGeom") <<
" at positions [z, phi] " << fwExtPillarZ[
i] <<
" " << fwExtPillarPhi[
i];
141 LogDebug(
"TIBGeom") <<
"BW External Pillar [Dz, DPhi] " << bwExtPillarDz <<
", " << bwExtPillarDPhi;
142 for (
unsigned int i = 0;
i < bwExtPillarZ.size();
i++) {
143 if (bwExtPillarPhi[
i] > 0.) {
144 LogDebug(
"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(
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(
name, Tube(rin, rout, 0.5 * layerL));
163 <<
" with Rin " << rin <<
" Rout " << rout <<
" ZHalf " << 0.5 * layerL;
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(
name, Tube(rin, rout, 0.5 * layerL));
187 <<
" with Rin " << rin <<
" Rout " << rout <<
" ZHalf " << 0.5 * layerL;
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(
name, Tube(rin, rout, 0.5 * layerL));
214 LogDebug(
"TIBGeom") << solid.name() <<
" Tubs made of " << cylinderMat <<
" from 0 to " <<
convertRadToDeg(2_pi)
215 <<
" with Rin " << rin <<
" Rout " << rout <<
" ZHalf " << 0.5 * layerL;
216 Volume cylinder = ns.addVolumeNS(
Volume(
name, solid, ns.material(cylinderMat)));
217 pv = layer.placeVolume(cylinder, 1);
226 solid = ns.addSolidNS(
name, Tube(rin, rout, 0.5 * layerL));
228 <<
" with Rin " << rin <<
" Rout " << rout <<
" ZHalf " << 0.5 * layerL;
229 Volume cylinderIn = ns.addVolumeNS(
Volume(
name, solid, ns.material(genMat)));
230 pv = cylinder.placeVolume(cylinderIn, 1);
237 solid = ns.addSolidNS(
name, Tube(rin, rout, fillerDz));
238 LogDebug(
"TIBGeom") << solid.name() <<
" Tubs made of " << fillerMat <<
" from " << 0. <<
" to "
239 <<
convertRadToDeg(2_pi) <<
" with Rin " << rin <<
" Rout " << rout <<
" ZHalf " << fillerDz;
240 Volume cylinderFiller = ns.addVolumeNS(
Volume(
name, solid, ns.material(fillerMat)));
241 pv = cylinderIn.placeVolume(cylinderFiller, 1,
Position(0.0, 0.0, 0.5 * layerL - fillerDz));
244 pv = cylinderIn.placeVolume(cylinderFiller, 2,
Position(0.0, 0.0, -0.5 * layerL + fillerDz));
250 Material matrib = ns.material(ribMat);
251 for (
size_t i = 0;
i < ribW.size();
i++) {
253 double width = 2. * ribW[
i] / (rin + rout);
254 double dz = 0.5 * layerL - 2. * fillerDz;
255 double _rmi =
std::min(rin + 0.5_mm, rout - 0.5_mm);
256 double _rma =
std::max(rin + 0.5_mm, rout - 0.5_mm);
260 << rout - 0.5_mm <<
" ZHalf " <<
dz;
262 double phix = ribPhi[
i];
263 double theta = 90_deg;
264 double phiy = phix + 90._deg;
267 pv = cylinderIn.placeVolume(cylinderRib, 1, Transform3D(
rotation, tran));
276 rout = rin + MFRingT;
278 solid = ns.addSolidNS(
name, Tube(rin, rout, MFRingDz));
279 LogDebug(
"TIBGeom") << solid.name() <<
" Tubs made of " << MFIntRingMat <<
" from 0 to " <<
convertRadToDeg(2_pi)
280 <<
" with Rin " << rin <<
" Rout " << rout <<
" ZHalf " << MFRingDz;
282 Volume inmfr = ns.addVolumeNS(
Volume(
name, solid, ns.material(MFIntRingMat)));
284 pv = layer.placeVolume(inmfr, 1,
Position(0.0, 0.0, -0.5 * layerL + MFRingDz));
287 pv = layer.placeVolume(inmfr, 2,
Position(0.0, 0.0, +0.5 * layerL - MFRingDz));
292 rin = rout - MFRingT;
294 solid = ns.addSolidNS(
name, Tube(rin, rout, MFRingDz));
295 LogDebug(
"TIBGeom") << solid.name() <<
" Tubs made of " << MFExtRingMat <<
" from 0 to " <<
convertRadToDeg(2_pi)
296 <<
" with Rin " << rin <<
" Rout " << rout <<
" ZHalf " << MFRingDz;
298 Volume outmfr = ns.addVolumeNS(
Volume(
name, solid, ns.material(MFExtRingMat)));
299 pv = layer.placeVolume(outmfr, 1,
Position(0.0, 0.0, -0.5 * layerL + MFRingDz));
301 pv = layer.placeVolume(outmfr, 2,
Position(0.0, 0.0, +0.5 * layerL - MFRingDz));
308 double centZ = centRing1par[0];
309 double centDz = 0.5 * centRing1par[1];
310 rin = centRing1par[2];
311 rout = centRing1par[3];
313 solid = ns.addSolidNS(
name, Tube(rin, rout, centDz));
316 <<
" with Rin " << rin <<
" Rout " << rout <<
" ZHalf " << centDz;
319 pv = layer.placeVolume(cent1, 1,
Position(0.0, 0.0, centZ));
322 centZ = centRing2par[0];
323 centDz = 0.5 * centRing2par[1];
324 rin = centRing2par[2];
325 rout = centRing2par[3];
327 solid = ns.addSolidNS(
name, Tube(rin, rout, centDz));
329 <<
" with Rin " << rin <<
" Rout " << rout <<
" ZHalf " << centDz;
332 pv = layer.placeVolume(cent2, 1,
Position(0e0, 0e0, centZ));
341 double dohmCarrierRin = MFRingOutR - MFRingT;
342 double dohmCarrierRout = MFRingOutR;
343 double dohmCarrierDz = 0.5 * (dohmPrimL + dohmtoMF);
344 double dohmCarrierZ = 0.5 * layerL - 2. * MFRingDz - dohmCarrierDz;
346 solid = ns.addSolidNS(
347 name, Tube(dohmCarrierRin, dohmCarrierRout, dohmCarrierDz, dohmCarrierPhiOff, 180._deg - dohmCarrierPhiOff));
348 LogDebug(
"TIBGeom") << solid.name() <<
" Tubs made of " << dohmCarrierMaterial <<
" from " << dohmCarrierPhiOff
349 <<
" to " << 180._deg - dohmCarrierPhiOff <<
" with Rin " << dohmCarrierRin <<
" Rout "
350 << MFRingOutR <<
" ZHalf " << dohmCarrierDz;
354 dphi = 2_pi / stringsUp;
356 Rotation3D dohmRotation;
357 double dohmR = 0.5 * (dohmCarrierRin + dohmCarrierRout);
359 for (
int j = 0;
j < 4;
j++) {
360 vector<double> dohmList;
364 int dohmCarrierReplica = 0;
370 dohmList = dohmListFW;
371 tran =
Position(0., 0., dohmCarrierZ);
374 dohmCarrierReplica = 1;
379 dohmList = dohmListFW;
380 tran =
Position(0., 0., dohmCarrierZ);
381 rotstr =
idName +
"FwDown";
383 dohmCarrierReplica = 2;
388 dohmList = dohmListBW;
389 tran =
Position(0., 0., -dohmCarrierZ);
392 dohmCarrierReplica = 1;
397 dohmList = dohmListBW;
398 tran =
Position(0., 0., -dohmCarrierZ);
399 rotstr =
idName +
"BwDown";
401 dohmCarrierReplica = 2;
406 Volume dohmCarrier = ns.addVolumeNS(
Volume(
name, solid, ns.material(dohmCarrierMaterial)));
410 for (
size_t i = 0;
i < placeDohm * dohmList.size();
i++) {
412 double phix =
phi + 90_deg;
415 double theta = 90_deg;
416 double phiy = phix + 90._deg;
423 if (dohmList[
i] < 0.) {
425 dohm = ns.volume(dohmAuxName);
426 dohmZ = dohmCarrierDz - 0.5 * dohmAuxL - dohmtoMF;
428 dohmReplica = primReplica;
431 dohm = ns.volume(dohmPrimName);
432 dohmZ = dohmCarrierDz - 0.5 * dohmPrimL - dohmtoMF;
434 dohmReplica = auxReplica;
437 pv = dohmCarrier.placeVolume(dohm, dohmReplica, Transform3D(dohmRotation, dohmTrasl));
441 pv = layer.placeVolume(dohmCarrier, dohmCarrierReplica, Transform3D(
rotation, tran));
446 for (
int j = 0;
j < 4;
j++) {
447 vector<double> pillarZ;
448 vector<double> pillarPhi;
449 double pillarDz = 0, pillarDPhi = 0, pillarRin = 0, pillarRout = 0;
454 pillarZ = fwIntPillarZ;
455 pillarPhi = fwIntPillarPhi;
456 pillarRin = MFRingInR;
457 pillarRout = MFRingInR + MFRingT;
458 pillarDz = fwIntPillarDz;
459 pillarDPhi = fwIntPillarDPhi;
463 pillarZ = bwIntPillarZ;
464 pillarPhi = bwIntPillarPhi;
465 pillarRin = MFRingInR;
466 pillarRout = MFRingInR + MFRingT;
467 pillarDz = bwIntPillarDz;
468 pillarDPhi = bwIntPillarDPhi;
472 pillarZ = fwExtPillarZ;
473 pillarPhi = fwExtPillarPhi;
474 pillarRin = MFRingOutR - MFRingT;
475 pillarRout = MFRingOutR;
476 pillarDz = fwExtPillarDz;
477 pillarDPhi = fwExtPillarDPhi;
481 pillarZ = bwExtPillarZ;
482 pillarPhi = bwExtPillarPhi;
483 pillarRin = MFRingOutR - MFRingT;
484 pillarRout = MFRingOutR;
485 pillarDz = bwExtPillarDz;
486 pillarDPhi = bwExtPillarDPhi;
490 solid = ns.addSolidNS(
name, Tube(pillarRin, pillarRout, pillarDz, -pillarDPhi, 2. * pillarDPhi));
491 Volume Pillar = ns.addVolumeNS(
Volume(
name, solid, ns.material(pillarMaterial)));
492 LogDebug(
"TIBGeom") << solid.name() <<
" Tubs made of " << pillarMaterial <<
" from " << -pillarDPhi <<
" to "
493 << pillarDPhi <<
" with Rin " << pillarRin <<
" Rout " << pillarRout <<
" ZHalf " << pillarDz;
495 Rotation3D pillarRota;
496 int pillarReplica = 0;
497 for (
unsigned int i = 0;
i < pillarZ.size();
i++) {
498 if (pillarPhi[
i] > 0.) {
499 pillarTran =
Position(0., 0., pillarZ[
i]);
500 pillarRota =
makeRotation3D(90._deg, pillarPhi[
i], 90._deg, 90._deg + pillarPhi[
i], 0., 0.);
501 pv = layer.placeVolume(Pillar,
i, Transform3D(pillarRota, pillarTran));