CMS 3D CMS Logo

DDTIBRadCableAlgo_MTCC.cc
Go to the documentation of this file.
1 // File: DDTIBRadCableAlgo_MTCC.cc
3 // Description: Equipping the side disks of TIB 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 DDTIBRadCableAlgo_MTCC::DDTIBRadCableAlgo_MTCC() : layRin(0), cableMat(0), strucMat(0), layers(0) {
20  LogDebug("TIBGeom") << "DDTIBRadCableAlgo_MTCC info: Creating an instance";
21 }
22 
24 
26  const DDVectorArguments& vArgs,
27  const DDMapArguments&,
28  const DDStringArguments& sArgs,
29  const DDStringVectorArguments& vsArgs) {
31  unsigned int i;
32  DDName parentName = parent().name();
33  LogDebug("TIBGeom") << "DDTIBRadCableAlgo_MTCC debug: Parent " << parentName << " NameSpace " << idNameSpace;
34 
35  rMin = nArgs["RMin"];
36  rMax = nArgs["RMax"];
37  layRin = vArgs["RadiusLo"];
38  deltaR = nArgs["DeltaR"];
39  LogDebug("TIBGeom") << "DDTIBRadCableAlgo_MTCC debug: Disk Rmin " << rMin << "\tRMax " << rMax
40  << "\tSeparation of layers " << deltaR << " with " << layRin.size() << " layers at R =";
41  for (i = 0; i < layRin.size(); i++)
42  LogDebug("TIBGeom") << " " << i << " : " << layRin[i];
43 
44  cylinderT = nArgs["CylinderThick"];
45  supportT = nArgs["SupportThick"];
46  supportDR = nArgs["SupportDR"];
47  supportMat = sArgs["SupportMaterial"];
48  LogDebug("TIBGeom") << "DDTIBRadCableAlgo_MTCC debug: SupportCylinder "
49  << "Thickness " << cylinderT << "\tSupportDisk "
50  << "Thickness " << supportT << "\tExtra width along R " << supportDR
51  << "\tMaterial: " << supportMat;
52 
53  cableT = nArgs["CableThick"];
54  cableMat = vsArgs["CableMaterial"];
55  LogDebug("TIBGeom") << "DDTIBRadCableAlgo_MTCC debug: Cable Thickness " << cableT << " with materials: ";
56  for (i = 0; i < cableMat.size(); i++)
57  LogDebug("TIBGeom") << " " << i << " : " << cableMat[i];
58 
59  strucMat = vsArgs["StructureMaterial"];
60  LogDebug("TIBGeom") << "DDTIBRadCableAlgo_MTCC debug: " << strucMat.size() << " materials for open structure:";
61  for (i = 0; i < strucMat.size(); i++)
62  LogDebug("TIBGeom") << " " << i << " : " << strucMat[i];
63 
64  layers = vArgs["Layers"];
65  LogDebug("TIBGeom") << "DDTIBRadCableAlgo_MTCC debug: " << layers.size() << " layers:";
66  for (i = 0; i < layers.size(); i++)
67  LogDebug("TIBGeom") << " " << i << " : " << layers[i];
68 }
69 
71  LogDebug("TIBGeom") << "==>> Constructing DDTIBRadCableAlgo_MTCC...";
72  DDName diskName = parent().name();
73 
74  DDSolid solid;
76  double rin, rout;
77 
78  // Loop over sub disks
80  DDMaterial suppMatter(suppName);
81  double diskDz = 0.5 * (supportT + cableT * layRin.size());
82  double dz = 0.5 * supportT;
83 
84  for (unsigned int i = 0; i < layRin.size(); i++) {
85  // fill only layers in layers list
86  bool empty = true;
87  for (double layer : layers) {
88  if (i + 1 == (unsigned int)layer) {
89  empty = false;
90  }
91  }
92 
93  if (!empty) {
94  //Support disks
95  name = "TIBSupportSideDisk" + std::to_string(i);
96  rin = layRin[i] + 0.5 * (deltaR - cylinderT) - supportDR;
97  rout = layRin[i] + 0.5 * (deltaR + cylinderT) + supportDR;
98  solid = DDSolidFactory::tubs(DDName(name, idNameSpace), dz, rin, rout, 0, CLHEP::twopi);
99  LogDebug("TIBGeom") << "DDTIBRadCableAlgo_MTCC test: " << DDName(name, idNameSpace) << " Tubs made of "
100  << supportMat << " from 0 to " << CLHEP::twopi / CLHEP::deg << " with Rin " << rin << " Rout "
101  << rout << " ZHalf " << dz;
102  DDLogicalPart suppLogic(DDName(name, idNameSpace), suppMatter, solid);
103 
104  DDTranslation r1(0, 0, (dz - diskDz));
105  cpv.position(DDName(name, idNameSpace), diskName, i + 1, r1, DDRotation());
106  LogDebug("TIBGeom") << "DDTIBRadCableAlgo_MTCC test: " << DDName(name, idNameSpace) << " number " << i + 1
107  << " positioned in " << diskName << " at " << r1 << " with no rotation";
108 
109  //Open Structure
110  name = "TIBOpenZone" + std::to_string(i);
111  rout = rin;
112  if (i == 0)
113  rin = rMin;
114  else
115  rin = layRin[i - 1] + 0.5 * (deltaR + cylinderT) + supportDR;
116  solid = DDSolidFactory::tubs(DDName(name, idNameSpace), dz, rin, rout, 0, CLHEP::twopi);
117  LogDebug("TIBGeom") << "DDTIBRadCableAlgo_MTCC test: " << DDName(name, idNameSpace) << " Tubs made of "
118  << strucMat[i] << " from 0 to " << CLHEP::twopi / CLHEP::deg << " with Rin " << rin
119  << " Rout " << rout << " ZHalf " << dz;
120  DDName strucName(DDSplit(strucMat[i]).first, DDSplit(strucMat[i]).second);
121  DDMaterial strucMatter(strucName);
122  DDLogicalPart strucLogic(DDName(name, idNameSpace), strucMatter, solid);
123 
124  DDTranslation r2(0, 0, (dz - diskDz));
125  cpv.position(DDName(name, idNameSpace), diskName, i + 1, r2, DDRotation());
126  LogDebug("TIBGeom") << "DDTIBRadCableAlgo_MTCC test: " << DDName(name, idNameSpace) << " number " << i + 1
127  << " positioned in " << diskName << " at " << r2 << " with no rotation";
128 
129  //Now the radial cable
130  name = "TIBRadCable" + std::to_string(i);
131  double rv = layRin[i] + 0.5 * deltaR;
132  std::vector<double> pgonZ;
133  pgonZ.emplace_back(-0.5 * cableT);
134  pgonZ.emplace_back(cableT * (rv / rMax - 0.5));
135  pgonZ.emplace_back(0.5 * cableT);
136  std::vector<double> pgonRmin;
137  pgonRmin.emplace_back(rv);
138  pgonRmin.emplace_back(rv);
139  pgonRmin.emplace_back(rv);
140  std::vector<double> pgonRmax;
141  pgonRmax.emplace_back(rMax);
142  pgonRmax.emplace_back(rMax);
143  pgonRmax.emplace_back(rv);
144  solid = DDSolidFactory::polycone(DDName(name, idNameSpace), 0, CLHEP::twopi, pgonZ, pgonRmin, pgonRmax);
145  LogDebug("TIBGeom") << "DDTIBRadCableAlgo_MTCC test: " << DDName(name, idNameSpace) << " Polycone made of "
146  << cableMat[i] << " from 0 to " << CLHEP::twopi / CLHEP::deg << " and with " << pgonZ.size()
147  << " sections";
148  for (unsigned int ii = 0; ii < pgonZ.size(); ii++)
149  LogDebug("TIBGeom") << "\t"
150  << "\tZ = " << pgonZ[ii] << "\tRmin = " << pgonRmin[ii] << "\tRmax = " << pgonRmax[ii];
151  DDName cableName(DDSplit(cableMat[i]).first, DDSplit(cableMat[i]).second);
152  LogDebug("TIBGeom") << " material cableName " << i << " " << cableName;
153  DDMaterial cableMatter(cableName);
154  DDLogicalPart cableLogic(DDName(name, idNameSpace), cableMatter, solid);
155 
156  DDTranslation r3(0, 0, (diskDz - (i + 0.5) * cableT));
157  cpv.position(DDName(name, idNameSpace), diskName, i + 1, r3, DDRotation());
158  LogDebug("TIBGeom") << "DDTIBRadCableAlgo_MTCC test: " << DDName(name, idNameSpace) << " number " << i + 1
159  << " positioned in " << diskName << " at " << r3 << " with no rotation";
160  }
161  //
162 
163  // fill only layers in layers list
164  empty = true;
165  for (double layer : layers) {
166  if (i + 1 == (unsigned int)layer) {
167  empty = false;
168  }
169  }
170 
171  if (!empty) {
172  //Now the last open zone
173  unsigned int i = layRin.size();
174  rin = layRin[i - 1] + 0.5 * (deltaR + cylinderT) + supportDR;
175  rout = rMax;
176  name = "TIBOpenZone" + std::to_string(i);
177  solid = DDSolidFactory::tubs(DDName(name, idNameSpace), dz, rin, rout, 0, CLHEP::twopi);
178  LogDebug("TIBGeom") << "DDTIBRadCableAlgo_MTCC test: " << DDName(name, idNameSpace) << " Tubs made of "
179  << strucMat[i] << " from 0 to " << CLHEP::twopi / CLHEP::deg << " with Rin " << rin
180  << " Rout " << rout << " ZHalf " << dz;
181  DDName strucName(DDSplit(strucMat[i]).first, DDSplit(strucMat[i]).second);
182  DDMaterial strucMatter(strucName);
183  DDLogicalPart strucLogic(DDName(name, idNameSpace), strucMatter, solid);
184 
185  DDTranslation r2(0, 0, (dz - diskDz));
186  cpv.position(DDName(name, idNameSpace), diskName, i + 1, r2, DDRotation());
187  LogDebug("TIBGeom") << "DDTIBRadCableAlgo_MTCC test: " << DDName(name, idNameSpace) << " number " << i + 1
188  << " positioned in " << diskName << " at " << r2 << " with no rotation";
189  }
190  }
191  LogDebug("TIBGeom") << "<<== End of DDTIBRadCableAlgo_MTCC construction ...";
192 }
#define LogDebug(id)
std::vector< double > layers
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:537
void execute(DDCompactView &cpv) override
DDName is used to identify DDD entities uniquely.
Definition: DDName.h:15
static std::string & ns()
Compact representation of the geometrical detector hierarchy.
Definition: DDCompactView.h:80
A DDSolid represents the shape of a part.
Definition: DDSolid.h:39
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< double > > DDTranslation
Definition: DDTranslation.h:7
std::vector< std::string > strucMat
U second(std::pair< T, U > const &p)
void initialize(const DDNumericArguments &nArgs, const DDVectorArguments &vArgs, const DDMapArguments &mArgs, const DDStringArguments &sArgs, const DDStringVectorArguments &vsArgs) override
std::vector< std::string > cableMat
A DDLogicalPart aggregates information concerning material, solid and sensitveness ...
Definition: DDLogicalPart.h:93
std::vector< double > layRin
static DDSolid tubs(const DDName &name, double zhalf, double rIn, double rOut, double startPhi, double deltaPhi)
Definition: DDSolid.cc:653
ii
Definition: cuy.py:590
void position(const DDLogicalPart &self, const DDLogicalPart &parent, const std::string &copyno, const DDTranslation &trans, const DDRotation &rot, const DDDivision *div=0)
std::pair< std::string, std::string > DDSplit(const std::string &n)
split into (name,namespace), separator = &#39;:&#39;
Definition: DDSplit.cc:3
ROOT::Math::Rotation3D DDRotation