1 #include "DD4hep/DetFactoryHelper.h"
9 using namespace cms_units::operators;
17 edm::LogVerbatim(
"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");
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
34 <<
" Materials " << 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 edm::LogVerbatim(
"PixelGeom") <<
"Full Ladder " << ladder[0] <<
" width/thickness " << ladderWidth[0] <<
", "
39 << ladderThick[0] <<
"\tHalf Ladder " << ladder[1] <<
" width/thickness "
40 << ladderWidth[1] <<
", " << 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 edm::LogVerbatim(
"PixelGeom") <<
"Rmin/Rmax " << rmin <<
", " << rmax <<
" d1/d2 " << d1 <<
", " << d2 <<
" x1/x2 "
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(ns.
prepend(idName), Tube(rtmi, rtmx, 0.5 * layerDz, 0, 2_pi));
57 edm::LogVerbatim(
"PixelGeom") <<
"IDname " << solid.name() <<
" Tubs made of " << genMat <<
" from 0 to "
58 <<
convertRadToDeg(2_pi) <<
" with Rin " << rtmi <<
" Rout " << rtmx <<
" ZHalf "
62 double rr = 0.5 * (rmax + rmin);
63 double dr = 0.5 * (rmax - rmin);
64 double h1 = 0.5 * coolSide *
cos(0.5 * dphi);
66 solid = ns.
addSolid(ns.
prepend(name), Trap(0.5 * coolDz, 0, 0, h1, d2, d1, 0, h1, d2, d1, 0));
67 edm::LogVerbatim(
"PixelGeom") <<
"Solid " << solid.name() <<
" Trap made of " << tubeMat <<
" of dimensions "
68 << 0.5 * coolDz <<
", 0, 0, " << h1 <<
", " << d2 <<
", " << d1 <<
", 0, " << h1 <<
", "
69 << d2 <<
", " << d1 <<
", 0";
75 name = idName +
"Coolant";
76 solid = ns.
addSolid(ns.
prepend(name), Trap(0.5 * coolDz, 0, 0, h1, d2, d1, 0, h1, d2, d1, 0));
77 edm::LogVerbatim(
"PixelGeom") <<
"Solid " << solid.name() <<
" Trap made of " << coolMat <<
" of dimensions "
78 << 0.5 * coolDz <<
", 0, 0, " << h1 <<
", " << d2 <<
", " << d1 <<
", 0, " << h1 <<
", "
79 << d2 <<
", " << d1 <<
", 0";
82 pv = coolTube.placeVolume(cool, 1);
83 edm::LogVerbatim(
"PixelGeom") <<
"Cool " << cool.name() <<
" number 1 positioned in " << coolTube.name()
84 <<
" at (0,0,0) with no rotation";
86 string ladderFull = ladder[0];
87 string ladderHalf = ladder[1];
88 int nphi = number / 2,
copy = 1, iup = -1;
94 double phi = phi0 +
i * dphi;
95 double phix, phiy, rrr, xx;
99 if (
i == 0 ||
i == nphi) {
100 rrr = rr + dr + 0.5 * (ladderThick[1] - ladderThick[0]);
101 xx = (0.5 * ladderWidth[1] - sensorEdge) *
sin(phi);
105 phiy = 90_deg + phix;
107 <<
"rotation: " << rots <<
"\t90., " <<
convertRadToDeg(phix) <<
", 90.,"
112 pv = layer.placeVolume(ladderHalfVol,
copy, Transform3D(rot, tran));
115 edm::LogVerbatim(
"PixelGeom") <<
"ladderHalfVol: " << ladderHalfVol.name() <<
" number " <<
copy
116 <<
" positioned in " << layer.name() <<
" at " << tran <<
" with " <<
rot;
119 rrr = rr - dr - 0.5 * (ladderThick[1] - ladderThick[0]);
123 phiy = 90_deg + phix;
128 pv = layer.placeVolume(ladderHalfVol,
copy, Transform3D(rot, tran));
131 edm::LogVerbatim(
"PixelGeom") <<
"ladderHalfVol: " << ladderHalfVol.name() <<
" number " <<
copy
132 <<
" positioned in " << layer.name() <<
" at " << tran <<
" with " <<
rot;
143 phiy = phix + 90._deg;
145 <<
"rotation: " << rots <<
"\t90., " <<
convertRadToDeg(phix) <<
", 90.,"
150 pv = layer.placeVolume(ladderFullVol,
copy, Transform3D(rot, tran));
153 edm::LogVerbatim(
"PixelGeom") <<
"test: " << ladderFullVol.name() <<
" number " <<
copy <<
" positioned in "
154 << layer.name() <<
" at " << tran <<
" with " <<
rot;
157 rrr = coolDist *
cos(0.5 * dphi);
160 phix = phi + 0.5 * dphi;
163 phiy = phix + 90._deg;
168 pv = layer.placeVolume(coolTube,
i + 1, Transform3D(rot, tran));
171 edm::LogVerbatim(
"PixelGeom") <<
"coolTube: " << coolTube.name() <<
" number " <<
i + 1 <<
" positioned in "
172 << layer.name() <<
" at " << tran <<
" with " <<
rot;
Log< level::Info, true > LogVerbatim
dd4hep::Volume volume(const std::string &name, bool exc=true) const
constexpr NumType convertRadToDeg(NumType radians)
Sin< T >::type sin(const T &t)
T value(const std::string &name) const
std::string to_string(const V &value)
dd4hep::Volume addVolume(dd4hep::Volume vol) const
DDRotationMatrix makeRotation3D(double thetaX, double phiX, double thetaY, double phiY, double thetaZ, double phiZ)
constexpr std::array< uint8_t, layerIndexSize > layer
std::string_view name() const
#define DECLARE_DDCMS_DETELEMENT(name, func)
dd4hep::PlacedVolume PlacedVolume
static std::string objName(const std::string &)
Cos< T >::type cos(const T &t)
dd4hep::Material material(const std::string &name) const
std::string prepend(const std::string &) const
dd4hep::Solid addSolid(const std::string &name, dd4hep::Solid solid) const
static constexpr float d1
std::string parentName() const
Access value of rParent child node.