CMS 3D CMS Logo

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