CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
DDTOBRadCableAlgo.cc
Go to the documentation of this file.
1 // File: DDTOBRadCableAlgo.cc
3 // Description: Equipping the side disks of TOB with cables etc
5 
15 #include "CLHEP/Units/GlobalPhysicalConstants.h"
16 #include "CLHEP/Units/GlobalSystemOfUnits.h"
17 
18 #include <string>
19 #include <vector>
20 
21 using namespace std;
22 
23 class DDTOBRadCableAlgo : public DDAlgorithm {
24 public:
25  //Constructor and Destructor
27  ~DDTOBRadCableAlgo() override;
28 
29  void initialize(const DDNumericArguments& nArgs,
30  const DDVectorArguments& vArgs,
31  const DDMapArguments& mArgs,
32  const DDStringArguments& sArgs,
33  const DDStringVectorArguments& vsArgs) override;
34 
35  void execute(DDCompactView& cpv) override;
36 
37 private:
38  string idNameSpace; // Namespace of this and ALL sub-parts
39 
40  double diskDz; // Disk thickness
41  double rMax; // Maximum radius
42  double cableT; // Cable thickness
43  vector<double> rodRin; // Radii for inner rods
44  vector<double> rodRout; // Radii for outer rods
45  vector<string> cableM; // Materials for cables
46  double connW; // Connector width
47  double connT; // Connector thickness
48  vector<string> connM; // Materials for connectors
49  vector<double> coolR1; // Radii for cooling manifold
50  vector<double> coolR2; // Radii for return cooling manifold
51  double coolRin; // Inner radius of cooling manifold
52  double coolRout1; // Outer radius of cooling manifold
53  double coolRout2; // Outer radius of cooling fluid in cooling manifold
54  double coolStartPhi1; // Starting Phi of cooling manifold
55  double coolDeltaPhi1; // Phi Range of cooling manifold
56  double coolStartPhi2; // Starting Phi of cooling fluid in of cooling manifold
57  double coolDeltaPhi2; // Phi Range of of cooling fluid in cooling manifold
58  string coolM1; // Material for cooling manifold
59  string coolM2; // Material for cooling fluid
60  vector<string> names; // Names of layers
61 };
62 
64  : rodRin(0),
65  rodRout(0),
66  cableM(0),
67  connM(0),
68  coolR1(0),
69  coolR2(0),
70  coolRin(0),
71  coolRout1(0),
72  coolRout2(0),
73  coolStartPhi1(0),
74  coolDeltaPhi1(0),
75  coolStartPhi2(0),
76  coolDeltaPhi2(0),
77  names(0) {
78  LogDebug("TOBGeom") << "DDTOBRadCableAlgo info: Creating an instance";
79 }
80 
82 
84  const DDVectorArguments& vArgs,
85  const DDMapArguments&,
86  const DDStringArguments& sArgs,
87  const DDStringVectorArguments& vsArgs) {
89  DDName parentName = parent().name();
90  LogDebug("TOBGeom") << "DDTOBRadCableAlgo debug: Parent " << parentName << " NameSpace " << idNameSpace;
91 
92  diskDz = nArgs["DiskDz"];
93  rMax = nArgs["RMax"];
94  cableT = nArgs["CableT"];
95  rodRin = vArgs["RodRin"];
96  rodRout = vArgs["RodRout"];
97  cableM = vsArgs["CableMaterial"];
98  LogDebug("TOBGeom") << "DDTOBRadCableAlgo debug: Disk Half width " << diskDz << "\tRMax " << rMax
99  << "\tCable Thickness " << cableT << "\tRadii of disk position and cable materials:";
100  for (int i = 0; i < (int)(rodRin.size()); i++)
101  LogDebug("TOBGeom") << "\t[" << i << "]\tRin = " << rodRin[i] << "\tRout = " << rodRout[i] << " " << cableM[i];
102 
103  connW = nArgs["ConnW"];
104  connT = nArgs["ConnT"];
105  connM = vsArgs["ConnMaterial"];
106  LogDebug("TOBGeom") << "DDTOBRadCableAlgo debug: Connector Width = " << connW << "\tThickness = " << connT
107  << "\tMaterials: ";
108  for (int i = 0; i < (int)(connM.size()); i++)
109  LogDebug("TOBGeom") << "\tconnM[" << i << "] = " << connM[i];
110 
111  coolR1 = vArgs["CoolR1"];
112  coolR2 = vArgs["CoolR2"];
113  coolRin = nArgs["CoolRin"];
114  coolRout1 = nArgs["CoolRout1"];
115  coolRout2 = nArgs["CoolRout2"];
116  coolStartPhi1 = nArgs["CoolStartPhi1"];
117  coolDeltaPhi1 = nArgs["CoolDeltaPhi1"];
118  coolStartPhi2 = nArgs["CoolStartPhi2"];
119  coolDeltaPhi2 = nArgs["CoolDeltaPhi2"];
120  coolM1 = sArgs["CoolMaterial1"];
121  coolM2 = sArgs["CoolMaterial2"];
122  LogDebug("TOBGeom") << "DDTOBRadCableAlgo debug: Cool Manifold Torus Rin = " << coolRin << " Rout = " << coolRout1
123  << "\t Phi start = " << coolStartPhi1 << " Phi Range = " << coolDeltaPhi1
124  << "\t Material = " << coolM1 << "\t Radial positions:";
125  for (int i = 0; i < (int)(coolR1.size()); i++)
126  LogDebug("TOBGeom") << "\t[" << i << "]\tR = " << coolR1[i];
127  for (int i = 0; i < (int)(coolR2.size()); i++)
128  LogDebug("TOBGeom") << "\t[" << i << "]\tR = " << coolR2[i];
129  LogDebug("TOBGeom") << "DDTOBRadCableAlgo debug: Cooling Fluid Torus Rin = " << coolRin << " Rout = " << coolRout2
130  << "\t Phi start = " << coolStartPhi2 << " Phi Range = " << coolDeltaPhi2
131  << "\t Material = " << coolM2 << "\t Radial positions:";
132  for (int i = 0; i < (int)(coolR1.size()); i++)
133  LogDebug("TOBGeom") << "\t[" << i << "]\tR = " << coolR1[i];
134  for (int i = 0; i < (int)(coolR2.size()); i++)
135  LogDebug("TOBGeom") << "\t[" << i << "]\tR = " << coolR2[i];
136 
137  names = vsArgs["RingName"];
138  for (int i = 0; i < (int)(names.size()); i++)
139  LogDebug("TOBGeom") << "DDTOBRadCableAlgo debug: names[" << i << "] = " << names[i];
140 }
141 
143  LogDebug("TOBGeom") << "==>> Constructing DDTOBRadCableAlgo...";
144  DDName diskName = parent().name();
145 
146  // Loop over sub disks
147  for (int i = 0; i < (int)(names.size()); i++) {
148  DDSolid solid;
149  string name;
150  double dz, rin, rout;
151 
152  // Cooling Manifolds
153  name = "TOBCoolingManifold" + names[i] + "a";
154  dz = coolRout1;
155  DDName manifoldName_a(name, idNameSpace);
157  LogDebug("TOBGeom") << "DDTOBRadCableAlgo test: " << DDName(name, idNameSpace) << " Torus made of " << coolM1
158  << " from " << coolStartPhi1 / CLHEP::deg << " to "
159  << (coolStartPhi1 + coolDeltaPhi1) / CLHEP::deg << " with Rin " << coolRin << " Rout "
160  << coolRout1 << " R torus " << coolR1[i];
161  DDName coolManifoldName_a(DDSplit(coolM1).first, DDSplit(coolM1).second);
162  DDMaterial coolManifoldMatter_a(coolManifoldName_a);
163  DDLogicalPart coolManifoldLogic_a(DDName(name, idNameSpace), coolManifoldMatter_a, solid);
164 
165  DDTranslation r1(0, 0, (dz - diskDz));
166  cpv.position(DDName(name, idNameSpace), diskName, i + 1, r1, DDRotation());
167  LogDebug("TOBGeom") << "DDTOBRadCableAlgo test: " << DDName(name, idNameSpace) << " number " << i + 1
168  << " positioned in " << diskName << " at " << r1 << " with no rotation";
169  // Cooling Fluid (in Cooling Manifold)
170  name = "TOBCoolingManifoldFluid" + names[i] + "a";
171  solid =
173  LogDebug("TOBGeom") << "DDTOBRadCableAlgo test: " << DDName(name, idNameSpace) << " Torus made of " << coolM2
174  << " from " << coolStartPhi2 / CLHEP::deg << " to "
175  << (coolStartPhi2 + coolDeltaPhi2) / CLHEP::deg << " with Rin " << coolRin << " Rout "
176  << coolRout2 << " R torus " << coolR1[i];
177  DDName coolManifoldFluidName_a(DDSplit(coolM2).first, DDSplit(coolM2).second);
178  DDMaterial coolManifoldFluidMatter_a(coolManifoldFluidName_a);
179  DDLogicalPart coolManifoldFluidLogic_a(DDName(name, idNameSpace), coolManifoldFluidMatter_a, solid);
180  cpv.position(DDName(name, idNameSpace), manifoldName_a, i + 1, DDTranslation(), DDRotation());
181  LogDebug("TOBGeom") << "DDTOBRadCableAlgo test: " << DDName(name, idNameSpace) << " number " << i + 1
182  << " positioned in " << coolManifoldName_a << " with no translation and no rotation";
183  //
184  name = "TOBCoolingManifold" + names[i] + "r";
185  dz = coolRout1;
186  DDName manifoldName_r(name, idNameSpace);
188  LogDebug("TOBGeom") << "DDTOBRadCableAlgo test: " << DDName(name, idNameSpace) << " Torus made of " << coolM1
189  << " from " << coolStartPhi1 / CLHEP::deg << " to "
190  << (coolStartPhi1 + coolDeltaPhi1) / CLHEP::deg << " with Rin " << coolRin << " Rout "
191  << coolRout1 << " R torus " << coolR2[i];
192  DDName coolManifoldName_r(DDSplit(coolM1).first, DDSplit(coolM1).second);
193  DDMaterial coolManifoldMatter_r(coolManifoldName_r);
194  DDLogicalPart coolManifoldLogic_r(DDName(name, idNameSpace), coolManifoldMatter_r, solid);
195 
196  r1 = DDTranslation(0, 0, (dz - diskDz));
197  cpv.position(DDName(name, idNameSpace), diskName, i + 1, r1, DDRotation());
198  LogDebug("TOBGeom") << "DDTOBRadCableAlgo test: " << DDName(name, idNameSpace) << " number " << i + 1
199  << " positioned in " << diskName << " at " << r1 << " with no rotation";
200  // Cooling Fluid (in Cooling Manifold)
201  name = "TOBCoolingManifoldFluid" + names[i] + "r";
202  solid =
204  LogDebug("TOBGeom") << "DDTOBRadCableAlgo test: " << DDName(name, idNameSpace) << " Torus made of " << coolM2
205  << " from " << coolStartPhi2 / CLHEP::deg << " to "
206  << (coolStartPhi2 + coolDeltaPhi2) / CLHEP::deg << " with Rin " << coolRin << " Rout "
207  << coolRout2 << " R torus " << coolR2[i];
208  DDName coolManifoldFluidName_r(DDSplit(coolM2).first, DDSplit(coolM2).second);
209  DDMaterial coolManifoldFluidMatter_r(coolManifoldFluidName_r);
210  DDLogicalPart coolManifoldFluidLogic_r(DDName(name, idNameSpace), coolManifoldFluidMatter_r, solid);
211  cpv.position(DDName(name, idNameSpace), manifoldName_r, i + 1, DDTranslation(), DDRotation());
212  LogDebug("TOBGeom") << "DDTOBRadCableAlgo test: " << DDName(name, idNameSpace) << " number " << i + 1
213  << " positioned in " << coolManifoldName_r << " with no translation and no rotation";
214 
215  // Connectors
216  name = "TOBConn" + names[i];
217  dz = 0.5 * connT;
218  rin = 0.5 * (rodRin[i] + rodRout[i]) - 0.5 * connW;
219  rout = 0.5 * (rodRin[i] + rodRout[i]) + 0.5 * connW;
220  solid = DDSolidFactory::tubs(DDName(name, idNameSpace), dz, rin, rout, 0, CLHEP::twopi);
221  LogDebug("TOBGeom") << "DDTOBRadCableAlgo test: " << DDName(name, idNameSpace) << " Tubs made of " << connM[i]
222  << " from 0 to " << CLHEP::twopi / CLHEP::deg << " with Rin " << rin << " Rout " << rout
223  << " ZHalf " << dz;
224  DDName connName(DDSplit(connM[i]).first, DDSplit(connM[i]).second);
225  DDMaterial connMatter(connName);
226  DDLogicalPart connLogic(DDName(name, idNameSpace), connMatter, solid);
227 
228  DDTranslation r2(0, 0, (dz - diskDz));
229  cpv.position(DDName(name, idNameSpace), diskName, i + 1, r2, DDRotation());
230  LogDebug("TOBGeom") << "DDTOBRadCableAlgo test: " << DDName(name, idNameSpace) << " number " << i + 1
231  << " positioned in " << diskName << " at " << r2 << " with no rotation";
232 
233  // Now the radial cable
234  name = "TOBRadServices" + names[i];
235  rin = 0.5 * (rodRin[i] + rodRout[i]);
236  rout = (i + 1 == (int)(names.size()) ? rMax : 0.5 * (rodRin[i + 1] + rodRout[i + 1]));
237  vector<double> pgonZ;
238  pgonZ.emplace_back(-0.5 * cableT);
239  pgonZ.emplace_back(cableT * (rin / rMax - 0.5));
240  pgonZ.emplace_back(0.5 * cableT);
241  vector<double> pgonRmin;
242  pgonRmin.emplace_back(rin);
243  pgonRmin.emplace_back(rin);
244  pgonRmin.emplace_back(rin);
245  vector<double> pgonRmax;
246  pgonRmax.emplace_back(rout);
247  pgonRmax.emplace_back(rout);
248  pgonRmax.emplace_back(rout);
249  solid = DDSolidFactory::polycone(DDName(name, idNameSpace), 0, CLHEP::twopi, pgonZ, pgonRmin, pgonRmax);
250  LogDebug("TOBGeom") << "DDTOBRadCableAlgo test: " << DDName(name, idNameSpace) << " Polycone made of " << cableM[i]
251  << " from 0 to " << CLHEP::twopi / CLHEP::deg << " and with " << pgonZ.size() << " sections";
252  for (int ii = 0; ii < (int)(pgonZ.size()); ii++)
253  LogDebug("TOBGeom") << "\t[" << ii << "]\tZ = " << pgonZ[ii] << "\tRmin = " << pgonRmin[ii]
254  << "\tRmax = " << pgonRmax[ii];
255  DDName cableName(DDSplit(cableM[i]).first, DDSplit(cableM[i]).second);
256  DDMaterial cableMatter(cableName);
257  DDLogicalPart cableLogic(DDName(name, idNameSpace), cableMatter, solid);
258 
259  DDTranslation r3(0, 0, (diskDz - (i + 0.5) * cableT));
260  cpv.position(DDName(name, idNameSpace), diskName, i + 1, r3, DDRotation());
261  LogDebug("TOBGeom") << "DDTOBRadCableAlgo test: " << DDName(name, idNameSpace) << " number " << i + 1
262  << " positioned in " << diskName << " at " << r3 << " with no rotation";
263  }
264 
265  LogDebug("TOBGeom") << "<<== End of DDTOBRadCableAlgo construction ...";
266 }
267 
268 DEFINE_EDM_PLUGIN(DDAlgorithmFactory, DDTOBRadCableAlgo, "track:DDTOBRadCableAlgo");
static DDSolid torus(const DDName &name, double rMin, double rMax, double rTorus, double startPhi, double deltaPhi)
Definition: DDSolid.cc:662
static AlgebraicMatrix initialize()
void position(const DDLogicalPart &self, const DDLogicalPart &parent, const std::string &copyno, const DDTranslation &trans, const DDRotation &rot, const DDDivision *div=nullptr)
DDMaterial is used to define and access material information.
Definition: DDMaterial.h:45
static DDSolid polycone(const DDName &name, double startPhi, double deltaPhi, const std::vector< double > &z, const std::vector< double > &rmin, const std::vector< double > &rmax)
Creates a polycone (refere to Geant3 or Geant4 documentation)
Definition: DDSolid.cc:551
void initialize(const DDNumericArguments &nArgs, const DDVectorArguments &vArgs, const DDMapArguments &mArgs, const DDStringArguments &sArgs, const DDStringVectorArguments &vsArgs) override
DDName is used to identify DDD entities uniquely.
Definition: DDName.h:17
static std::string & ns()
int ii
Definition: cuy.py:589
Compact representation of the geometrical detector hierarchy.
Definition: DDCompactView.h:81
const std::string names[nVars_]
A DDSolid represents the shape of a part.
Definition: DDSolid.h:39
Represents a uniquely identifyable rotation matrix.
Definition: DDTransform.h:57
U second(std::pair< T, U > const &p)
void execute(DDCompactView &cpv) override
vector< double > coolR2
vector< string > names
A DDLogicalPart aggregates information concerning material, solid and sensitveness ...
Definition: DDLogicalPart.h:93
static DDSolid tubs(const DDName &name, double zhalf, double rIn, double rOut, double startPhi, double deltaPhi)
Definition: DDSolid.cc:667
~DDTOBRadCableAlgo() override
vector< string > connM
vector< double > coolR1
vector< string > cableM
vector< double > rodRin
vector< double > rodRout
#define DEFINE_EDM_PLUGIN(factory, type, name)
std::pair< std::string, std::string > DDSplit(const std::string &n)
split into (name,namespace), separator = &#39;:&#39;
Definition: DDSplit.cc:3
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< double > > DDTranslation
Definition: DDTranslation.h:7
#define LogDebug(id)