1 #include "DD4hep/DetFactoryHelper.h"
15 string parentName =
args.parentName();
17 LogDebug(
"PixelGeom") <<
"+++ Parsing arguments for Algorithm:" <<
args.name <<
" rParent:" << parentName;
18 string genMat =
args.value<
string>(
"GeneralMaterial");
20 double layerDz =
args.value<
double>(
"LayerDz");
21 double sensorEdge =
args.value<
double>(
"SensorEdge");
22 double coolDz =
args.value<
double>(
"CoolDz");
23 double coolWidth =
args.value<
double>(
"CoolWidth");
24 double coolSide =
args.value<
double>(
"CoolSide");
25 double coolThick =
args.value<
double>(
"CoolThick");
26 double coolDist =
args.value<
double>(
"CoolDist");
27 string coolMat =
args.value<
string>(
"CoolMaterial");
28 string tubeMat =
args.value<
string>(
"CoolTubeMaterial");
29 LogDebug(
"PixelGeom") <<
"Parent " << parentName <<
" NameSpace " << ns.
name() <<
"\n"
30 <<
"\tLadders " <<
number <<
"\tGeneral Material " << genMat <<
"\tLength " << layerDz
31 <<
"\tSensorEdge " << sensorEdge <<
"\tSpecification of Cooling Pieces:\n"
32 <<
"\tLength " << coolDz <<
" Width " << coolWidth <<
" Side " << coolSide
33 <<
" Thickness of Shell " << coolThick <<
" Radial distance " << coolDist <<
" Materials "
34 << coolMat <<
", " << tubeMat;
35 vector<string>
ladder =
args.value<vector<string> >(
"LadderName");
36 vector<double> ladderWidth =
args.value<vector<double> >(
"LadderWidth");
37 vector<double> ladderThick =
args.value<vector<double> >(
"LadderThick");
38 LogDebug(
"PixelGeom") <<
"Full Ladder " <<
ladder[0] <<
" width/thickness " << ladderWidth[0] <<
", "
39 << ladderThick[0] <<
"\tHalf Ladder " <<
ladder[1] <<
" width/thickness " << ladderWidth[1]
40 <<
", " << ladderThick[1];
43 double dphi = 2_pi /
number;
44 double d2 = 0.5 * coolWidth;
45 double d1 = d2 - coolSide *
sin(0.5 * dphi);
46 double x1 = (
d1 + d2) / (2. *
sin(0.5 * dphi));
47 double x2 = coolDist *
sin(0.5 * dphi);
48 double rmin = (coolDist - 0.5 * (
d1 + d2)) *
cos(0.5 * dphi) - 0.5 * ladderThick[0];
49 double rmax = (coolDist + 0.5 * (
d1 + d2)) *
cos(0.5 * dphi) + 0.5 * ladderThick[0];
50 double rmxh = rmax - 0.5 * ladderThick[0] + ladderThick[1];
51 LogDebug(
"PixelGeom") <<
"Rmin/Rmax " << rmin <<
", " << rmax <<
" d1/d2 " <<
d1 <<
", " << d2 <<
" x1/x2 " <<
x1
54 double rtmi = rmin + 0.5 * ladderThick[0] - ladderThick[1];
55 double rtmx =
sqrt(rmxh * rmxh + ladderWidth[1] * ladderWidth[1]);
56 Solid solid = ns.
addSolid(
idName, Tube(rtmi, rtmx, 0.5 * layerDz, 0, 2_pi));
58 <<
" with Rin " << rtmi <<
" Rout " << rtmx <<
" ZHalf " << 0.5 * layerDz;
61 double rr = 0.5 * (rmax + rmin);
62 double dr = 0.5 * (rmax - rmin);
63 double h1 = 0.5 * coolSide *
cos(0.5 * dphi);
65 solid = ns.
addSolid(
name, Trap(0.5 * coolDz, 0, 0, h1, d2,
d1, 0, h1, d2,
d1, 0));
66 LogDebug(
"PixelGeom") <<
"Solid " << solid.name() <<
" Trap made of " << tubeMat <<
" of dimensions " << 0.5 * coolDz
67 <<
", 0, 0, " << h1 <<
", " << d2 <<
", " <<
d1 <<
", 0, " << h1 <<
", " << d2 <<
", " <<
d1
75 solid = ns.
addSolid(
name, Trap(0.5 * coolDz, 0, 0, h1, d2,
d1, 0, h1, d2,
d1, 0));
76 LogDebug(
"PixelGeom") <<
"Solid " << solid.name() <<
" Trap made of " << coolMat <<
" of dimensions " << 0.5 * coolDz
77 <<
", 0, 0, " << h1 <<
", " << d2 <<
", " <<
d1 <<
", 0, " << h1 <<
", " << d2 <<
", " <<
d1
81 pv = coolTube.placeVolume(cool, 1);
82 LogDebug(
"PixelGeom") <<
"Cool " << cool.name() <<
" number 1 positioned in " << coolTube.name()
83 <<
" at (0,0,0) with no rotation";
85 string ladderFull =
ladder[0];
86 string ladderHalf =
ladder[1];
93 double phi = phi0 +
i * dphi;
94 double phix, phiy, rrr,
xx;
99 rrr =
rr +
dr + 0.5 * (ladderThick[1] - ladderThick[0]);
100 xx = (0.5 * ladderWidth[1] - sensorEdge) *
sin(phi);
104 phiy = 90_deg + phix;
105 LogDebug(
"PixelGeom") <<
"Creating a new "
106 <<
"rotation: " << rots <<
"\t90., " <<
convertRadToDeg(phix) <<
", 90.,"
111 pv = layer.placeVolume(ladderHalfVol,
copy, Transform3D(
rot, tran));
114 LogDebug(
"PixelGeom") <<
"ladderHalfVol: " << ladderHalfVol.name() <<
" number " <<
copy <<
" positioned in "
115 << layer.name() <<
" at " << tran <<
" with " <<
rot;
118 rrr =
rr -
dr - 0.5 * (ladderThick[1] - ladderThick[0]);
122 phiy = 90_deg + phix;
127 pv = layer.placeVolume(ladderHalfVol,
copy, Transform3D(
rot, tran));
130 LogDebug(
"PixelGeom") <<
"ladderHalfVol: " << ladderHalfVol.name() <<
" number " <<
copy <<
" positioned in "
131 << layer.name() <<
" at " << tran <<
" with " <<
rot;
142 phiy = phix + 90._deg;
143 LogDebug(
"PixelGeom") <<
"DDPixBarLayerAlgo test: Creating a new "
144 <<
"rotation: " << rots <<
"\t90., " <<
convertRadToDeg(phix) <<
", 90.,"
149 pv = layer.placeVolume(ladderFullVol,
copy, Transform3D(
rot, tran));
152 LogDebug(
"PixelGeom") <<
"test: " << ladderFullVol.name() <<
" number " <<
copy <<
" positioned in "
153 << layer.name() <<
" at " << tran <<
" with " <<
rot;
156 rrr = coolDist *
cos(0.5 * dphi);
158 rots =
idName + std::to_string(
i + 100);
159 phix = phi + 0.5 * dphi;
162 phiy = phix + 90._deg;
167 pv = layer.placeVolume(coolTube,
i + 1, Transform3D(
rot, tran));
170 LogDebug(
"PixelGeom") <<
"coolTube: " << coolTube.name() <<
" number " <<
i + 1 <<
" positioned in " << layer.name()
171 <<
" at " << tran <<
" with " <<
rot;
173 LogDebug(
"PixelGeom") <<
"Layer: " << layer.name();