CMS 3D CMS Logo

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
Functions
DDTOBRadCableAlgo.cc File Reference
#include "DD4hep/DetFactoryHelper.h"
#include "DataFormats/Math/interface/CMSUnits.h"
#include "DetectorDescription/DDCMS/interface/DDPlugins.h"
#include "FWCore/MessageLogger/interface/MessageLogger.h"

Go to the source code of this file.

Functions

static long algorithm (Detector &, cms::DDParsingContext &ctxt, xml_h e)
 
 DD4HEP_OPEN_PLUGIN (dd4hep, ddcms_det_element_DDCMS_track_DDTOBRadCableAlgo)
 

Function Documentation

◆ algorithm()

static long algorithm ( Detector &  ,
cms::DDParsingContext ctxt,
xml_h  e 
)
static

Definition at line 11 of file DDTOBRadCableAlgo.cc.

References cms::DDNamespace::addSolid(), cms::DDNamespace::addVolume(), writedatasetfile::args, angle_units::operators::convertRadToDeg(), PVValHelper::dz, MillePedeFileConverter_cfg::e, mps_fire::i, cuy::ii, createfilelist::int, cms::DDNamespace::material(), Skims_PA_cff::name, cms::DDNamespace::name(), names, PixelTestBeamValidation_cfi::Position, cms::DDNamespace::prepend(), diffTwoXMLs::r1, diffTwoXMLs::r2, photonAnalyzer_cfi::rMax, and cms::DDNamespace::volume().

