CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
DDTIBLayerAlgo_MTCC.cc
Go to the documentation of this file.
1 // File: DDTIBLayerAlgo_MTCC.cc
3 // Description: Makes a TIB layer and position the strings with a tilt angle
5 
6 #include <cmath>
7 #include <algorithm>
8 
17 #include "CLHEP/Units/GlobalPhysicalConstants.h"
18 #include "CLHEP/Units/GlobalSystemOfUnits.h"
19 
21  LogDebug("TIBGeom") << "DDTIBLayerAlgo_MTCC info: Creating an instance";
22 }
23 
25 
27  const DDVectorArguments & vArgs,
28  const DDMapArguments & ,
29  const DDStringArguments & sArgs,
30  const DDStringVectorArguments & ) {
31 
33  genMat = sArgs["GeneralMaterial"];
34  DDName parentName = parent().name();
35  LogDebug("TIBGeom") << "DDTIBLayerAlgo_MTCC debug: Parent " << parentName
36  << " NameSpace " << idNameSpace << " General Material "
37  << genMat;
38 
39  detectorTilt = nArgs["DetectorTilt"];
40  layerL = nArgs["LayerL"];
41  detectorTol = nArgs["LayerTolerance"];
42  detectorW = nArgs["DetectorWidth"];
43  detectorT = nArgs["DetectorThickness"];
44  coolTubeW = nArgs["CoolTubeWidth"];
45  coolTubeT = nArgs["CoolTubeThickness"];
46  LogDebug("TIBGeom") << "DDTIBLayerAlgo_MTCC debug: Tilt Angle "
47  << detectorTilt/CLHEP::deg << " Layer Length/tolerance "
48  << layerL << " " << detectorTol
49  << " Detector layer Width/Thick " << detectorW << ", "
50  << detectorT << " Cooling Tube/Cable layer Width/Thick "
51  << coolTubeW << ", " << coolTubeT;
52 
53  radiusLo = nArgs["RadiusLo"];
54  phioffLo = nArgs["PhiOffsetLo"];
55  phiMinLo = nArgs["PhiMinimumLo"];
56  phiMaxLo = nArgs["PhiMaximumLo"];
57  stringsLo = int(nArgs["StringsLo"]);
58  stringLoList = vArgs["StringLoList"];
59  detectorLo = sArgs["StringDetLoName"];
60  emptyDetectorLo = sArgs["EmptyStringDetLoName"];
61  roffDetLo = nArgs["ROffsetDetLo"];
62  coolCableLo = sArgs["StringCabLoName"];
63  emptyCoolCableLo = sArgs["EmptyStringCabLoName"];
64  roffCableLo = nArgs["ROffsetCabLo"];
65  LogDebug("TIBGeom") << "DDTIBLayerAlgo_MTCC debug: Lower layer Radius "
66  << radiusLo << " Phi offset " << phioffLo/CLHEP::deg
67  << " min " << phiMinLo/CLHEP::deg << " max "
68  << phiMaxLo/CLHEP::deg << " Number " << stringsLo
69  << " String " << detectorLo << " at offset "
70  << roffDetLo << " String " << coolCableLo <<" at offset "
71  << roffCableLo << " Strings filled: ";
72  for(unsigned int i=0; i<stringLoList.size(); i++) {
73  LogDebug("TIBGeom") << "String " << i << " " << (int)stringLoList[i];
74  }
75  LogDebug("TIBGeom") << " Empty String " << emptyDetectorLo << " at offset "
76  << roffDetLo << " Empty String " << emptyCoolCableLo
77  << " at offset " << roffCableLo;
78 
79  radiusUp = nArgs["RadiusUp"];
80  phioffUp = nArgs["PhiOffsetUp"];
81  phiMinUp = nArgs["PhiMinimumUp"];
82  phiMaxUp = nArgs["PhiMaximumUp"];
83  stringsUp = int(nArgs["StringsUp"]);
84  stringUpList = vArgs["StringUpList"];
85  detectorUp = sArgs["StringDetUpName"];
86  emptyDetectorUp = sArgs["EmptyStringDetUpName"];
87  roffDetUp = nArgs["ROffsetDetUp"];
88  coolCableUp = sArgs["StringCabUpName"];
89  emptyCoolCableUp = sArgs["EmptyStringCabUpName"];
90  roffCableUp = nArgs["ROffsetCabUp"];
91  LogDebug("TIBGeom") << "DDTIBLayerAlgo_MTCC debug: Upper layer Radius "
92  << radiusUp << " Phi offset " << phioffUp/CLHEP::deg
93  << " min " << phiMinUp/CLHEP::deg << " max "
94  << phiMaxUp/CLHEP::deg << " Number " << stringsUp
95  << " String " << detectorUp << " at offset " << roffDetUp
96  << " String " << coolCableUp << " at offset "
97  << roffCableUp << " Strings filled: ";
98  for(unsigned int i=0; i<stringUpList.size(); i++) {
99  LogDebug("TIBGeom") << "String " << i << " " << (int)stringUpList[i];
100  }
101  LogDebug("TIBGeom") << " Empty String " << emptyDetectorUp << " at offset "
102  << roffDetUp << " Empty String " << emptyCoolCableUp
103  << " at offset " << roffCableUp;
104 
105  cylinderT = nArgs["CylinderThickness"];
106  cylinderMat = sArgs["CylinderMaterial"];
107  supportW = nArgs["SupportWidth"];
108  supportT = nArgs["SupportThickness"];
109  supportMat = sArgs["SupportMaterial"];
110  ribMat = sArgs["RibMaterial"];
111  ribW = vArgs["RibWidth"];
112  ribPhi = vArgs["RibPhi"];
113  LogDebug("TIBGeom") << "DDTIBLayerAlgo_MTCC debug: Cylinder Material/"
114  << "thickness " << cylinderMat << " " << cylinderT
115  << " Support Wall Material/Width/Thickness "
116  << supportMat << " " << supportW << " " << supportT
117  << " Rib Material " << ribMat << " at "
118  << ribW.size() << " positions with width/phi";
119  for (unsigned int i = 0; i < ribW.size(); i++)
120  LogDebug("TIBGeom") << "Rib " << i << " " << ribW[i] << " "
121  << ribPhi[i]/CLHEP::deg;
122 
123  dohmN = int(nArgs["DOHMPhiNumber"]);
124  dohmCarrierW = nArgs["DOHMCarrierWidth"];
125  dohmCarrierT = nArgs["DOHMCarrierThickness"];
126  dohmCarrierR = nArgs["DOHMCarrierRadialHeight"];
127  dohmCarrierMaterial = sArgs["DOHMCarrierMaterial"];
128  dohmCableMaterial = sArgs["DOHMCableMaterial"];
129  dohmPrimW = nArgs["DOHMPRIMWidth"];
130  dohmPrimL = nArgs["DOHMPRIMLength"];
131  dohmPrimT = nArgs["DOHMPRIMThickness"];
132  dohmPrimMaterial = sArgs["DOHMPRIMMaterial"];
133  dohmAuxW = nArgs["DOHMAUXWidth"];
134  dohmAuxL = nArgs["DOHMAUXLength"];
135  dohmAuxT = nArgs["DOHMAUXThickness"];
136  dohmAuxMaterial = sArgs["DOHMAUXMaterial"];
137  dohmList = vArgs["DOHMList"];
138  LogDebug("TIBGeom") << "DDTIBLayerAlgo_MTCC debug: DOHM PRIMary " << dohmN
139  << " Width/Length/Thickness " << " Material "
140  << dohmPrimMaterial << " " << dohmPrimW << " "
141  << dohmPrimL << " " << dohmPrimT
142  << " at positions:";
143  for(unsigned int i=0; i<dohmList.size(); i++) {
144  if((int)dohmList[i]>0) LogDebug("TIBGeom") << i+1 << ",";
145  }
146  LogDebug("TIBGeom") << "DDTIBLayerAlgo_MTCC debug: DOHM AUXiliary "
147  << " Material " << dohmAuxMaterial << " "
148  << dohmAuxW << " " << dohmAuxL << " " << dohmAuxT
149  << " at positions:";
150  for(unsigned int i=0; i<dohmList.size(); i++) {
151  if((int)dohmList[i]==2) LogDebug("TIBGeom") << i+1 << ",";
152  }
153  LogDebug("TIBGeom") << " in Carrier Width/Thickness/Radius "
154  << dohmCarrierW << " " << dohmCarrierT << " "
155  << dohmCarrierR << " Carrier Material "
157  << "\n with cables and connectors Material "
158  << dohmCableMaterial << "\n"
159  << "DDTIBLayerAlgo_MTCC debug: no DOHM "
160  << " at positions: ";
161  for(unsigned int i=0; i<dohmList.size(); i++) {
162  if((int)dohmList[i]==0) LogDebug("TIBGeom") << i+1 << ",";
163  }
164 
165 }
166 
167 
169 
170  LogDebug("TIBGeom") << "==>> Constructing DDTIBLayerAlgo_MTCC...";
171 
172  //Parameters for the tilt of the layer
173  double rotsi = std::abs(detectorTilt);
174  double redgd1 = 0.5*(detectorW*sin(rotsi)+detectorT*cos(rotsi));
175  double redgd2 = 0.5*(detectorW*cos(rotsi)-detectorT*sin(rotsi));
176  double redgc1 = 0.5*(coolTubeW*sin(rotsi)+coolTubeT*cos(rotsi));
177  double redgc2 = 0.5*(coolTubeW*cos(rotsi)-coolTubeT*sin(rotsi));
178  LogDebug("TIBGeom") << "DDTIBLayerAlgo_MTCC test DeltaR (Detector Tilt) "
179  << redgd1 << ", " << redgd2 << " DeltaR (Cable+Cool) "
180  << redgc1 << ", " << redgc2;
181 
182  DDName parentName = parent().name();
183  const std::string &idName = parentName.name();
184  double rmin = radiusLo + roffDetLo - redgd1 - detectorTol;
185  double rmax = sqrt((radiusUp+roffDetUp+redgd1)*(radiusUp+roffDetUp+redgd1)+
186  redgd2*redgd2) + detectorTol;
187  DDSolid solid = DDSolidFactory::tubs(DDName(idName, idNameSpace), 0.5*layerL,
188  rmin, rmax, 0, CLHEP::twopi);
189  LogDebug("TIBGeom") << "DDTIBLayerAlgo_MTCC test: "
190  << DDName(idName,idNameSpace) << " Tubs made of "
191  << genMat << " from 0 to " << CLHEP::twopi/CLHEP::deg
192  << " with Rin " << rmin << " Rout " << rmax << " ZHalf "
193  << 0.5*layerL;
195  DDMaterial matter(matname);
196  DDLogicalPart layer(solid.ddname(), matter, solid);
197 
198  //Lower part first
199  double rin = rmin;
200  double rout = 0.5*(radiusLo+radiusUp-cylinderT);
201  std::string name = idName + "Down";
202  solid = DDSolidFactory::tubs(DDName(name, idNameSpace), 0.5*layerL,
203  rin, rout, 0, CLHEP::twopi);
204  LogDebug("TIBGeom") << "DDTIBLayerAlgo_MTCC test: "
205  << DDName(name, idNameSpace) << " Tubs made of "
206  << genMat << " from 0 to " << CLHEP::twopi/CLHEP::deg
207  << " with Rin " << rin << " Rout " << rout << " ZHalf "
208  << 0.5*layerL;
209  DDLogicalPart layerIn(solid.ddname(), matter, solid);
210  cpv.position(layerIn, layer, 1, DDTranslation(0.0, 0.0, 0.0), DDRotation());
211  LogDebug("TIBGeom") << "DDTIBLayerAlgo_MTCC test: " << layerIn.name()
212  << " number 1 positioned in " << layer.name()
213  << " at (0,0,0) with no rotation";
214 
215  double rposdet = radiusLo + roffDetLo;
216  double rposcab = rposdet + roffCableLo;
217  double dphi = CLHEP::twopi/stringsLo;
218  DDName detIn(DDSplit(detectorLo).first, DDSplit(detectorLo).second);
219  DDName cabIn(DDSplit(coolCableLo).first, DDSplit(coolCableLo).second);
220  for (int n = 0; n < stringsLo; n++) {
221  double phi = phioffLo + n*dphi;
222  if( phi>=phiMinLo && phi<phiMaxLo ) { // phi range
223  double phix = phi - detectorTilt + 90*CLHEP::deg;
224  double phideg = phix/CLHEP::deg;
226  if (phideg != 0) {
227  double theta = 90*CLHEP::deg;
228  double phiy = phix + 90.*CLHEP::deg;
229  std::string rotstr = idName + dbl_to_string(phideg*10.);
230  rotation = DDRotation(DDName(rotstr, idNameSpace));
231  if (!rotation) {
232  LogDebug("TIBGeom") << "DDTIBLayer_MTCC test: Creating a new "
233  << "rotation: " << rotstr << "\t90., "
234  << phix/CLHEP::deg << ", 90.,"
235  << phiy/CLHEP::deg << ", 0, 0";
236  rotation = DDrot(DDName(rotstr, idNameSpace), theta,phix, theta,phiy,
237  0., 0.);
238  }
239  }
240 
241  // fill strings in the stringLoList with modules, the others with only structure
242  bool empty=true;
243  for(unsigned int i=0; i<stringLoList.size(); i++) {
244  if(n+1==(int)stringLoList[i]) {
245  empty=false;
246  }
247  }
248  if(empty) {
249  if(emptyDetectorLo!="nothing") {
250  DDName emptyDetIn(DDSplit(emptyDetectorLo).first, DDSplit(emptyDetectorLo).second);
251  DDTranslation trdet(rposdet*cos(phi), rposdet*sin(phi), 0);
252  cpv.position(emptyDetIn, layerIn, n+1, trdet, rotation);
253  LogDebug("TIBGeom") << "DDTIBLayer_MTCC test " << emptyDetIn.name()
254  << " number " << n+1 << " positioned in "
255  << layerIn.name() << " at " << trdet
256  << " with " << rotation;
257  }
258  if(emptyCoolCableLo!="nothing") {
259  DDName emptyCabIn(DDSplit(emptyCoolCableLo).first, DDSplit(emptyCoolCableLo).second);
260  DDTranslation trcab(rposcab*cos(phi), rposcab*sin(phi), 0);
261  cpv.position(emptyCabIn, layerIn, n+1, trcab, rotation);
262  LogDebug("TIBGeom") << "DDTIBLayer_MTCC test " << emptyCabIn.name()
263  << " number " << n+1 << " positioned in "
264  << layerIn.name() << " at " << trcab
265  << " with " << rotation;
266  }
267  } else {
268  DDTranslation trdet(rposdet*cos(phi), rposdet*sin(phi), 0);
269  cpv.position(detIn, layerIn, n+1, trdet, rotation);
270  LogDebug("TIBGeom") << "DDTIBLayer_MTCC test " << detIn.name()
271  << " number " << n+1 << " positioned in "
272  << layerIn.name() << " at " << trdet
273  << " with " << rotation;
274  DDTranslation trcab(rposcab*cos(phi), rposcab*sin(phi), 0);
275  cpv.position(cabIn, layerIn, n+1, trcab, rotation);
276  LogDebug("TIBGeom") << "DDTIBLayer_MTCC test " << cabIn.name()
277  << " number " << n+1 << " positioned in "
278  << layerIn.name() << " at " << trcab
279  << " with " << rotation;
280  }
281  //
282 
283  } // phi range
284 
285  }
286 
287  //Now the upper part
288  rin = 0.5*(radiusLo+radiusUp+cylinderT);
289  rout = rmax;
290  name = idName + "Up";
291  solid = DDSolidFactory::tubs(DDName(name, idNameSpace), 0.5*layerL,
292  rin, rout, 0, CLHEP::twopi);
293  LogDebug("TIBGeom") << "DDTIBLayerAlgo_MTCC test: "
294  << DDName(name, idNameSpace) << " Tubs made of "
295  << genMat << " from 0 to " << CLHEP::twopi/CLHEP::deg
296  << " with Rin " << rin << " Rout " << rout << " ZHalf "
297  << 0.5*layerL;
298  DDLogicalPart layerOut(solid.ddname(), matter, solid);
299  cpv.position(layerOut, layer, 1, DDTranslation(0.0, 0.0, 0.0), DDRotation());
300  LogDebug("TIBGeom") << "DDTIBLayerAlgo_MTCC test: " << layerOut.name()
301  << " number 1 positioned in " << layer.name()
302  << " at (0,0,0) with no rotation";
303 
304  rposdet = radiusUp + roffDetUp;
305  rposcab = rposdet + roffCableUp;
306  dphi = CLHEP::twopi/stringsUp;
307  DDName detOut(DDSplit(detectorUp).first, DDSplit(detectorUp).second);
308  DDName cabOut(DDSplit(coolCableUp).first, DDSplit(coolCableUp).second);
309  for (int n = 0; n < stringsUp; n++) {
310  double phi = phioffUp + n*dphi;
311  if( phi>=phiMinUp && phi<phiMaxUp ) { // phi range
312  double phix = phi - detectorTilt - 90*CLHEP::deg;
313  double phideg = phix/CLHEP::deg;
315  if (phideg != 0) {
316  double theta = 90*CLHEP::deg;
317  double phiy = phix + 90.*CLHEP::deg;
318  std::string rotstr = idName + dbl_to_string(phideg*10.);
319  rotation = DDRotation(DDName(rotstr, idNameSpace));
320  if (!rotation) {
321  LogDebug("TIBGeom") << "DDTIBLayer_MTCC test: Creating a new "
322  << "rotation: " << rotstr << "\t90., "
323  << phix/CLHEP::deg << ", 90.,"
324  << phiy/CLHEP::deg << ", 0, 0";
325  rotation = DDrot(DDName(rotstr, idNameSpace), theta,phix, theta,phiy,
326  0., 0.);
327  }
328  }
329 
330  // fill strings in the stringUpList with modules, the others with only structure
331  bool empty=true;
332  for(unsigned int i=0; i<stringUpList.size(); i++) {
333  if(n+1==(int)stringUpList[i]) {
334  empty=false;
335  }
336  }
337  if(empty) {
338  if(emptyDetectorUp!="nothing") {
339  DDName emptyDetOut(DDSplit(emptyDetectorUp).first, DDSplit(emptyDetectorUp).second);
340  DDTranslation trdet(rposdet*cos(phi), rposdet*sin(phi), 0);
341  cpv.position(emptyDetOut, layerOut, n+1, trdet, rotation);
342  LogDebug("TIBGeom") << "DDTIBLayer test " << emptyDetOut.name()
343  << " number " << n+1 << " positioned in "
344  << layerOut.name() << " at " << trdet
345  << " with " << rotation;
346 
347  }
348  if(emptyCoolCableUp!="nothing") {
349  DDName emptyCabOut(DDSplit(emptyCoolCableUp).first, DDSplit(emptyCoolCableUp).second);
350  DDTranslation trcab(rposcab*cos(phi), rposcab*sin(phi), 0);
351  cpv.position(emptyCabOut, layerOut, n+1, trcab, rotation);
352  LogDebug("TIBGeom") << "DDTIBLayer_MTCC test " << emptyCabOut.name()
353  << " number " << n+1 << " positioned in "
354  << layerOut.name() << " at " << trcab
355  << " with " << rotation;
356  }
357  } else {
358  DDTranslation trdet(rposdet*cos(phi), rposdet*sin(phi), 0);
359  cpv.position(detOut, layerOut, n+1, trdet, rotation);
360  LogDebug("TIBGeom") << "DDTIBLayer test " << detOut.name()
361  << " number " << n+1 << " positioned in "
362  << layerOut.name() << " at " << trdet
363  << " with " << rotation;
364  DDTranslation trcab(rposcab*cos(phi), rposcab*sin(phi), 0);
365  cpv.position(cabOut, layerOut, n+1, trcab, rotation);
366  LogDebug("TIBGeom") << "DDTIBLayer_MTCC test " << cabOut.name()
367  << " number " << n+1 << " positioned in "
368  << layerOut.name() << " at " << trcab
369  << " with " << rotation;
370  }
371  //
372 
373  } // phi range
374 
375  }
376 
377  double phiMin = phiMinUp-phioffUp; // lower phi for cylinders
378  double phiMax = phiMaxUp-phioffUp; // upper phi for cylinders
379  double phidiff = fabs(phiMax-phiMin); // cylinders will not be twopi but phidiff
380  //Finally the inner cylinder, support wall and ribs
381  rin = 0.5*(radiusLo+radiusUp-cylinderT);
382  rout = 0.5*(radiusLo+radiusUp+cylinderT);
383  name = idName + "Cylinder";
384  solid = DDSolidFactory::tubs(DDName(name, idNameSpace), 0.25*layerL,
385  rin, rout, phiMin, phidiff);
386  LogDebug("TIBGeom") << "DDTIBLayerAlgo_MTCC test: "
387  << DDName(name, idNameSpace) << " Tubs made of "
388  << cylinderMat << " from " << phiMin/CLHEP::deg << " to "
389  << (phiMin+phidiff)/CLHEP::deg << " with Rin " << rin
390  << " Rout " << rout << " ZHalf " << 0.25*layerL;
391  matname = DDName(DDSplit(cylinderMat).first, DDSplit(cylinderMat).second);
392  DDMaterial matcyl(matname);
393  DDLogicalPart cylinder(solid.ddname(), matcyl, solid);
394  cpv.position(cylinder, layer, 1, DDTranslation(0.0,0.0,0.25*layerL), DDRotation());
395  LogDebug("TIBGeom") << "DDTIBLayerAlgo_MTCC test: " << cylinder.name()
396  << " number 1 positioned in " << layer.name()
397  << " at (0,0," << 0.25*layerL << ") with no rotation";
398  rin += supportT;
399  rout -= supportT;
400  name = idName + "CylinderIn";
401  solid = DDSolidFactory::tubs(DDName(name, idNameSpace), 0.5*layerL,
402  rin, rout, phiMin, phidiff);
403  LogDebug("TIBGeom") << "DDTIBLayerAlgo_MTCC test: "
404  << DDName(name, idNameSpace) << " Tubs made of "
405  << genMat << " from " << phiMin/CLHEP::deg << " to "
406  << (phiMin+phidiff)/CLHEP::deg << phidiff/CLHEP::deg
407  << " with Rin " << rin << " Rout " << rout << " ZHalf "
408  << 0.5*layerL;
409  DDLogicalPart cylinderIn(solid.ddname(), matter, solid);
410  cpv.position(cylinderIn, cylinder, 1, DDTranslation(0.0, 0.0, -0.25*layerL), DDRotation());
411  LogDebug("TIBGeom") << "DDTIBLayerAlgo_MTCC test: " << cylinderIn.name()
412  << " number 1 positioned in " << cylinder.name()
413  << " at (0,0," << -0.25*layerL << ") with no rotation";
414  name = idName + "CylinderInSup";
415  solid = DDSolidFactory::tubs(DDName(name, idNameSpace), 0.5*supportW,
416  rin, rout, phiMin, phidiff);
417  LogDebug("TIBGeom") << "DDTIBLayerAlgo_MTCC test: "
418  << DDName(name, idNameSpace) << " Tubs made of "
419  << genMat << " from " << phiMin/CLHEP::deg << " to "
420  << (phiMin+phidiff)/CLHEP::deg << " with Rin " << rin
421  << " Rout " << rout << " ZHalf " << 0.5*supportW;
422  matname = DDName(DDSplit(supportMat).first, DDSplit(supportMat).second);
423  DDMaterial matsup(matname);
424  DDLogicalPart cylinderSup(solid.ddname(), matsup, solid);
425  cpv.position(cylinderSup, cylinderIn, 1, DDTranslation(0., 0., 0.), DDRotation());
426  LogDebug("TIBGeom") << "DDTIBLayerAlgo_MTCC test: " << cylinderSup.name()
427  << " number 1 positioned in " << cylinderIn.name()
428  << " at (0,0,0) with no rotation";
429  matname = DDName(DDSplit(ribMat).first, DDSplit(ribMat).second);
430  DDMaterial matrib(matname);
431  for (unsigned int i = 0; i < ribW.size(); i++) {
432  name = idName + "Rib" + dbl_to_string(i);
433  double width = 2.*ribW[i]/(rin+rout);
434  double dz = 0.25*(layerL - supportW);
435  solid = DDSolidFactory::tubs(DDName(name, idNameSpace), dz, rin, rout,
436  -0.5*width, width);
437  LogDebug("TIBGeom") << "DDTIBLayerAlgo_MTCC test: "
438  << DDName(name, idNameSpace) << " Tubs made of "
439  << ribMat << " from " << -0.5*width/CLHEP::deg
440  << " to " << 0.5*width/CLHEP::deg << " with Rin "
441  << rin << " Rout " << rout << " ZHalf " << dz;
442  DDLogicalPart cylinderRib(solid.ddname(), matrib, solid);
443  double phix = ribPhi[i];
444  double phideg = phix/CLHEP::deg;
445  if( phideg>=phiMin/CLHEP::deg && phideg<phiMax/CLHEP::deg ) { // phi range
447  if (phideg != 0) {
448  double theta = 90*CLHEP::deg;
449  double phiy = phix + 90.*CLHEP::deg;
450  std::string rotstr = idName + dbl_to_string(phideg*10.);
451  rotation = DDRotation(DDName(rotstr, idNameSpace));
452  if (!rotation) {
453  LogDebug("TIBGeom") << "DDTIBLayer_MTCC test: Creating a new "
454  << "rotation: " << rotstr << "\t90., "
455  << phix/CLHEP::deg << ", 90.,"
456  << phiy/CLHEP::deg << ", 0, 0";
457  rotation = DDrot(DDName(rotstr, idNameSpace), theta,phix, theta,phiy,
458  0., 0.);
459  }
460  }
461  DDTranslation tran(0, 0, +0.25*(layerL+supportW));
462  cpv.position(cylinderRib, cylinderIn, 1, tran, rotation);
463  LogDebug("TIBGeom") << "DDTIBLayer_MTCC test " << cylinderRib.name()
464  << " number 1 positioned in " << cylinderIn.name()
465  << " at " << tran << " with " << rotation;
466  } // phi range
467  }
468 
469 
470  // DOHM + carrier (portadohm)
471  double dz_dohm = 0.5*dohmCarrierW;
472  double dphi_dohm = CLHEP::twopi/((double)dohmN);
473  double rout_dohm = 0.5*(radiusLo+radiusUp+cylinderT)+dohmCarrierR;
474 
475  // DOHM Carrier TIB+ & TIB-
476  // lower
477  name = idName + "DOHMCarrier_lo";
478  double rin_lo = rout_dohm;
479  double rout_lo = rin_lo + dohmCarrierT;
480  solid = DDSolidFactory::tubs(DDName(name, idNameSpace), dz_dohm,
481  rin_lo, rout_lo,
482  -0.5*dphi_dohm, dphi_dohm);
483  LogDebug("TIBGeom") << "DDTIBLayerAlgo_MTCC test: "
484  << DDName(name, idNameSpace) << " Tubs made of "
485  << dohmCarrierMaterial << " from "
486  << -0.5*(dphi_dohm)/CLHEP::deg << " to "
487  << +0.5*(dphi_dohm)/CLHEP::deg << " with Rin "
488  << rin_lo << " Rout " << rout_lo << " ZHalf "
489  << dz_dohm;
490  // create different name objects for only PRIMary DOHMs and PRIMary+AUXiliary DOHM Carriers
491  std::string name_lo_r = name + "_PRIM_AUX" + "_lo" + "_r";
492  std::string name_lo_l = name + "_PRIM_AUX" + "_lo" + "_l";
493  DDLogicalPart dohmCarrierPrimAux_lo_r(name_lo_r, DDMaterial(dohmCarrierMaterial), solid);
494  DDLogicalPart dohmCarrierPrimAux_lo_l(name_lo_l, DDMaterial(dohmCarrierMaterial), solid);
495  name_lo_r = name + "_PRIM" + "_lo" + "_r";
496  name_lo_l = name + "_PRIM" + "_lo" + "_l";
497  DDLogicalPart dohmCarrierPrim_lo_r(name_lo_r, DDMaterial(dohmCarrierMaterial), solid);
498  DDLogicalPart dohmCarrierPrim_lo_l(name_lo_l, DDMaterial(dohmCarrierMaterial), solid);
499  // upper
500  name = idName + "DOHMCarrier_up";
501  double rin_up = rout_lo + 2.*dohmAuxT;
502  double rout_up = rin_up + dohmCarrierT;
503  solid = DDSolidFactory::tubs(DDName(name, idNameSpace), dz_dohm,
504  rin_up, rout_up,
505  -0.5*dphi_dohm, dphi_dohm);
506  LogDebug("TIBGeom") << "DDTIBLayerAlgo_MTCC test: "
507  << DDName(name, idNameSpace) << " Tubs made of "
508  << dohmCarrierMaterial << " from "
509  << -0.5*(dphi_dohm)/CLHEP::deg << " to "
510  << +0.5*(dphi_dohm)/CLHEP::deg << " with Rin "
511  << rin_up << " Rout " << rout_up << " ZHalf "
512  << dz_dohm;
513  // create different name objects for only PRIMary DOHMs and PRIMary+AUXiliary DOHM Carriers
514  std::string name_up_r = name + "_PRIM_AUX" + "_up" + "_r";
515  std::string name_up_l = name + "_PRIM_AUX" + "_up" + "_l";
516  DDLogicalPart dohmCarrierPrimAux_up_r(name_up_r, DDMaterial(dohmCarrierMaterial), solid);
517  DDLogicalPart dohmCarrierPrimAux_up_l(name_up_l, DDMaterial(dohmCarrierMaterial), solid);
518  name_up_r = name + "_PRIM" + "_up" + "_r";
519  name_up_l = name + "_PRIM" + "_up" + "_l";
520  DDLogicalPart dohmCarrierPrim_up_r(name_up_r, DDMaterial(dohmCarrierMaterial), solid);
521  DDLogicalPart dohmCarrierPrim_up_l(name_up_l, DDMaterial(dohmCarrierMaterial), solid);
522  //
523  for (unsigned int i = 0; i < (unsigned int)dohmN; i++) {
524  DDLogicalPart dohmCarrier_lo_r;
525  DDLogicalPart dohmCarrier_lo_l;
526  DDLogicalPart dohmCarrier_up_r;
527  DDLogicalPart dohmCarrier_up_l;
528  // create different name objects for only PRIMary DOHMs and PRIMary+AUXiliary DOHMs
529  bool prim = false;
530  bool aux = false;
531  if((unsigned int)dohmList[i]==2) {
532  prim = true;
533  aux = true;
534  } else if((unsigned int)dohmList[i]==1) {
535  prim = true;
536  aux = false;
537  } else {
538  prim = false;
539  aux = false;
540  }
541 
542  if(prim) {
543  dohmCarrier_lo_r = dohmCarrierPrim_lo_r;
544  dohmCarrier_lo_l = dohmCarrierPrim_lo_l;
545  dohmCarrier_up_r = dohmCarrierPrim_up_r;
546  dohmCarrier_up_l = dohmCarrierPrim_up_l;
547  }
548  if(prim && aux) {
549  dohmCarrier_lo_r = dohmCarrierPrimAux_lo_r;
550  dohmCarrier_lo_l = dohmCarrierPrimAux_lo_l;
551  dohmCarrier_up_r = dohmCarrierPrimAux_up_r;
552  dohmCarrier_up_l = dohmCarrierPrimAux_up_l;
553  }
554  //
555 
556  if(prim) {
557  double phix = ((double)i+0.5)*dphi_dohm;
558  double phideg = phix/CLHEP::deg;
559  // if( phideg>=phiMin/CLHEP::deg && phideg<phiMax/CLHEP::deg ) { // phi range
561  if (phideg != 0) {
562  double theta = 90*CLHEP::deg;
563  double phiy = phix + 90.*CLHEP::deg;
564  std::string rotstr = idName + dbl_to_string(phideg*10.);
565  rotation = DDRotation(DDName(rotstr, idNameSpace));
566  if (!rotation) {
567  LogDebug("TIBGeom") << "DDTIBLayer_MTCC test: Creating a new "
568  << "rotation: " << rotstr << "\t90., "
569  << phix/CLHEP::deg << ", 90.,"
570  << phiy/CLHEP::deg << ", 0, 0";
571  rotation = DDrot(DDName(rotstr, idNameSpace), theta,phix, theta,phiy,
572  0., 0.);
573  }
574  }
575  // TIB+ DOHM Carrier - lower
576  DDTranslation tran(0, 0, 0.5*layerL-dz_dohm);
577  cpv.position(dohmCarrier_lo_r, parent(), i+1, tran, rotation );
578  LogDebug("TIBGeom") << "DDTIBLayer_MTCC test " << dohmCarrier_lo_r.name()
579  << " z+ number " << i+1 << " positioned in "
580  << parent().name() << " at " << tran
581  << " with " << rotation;
582  // TIB+ DOHM Carrier - upper
583  cpv.position(dohmCarrier_up_r, parent(), i+1+(unsigned int)dohmN, tran, rotation );
584  LogDebug("TIBGeom") << "DDTIBLayer_MTCC test " << dohmCarrier_up_r.name()
585  << " z+ number " << i+1 << " positioned in "
586  << parent().name() << " at " << tran
587  << " with " << rotation;
588  }
589 
590  // } // phi range
591  }
592 
593 
594  // DOHM only PRIMary
595  double dx = 0.5*dohmPrimT;
596  double dy = 0.5*dohmPrimW;
597  double dz = 0.5*dohmPrimL;
598  name = idName + "DOHM_PRIM";
599  solid = DDSolidFactory::box(DDName(name, idNameSpace), dx, dy, dz);
600  DDLogicalPart dohmPrim(solid.ddname(), DDMaterial(dohmPrimMaterial), solid);
601  LogDebug("TIBGeom") << "DDTIBLayerAlgo_MTCC test: "
602  << DDName(name, idNameSpace) << " Box made of "
603  << dohmPrimMaterial << " of dimensions " << dx << ", "
604  << dy << ", " << dz;
605  name = idName + "DOHM_PRIM_Cable";
606  double dx_cable = 0.25*dohmPrimT;
607  double dy_cable = 0.40*dohmPrimW;
608  double dz_cable = 0.5*dohmPrimL;
609  solid = DDSolidFactory::box(DDName(name, idNameSpace), dx_cable, dy_cable, dz_cable);
610  DDLogicalPart dohmCablePrim(solid.ddname(), DDMaterial(dohmCableMaterial), solid);
611  LogDebug("TIBGeom") << "DDTIBLayerAlgo_MTCC test: "
612  << DDName(name, idNameSpace) << " Box made of "
613  << dohmCableMaterial << " of dimensions " << dx_cable
614  << ", " << dy_cable << ", " << dz_cable;
615  // TIB+ DOHM
616  DDTranslation tran(rout_dohm+0.5*dohmPrimT, 0. , 0.);
617  cpv.position(dohmPrim, dohmCarrierPrim_lo_r, 1, tran, DDRotation() );
618  LogDebug("TIBGeom") << "DDTIBLayer_MTCC test " << dohmPrim.name()
619  << " z+ number " << 1 << " positioned in "
620  << dohmCarrierPrim_lo_r.name() << " at " << tran
621  << " with no rotation";
622  tran = DDTranslation(rout_dohm+dx_cable, 0.5*dohmPrimW , 0.);
623  cpv.position(dohmCablePrim, dohmCarrierPrim_lo_r, 1, tran, DDRotation() );
624  LogDebug("TIBGeom") << "DDTIBLayer_MTCC test " << dohmCablePrim.name()
625  << " copy number " << 1 << " positioned in "
626  << dohmCarrierPrim_lo_r.name()
627  << " at " << tran << " with no rotation";
628  tran = DDTranslation(rout_dohm+dx_cable, -0.5*dohmPrimW , 0.);
629  cpv.position(dohmCablePrim, dohmCarrierPrim_lo_r, 2, tran, DDRotation() );
630  LogDebug("TIBGeom") << "DDTIBLayer_MTCC test " << dohmCablePrim.name()
631  << " copy number " << 2 << " positioned in "
632  << dohmCarrierPrim_lo_r.name()
633  << " at " << tran << " with no rotation";
634 
635  // DOHM PRIMary + AUXiliary
636  dx = 0.5*dohmPrimT;
637  dy = 0.5*dohmPrimW;
638  dz = 0.5*dohmPrimL;
639  name = idName + "DOHM_PRIM";
640  solid = DDSolidFactory::box(DDName(name, idNameSpace), dx, dy, dz);
641  LogDebug("TIBGeom") << "DDTIBLayerAlgo_MTCC test: "
642  << DDName(name, idNameSpace) << " Box made of "
643  << dohmPrimMaterial << " of dimensions " << dx << ", "
644  << dy << ", " << dz;
645  dohmPrim = DDLogicalPart(solid.ddname(), DDMaterial(dohmPrimMaterial), solid);
646  name = idName + "DOHM_PRIM_Cable";
647  dx_cable = 0.25*dohmPrimT;
648  dy_cable = 0.40*dohmPrimW;
649  dz_cable = 0.5*dohmPrimL;
650  solid = DDSolidFactory::box(DDName(name, idNameSpace), dx_cable, dy_cable, dz_cable);
651  dohmCablePrim = DDLogicalPart(solid.ddname(), DDMaterial(dohmCableMaterial), solid);
652  LogDebug("TIBGeom") << "DDTIBLayerAlgo_MTCC test: "
653  << DDName(name, idNameSpace) << " Box made of "
654  << dohmCableMaterial << " of dimensions " << dx_cable
655  << ", " << dy_cable << ", " << dz_cable;
656  dx = 0.5*dohmAuxT;
657  dy = 0.5*dohmAuxW;
658  dz = 0.5*dohmAuxL;
659  name = idName + "DOHM_AUX";
660  solid = DDSolidFactory::box(DDName(name, idNameSpace), dx, dy, dz);
661  DDLogicalPart dohmAux(solid.ddname(), DDMaterial(dohmAuxMaterial), solid);
662  LogDebug("TIBGeom") << "DDTIBLayerAlgo_MTCC test: "
663  << DDName(name, idNameSpace) << " Box made of "
664  << dohmAuxMaterial << " of dimensions " << dx << ", "
665  << dy << ", " << dz;
666  name = idName + "DOHM_AUX_Cable";
667  solid = DDSolidFactory::box(DDName(name, idNameSpace), dx_cable, dy_cable, dz_cable);
668  DDLogicalPart dohmCableAux(solid.ddname(), DDMaterial(dohmCableMaterial), solid);
669  LogDebug("TIBGeom") << "DDTIBLayerAlgo_MTCC test: "
670  << DDName(name, idNameSpace) << " Box made of "
671  << dohmCableMaterial << " of dimensions " << dx_cable
672  << ", " << dy_cable << ", " << dz_cable;
673  // TIB+ DOHM
674  tran = DDTranslation(rout_dohm+0.5*dohmPrimT, -0.75*dohmPrimW , 0.);
675  cpv.position(dohmPrim, dohmCarrierPrimAux_lo_r, 1, tran, DDRotation() );
676  LogDebug("TIBGeom") << "DDTIBLayer_MTCC test " << dohmAux.name()
677  << " z+ number " << 1 << " positioned in "
678  << dohmCarrierPrimAux_lo_r.name() << " at " << tran
679  << " with no rotation";
680  tran = DDTranslation(rout_dohm+dx_cable, -0.75*dohmPrimW+0.5*dohmPrimW , 0.);
681  cpv.position(dohmCablePrim, dohmCarrierPrimAux_lo_r, 1, tran, DDRotation() );
682  LogDebug("TIBGeom") << "DDTIBLayer_MTCC test " << dohmCablePrim.name()
683  << " copy number " << 1 << " positioned in "
684  << dohmCarrierPrimAux_lo_r.name() << " at " << tran
685  << " with no rotation";
686  tran = DDTranslation(rout_dohm+dx_cable, -0.75*dohmPrimW-0.5*dohmPrimW , 0.);
687  cpv.position(dohmCablePrim, dohmCarrierPrimAux_lo_r, 2, tran, DDRotation() );
688  LogDebug("TIBGeom") << "DDTIBLayer_MTCC test " << dohmCablePrim.name()
689  << " copy number " << 2 << " positioned in "
690  << dohmCarrierPrimAux_lo_r.name() << " at " << tran
691  << " with no rotation";
692  tran = DDTranslation(rout_dohm+0.5*dohmAuxT, 0.75*dohmAuxW , 0.);
693  cpv.position(dohmAux, dohmCarrierPrimAux_lo_r, 1, tran, DDRotation() );
694  LogDebug("TIBGeom") << "DDTIBLayer_MTCC test " << dohmAux.name()
695  << " z+ number " << 1 << " positioned in "
696  << dohmCarrierPrimAux_lo_r.name()
697  << " at (0,0,0) with no rotation";
698  tran = DDTranslation(rout_dohm+dx_cable, 0.75*dohmAuxW+0.5*dohmPrimW , 0.);
699  cpv.position(dohmCableAux, dohmCarrierPrimAux_lo_r, 1, tran, DDRotation() );
700  LogDebug("TIBGeom") << "DDTIBLayer_MTCC test " << dohmCableAux.name()
701  << " copy number " << 1 << " positioned in "
702  << dohmCarrierPrimAux_lo_r.name()
703  << " at " << tran << " with no rotation";
704 }
#define LogDebug(id)
int i
Definition: DBlmapReader.cc:9
std::string dohmCarrierMaterial
const N & name() const
Definition: DDBase.h:82
list parent
Definition: dbtoconf.py:74
DDMaterial is used to define and access material information.
Definition: DDMaterial.h:41
std::vector< double > stringUpList
std::vector< double > dohmList
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
std::vector< double > ribW
Geom::Theta< T > theta() const
void execute(DDCompactView &cpv)
void position(const DDLogicalPart &self, const DDLogicalPart &parent, std::string copyno, const DDTranslation &trans, const DDRotation &rot, const DDDivision *div=NULL)
#define abs(x)
Definition: mlp_lapack.h:159
DDName is used to identify DDD entities uniquely.
Definition: DDName.h:18
double phidiff(double phi)
Normalized difference in azimuthal angles to a range between .
Definition: fourvec.cc:231
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
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)
T sqrt(T t)
Definition: SSEVec.h:46
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
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< double > ribPhi
bool first
Definition: L1TdeRCT.cc:94
static DDSolid box(const DDName &name, double xHalf, double yHalf, double zHalf)
Creates a box with side length 2*xHalf, 2*yHalf, 2*zHalf.
Definition: DDSolid.cc:519
DDRotation DDrot(const DDName &name, DDRotationMatrix *rot)
Definition of a uniquely identifiable rotation matrix named by DDName name.
Definition: DDRotation.cc:93
std::vector< double > stringLoList
std::pair< std::string, std::string > DDSplit(const std::string &n)
split into (name,namespace), separator = &#39;:&#39;
Definition: DDSplit.cc:4
const std::string & name() const
Returns the name.
Definition: DDName.cc:87
const N & ddname() const
Definition: DDBase.h:84
Definition: DDAxes.h:10