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");
37 LogDebug(
"TOBGeom") <<
"DDTOBRadCableAlgo debug: Parent " << parentName <<
" NameSpace " << ns.
name();
38 LogDebug(
"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 LogDebug(
"TOBGeom") <<
"\t[" <<
i <<
"]\tRin = " << rodRin[
i] <<
"\tRout = " << rodRout[
i] <<
" " << cableM[
i];
42 LogDebug(
"TOBGeom") <<
"DDTOBRadCableAlgo debug: Connector Width = " << connW <<
"\tThickness = " << connT
44 for (
int i = 0;
i < (
int)(connM.size());
i++)
45 LogDebug(
"TOBGeom") <<
"\tconnM[" <<
i <<
"] = " << connM[
i];
46 LogDebug(
"TOBGeom") <<
"DDTOBRadCableAlgo debug: Cool Manifold Torus Rin = " << coolRin <<
" Rout = " << coolRout1
47 <<
"\t Phi start = " << coolStartPhi1 <<
" Phi Range = " << coolDeltaPhi1
48 <<
"\t Material = " << coolM1 <<
"\t Radial positions:";
49 for (
int i = 0;
i < (
int)(coolR1.size());
i++)
50 LogDebug(
"TOBGeom") <<
"\t[" <<
i <<
"]\tR = " << coolR1[
i];
51 for (
int i = 0;
i < (
int)(coolR2.size());
i++)
52 LogDebug(
"TOBGeom") <<
"\t[" <<
i <<
"]\tR = " << coolR2[
i];
53 LogDebug(
"TOBGeom") <<
"DDTOBRadCableAlgo debug: Cooling Fluid Torus Rin = " << coolRin <<
" Rout = " << coolRout2
54 <<
"\t Phi start = " << coolStartPhi2 <<
" Phi Range = " << coolDeltaPhi2
55 <<
"\t Material = " << coolM2 <<
"\t Radial positions:";
56 for (
int i = 0;
i < (
int)(coolR1.size());
i++)
57 LogDebug(
"TOBGeom") <<
"\t[" <<
i <<
"]\tR = " << coolR1[
i];
58 for (
int i = 0;
i < (
int)(coolR2.size());
i++)
59 LogDebug(
"TOBGeom") <<
"\t[" <<
i <<
"]\tR = " << coolR2[
i];
60 for (
int i = 0;
i < (
int)(names.size());
i++)
61 LogDebug(
"TOBGeom") <<
"DDTOBRadCableAlgo debug: names[" <<
i <<
"] = " << names[
i];
65 for (
int i = 0;
i < (
int)(names.size());
i++) {
71 name =
"TOBCoolingManifold" + names[
i] +
"a";
73 solid = ns.
addSolid(name, Torus(coolR1[
i], coolRin, coolRout1, coolStartPhi1, coolDeltaPhi1));
74 LogDebug(
"TOBGeom") << name <<
" Torus made of " << coolM1 <<
" from " <<
convertRadToDeg(coolStartPhi1) <<
" to " 75 <<
convertRadToDeg((coolStartPhi1 + coolDeltaPhi1)) <<
" with Rin " << coolRin <<
" Rout " 76 << coolRout1 <<
" R torus " << coolR1[
i];
78 Position
r1(0, 0, (dz - diskDz));
79 disk.placeVolume(coolManifoldLogic_a, i + 1, r1);
80 LogDebug(
"TOBGeom") << name <<
" number " << i + 1 <<
" positioned in " << disk.name() <<
" at " << r1
81 <<
" with no rotation";
84 name =
"TOBCoolingManifoldFluid" + names[
i] +
"a";
85 solid = ns.
addSolid(name, Torus(coolR1[i], coolRin, coolRout2, coolStartPhi2, coolDeltaPhi2));
86 LogDebug(
"TOBGeom") << name <<
" Torus made of " << coolM2 <<
" from " <<
convertRadToDeg(coolStartPhi2) <<
" to " 87 <<
convertRadToDeg((coolStartPhi2 + coolDeltaPhi2)) <<
" with Rin " << coolRin <<
" Rout " 88 << coolRout2 <<
" R torus " << coolR1[
i];
90 disk.placeVolume(coolManifoldFluidLogic_a, i + 1);
91 LogDebug(
"TOBGeom") << name <<
" number " << i + 1 <<
" positioned in " << coolM2
92 <<
" with no translation and no rotation";
94 name =
"TOBCoolingManifold" + names[
i] +
"r";
96 solid = ns.
addSolid(name, Torus(coolR2[i], coolRin, coolRout1, coolStartPhi1, coolDeltaPhi1));
97 LogDebug(
"TOBGeom") << name <<
" Torus made of " << coolM1 <<
" from " <<
convertRadToDeg(coolStartPhi1) <<
" to " 98 <<
convertRadToDeg((coolStartPhi1 + coolDeltaPhi1)) <<
" with Rin " << coolRin <<
" Rout " 99 << coolRout1 <<
" R torus " << coolR2[
i];
101 r1 = Position(0, 0, (dz - diskDz));
102 disk.placeVolume(coolManifoldLogic_r, i + 1, r1);
103 LogDebug(
"TOBGeom") << name <<
" number " << i + 1 <<
" positioned in " << disk.name() <<
" at " << r1
104 <<
" with no rotation";
107 name =
"TOBCoolingManifoldFluid" + names[
i] +
"r";
108 solid = ns.
addSolid(name, Torus(coolR2[i], coolRin, coolRout2, coolStartPhi2, coolDeltaPhi2));
109 LogDebug(
"TOBGeom") << name <<
" Torus made of " << coolM2 <<
" from " <<
convertRadToDeg(coolStartPhi2) <<
" to " 110 <<
convertRadToDeg((coolStartPhi2 + coolDeltaPhi2)) <<
" with Rin " << coolRin <<
" Rout " 111 << coolRout2 <<
" R torus " << coolR2[
i];
113 disk.placeVolume(coolManifoldFluidLogic_r, i + 1);
114 LogDebug(
"TOBGeom") << name <<
" number " << i + 1 <<
" positioned in " << coolM2
115 <<
" with no translation and no rotation";
118 name =
"TOBConn" + names[
i];
120 rin = 0.5 * (rodRin[
i] + rodRout[
i]) - 0.5 * connW;
121 rout = 0.5 * (rodRin[
i] + rodRout[
i]) + 0.5 * connW;
122 solid = ns.
addSolid(name, Tube(rin, rout, dz));
124 <<
" with Rin " << rin <<
" Rout " << rout <<
" ZHalf " <<
dz;
126 Position
r2(0, 0, (dz - diskDz));
127 disk.placeVolume(connLogic, i + 1, r2);
128 LogDebug(
"TOBGeom") << name <<
" number " << i + 1 <<
" positioned in " << disk.name() <<
" at " << r2
129 <<
" with no rotation";
132 name =
"TOBRadServices" + names[
i];
133 rin = 0.5 * (rodRin[
i] + rodRout[
i]);
134 rout = (i + 1 == (
int)(names.size()) ? rMax : 0.5 * (rodRin[i + 1] + rodRout[i + 1]));
135 vector<double> pgonZ;
136 pgonZ.emplace_back(-0.5 * cableT);
137 pgonZ.emplace_back(cableT * (rin / rMax - 0.5));
138 pgonZ.emplace_back(0.5 * cableT);
139 vector<double> pgonRmin;
140 pgonRmin.emplace_back(rin);
141 pgonRmin.emplace_back(rin);
142 pgonRmin.emplace_back(rin);
143 vector<double> pgonRmax;
144 pgonRmax.emplace_back(rout);
145 pgonRmax.emplace_back(rout);
146 pgonRmax.emplace_back(rout);
147 solid = ns.
addSolid(name, Polycone(0, 2_pi, pgonRmin, pgonRmax, pgonZ));
149 <<
" and with " << pgonZ.size() <<
" sections";
150 for (
int ii = 0;
ii < (
int)(pgonZ.size());
ii++)
151 LogDebug(
"TOBGeom") <<
"\t[" <<
ii <<
"]\tZ = " << pgonZ[
ii] <<
"\tRmin = " << pgonRmin[
ii]
152 <<
"\tRmax = " << pgonRmax[
ii];
154 Position r3(0, 0, (diskDz - (i + 0.5) * cableT));
155 disk.placeVolume(cableLogic, i + 1, r3);
156 LogDebug(
"TOBGeom") << name <<
" number " << i + 1 <<
" positioned in " << disk.name() <<
" at " << r3
157 <<
" with no rotation";
159 LogDebug(
"TOBGeom") <<
"<<== End of DDTOBRadCableAlgo construction ...";
dd4hep::Volume volume(const std::string &name, bool exc=true) const
constexpr NumType convertRadToDeg(NumType radians)
dd4hep::Volume addVolume(dd4hep::Volume vol) const
Add rotation matrix to current namespace.
const std::string names[nVars_]
std::string_view name() const
static long algorithm(Detector &, cms::DDParsingContext &ctxt, xml_h e, SensitiveDetector &)
dd4hep::Material material(const std::string &name) const
Namespace of DDCMS conversion namespace.
dd4hep::Solid addSolid(const std::string &name, dd4hep::Solid solid) const
std::vector< double > vecDble(const std::string &nam) const
Shortcut to access vector<double> arguments.
double dble(const std::string &nam) const
Shortcut to access double arguments.
std::vector< std::string > vecStr(const std::string &nam) const
Shortcut to access vector<string> arguments.
#define DECLARE_DDCMS_DETELEMENT(name, func)
std::string parentName() const
Access value of rParent child node.
std::string str(const std::string &nam) const
Shortcut to access string arguments.