11  {
12  cms::DDNamespace ns(ctxt, e, true);
13  DDAlgoArguments args(ctxt, e);
14  double diskDz = args.dble("DiskDz"); // Disk thickness
15  double rMax = args.dble("RMax"); // Maximum radius
16  double cableT = args.dble("CableT"); // Cable thickness
17  vector<double> rodRin = args.vecDble("RodRin"); // Radii for inner rods
18  vector<double> rodRout = args.vecDble("RodRout"); // Radii for outer rods
19  vector<string> cableM = args.vecStr("CableMaterial"); // Materials for cables
20  double connW = args.dble("ConnW"); // Connector width
21  double connT = args.dble("ConnT"); // Connector thickness
22  vector<string> connM = args.vecStr("ConnMaterial"); // Materials for connectors
23  vector<double> coolR1 = args.vecDble("CoolR1"); // Radii for cooling manifold
24  vector<double> coolR2 = args.vecDble("CoolR2"); // Radii for return cooling manifold
25  double coolRin = args.dble("CoolRin"); // Inner radius of cooling manifold
26  double coolRout1 = args.dble("CoolRout1"); // Outer radius of cooling manifold
27  double coolRout2 = args.dble("CoolRout2"); // Outer radius of cooling fluid in cooling manifold
28  double coolStartPhi1 = args.dble("CoolStartPhi1"); // Starting Phi of cooling manifold
29  double coolDeltaPhi1 = args.dble("CoolDeltaPhi1"); // Phi Range of cooling manifold
30  double coolStartPhi2 = args.dble("CoolStartPhi2"); // Starting Phi of cooling fluid in of cooling manifold
31  double coolDeltaPhi2 = args.dble("CoolDeltaPhi2"); // Phi Range of of cooling fluid in cooling manifold
32  string coolM1 = args.str("CoolMaterial1"); // Material for cooling manifold
33  string coolM2 = args.str("CoolMaterial2"); // Material for cooling fluid
34  vector<string> names = args.vecStr("RingName"); // Names of layers
35 
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] << " "
42  << cableM[i];
43  edm::LogVerbatim("TOBGeom") << "DDTOBRadCableAlgo debug: Connector Width = " << connW << "\tThickness = " << connT
44  << "\tMaterials: ";
45  for (int i = 0; i < (int)(connM.size()); i++)
46  edm::LogVerbatim("TOBGeom") << "\tconnM[" << i << "] = " << connM[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++)
52  edm::LogVerbatim("TOBGeom") << "\t[" << i << "]\tR = " << coolR1[i];
53  for (int i = 0; i < (int)(coolR2.size()); i++)
54  edm::LogVerbatim("TOBGeom") << "\t[" << i << "]\tR = " << coolR2[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++)
60  edm::LogVerbatim("TOBGeom") << "\t[" << i << "]\tR = " << coolR1[i];
61  for (int i = 0; i < (int)(coolR2.size()); i++)
62  edm::LogVerbatim("TOBGeom") << "\t[" << i << "]\tR = " << coolR2[i];
63  for (int i = 0; i < (int)(names.size()); i++)
64  edm::LogVerbatim("TOBGeom") << "DDTOBRadCableAlgo debug: names[" << i << "] = " << names[i];
65 
66  Volume disk = ns.volume(parentName);
67  // Loop over sub disks
68  for (int i = 0; i < (int)(names.size()); i++) {
69  Solid solid;
70  string name;
71  double dz, rin, rout;
72 
73  // Cooling Manifolds
74  name = "TOBCoolingManifold" + names[i] + "a";
75  dz = coolRout1;
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 "
78  << convertRadToDeg(coolStartPhi1) << " to "
79  << convertRadToDeg((coolStartPhi1 + coolDeltaPhi1)) << " with Rin " << coolRin
80  << " Rout " << coolRout1 << " R torus " << coolR1[i];
81  Volume coolManifoldLogic_a = ns.addVolume(Volume(solid.name(), solid, ns.material(coolM1)));
82  Position r1(0, 0, (dz - diskDz));
83  disk.placeVolume(coolManifoldLogic_a, i + 1, r1); // i+1
84  edm::LogVerbatim("TOBGeom") << solid.name() << " number " << i + 1 << " positioned in " << disk.name() << " at "
85  << r1 << " with no rotation";
86 
87  // Cooling Fluid (in Cooling Manifold)
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 "
91  << convertRadToDeg(coolStartPhi2) << " to "
92  << convertRadToDeg((coolStartPhi2 + coolDeltaPhi2)) << " with Rin " << coolRin
93  << " Rout " << coolRout2 << " R torus " << coolR1[i];
94  Volume coolManifoldFluidLogic_a = ns.addVolume(Volume(solid.name(), solid, ns.material(coolM2)));
95  coolManifoldLogic_a.placeVolume(coolManifoldFluidLogic_a, i + 1); // i+1
96  edm::LogVerbatim("TOBGeom") << solid.name() << " number " << i + 1 << " positioned in " << coolM2
97  << " with no translation and no rotation";
98 
99  name = "TOBCoolingManifold" + names[i] + "r";
100  dz = coolRout1;
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 "
103  << convertRadToDeg(coolStartPhi1) << " to "
104  << convertRadToDeg((coolStartPhi1 + coolDeltaPhi1)) << " with Rin " << coolRin
105  << " Rout " << coolRout1 << " R torus " << coolR2[i];
106  Volume coolManifoldLogic_r = ns.addVolume(Volume(solid.name(), solid, ns.material(coolM1)));
107  r1 = Position(0, 0, (dz - diskDz));
108  disk.placeVolume(coolManifoldLogic_r, i + 1, r1); // i+1
109  edm::LogVerbatim("TOBGeom") << solid.name() << " number " << i + 1 << " positioned in " << disk.name() << " at "
110  << r1 << " with no rotation";
111 
112  // Cooling Fluid (in Cooling Manifold)
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 "
116  << convertRadToDeg(coolStartPhi2) << " to "
117  << convertRadToDeg((coolStartPhi2 + coolDeltaPhi2)) << " with Rin " << coolRin
118  << " Rout " << coolRout2 << " R torus " << coolR2[i];
119  Volume coolManifoldFluidLogic_r = ns.addVolume(Volume(solid.name(), solid, ns.material(coolM2)));
120  coolManifoldLogic_r.placeVolume(coolManifoldFluidLogic_r, i + 1); // i+1
121  edm::LogVerbatim("TOBGeom") << solid.name() << " number " << i + 1 << " positioned in " << coolM2
122  << " with no translation and no rotation";
123 
124  // Connectors
125  name = "TOBConn" + names[i];
126  dz = 0.5 * connT;
127  rin = 0.5 * (rodRin[i] + rodRout[i]) - 0.5 * connW;
128  rout = 0.5 * (rodRin[i] + rodRout[i]) + 0.5 * connW;
129  solid = ns.addSolid(ns.prepend(name), Tube(rin, rout, dz));
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;
132  Volume connLogic = ns.addVolume(Volume(solid.name(), solid, ns.material(connM[i])));
133  Position r2(0, 0, (dz - diskDz));
134  disk.placeVolume(connLogic, i + 1, r2); // i+1
135  edm::LogVerbatim("TOBGeom") << solid.name() << " number " << i + 1 << " positioned in " << disk.name() << " at "
136  << r2 << " with no rotation";
137 
138  // Now the radial cable
139  name = "TOBRadServices" + names[i];
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);
154  solid = ns.addSolid(ns.prepend(name), Polycone(0, 2_pi, pgonRmin, pgonRmax, pgonZ));
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++)
158  edm::LogVerbatim("TOBGeom") << "\t[" << ii << "]\tZ = " << pgonZ[ii] << "\tRmin = " << pgonRmin[ii]
159  << "\tRmax = " << pgonRmax[ii];
160  Volume cableLogic = ns.addVolume(Volume(solid.name(), solid, ns.material(cableM[i])));
161  Position r3(0, 0, (diskDz - (i + 0.5) * cableT));
162  disk.placeVolume(cableLogic, i + 1, r3); // i+1
163  edm::LogVerbatim("TOBGeom") << solid.name() << " number " << i + 1 << " positioned in " << disk.name() << " at "
164  << r3 << " with no rotation";
165  }
166  edm::LogVerbatim("TOBGeom") << "<<== End of DDTOBRadCableAlgo construction ...";
167  return 1;
168 }
Log< level::Info, true > LogVerbatim
constexpr NumType convertRadToDeg(NumType radians)
Definition: angle_units.h:21
const std::string names[nVars_]
dd4hep::Volume Volume
ii
Definition: cuy.py:589

◆ DD4HEP_OPEN_PLUGIN()

DD4HEP_OPEN_PLUGIN ( dd4hep  ,
ddcms_det_element_DDCMS_track_DDTOBRadCableAlgo   
)

Definition at line 171 of file DDTOBRadCableAlgo.cc.