CMS 3D CMS Logo

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