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 edm::LogVerbatim(
"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 edm::LogVerbatim(
"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(ns.
prepend(
name), dd4hep::Tube(rtmi, rtmx, 0.5 * layerDz, 0., 2._pi));
57 edm::LogVerbatim(
"PixelGeom") <<
"DDPixBarLayerUpgradeAlgo test: " << solid.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(ns.
prepend(
name +
"CoolTube"), dd4hep::Tube(0., coolRadius, 0.5 * coolDz, 0., 2_pi));
66 edm::LogVerbatim(
"PixelGeom") <<
"DDPixBarLayerUpgradeAlgo test: " << solid.name() <<
" Tubs made of " << tubeMat
67 <<
" from 0 to " <<
convertRadToDeg(2_pi) <<
" with Rout " << coolRadius <<
" ZHalf " 73 solid = ns.
addSolid(ns.
prepend(
name +
"CoolTubeHalf"), dd4hep::Tube(0., coolRadius, 0.5 * coolDz, 0, 1_pi));
75 edm::LogVerbatim(
"PixelGeom") <<
"DDPixBarLayerUpgradeAlgo test: " << solid.name() <<
" Tubs made of " << tubeMatHalf
76 <<
" from 0 to " <<
convertRadToDeg(2_pi) <<
" with Rout " << coolRadius <<
" ZHalf " 84 solid = ns.
addSolid(ns.
prepend(
name +
"Coolant"), dd4hep::Tube(0., coolRadius - coolThick, 0.5 * coolDz, 0., 2_pi));
86 edm::LogVerbatim(
"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 edm::LogVerbatim(
"PixelGeom") <<
"DDPixBarLayerUpgradeAlgo test: " << cool.name() <<
" number 1 positioned in " 95 << coolTube.name() <<
" at (0,0,0) with no rotation";
100 ns.
addSolid(ns.
prepend(
name +
"CoolantHalf"), dd4hep::Tube(0., coolRadius - coolThick, 0.5 * coolDz, 0., 1._pi));
102 edm::LogVerbatim(
"PixelGeom") <<
"DDPixBarLayerUpgradeAlgo test: " << solid.name() <<
" Tubs made of " << tubeMatHalf
103 <<
" from 0 to " <<
convertRadToDeg(2._pi) <<
" with Rout " << coolRadius - coolThick
104 <<
" ZHalf " << 0.5 * coolDz;
108 coolTubeHalf.placeVolume(coolHalf, 1, dd4hep::Transform3D(dd4hep::Rotation3D(),
dd4hep::Position(0., 0., 0.)));
110 edm::LogVerbatim(
"PixelGeom") <<
"DDPixBarLayerUpgradeAlgo test: " << cool.name() <<
" number 1 positioned in " 111 << coolTube.name() <<
" at (0,0,0) with no rotation";
112 int copy = 1, iup = (-1) * outerFirst;
113 int copyoffset =
number + 2;
116 double phi =
i * dphi + 90._deg - 0.5 * dphi + phiFineTune;
117 double phix, phiy, rrr, rrroffset;
121 auto rot = dd4hep::Rotation3D();
127 if ((
i == 1) || (
i ==
number / 2 + 1)) {
128 dr = coolRadius + 0.5 * ladderThick + ladderOffset;
130 dr = coolRadius + 0.5 * ladderThick;
134 rrr = coolDist *
cos(0.5 * dphi) + iup * dr + rOuterFineTune;
136 rrr = coolDist *
cos(0.5 * dphi) + iup * dr + rInnerFineTune;
143 phix = phi - 90._deg;
145 phix = phi + 90._deg;
148 phiy = phix + 90._deg;
150 edm::LogVerbatim(
"PixelGeom") <<
"DDPixBarLayerUpgradeAlgo test: Creating a new " 151 <<
"rotation: " << rots <<
"\t90., " <<
convertRadToDeg(phix) <<
", 90.," 160 <<
" positioned in " << layer.name() <<
" at " << tran <<
" with " <<
rot;
164 rrr = coolDist *
cos(0.5 * dphi) + coolRadius / 2.;
167 phix = phi + 90._deg;
172 phiy = phix + 90._deg;
174 edm::LogVerbatim(
"PixelGeom") <<
"DDPixBarLayerUpgradeAlgo test: Creating a new " 175 <<
"rotation: " << rots <<
"\t90., " <<
convertRadToDeg(phix) <<
", 90.," 182 layer.placeVolume(coolTubeHalf,
i + 1, dd4hep::Transform3D(
rot, tran));
184 if ((
i == 1) || (
i ==
number / 2 + 1)) {
185 rrroffset = coolDist *
cos(0.5 * dphi) + iup * ladderOffset + rOuterFineTune;
187 rrroffset *
cos(phi) - cool1Offset *
sin(phi), rrroffset *
sin(phi) + cool1Offset *
cos(phi), 0.);
189 layer.placeVolume(coolTube, copyoffset, dd4hep::Transform3D(dd4hep::Rotation3D(), tran));
194 rrroffset *
cos(phi) - cool2Offset *
sin(phi), rrroffset *
sin(phi) + cool2Offset *
cos(phi), 0.);
196 layer.placeVolume(coolTube, copyoffset, dd4hep::Transform3D(dd4hep::Rotation3D(), tran));
200 edm::LogVerbatim(
"PixelGeom") <<
"DDPixBarLayerUpgradeAlgo test: " << coolTube.name() <<
" number " <<
i + 1
201 <<
" positioned in " << layer.name() <<
" at " << tran <<
" with " <<
rot;
Log< level::Info, true > LogVerbatim
static long algorithm(dd4hep::Detector &, cms::DDParsingContext &ctxt, xml_h e)
constexpr NumType convertRadToDeg(NumType radians)
Sin< T >::type sin(const T &t)
std::string to_string(const V &value)
dd4hep::Material material(const std::string &name) const
DDRotationMatrix makeRotation3D(double thetaX, double phiX, double thetaY, double phiY, double thetaZ, double phiZ)
#define DECLARE_DDCMS_DETELEMENT(name, func)
static constexpr long s_executed
static std::string objName(const std::string &)
Cos< T >::type cos(const T &t)
dd4hep::Volume addVolume(dd4hep::Volume vol) const
dd4hep::Solid addSolid(const std::string &name, dd4hep::Solid solid) const
dd4hep::Volume volume(const std::string &name, bool exc=true) const
std::string prepend(const std::string &) const