1 #include "DD4hep/DetFactoryHelper.h" 15 string parentName =
args.parentName();
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]);
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";
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];
94 double phi = phi0 +
i * dphi;
95 double phix, phiy, rrr,
xx;
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
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)
dd4hep::PlacedVolume PlacedVolume
std::string_view name() const
static std::string objName(const std::string &)
Cos< T >::type cos(const T &t)
dd4hep::Volume addVolume(dd4hep::Volume vol) const
Namespace of DDCMS conversion namespace.
static long algorithm(Detector &description, cms::DDParsingContext &ctxt, xml_h e)
dd4hep::Solid addSolid(const std::string &name, dd4hep::Solid solid) const
static constexpr float d1
dd4hep::Volume volume(const std::string &name, bool exc=true) const
std::string prepend(const std::string &) const