CMS 3D CMS Logo

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, SensitiveDetector &)
 
 DD4HEP_OPEN_PLUGIN (dd4hep, ddcms_det_element_DDCMS_track_DDTOBRadCableAlgo)
 

Function Documentation

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

Definition at line 11 of file DDTOBRadCableAlgo.cc.

References cms::DDNamespace::addSolid(), cms::DDNamespace::addVolume(), writedatasetfile::args, angle_units::operators::convertRadToDeg(), cms::DDAlgoArguments::dble(), PVValHelper::dz, mps_fire::i, cuy::ii, createfilelist::int, LogDebug, cms::DDNamespace::material(), Skims_PA_cff::name, cms::DDNamespace::name(), names, cms::DDAlgoArguments::parentName(), diffTwoXMLs::r1, diffTwoXMLs::r2, photonAnalyzer_cfi::rMax, cms::DDAlgoArguments::str(), cms::DDAlgoArguments::vecDble(), cms::DDAlgoArguments::vecStr(), 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  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
43  << "\tMaterials: ";
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];
62 
63  Volume disk = ns.volume(parentName);
64  // Loop over sub disks
65  for (int i = 0; i < (int)(names.size()); i++) {
66  Solid solid;
67  string name;
68  double dz, rin, rout;
69 
70  // Cooling Manifolds
71  name = "TOBCoolingManifold" + names[i] + "a";
72  dz = coolRout1;
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];
77  Volume coolManifoldLogic_a = ns.addVolume(Volume(name, solid, ns.material(coolM1)));
78  Position r1(0, 0, (dz - diskDz));
79  disk.placeVolume(coolManifoldLogic_a, i + 1, r1); // i+1
80  LogDebug("TOBGeom") << name << " number " << i + 1 << " positioned in " << disk.name() << " at " << r1
81  << " with no rotation";
82 
83  // Cooling Fluid (in Cooling Manifold)
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];
89  Volume coolManifoldFluidLogic_a = ns.addVolume(Volume(name, solid, ns.material(coolM2)));
90  disk.placeVolume(coolManifoldFluidLogic_a, i + 1); // i+1
91  LogDebug("TOBGeom") << name << " number " << i + 1 << " positioned in " << coolM2
92  << " with no translation and no rotation";
93 
94  name = "TOBCoolingManifold" + names[i] + "r";
95  dz = coolRout1;
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];
100  Volume coolManifoldLogic_r = ns.addVolume(Volume(name, solid, ns.material(coolM1)));
101  r1 = Position(0, 0, (dz - diskDz));
102  disk.placeVolume(coolManifoldLogic_r, i + 1, r1); // i+1
103  LogDebug("TOBGeom") << name << " number " << i + 1 << " positioned in " << disk.name() << " at " << r1
104  << " with no rotation";
105 
106  // Cooling Fluid (in Cooling Manifold)
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];
112  Volume coolManifoldFluidLogic_r = ns.addVolume(Volume(name, solid, ns.material(coolM2)));
113  disk.placeVolume(coolManifoldFluidLogic_r, i + 1); // i+1
114  LogDebug("TOBGeom") << name << " number " << i + 1 << " positioned in " << coolM2
115  << " with no translation and no rotation";
116 
117  // Connectors
118  name = "TOBConn" + names[i];
119  dz = 0.5 * connT;
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));
123  LogDebug("TOBGeom") << name << " Tubs made of " << connM[i] << " from 0 to " << convertRadToDeg(2_pi)
124  << " with Rin " << rin << " Rout " << rout << " ZHalf " << dz;
125  Volume connLogic = ns.addVolume(Volume(name, solid, ns.material(connM[i])));
126  Position r2(0, 0, (dz - diskDz));
127  disk.placeVolume(connLogic, i + 1, r2); // i+1
128  LogDebug("TOBGeom") << name << " number " << i + 1 << " positioned in " << disk.name() << " at " << r2
129  << " with no rotation";
130 
131  // Now the radial cable
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));
148  LogDebug("TOBGeom") << name << " Polycone made of " << cableM[i] << " from 0 to " << convertRadToDeg(2_pi)
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];
153  Volume cableLogic = ns.addVolume(Volume(name, solid, ns.material(cableM[i])));
154  Position r3(0, 0, (diskDz - (i + 0.5) * cableT));
155  disk.placeVolume(cableLogic, i + 1, r3); // i+1
156  LogDebug("TOBGeom") << name << " number " << i + 1 << " positioned in " << disk.name() << " at " << r3
157  << " with no rotation";
158  }
159  LogDebug("TOBGeom") << "<<== End of DDTOBRadCableAlgo construction ...";
160  return 1;
161 }
#define LogDebug(id)
constexpr NumType convertRadToDeg(NumType radians)
Definition: angle_units.h:21
const std::string names[nVars_]
dd4hep::Volume Volume
ii
Definition: cuy.py:590
DD4HEP_OPEN_PLUGIN ( dd4hep  ,
ddcms_det_element_DDCMS_track_DDTOBRadCableAlgo   
)

Definition at line 164 of file DDTOBRadCableAlgo.cc.