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) {
30 
32  unsigned int i;
33  DDName parentName = parent().name();
34  LogDebug("TIBGeom") << "DDTIBRadCableAlgo_MTCC debug: Parent " << parentName
35  << " NameSpace " << idNameSpace;
36 
37  rMin = nArgs["RMin"];
38  rMax = nArgs["RMax"];
39  layRin = vArgs["RadiusLo"];
40  deltaR = nArgs["DeltaR"];
41  LogDebug("TIBGeom") << "DDTIBRadCableAlgo_MTCC debug: Disk Rmin " << rMin
42  << "\tRMax " << rMax << "\tSeparation of layers "
43  << deltaR <<" with " << layRin.size() <<" layers at R =";
44  for (i = 0; i < layRin.size(); i++)
45  LogDebug("TIBGeom") << " " << i << " : " << layRin[i];
46 
47  cylinderT = nArgs["CylinderThick"];
48  supportT = nArgs["SupportThick"];
49  supportDR = nArgs["SupportDR"];
50  supportMat = sArgs["SupportMaterial"];
51  LogDebug("TIBGeom") << "DDTIBRadCableAlgo_MTCC debug: SupportCylinder "
52  << "Thickness " << cylinderT << "\tSupportDisk "
53  << "Thickness " << supportT << "\tExtra width along R "
54  << supportDR << "\tMaterial: " << supportMat;
55 
56  cableT = nArgs["CableThick"];
57  cableMat = vsArgs["CableMaterial"];
58  LogDebug("TIBGeom") << "DDTIBRadCableAlgo_MTCC debug: Cable Thickness "
59  << cableT << " with materials: ";
60  for (i = 0; i < cableMat.size(); i++)
61  LogDebug("TIBGeom") << " " << i << " : " << cableMat[i];
62 
63  strucMat = vsArgs["StructureMaterial"];
64  LogDebug("TIBGeom") << "DDTIBRadCableAlgo_MTCC debug: " << strucMat.size()
65  << " materials for open structure:";
66  for (i=0; i<strucMat.size(); i++)
67  LogDebug("TIBGeom") << " " << i << " : " << strucMat[i];
68 
69  layers = vArgs["Layers"];
70  LogDebug("TIBGeom") << "DDTIBRadCableAlgo_MTCC debug: " << layers.size()
71  << " layers:";
72  for (i=0; i<layers.size(); i++)
73  LogDebug("TIBGeom") << " " << i << " : " << layers[i];
74 
75 }
76 
78 
79  LogDebug("TIBGeom") << "==>> Constructing DDTIBRadCableAlgo_MTCC...";
80  DDName diskName = parent().name();
81 
82  DDSolid solid;
84  double rin, rout;
85 
86  // Loop over sub disks
88  DDMaterial suppMatter(suppName);
89  double diskDz = 0.5 * (supportT + cableT*layRin.size());
90  double dz = 0.5*supportT;
91 
92  for (unsigned int i=0; i<layRin.size(); i++) {
93 
94  // fill only layers in layers list
95  bool empty=true;
96  for(unsigned int j=0; j<layers.size(); j++) {
97  if(i+1==(unsigned int)layers[j]) {
98  empty=false;
99  }
100  }
101 
102  if(!empty) {
103  //Support disks
104  name = "TIBSupportSideDisk" + std::to_string(i);
105  rin = layRin[i]+0.5*(deltaR-cylinderT)-supportDR;
106  rout = layRin[i]+0.5*(deltaR+cylinderT)+supportDR;
107  solid = DDSolidFactory::tubs(DDName(name, idNameSpace), dz, rin,
108  rout, 0, CLHEP::twopi);
109  LogDebug("TIBGeom") << "DDTIBRadCableAlgo_MTCC test: "
110  << DDName(name, idNameSpace) << " Tubs made of "
111  << supportMat << " from 0 to "
112  << CLHEP::twopi/CLHEP::deg << " with Rin " << rin
113  << " Rout " << rout << " ZHalf " << dz;
114  DDLogicalPart suppLogic(DDName(name, idNameSpace), suppMatter, solid);
115 
116  DDTranslation r1(0, 0, (dz-diskDz));
117  cpv.position(DDName(name,idNameSpace), diskName, i+1, r1, DDRotation());
118  LogDebug("TIBGeom") << "DDTIBRadCableAlgo_MTCC test: "
119  << DDName(name,idNameSpace) << " number " << i+1
120  << " positioned in " << diskName << " at " << r1
121  << " with no rotation";
122 
123  //Open Structure
124  name = "TIBOpenZone" + std::to_string(i);
125  rout = rin;
126  if (i == 0) rin = rMin;
127  else rin = layRin[i-1]+0.5*(deltaR+cylinderT)+supportDR;
128  solid = DDSolidFactory::tubs(DDName(name, idNameSpace), dz, rin,
129  rout, 0, CLHEP::twopi);
130  LogDebug("TIBGeom") << "DDTIBRadCableAlgo_MTCC test: "
131  << DDName(name, idNameSpace) << " Tubs made of "
132  << strucMat[i] << " from 0 to "
133  << CLHEP::twopi/CLHEP::deg << " with Rin " << rin
134  << " Rout " << rout << " ZHalf " << dz;
135  DDName strucName(DDSplit(strucMat[i]).first, DDSplit(strucMat[i]).second);
136  DDMaterial strucMatter(strucName);
137  DDLogicalPart strucLogic(DDName(name, idNameSpace), strucMatter, solid);
138 
139  DDTranslation r2(0, 0, (dz-diskDz));
140  cpv.position(DDName(name,idNameSpace), diskName, i+1, r2, DDRotation());
141  LogDebug("TIBGeom") << "DDTIBRadCableAlgo_MTCC test: "
142  << DDName(name,idNameSpace) << " number " << i+1
143  << " positioned in " << diskName
144  << " at " << r2 << " with no rotation";
145 
146  //Now the radial cable
147  name = "TIBRadCable" + std::to_string(i);
148  double rv = layRin[i]+0.5*deltaR;
149  std::vector<double> pgonZ;
150  pgonZ.push_back(-0.5*cableT);
151  pgonZ.push_back(cableT*(rv/rMax-0.5));
152  pgonZ.push_back(0.5*cableT);
153  std::vector<double> pgonRmin;
154  pgonRmin.push_back(rv);
155  pgonRmin.push_back(rv);
156  pgonRmin.push_back(rv);
157  std::vector<double> pgonRmax;
158  pgonRmax.push_back(rMax);
159  pgonRmax.push_back(rMax);
160  pgonRmax.push_back(rv);
161  solid = DDSolidFactory::polycone(DDName(name, idNameSpace), 0,
162  CLHEP::twopi,pgonZ, pgonRmin, pgonRmax);
163  LogDebug("TIBGeom") << "DDTIBRadCableAlgo_MTCC test: "
164  << DDName(name, idNameSpace)
165  << " Polycone made of " << cableMat[i]
166  << " from 0 to " << CLHEP::twopi/CLHEP::deg
167  << " and with " << pgonZ.size() << " sections";
168  for (unsigned int ii = 0; ii <pgonZ.size(); ii++)
169  LogDebug("TIBGeom") << "\t" << "\tZ = " << pgonZ[ii] << "\tRmin = "
170  << pgonRmin[ii] << "\tRmax = " << pgonRmax[ii];
171  DDName cableName(DDSplit(cableMat[i]).first,DDSplit(cableMat[i]).second);
172  LogDebug("TIBGeom") << " material cableName " << i << " " << cableName;
173  DDMaterial cableMatter(cableName);
174  DDLogicalPart cableLogic(DDName(name, idNameSpace), cableMatter, solid);
175 
176  DDTranslation r3(0, 0, (diskDz-(i+0.5)*cableT));
177  cpv.position(DDName(name,idNameSpace), diskName, i+1, r3, DDRotation());
178  LogDebug("TIBGeom") << "DDTIBRadCableAlgo_MTCC test: "
179  << DDName(name,idNameSpace) << " number " << i+1
180  << " positioned in " << diskName << " at "
181  << r3 << " with no rotation";
182 
183  }
184  //
185 
186  // fill only layers in layers list
187  empty=true;
188  for(unsigned int j=0; j<layers.size(); j++) {
189  if(i+1==(unsigned int)layers[j]) {
190  empty=false;
191  }
192  }
193 
194  if(!empty) {
195  //Now the last open zone
196  unsigned int i = layRin.size();
197  rin = layRin[i-1]+0.5*(deltaR+cylinderT)+supportDR;
198  rout = rMax;
199  name = "TIBOpenZone" + std::to_string(i);
200  solid = DDSolidFactory::tubs(DDName(name, idNameSpace), dz, rin,
201  rout, 0, CLHEP::twopi);
202  LogDebug("TIBGeom") << "DDTIBRadCableAlgo_MTCC test: "
203  << DDName(name, idNameSpace) << " Tubs made of "
204  << strucMat[i] << " from 0 to "
205  << CLHEP::twopi/CLHEP::deg << " with Rin " << rin
206  << " Rout " << rout << " ZHalf " << dz;
207  DDName strucName(DDSplit(strucMat[i]).first,DDSplit(strucMat[i]).second);
208  DDMaterial strucMatter(strucName);
209  DDLogicalPart strucLogic(DDName(name, idNameSpace), strucMatter, solid);
210 
211  DDTranslation r2(0, 0, (dz-diskDz));
212  cpv.position(DDName(name,idNameSpace), diskName, i+1, r2, DDRotation());
213  LogDebug("TIBGeom") << "DDTIBRadCableAlgo_MTCC test: "
214  << DDName(name,idNameSpace) << " number " << i+1
215  << " positioned in " << diskName
216  << " at " << r2 << " with no rotation";
217  }
218  }
219  LogDebug("TIBGeom") << "<<== End of DDTIBRadCableAlgo_MTCC construction ...";
220 
221 }
#define LogDebug(id)
std::vector< double > layers
void initialize(const DDNumericArguments &nArgs, const DDVectorArguments &vArgs, const DDMapArguments &mArgs, const DDStringArguments &sArgs, const DDStringVectorArguments &vsArgs)
int i
Definition: DBlmapReader.cc:9
std::vector< LayerSetAndLayers > layers(const SeedingLayerSetsHits &sets)
Definition: LayerTriplets.cc:4
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:691
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:16
static std::string & ns()
type of data representation of DDCompactView
Definition: DDCompactView.h:90
A DDSolid represents the shape of a part.
Definition: DDSolid.h:37
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< double > > DDTranslation
Definition: DDTranslation.h:7
Represents a uniquely identifyable rotation matrix.
Definition: DDTransform.h:66
std::vector< std::string > strucMat
U second(std::pair< T, U > const &p)
std::vector< std::string > cableMat
int j
Definition: DBlmapReader.cc:9
A DDLogicalPart aggregates information concerning material, solid and sensitveness ...
Definition: DDLogicalPart.h:92
std::vector< double > layRin
static DDSolid tubs(const DDName &name, double zhalf, double rIn, double rOut, double startPhi, double deltaPhi)
Definition: DDSolid.cc:823
ii
Definition: cuy.py:588
void execute(DDCompactView &cpv)
std::pair< std::string, std::string > DDSplit(const std::string &n)
split into (name,namespace), separator = &#39;:&#39;
Definition: DDSplit.cc:4