CMS 3D CMS Logo

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