17 string mother =
args.parentName();
18 string genMat =
args.str(
"GeneralMaterial");
19 double detectorTilt =
args.dble(
"DetectorTilt");
20 double layerL =
args.dble(
"LayerL");
22 double radiusLo =
args.dble(
"RadiusLo");
23 int stringsLo =
args.integer(
"StringsLo");
24 string detectorLo =
args.str(
"StringDetLoName");
26 double radiusUp =
args.dble(
"RadiusUp");
27 int stringsUp =
args.integer(
"StringsUp");
28 string detectorUp =
args.str(
"StringDetUpName");
30 double cylinderT =
args.dble(
"CylinderThickness");
31 double cylinderInR =
args.dble(
"CylinderInnerRadius");
32 string cylinderMat =
args.str(
"CylinderMaterial");
33 double MFRingInR =
args.dble(
"MFRingInnerRadius");
34 double MFRingOutR =
args.dble(
"MFRingOuterRadius");
35 double MFRingT =
args.dble(
"MFRingThickness");
36 double MFRingDz =
args.dble(
"MFRingDeltaz");
37 string MFIntRingMat =
args.str(
"MFIntRingMaterial");
38 string MFExtRingMat =
args.str(
"MFExtRingMaterial");
40 double supportT =
args.dble(
"SupportThickness");
42 string centMat =
args.str(
"CentRingMaterial");
46 string fillerMat =
args.str(
"FillerMaterial");
47 double fillerDz =
args.dble(
"FillerDeltaz");
49 string ribMat =
args.str(
"RibMaterial");
56 double dohmtoMF =
args.dble(
"DOHMtoMFDist");
57 double dohmCarrierPhiOff =
args.dble(
"DOHMCarrierPhiOffset");
58 string dohmPrimName =
args.str(
"StringDOHMPrimName");
59 string dohmAuxName =
args.str(
"StringDOHMAuxName");
61 string dohmCarrierMaterial =
args.str(
"DOHMCarrierMaterial");
62 string dohmCableMaterial =
args.str(
"DOHMCableMaterial");
63 double dohmPrimL =
args.dble(
"DOHMPRIMLength");
64 string dohmPrimMaterial =
args.str(
"DOHMPRIMMaterial");
65 double dohmAuxL =
args.dble(
"DOHMAUXLength");
66 string dohmAuxMaterial =
args.str(
"DOHMAUXMaterial");
68 string pillarMaterial =
args.str(
"PillarMaterial");
70 double fwIntPillarDz =
args.dble(
"FWIntPillarDz");
71 double fwIntPillarDPhi =
args.dble(
"FWIntPillarDPhi");
74 double bwIntPillarDz =
args.dble(
"BWIntPillarDz");
75 double bwIntPillarDPhi =
args.dble(
"BWIntPillarDPhi");
79 double fwExtPillarDz =
args.dble(
"FWExtPillarDz");
80 double fwExtPillarDPhi =
args.dble(
"FWExtPillarDPhi");
83 double bwExtPillarDz =
args.dble(
"BWExtPillarDz");
84 double bwExtPillarDPhi =
args.dble(
"BWExtPillarDPhi");
92 <<
" positioned: " << pvl.motherVol()->GetName() <<
" " << pvl.position();
95 LogDebug(
"TIBGeom") <<
"Parent " << mother <<
" NameSpace " << ns.name() <<
" General Material " << genMat;
96 LogDebug(
"TIBGeom") <<
"Lower layer Radius " << radiusLo <<
" Number " << stringsLo <<
" String " << detectorLo;
97 LogDebug(
"TIBGeom") <<
"Upper layer Radius " << radiusUp <<
" Number " << stringsUp <<
" String " << detectorUp;
98 LogDebug(
"TIBGeom") <<
"Cylinder Material/thickness " << cylinderMat <<
" " << cylinderT <<
" Rib Material " << ribMat
99 <<
" at " << ribW.size() <<
" positions with width/phi";
100 for (
unsigned int i = 0;
i < ribW.size();
i++) {
101 LogDebug(
"TIBGeom") <<
"\tribW[" <<
i <<
"] = " << ribW[
i] <<
"\tribPhi[" <<
i
104 LogDebug(
"TIBGeom") <<
"DOHM Primary "
105 <<
" Material " << dohmPrimMaterial <<
" Length " << dohmPrimL;
107 <<
" Material " << dohmAuxMaterial <<
" Length " << dohmAuxL;
108 for (
double i : dohmListFW) {
110 LogDebug(
"TIBGeom") <<
"DOHM Primary at FW Position " <<
i;
112 LogDebug(
"TIBGeom") <<
"DOHM Aux at FW Position " << -
i;
114 for (
double i : dohmListBW) {
116 LogDebug(
"TIBGeom") <<
"DOHM Primary at BW Position " <<
i;
118 LogDebug(
"TIBGeom") <<
"DOHM Aux at BW Position " << -
i;
120 LogDebug(
"TIBGeom") <<
"FW Internal Pillar [Dz, DPhi] " << fwIntPillarDz <<
", " << fwIntPillarDPhi;
121 for (
unsigned int i = 0;
i < fwIntPillarZ.size();
i++) {
122 if (fwIntPillarPhi[
i] > 0.) {
123 LogDebug(
"TIBGeom") <<
" at positions [z, phi] " << fwIntPillarZ[
i] <<
" " << fwIntPillarPhi[
i];
126 LogDebug(
"TIBGeom") <<
"BW Internal Pillar [Dz, DPhi] " << bwIntPillarDz <<
", " << bwIntPillarDPhi;
127 for (
unsigned int i = 0;
i < bwIntPillarZ.size();
i++) {
128 if (bwIntPillarPhi[
i] > 0.) {
129 LogDebug(
"TIBGeom") <<
" at positions [z, phi] " << bwIntPillarZ[
i] <<
" " << bwIntPillarPhi[
i];
132 LogDebug(
"TIBGeom") <<
"FW External Pillar [Dz, DPhi] " << fwExtPillarDz <<
", " << fwExtPillarDPhi;
133 for (
unsigned int i = 0;
i < fwExtPillarZ.size();
i++) {
134 if (fwExtPillarPhi[
i] > 0.) {
135 LogDebug(
"TIBGeom") <<
" at positions [z, phi] " << fwExtPillarZ[
i] <<
" " << fwExtPillarPhi[
i];
138 LogDebug(
"TIBGeom") <<
"BW External Pillar [Dz, DPhi] " << bwExtPillarDz <<
", " << bwExtPillarDPhi;
139 for (
unsigned int i = 0;
i < bwExtPillarZ.size();
i++) {
140 if (bwExtPillarPhi[
i] > 0.) {
141 LogDebug(
"TIBGeom") <<
" at positions [z, phi] " << bwExtPillarZ[
i] <<
" " << bwExtPillarPhi[
i];
145 const string&
idName = mother;
146 double rmin = MFRingInR;
147 double rmax = MFRingOutR;
148 Solid solid = ns.addSolidNS(
idName, Tube(rmin, rmax, 0.5 * layerL));
150 <<
" with Rin " << rmin <<
" Rout " << rmax <<
" ZHalf " << 0.5 * layerL;
154 double rin = rmin + MFRingT;
156 double rout = cylinderInR;
158 solid = ns.addSolidNS(
name, Tube(rin, rout, 0.5 * layerL));
160 <<
" with Rin " << rin <<
" Rout " << rout <<
" ZHalf " << 0.5 * layerL;
162 pv = layer.placeVolume(layerIn, 1);
165 double rposdet = radiusLo;
166 double dphi = 2_pi / stringsLo;
167 Volume detIn = ns.volume(detectorLo);
168 for (
int n = 0;
n < stringsLo;
n++) {
169 double phi = (
n + 0.5) * dphi;
170 double phix =
phi - detectorTilt + 90_deg;
171 double theta = 90_deg;
172 double phiy = phix + 90._deg;
175 pv = layerIn.placeVolume(detIn,
n + 1, Transform3D(
rotation, trdet));
179 rin = cylinderInR + cylinderT;
180 rout = rmax - MFRingT;
182 solid = ns.addSolidNS(
name, Tube(rin, rout, 0.5 * layerL));
184 <<
" with Rin " << rin <<
" Rout " << rout <<
" ZHalf " << 0.5 * layerL;
186 pv = layer.placeVolume(layerOut, 1);
190 dphi = 2_pi / stringsUp;
191 Volume detOut = ns.volume(detectorUp);
192 for (
int n = 0;
n < stringsUp;
n++) {
193 double phi = (
n + 0.5) * dphi;
194 double phix =
phi - detectorTilt - 90_deg;
195 double theta = 90_deg;
196 double phiy = phix + 90._deg;
199 pv = layerOut.placeVolume(detOut,
n + 1, Transform3D(
rotation, trdet));
208 rout = cylinderInR + cylinderT;
210 solid = ns.addSolidNS(
name, Tube(rin, rout, 0.5 * layerL));
211 LogDebug(
"TIBGeom") << solid.name() <<
" Tubs made of " << cylinderMat <<
" from 0 to " <<
convertRadToDeg(2_pi)
212 <<
" with Rin " << rin <<
" Rout " << rout <<
" ZHalf " << 0.5 * layerL;
213 Volume cylinder = ns.addVolumeNS(
Volume(
name, solid, ns.material(cylinderMat)));
214 pv = layer.placeVolume(cylinder, 1);
223 solid = ns.addSolidNS(
name, Tube(rin, rout, 0.5 * layerL));
225 <<
" with Rin " << rin <<
" Rout " << rout <<
" ZHalf " << 0.5 * layerL;
226 Volume cylinderIn = ns.addVolumeNS(
Volume(
name, solid, ns.material(genMat)));
227 pv = cylinder.placeVolume(cylinderIn, 1);
234 solid = ns.addSolidNS(
name, Tube(rin, rout, fillerDz));
235 LogDebug(
"TIBGeom") << solid.name() <<
" Tubs made of " << fillerMat <<
" from " << 0. <<
" to "
236 <<
convertRadToDeg(2_pi) <<
" with Rin " << rin <<
" Rout " << rout <<
" ZHalf " << fillerDz;
237 Volume cylinderFiller = ns.addVolumeNS(
Volume(
name, solid, ns.material(fillerMat)));
238 pv = cylinderIn.placeVolume(cylinderFiller, 1,
Position(0.0, 0.0, 0.5 * layerL - fillerDz));
241 pv = cylinderIn.placeVolume(cylinderFiller, 2,
Position(0.0, 0.0, -0.5 * layerL + fillerDz));
247 Material matrib = ns.material(ribMat);
248 for (
size_t i = 0;
i < ribW.size();
i++) {
250 double width = 2. * ribW[
i] / (rin + rout);
251 double dz = 0.5 * layerL - 2. * fillerDz;
252 double _rmi =
std::min(rin + 0.5_mm, rout - 0.5_mm);
253 double _rma =
std::max(rin + 0.5_mm, rout - 0.5_mm);
257 << rout - 0.5_mm <<
" ZHalf " <<
dz;
259 double phix = ribPhi[
i];
260 double theta = 90_deg;
261 double phiy = phix + 90._deg;
264 pv = cylinderIn.placeVolume(cylinderRib, 1, Transform3D(
rotation, tran));
273 rout = rin + MFRingT;
275 solid = ns.addSolidNS(
name, Tube(rin, rout, MFRingDz));
276 LogDebug(
"TIBGeom") << solid.name() <<
" Tubs made of " << MFIntRingMat <<
" from 0 to " <<
convertRadToDeg(2_pi)
277 <<
" with Rin " << rin <<
" Rout " << rout <<
" ZHalf " << MFRingDz;
279 Volume inmfr = ns.addVolumeNS(
Volume(
name, solid, ns.material(MFIntRingMat)));
281 pv = layer.placeVolume(inmfr, 1,
Position(0.0, 0.0, -0.5 * layerL + MFRingDz));
284 pv = layer.placeVolume(inmfr, 2,
Position(0.0, 0.0, +0.5 * layerL - MFRingDz));
289 rin = rout - MFRingT;
291 solid = ns.addSolidNS(
name, Tube(rin, rout, MFRingDz));
292 LogDebug(
"TIBGeom") << solid.name() <<
" Tubs made of " << MFExtRingMat <<
" from 0 to " <<
convertRadToDeg(2_pi)
293 <<
" with Rin " << rin <<
" Rout " << rout <<
" ZHalf " << MFRingDz;
295 Volume outmfr = ns.addVolumeNS(
Volume(
name, solid, ns.material(MFExtRingMat)));
296 pv = layer.placeVolume(outmfr, 1,
Position(0.0, 0.0, -0.5 * layerL + MFRingDz));
298 pv = layer.placeVolume(outmfr, 2,
Position(0.0, 0.0, +0.5 * layerL - MFRingDz));
305 double centZ = centRing1par[0];
306 double centDz = 0.5 * centRing1par[1];
307 rin = centRing1par[2];
308 rout = centRing1par[3];
310 solid = ns.addSolidNS(
name, Tube(rin, rout, centDz));
313 <<
" with Rin " << rin <<
" Rout " << rout <<
" ZHalf " << centDz;
316 pv = layer.placeVolume(cent1, 1,
Position(0.0, 0.0, centZ));
319 centZ = centRing2par[0];
320 centDz = 0.5 * centRing2par[1];
321 rin = centRing2par[2];
322 rout = centRing2par[3];
324 solid = ns.addSolidNS(
name, Tube(rin, rout, centDz));
326 <<
" with Rin " << rin <<
" Rout " << rout <<
" ZHalf " << centDz;
329 pv = layer.placeVolume(cent2, 1,
Position(0e0, 0e0, centZ));
338 double dohmCarrierRin = MFRingOutR - MFRingT;
339 double dohmCarrierRout = MFRingOutR;
340 double dohmCarrierDz = 0.5 * (dohmPrimL + dohmtoMF);
341 double dohmCarrierZ = 0.5 * layerL - 2. * MFRingDz - dohmCarrierDz;
343 solid = ns.addSolidNS(
344 name, Tube(dohmCarrierRin, dohmCarrierRout, dohmCarrierDz, dohmCarrierPhiOff, 180._deg - dohmCarrierPhiOff));
345 LogDebug(
"TIBGeom") << solid.name() <<
" Tubs made of " << dohmCarrierMaterial <<
" from " << dohmCarrierPhiOff
346 <<
" to " << 180._deg - dohmCarrierPhiOff <<
" with Rin " << dohmCarrierRin <<
" Rout "
347 << MFRingOutR <<
" ZHalf " << dohmCarrierDz;
351 dphi = 2_pi / stringsUp;
353 Rotation3D dohmRotation;
354 double dohmR = 0.5 * (dohmCarrierRin + dohmCarrierRout);
356 for (
int j = 0;
j < 4;
j++) {
357 vector<double> dohmList;
361 int dohmCarrierReplica = 0;
367 dohmList = dohmListFW;
368 tran =
Position(0., 0., dohmCarrierZ);
371 dohmCarrierReplica = 1;
376 dohmList = dohmListFW;
377 tran =
Position(0., 0., dohmCarrierZ);
378 rotstr =
idName +
"FwDown";
380 dohmCarrierReplica = 2;
385 dohmList = dohmListBW;
386 tran =
Position(0., 0., -dohmCarrierZ);
389 dohmCarrierReplica = 1;
394 dohmList = dohmListBW;
395 tran =
Position(0., 0., -dohmCarrierZ);
396 rotstr =
idName +
"BwDown";
398 dohmCarrierReplica = 2;
403 Volume dohmCarrier = ns.addVolumeNS(
Volume(
name, solid, ns.material(dohmCarrierMaterial)));
407 for (
size_t i = 0;
i < placeDohm * dohmList.size();
i++) {
409 double phix =
phi + 90_deg;
412 double theta = 90_deg;
413 double phiy = phix + 90._deg;
420 if (dohmList[
i] < 0.) {
422 dohm = ns.volume(dohmAuxName);
423 dohmZ = dohmCarrierDz - 0.5 * dohmAuxL - dohmtoMF;
425 dohmReplica = primReplica;
428 dohm = ns.volume(dohmPrimName);
429 dohmZ = dohmCarrierDz - 0.5 * dohmPrimL - dohmtoMF;
431 dohmReplica = auxReplica;
434 pv = dohmCarrier.placeVolume(dohm, dohmReplica, Transform3D(dohmRotation, dohmTrasl));
438 pv = layer.placeVolume(dohmCarrier, dohmCarrierReplica, Transform3D(
rotation, tran));
443 for (
int j = 0;
j < 4;
j++) {
444 vector<double> pillarZ;
445 vector<double> pillarPhi;
446 double pillarDz = 0, pillarDPhi = 0, pillarRin = 0, pillarRout = 0;
451 pillarZ = fwIntPillarZ;
452 pillarPhi = fwIntPillarPhi;
453 pillarRin = MFRingInR;
454 pillarRout = MFRingInR + MFRingT;
455 pillarDz = fwIntPillarDz;
456 pillarDPhi = fwIntPillarDPhi;
460 pillarZ = bwIntPillarZ;
461 pillarPhi = bwIntPillarPhi;
462 pillarRin = MFRingInR;
463 pillarRout = MFRingInR + MFRingT;
464 pillarDz = bwIntPillarDz;
465 pillarDPhi = bwIntPillarDPhi;
469 pillarZ = fwExtPillarZ;
470 pillarPhi = fwExtPillarPhi;
471 pillarRin = MFRingOutR - MFRingT;
472 pillarRout = MFRingOutR;
473 pillarDz = fwExtPillarDz;
474 pillarDPhi = fwExtPillarDPhi;
478 pillarZ = bwExtPillarZ;
479 pillarPhi = bwExtPillarPhi;
480 pillarRin = MFRingOutR - MFRingT;
481 pillarRout = MFRingOutR;
482 pillarDz = bwExtPillarDz;
483 pillarDPhi = bwExtPillarDPhi;
487 solid = ns.addSolidNS(
name, Tube(pillarRin, pillarRout, pillarDz, -pillarDPhi, 2. * pillarDPhi));
488 Volume Pillar = ns.addVolumeNS(
Volume(
name, solid, ns.material(pillarMaterial)));
489 LogDebug(
"TIBGeom") << solid.name() <<
" Tubs made of " << pillarMaterial <<
" from " << -pillarDPhi <<
" to "
490 << pillarDPhi <<
" with Rin " << pillarRin <<
" Rout " << pillarRout <<
" ZHalf " << pillarDz;
492 Rotation3D pillarRota;
493 int pillarReplica = 0;
494 for (
unsigned int i = 0;
i < pillarZ.size();
i++) {
495 if (pillarPhi[
i] > 0.) {
496 pillarTran =
Position(0., 0., pillarZ[
i]);
497 pillarRota =
makeRotation3D(90._deg, pillarPhi[
i], 90._deg, 90._deg + pillarPhi[
i], 0., 0.);
498 pv = layer.placeVolume(Pillar,
i, Transform3D(pillarRota, pillarTran));