1 #include "DD4hep/DetFactoryHelper.h"
15 double layerDz =
args.value<
double>(
"LayerDz");
16 double coolDz =
args.value<
double>(
"CoolDz");
17 double coolThick =
args.value<
double>(
"CoolThick");
18 double coolRadius =
args.value<
double>(
"CoolRadius");
19 double coolDist =
args.value<
double>(
"CoolDist");
20 double cool1Offset =
args.value<
double>(
"Cool1Offset");
21 double cool2Offset =
args.value<
double>(
"Cool2Offset");
26 double phiFineTune =
args.value<
double>(
"PitchFineTune");
27 double rOuterFineTune =
args.value<
double>(
"OuterOffsetFineTune");
28 double rInnerFineTune =
args.value<
double>(
"InnerOffsetFineTune");
33 double ladderWidth =
args.value<
double>(
"LadderWidth");
34 double ladderThick =
args.value<
double>(
"LadderThick");
35 double ladderOffset =
args.value<
double>(
"LadderOffset");
36 int outerFirst =
args.value<
int>(
"OuterFirst");
38 LogDebug(
"PixelGeom") <<
"DDPixBarLayerUpgradeAlgo debug: Parent " << parentName <<
" NameSpace "
39 << ns.
objName(parentName) <<
"\n\tLadders " <<
number <<
"\tGeneral Material " << genMat
40 <<
"\tLength " << layerDz <<
"\tSpecification of Cooling Pieces:\n"
41 <<
"\tLength " << coolDz <<
"\tThickness of Shell " << coolThick <<
"\tRadial distance "
42 << coolDist <<
"\tMaterials " << coolMat <<
", " << tubeMat << std::endl;
44 LogDebug(
"PixelGeom") <<
"DDPixBarLayerUpgradeAlgo debug: Full Ladder " <<
ladder <<
" width/thickness "
45 << ladderWidth <<
", " << ladderThick;
47 double dphi = 2_pi / (double)
number;
48 double x2 = coolDist *
sin(0.5 * dphi);
49 double rtmi = coolDist *
cos(0.5 * dphi) - (coolRadius + ladderThick) + rInnerFineTune;
50 double rmxh = coolDist *
cos(0.5 * dphi) + (coolRadius + ladderThick + ladderOffset) + rOuterFineTune;
51 double rtmx =
sqrt(rmxh * rmxh + ladderWidth * ladderWidth / 4.);
55 dd4hep::Solid solid = ns.
addSolid(
name, dd4hep::Tube(rtmi, rtmx, 0.5 * layerDz, 0., 2._pi));
57 LogDebug(
"PixelGeom") <<
"DDPixBarLayerUpgradeAlgo test: " << ns.
name() <<
" Tubs made of " << genMat
58 <<
" from 0. to " <<
convertRadToDeg(2_pi) <<
" with Rin " << rtmi <<
" Rout " << rtmx
59 <<
" ZHalf " << 0.5 * layerDz;
64 solid = ns.
addSolid(
name +
"CoolTube", dd4hep::Tube(0., coolRadius, 0.5 * coolDz, 0., 2_pi));
66 LogDebug(
"PixelGeom") <<
"DDPixBarLayerUpgradeAlgo test: " << solid.name() <<
" Tubs made of " << tubeMat
67 <<
" from 0 to " <<
convertRadToDeg(2_pi) <<
" with Rout " << coolRadius <<
" ZHalf "
73 solid = ns.
addSolid(
name +
"CoolTubeHalf", dd4hep::Tube(0., coolRadius, 0.5 * coolDz, 0, 1_pi));
75 LogDebug(
"PixelGeom") <<
"DDPixBarLayerUpgradeAlgo test: " << solid.name() <<
" Tubs made of " << tubeMatHalf
76 <<
" from 0 to " <<
convertRadToDeg(2_pi) <<
" with Rout " << coolRadius <<
" ZHalf "
84 solid = ns.
addSolid(
name +
"Coolant", dd4hep::Tube(0., coolRadius - coolThick, 0.5 * coolDz, 0., 2_pi));
86 LogDebug(
"PixelGeom") <<
"DDPixBarLayerUpgradeAlgo test: " << solid.name() <<
" Tubs made of " << tubeMat
87 <<
" from 0 to " <<
convertRadToDeg(2._pi) <<
" with Rout " << coolRadius - coolThick
88 <<
" ZHalf " << 0.5 * coolDz;
92 coolTube.placeVolume(cool, 1, dd4hep::Transform3D(dd4hep::Rotation3D(),
dd4hep::Position(0., 0., 0.)));
94 LogDebug(
"PixelGeom") <<
"DDPixBarLayerUpgradeAlgo test: " << cool.name() <<
" number 1 positioned in "
95 << coolTube.name() <<
" at (0,0,0) with no rotation";
99 solid = ns.
addSolid(
name +
"CoolantHalf", dd4hep::Tube(0., coolRadius - coolThick, 0.5 * coolDz, 0., 1._pi));
101 LogDebug(
"PixelGeom") <<
"DDPixBarLayerUpgradeAlgo test: " << solid.name() <<
" Tubs made of " << tubeMatHalf
102 <<
" from 0 to " <<
convertRadToDeg(2._pi) <<
" with Rout " << coolRadius - coolThick
103 <<
" ZHalf " << 0.5 * coolDz;
107 coolTubeHalf.placeVolume(coolHalf, 1, dd4hep::Transform3D(dd4hep::Rotation3D(),
dd4hep::Position(0., 0., 0.)));
109 LogDebug(
"PixelGeom") <<
"DDPixBarLayerUpgradeAlgo test: " << cool.name() <<
" number 1 positioned in "
110 << coolTube.name() <<
" at (0,0,0) with no rotation";
111 int copy = 1, iup = (-1) * outerFirst;
112 int copyoffset =
number + 2;
115 double phi =
i * dphi + 90._deg - 0.5 * dphi + phiFineTune;
116 double phix, phiy, rrr, rrroffset;
120 auto rot = dd4hep::Rotation3D();
126 if ((
i == 1) || (
i ==
number / 2 + 1)) {
127 dr = coolRadius + 0.5 * ladderThick + ladderOffset;
129 dr = coolRadius + 0.5 * ladderThick;
133 rrr = coolDist *
cos(0.5 * dphi) + iup *
dr + rOuterFineTune;
135 rrr = coolDist *
cos(0.5 * dphi) + iup *
dr + rInnerFineTune;
142 phix = phi - 90._deg;
144 phix = phi + 90._deg;
147 phiy = phix + 90._deg;
149 LogDebug(
"PixelGeom") <<
"DDPixBarLayerUpgradeAlgo test: Creating a new "
150 <<
"rotation: " << rots <<
"\t90., " <<
convertRadToDeg(phix) <<
", 90.,"
158 LogDebug(
"PixelGeom") <<
"DDPixBarLayerUpgradeAlgo test: " <<
ladder <<
" number " <<
copy <<
" positioned in "
159 << layer.name() <<
" at " << tran <<
" with " <<
rot;
163 rrr = coolDist *
cos(0.5 * dphi) + coolRadius / 2.;
165 rots =
name + std::to_string(
i + 100);
166 phix = phi + 90._deg;
171 phiy = phix + 90._deg;
173 LogDebug(
"PixelGeom") <<
"DDPixBarLayerUpgradeAlgo test: Creating a new "
174 <<
"rotation: " << rots <<
"\t90., " <<
convertRadToDeg(phix) <<
", 90.,"
181 layer.placeVolume(coolTubeHalf,
i + 1, dd4hep::Transform3D(
rot, tran));
183 if ((
i == 1) || (
i ==
number / 2 + 1)) {
184 rrroffset = coolDist *
cos(0.5 * dphi) + iup * ladderOffset + rOuterFineTune;
186 rrroffset *
cos(phi) - cool1Offset *
sin(phi), rrroffset *
sin(phi) + cool1Offset *
cos(phi), 0.);
188 layer.placeVolume(coolTube, copyoffset, dd4hep::Transform3D(dd4hep::Rotation3D(), tran));
193 rrroffset *
cos(phi) - cool2Offset *
sin(phi), rrroffset *
sin(phi) + cool2Offset *
cos(phi), 0.);
195 layer.placeVolume(coolTube, copyoffset, dd4hep::Transform3D(dd4hep::Rotation3D(), tran));
199 LogDebug(
"PixelGeom") <<
"DDPixBarLayerUpgradeAlgo test: " << coolTube.name() <<
" number " <<
i + 1
200 <<
" positioned in " << layer.name() <<
" at " << tran <<
" with " <<
rot;