1 #include "DD4hep/DetFactoryHelper.h" 14 double diskDz =
args.dble(
"DiskDz");
16 double cableT =
args.dble(
"CableT");
17 vector<double> rodRin =
args.vecDble(
"RodRin");
18 vector<double> rodRout =
args.vecDble(
"RodRout");
19 vector<string> cableM =
args.vecStr(
"CableMaterial");
20 double connW =
args.dble(
"ConnW");
21 double connT =
args.dble(
"ConnT");
22 vector<string> connM =
args.vecStr(
"ConnMaterial");
23 vector<double> coolR1 =
args.vecDble(
"CoolR1");
24 vector<double> coolR2 =
args.vecDble(
"CoolR2");
25 double coolRin =
args.dble(
"CoolRin");
26 double coolRout1 =
args.dble(
"CoolRout1");
27 double coolRout2 =
args.dble(
"CoolRout2");
28 double coolStartPhi1 =
args.dble(
"CoolStartPhi1");
29 double coolDeltaPhi1 =
args.dble(
"CoolDeltaPhi1");
30 double coolStartPhi2 =
args.dble(
"CoolStartPhi2");
31 double coolDeltaPhi2 =
args.dble(
"CoolDeltaPhi2");
32 string coolM1 =
args.str(
"CoolMaterial1");
33 string coolM2 =
args.str(
"CoolMaterial2");
34 vector<string>
names =
args.vecStr(
"RingName");
36 string parentName =
args.parentName();
37 edm::LogVerbatim(
"TOBGeom") <<
"DDTOBRadCableAlgo debug: Parent " << parentName <<
" NameSpace " << ns.
name();
38 edm::LogVerbatim(
"TOBGeom") <<
"DDTOBRadCableAlgo debug: Disk Half width " << diskDz <<
"\tRMax " <<
rMax 39 <<
"\tCable Thickness " << cableT <<
"\tRadii of disk position and cable materials:";
40 for (
int i = 0;
i < (
int)(rodRin.size());
i++)
41 edm::LogVerbatim(
"TOBGeom") <<
"\t[" <<
i <<
"]\tRin = " << rodRin[
i] <<
"\tRout = " << rodRout[
i] <<
" " 43 edm::LogVerbatim(
"TOBGeom") <<
"DDTOBRadCableAlgo debug: Connector Width = " << connW <<
"\tThickness = " << connT
45 for (
int i = 0;
i < (
int)(connM.size());
i++)
47 edm::LogVerbatim(
"TOBGeom") <<
"DDTOBRadCableAlgo debug: Cool Manifold Torus Rin = " << coolRin
48 <<
" Rout = " << coolRout1 <<
"\t Phi start = " << coolStartPhi1
49 <<
" Phi Range = " << coolDeltaPhi1 <<
"\t Material = " << coolM1
50 <<
"\t Radial positions:";
51 for (
int i = 0;
i < (
int)(coolR1.size());
i++)
53 for (
int i = 0;
i < (
int)(coolR2.size());
i++)
55 edm::LogVerbatim(
"TOBGeom") <<
"DDTOBRadCableAlgo debug: Cooling Fluid Torus Rin = " << coolRin
56 <<
" Rout = " << coolRout2 <<
"\t Phi start = " << coolStartPhi2
57 <<
" Phi Range = " << coolDeltaPhi2 <<
"\t Material = " << coolM2
58 <<
"\t Radial positions:";
59 for (
int i = 0;
i < (
int)(coolR1.size());
i++)
61 for (
int i = 0;
i < (
int)(coolR2.size());
i++)
76 solid = ns.
addSolid(ns.
prepend(
name), Torus(coolR1[
i], coolRin, coolRout1, coolStartPhi1, coolDeltaPhi1));
77 edm::LogVerbatim(
"TOBGeom") << solid.name() <<
" Torus made of " << coolM1 <<
" from " 79 <<
convertRadToDeg((coolStartPhi1 + coolDeltaPhi1)) <<
" with Rin " << coolRin
80 <<
" Rout " << coolRout1 <<
" R torus " << coolR1[
i];
83 disk.placeVolume(coolManifoldLogic_a,
i + 1, r1);
84 edm::LogVerbatim(
"TOBGeom") << solid.name() <<
" number " <<
i + 1 <<
" positioned in " << disk.name() <<
" at " 85 << r1 <<
" with no rotation";
88 name =
"TOBCoolingManifoldFluid" +
names[
i] +
"a";
89 solid = ns.
addSolid(ns.
prepend(
name), Torus(coolR1[
i], coolRin, coolRout2, coolStartPhi2, coolDeltaPhi2));
90 edm::LogVerbatim(
"TOBGeom") << solid.name() <<
" Torus made of " << coolM2 <<
" from " 92 <<
convertRadToDeg((coolStartPhi2 + coolDeltaPhi2)) <<
" with Rin " << coolRin
93 <<
" Rout " << coolRout2 <<
" R torus " << coolR1[
i];
95 coolManifoldLogic_a.placeVolume(coolManifoldFluidLogic_a,
i + 1);
96 edm::LogVerbatim(
"TOBGeom") << solid.name() <<
" number " <<
i + 1 <<
" positioned in " << coolM2
97 <<
" with no translation and no rotation";
101 solid = ns.
addSolid(ns.
prepend(
name), Torus(coolR2[
i], coolRin, coolRout1, coolStartPhi1, coolDeltaPhi1));
102 edm::LogVerbatim(
"TOBGeom") << solid.name() <<
" Torus made of " << coolM1 <<
" from " 104 <<
convertRadToDeg((coolStartPhi1 + coolDeltaPhi1)) <<
" with Rin " << coolRin
105 <<
" Rout " << coolRout1 <<
" R torus " << coolR2[
i];
108 disk.placeVolume(coolManifoldLogic_r,
i + 1, r1);
109 edm::LogVerbatim(
"TOBGeom") << solid.name() <<
" number " <<
i + 1 <<
" positioned in " << disk.name() <<
" at " 110 << r1 <<
" with no rotation";
113 name =
"TOBCoolingManifoldFluid" +
names[
i] +
"r";
114 solid = ns.
addSolid(ns.
prepend(
name), Torus(coolR2[
i], coolRin, coolRout2, coolStartPhi2, coolDeltaPhi2));
115 edm::LogVerbatim(
"TOBGeom") << solid.name() <<
" Torus made of " << coolM2 <<
" from " 117 <<
convertRadToDeg((coolStartPhi2 + coolDeltaPhi2)) <<
" with Rin " << coolRin
118 <<
" Rout " << coolRout2 <<
" R torus " << coolR2[
i];
120 coolManifoldLogic_r.placeVolume(coolManifoldFluidLogic_r,
i + 1);
121 edm::LogVerbatim(
"TOBGeom") << solid.name() <<
" number " <<
i + 1 <<
" positioned in " << coolM2
122 <<
" with no translation and no rotation";
127 rin = 0.5 * (rodRin[
i] + rodRout[
i]) - 0.5 * connW;
128 rout = 0.5 * (rodRin[
i] + rodRout[
i]) + 0.5 * connW;
130 edm::LogVerbatim(
"TOBGeom") << solid.name() <<
" Tubs made of " << connM[
i] <<
" from 0 to " 131 <<
convertRadToDeg(2_pi) <<
" with Rin " << rin <<
" Rout " << rout <<
" ZHalf " <<
dz;
134 disk.placeVolume(connLogic,
i + 1,
r2);
135 edm::LogVerbatim(
"TOBGeom") << solid.name() <<
" number " <<
i + 1 <<
" positioned in " << disk.name() <<
" at " 136 <<
r2 <<
" with no rotation";
140 rin = 0.5 * (rodRin[
i] + rodRout[
i]);
141 rout = (
i + 1 == (
int)(
names.size()) ?
rMax : 0.5 * (rodRin[
i + 1] + rodRout[
i + 1]));
142 vector<double> pgonZ;
143 pgonZ.emplace_back(-0.5 * cableT);
144 pgonZ.emplace_back(cableT * (rin /
rMax - 0.5));
145 pgonZ.emplace_back(0.5 * cableT);
146 vector<double> pgonRmin;
147 pgonRmin.emplace_back(rin);
148 pgonRmin.emplace_back(rin);
149 pgonRmin.emplace_back(rin);
150 vector<double> pgonRmax;
151 pgonRmax.emplace_back(rout);
152 pgonRmax.emplace_back(rout);
153 pgonRmax.emplace_back(rout);
155 edm::LogVerbatim(
"TOBGeom") << solid.name() <<
" Polycone made of " << cableM[
i] <<
" from 0 to " 156 <<
convertRadToDeg(2_pi) <<
" and with " << pgonZ.size() <<
" sections";
157 for (
int ii = 0;
ii < (
int)(pgonZ.size());
ii++)
159 <<
"\tRmax = " << pgonRmax[
ii];
161 Position r3(0, 0, (diskDz - (
i + 0.5) * cableT));
162 disk.placeVolume(cableLogic,
i + 1, r3);
163 edm::LogVerbatim(
"TOBGeom") << solid.name() <<
" number " <<
i + 1 <<
" positioned in " << disk.name() <<
" at " 164 << r3 <<
" with no rotation";
166 edm::LogVerbatim(
"TOBGeom") <<
"<<== End of DDTOBRadCableAlgo construction ...";
Log< level::Info, true > LogVerbatim
constexpr NumType convertRadToDeg(NumType radians)
static long algorithm(Detector &, cms::DDParsingContext &ctxt, xml_h e)
dd4hep::Material material(const std::string &name) const
const std::string names[nVars_]
#define DECLARE_DDCMS_DETELEMENT(name, func)
std::string_view name() const
dd4hep::Volume addVolume(dd4hep::Volume vol) const
Namespace of DDCMS conversion namespace.
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