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  DDLogicalPart layer(solid.ddname(), matter, solid);
195 
196  //Lower part first
197  double rin = rmin;
198  double rout = 0.5*(radiusLo+radiusUp-cylinderT);
199  std::string name = idName + "Down";
200  solid = DDSolidFactory::tubs(DDName(name, idNameSpace), 0.5*layerL,
201  rin, rout, 0, CLHEP::twopi);
202  LogDebug("TIBGeom") << "DDTIBLayerAlgo_MTCC test: "
203  << DDName(name, idNameSpace) << " Tubs made of "
204  << genMat << " from 0 to " << CLHEP::twopi/CLHEP::deg
205  << " with Rin " << rin << " Rout " << rout << " ZHalf "
206  << 0.5*layerL;
207  DDLogicalPart layerIn(solid.ddname(), matter, solid);
208  cpv.position(layerIn, layer, 1, DDTranslation(0.0, 0.0, 0.0), DDRotation());
209  LogDebug("TIBGeom") << "DDTIBLayerAlgo_MTCC test: " << layerIn.name()
210  << " number 1 positioned in " << layer.name()
211  << " at (0,0,0) with no rotation";
212 
213  double rposdet = radiusLo + roffDetLo;
214  double rposcab = rposdet + roffCableLo;
215  double dphi = CLHEP::twopi/stringsLo;
216  DDName detIn(DDSplit(detectorLo).first, DDSplit(detectorLo).second);
217  DDName cabIn(DDSplit(coolCableLo).first, DDSplit(coolCableLo).second);
218  for (int n = 0; n < stringsLo; n++) {
219  double phi = phioffLo + n*dphi;
220  if( phi>=phiMinLo && phi<phiMaxLo ) { // phi range
221  double phix = phi - detectorTilt + 90*CLHEP::deg;
222  double phideg = phix/CLHEP::deg;
224  if (phideg != 0) {
225  double theta = 90*CLHEP::deg;
226  double phiy = phix + 90.*CLHEP::deg;
227  std::string rotstr = idName + std::to_string(phideg*10.);
228  rotation = DDRotation(DDName(rotstr, idNameSpace));
229  if (!rotation) {
230  LogDebug("TIBGeom") << "DDTIBLayer_MTCC test: Creating a new "
231  << "rotation: " << rotstr << "\t90., "
232  << phix/CLHEP::deg << ", 90.,"
233  << phiy/CLHEP::deg << ", 0, 0";
234  rotation = DDrot(DDName(rotstr, idNameSpace), theta,phix, theta,phiy,
235  0., 0.);
236  }
237  }
238 
239  // fill strings in the stringLoList with modules, the others with only structure
240  bool empty=true;
241  for(double i : stringLoList) {
242  if(n+1==(int)i) {
243  empty=false;
244  }
245  }
246  if(empty) {
247  if(emptyDetectorLo!="nothing") {
248  DDName emptyDetIn(DDSplit(emptyDetectorLo).first, DDSplit(emptyDetectorLo).second);
249  DDTranslation trdet(rposdet*cos(phi), rposdet*sin(phi), 0);
250  cpv.position(emptyDetIn, layerIn, n+1, trdet, rotation);
251  LogDebug("TIBGeom") << "DDTIBLayer_MTCC test " << emptyDetIn.name()
252  << " number " << n+1 << " positioned in "
253  << layerIn.name() << " at " << trdet
254  << " with " << rotation;
255  }
256  if(emptyCoolCableLo!="nothing") {
257  DDName emptyCabIn(DDSplit(emptyCoolCableLo).first, DDSplit(emptyCoolCableLo).second);
258  DDTranslation trcab(rposcab*cos(phi), rposcab*sin(phi), 0);
259  cpv.position(emptyCabIn, layerIn, n+1, trcab, rotation);
260  LogDebug("TIBGeom") << "DDTIBLayer_MTCC test " << emptyCabIn.name()
261  << " number " << n+1 << " positioned in "
262  << layerIn.name() << " at " << trcab
263  << " with " << rotation;
264  }
265  } else {
266  DDTranslation trdet(rposdet*cos(phi), rposdet*sin(phi), 0);
267  cpv.position(detIn, layerIn, n+1, trdet, rotation);
268  LogDebug("TIBGeom") << "DDTIBLayer_MTCC test " << detIn.name()
269  << " number " << n+1 << " positioned in "
270  << layerIn.name() << " at " << trdet
271  << " with " << rotation;
272  DDTranslation trcab(rposcab*cos(phi), rposcab*sin(phi), 0);
273  cpv.position(cabIn, layerIn, n+1, trcab, rotation);
274  LogDebug("TIBGeom") << "DDTIBLayer_MTCC test " << cabIn.name()
275  << " number " << n+1 << " positioned in "
276  << layerIn.name() << " at " << trcab
277  << " with " << rotation;
278  }
279  //
280 
281  } // phi range
282 
283  }
284 
285  //Now the upper part
286  rin = 0.5*(radiusLo+radiusUp+cylinderT);
287  rout = rmax;
288  name = idName + "Up";
289  solid = DDSolidFactory::tubs(DDName(name, idNameSpace), 0.5*layerL,
290  rin, rout, 0, CLHEP::twopi);
291  LogDebug("TIBGeom") << "DDTIBLayerAlgo_MTCC test: "
292  << DDName(name, idNameSpace) << " Tubs made of "
293  << genMat << " from 0 to " << CLHEP::twopi/CLHEP::deg
294  << " with Rin " << rin << " Rout " << rout << " ZHalf "
295  << 0.5*layerL;
296  DDLogicalPart layerOut(solid.ddname(), matter, solid);
297  cpv.position(layerOut, layer, 1, DDTranslation(0.0, 0.0, 0.0), DDRotation());
298  LogDebug("TIBGeom") << "DDTIBLayerAlgo_MTCC test: " << layerOut.name()
299  << " number 1 positioned in " << layer.name()
300  << " at (0,0,0) with no rotation";
301 
302  rposdet = radiusUp + roffDetUp;
303  rposcab = rposdet + roffCableUp;
304  dphi = CLHEP::twopi/stringsUp;
305  DDName detOut(DDSplit(detectorUp).first, DDSplit(detectorUp).second);
306  DDName cabOut(DDSplit(coolCableUp).first, DDSplit(coolCableUp).second);
307  for (int n = 0; n < stringsUp; n++) {
308  double phi = phioffUp + n*dphi;
309  if( phi>=phiMinUp && phi<phiMaxUp ) { // phi range
310  double phix = phi - detectorTilt - 90*CLHEP::deg;
311  double phideg = phix/CLHEP::deg;
313  if (phideg != 0) {
314  double theta = 90*CLHEP::deg;
315  double phiy = phix + 90.*CLHEP::deg;
316  std::string rotstr = idName + std::to_string(phideg*10.);
317  rotation = DDRotation(DDName(rotstr, idNameSpace));
318  if (!rotation) {
319  LogDebug("TIBGeom") << "DDTIBLayer_MTCC test: Creating a new "
320  << "rotation: " << rotstr << "\t90., "
321  << phix/CLHEP::deg << ", 90.,"
322  << phiy/CLHEP::deg << ", 0, 0";
323  rotation = DDrot(DDName(rotstr, idNameSpace), theta,phix, theta,phiy,
324  0., 0.);
325  }
326  }
327 
328  // fill strings in the stringUpList with modules, the others with only structure
329  bool empty=true;
330  for(double i : stringUpList) {
331  if(n+1==(int)i) {
332  empty=false;
333  }
334  }
335  if(empty) {
336  if(emptyDetectorUp!="nothing") {
337  DDName emptyDetOut(DDSplit(emptyDetectorUp).first, DDSplit(emptyDetectorUp).second);
338  DDTranslation trdet(rposdet*cos(phi), rposdet*sin(phi), 0);
339  cpv.position(emptyDetOut, layerOut, n+1, trdet, rotation);
340  LogDebug("TIBGeom") << "DDTIBLayer test " << emptyDetOut.name()
341  << " number " << n+1 << " positioned in "
342  << layerOut.name() << " at " << trdet
343  << " with " << rotation;
344 
345  }
346  if(emptyCoolCableUp!="nothing") {
347  DDName emptyCabOut(DDSplit(emptyCoolCableUp).first, DDSplit(emptyCoolCableUp).second);
348  DDTranslation trcab(rposcab*cos(phi), rposcab*sin(phi), 0);
349  cpv.position(emptyCabOut, layerOut, n+1, trcab, rotation);
350  LogDebug("TIBGeom") << "DDTIBLayer_MTCC test " << emptyCabOut.name()
351  << " number " << n+1 << " positioned in "
352  << layerOut.name() << " at " << trcab
353  << " with " << rotation;
354  }
355  } else {
356  DDTranslation trdet(rposdet*cos(phi), rposdet*sin(phi), 0);
357  cpv.position(detOut, layerOut, n+1, trdet, rotation);
358  LogDebug("TIBGeom") << "DDTIBLayer test " << detOut.name()
359  << " number " << n+1 << " positioned in "
360  << layerOut.name() << " at " << trdet
361  << " with " << rotation;
362  DDTranslation trcab(rposcab*cos(phi), rposcab*sin(phi), 0);
363  cpv.position(cabOut, layerOut, n+1, trcab, rotation);
364  LogDebug("TIBGeom") << "DDTIBLayer_MTCC test " << cabOut.name()
365  << " number " << n+1 << " positioned in "
366  << layerOut.name() << " at " << trcab
367  << " with " << rotation;
368  }
369  //
370 
371  } // phi range
372 
373  }
374 
375  double phiMin = phiMinUp-phioffUp; // lower phi for cylinders
376  double phiMax = phiMaxUp-phioffUp; // upper phi for cylinders
377  double phidiff = fabs(phiMax-phiMin); // cylinders will not be twopi but phidiff
378  //Finally the inner cylinder, support wall and ribs
379  rin = 0.5*(radiusLo+radiusUp-cylinderT);
380  rout = 0.5*(radiusLo+radiusUp+cylinderT);
381  name = idName + "Cylinder";
382  solid = DDSolidFactory::tubs(DDName(name, idNameSpace), 0.25*layerL,
383  rin, rout, phiMin, phidiff);
384  LogDebug("TIBGeom") << "DDTIBLayerAlgo_MTCC test: "
385  << DDName(name, idNameSpace) << " Tubs made of "
386  << cylinderMat << " from " << phiMin/CLHEP::deg << " to "
387  << (phiMin+phidiff)/CLHEP::deg << " with Rin " << rin
388  << " Rout " << rout << " ZHalf " << 0.25*layerL;
389  DDMaterial matcyl( DDName( DDSplit(cylinderMat).first, DDSplit(cylinderMat).second ));
390  DDLogicalPart cylinder(solid.ddname(), matcyl, solid);
391  cpv.position(cylinder, layer, 1, DDTranslation(0.0,0.0,0.25*layerL), DDRotation());
392  LogDebug("TIBGeom") << "DDTIBLayerAlgo_MTCC test: " << cylinder.name()
393  << " number 1 positioned in " << layer.name()
394  << " at (0,0," << 0.25*layerL << ") with no rotation";
395  rin += supportT;
396  rout -= supportT;
397  name = idName + "CylinderIn";
398  solid = DDSolidFactory::tubs(DDName(name, idNameSpace), 0.5*layerL,
399  rin, rout, phiMin, phidiff);
400  LogDebug("TIBGeom") << "DDTIBLayerAlgo_MTCC test: "
401  << DDName(name, idNameSpace) << " Tubs made of "
402  << genMat << " from " << phiMin/CLHEP::deg << " to "
403  << (phiMin+phidiff)/CLHEP::deg << phidiff/CLHEP::deg
404  << " with Rin " << rin << " Rout " << rout << " ZHalf "
405  << 0.5*layerL;
406  DDLogicalPart cylinderIn(solid.ddname(), matter, solid);
407  cpv.position(cylinderIn, cylinder, 1, DDTranslation(0.0, 0.0, -0.25*layerL), DDRotation());
408  LogDebug("TIBGeom") << "DDTIBLayerAlgo_MTCC test: " << cylinderIn.name()
409  << " number 1 positioned in " << cylinder.name()
410  << " at (0,0," << -0.25*layerL << ") with no rotation";
411  name = idName + "CylinderInSup";
412  solid = DDSolidFactory::tubs(DDName(name, idNameSpace), 0.5*supportW,
413  rin, rout, phiMin, phidiff);
414  LogDebug("TIBGeom") << "DDTIBLayerAlgo_MTCC test: "
415  << DDName(name, idNameSpace) << " Tubs made of "
416  << genMat << " from " << phiMin/CLHEP::deg << " to "
417  << (phiMin+phidiff)/CLHEP::deg << " with Rin " << rin
418  << " Rout " << rout << " ZHalf " << 0.5*supportW;
419  DDMaterial matsup( DDName( DDSplit(supportMat).first, DDSplit(supportMat).second ));
420  DDLogicalPart cylinderSup(solid.ddname(), matsup, solid);
421  cpv.position(cylinderSup, cylinderIn, 1, DDTranslation(0., 0., 0.), DDRotation());
422  LogDebug("TIBGeom") << "DDTIBLayerAlgo_MTCC test: " << cylinderSup.name()
423  << " number 1 positioned in " << cylinderIn.name()
424  << " at (0,0,0) with no rotation";
425  DDMaterial matrib( DDName( DDSplit(ribMat).first, DDSplit(ribMat).second ));
426  for (unsigned int i = 0; i < ribW.size(); i++) {
427  name = idName + "Rib" + std::to_string(i);
428  double width = 2.*ribW[i]/(rin+rout);
429  double dz = 0.25*(layerL - supportW);
430  solid = DDSolidFactory::tubs(DDName(name, idNameSpace), dz, rin, rout,
431  -0.5*width, width);
432  LogDebug("TIBGeom") << "DDTIBLayerAlgo_MTCC test: "
433  << DDName(name, idNameSpace) << " Tubs made of "
434  << ribMat << " from " << -0.5*width/CLHEP::deg
435  << " to " << 0.5*width/CLHEP::deg << " with Rin "
436  << rin << " Rout " << rout << " ZHalf " << dz;
437  DDLogicalPart cylinderRib(solid.ddname(), matrib, solid);
438  double phix = ribPhi[i];
439  double phideg = phix/CLHEP::deg;
440  if( phideg>=phiMin/CLHEP::deg && phideg<phiMax/CLHEP::deg ) { // phi range
442  if (phideg != 0) {
443  double theta = 90*CLHEP::deg;
444  double phiy = phix + 90.*CLHEP::deg;
445  std::string rotstr = idName + std::to_string(phideg*10.);
446  rotation = DDRotation(DDName(rotstr, idNameSpace));
447  if (!rotation) {
448  LogDebug("TIBGeom") << "DDTIBLayer_MTCC test: Creating a new "
449  << "rotation: " << rotstr << "\t90., "
450  << phix/CLHEP::deg << ", 90.,"
451  << phiy/CLHEP::deg << ", 0, 0";
452  rotation = DDrot(DDName(rotstr, idNameSpace), theta,phix, theta,phiy,
453  0., 0.);
454  }
455  }
456  DDTranslation tran(0, 0, +0.25*(layerL+supportW));
457  cpv.position(cylinderRib, cylinderIn, 1, tran, rotation);
458  LogDebug("TIBGeom") << "DDTIBLayer_MTCC test " << cylinderRib.name()
459  << " number 1 positioned in " << cylinderIn.name()
460  << " at " << tran << " with " << rotation;
461  } // phi range
462  }
463 
464 
465  // DOHM + carrier (portadohm)
466  double dz_dohm = 0.5*dohmCarrierW;
467  double dphi_dohm = CLHEP::twopi/((double)dohmN);
468  double rout_dohm = 0.5*(radiusLo+radiusUp+cylinderT)+dohmCarrierR;
469 
470  // DOHM Carrier TIB+ & TIB-
471  // lower
472  name = idName + "DOHMCarrier_lo";
473  double rin_lo = rout_dohm;
474  double rout_lo = rin_lo + dohmCarrierT;
475  solid = DDSolidFactory::tubs(DDName(name, idNameSpace), dz_dohm,
476  rin_lo, rout_lo,
477  -0.5*dphi_dohm, dphi_dohm);
478  LogDebug("TIBGeom") << "DDTIBLayerAlgo_MTCC test: "
479  << DDName(name, idNameSpace) << " Tubs made of "
480  << dohmCarrierMaterial << " from "
481  << -0.5*(dphi_dohm)/CLHEP::deg << " to "
482  << +0.5*(dphi_dohm)/CLHEP::deg << " with Rin "
483  << rin_lo << " Rout " << rout_lo << " ZHalf "
484  << dz_dohm;
485  // create different name objects for only PRIMary DOHMs and PRIMary+AUXiliary DOHM Carriers
486  std::string name_lo_r = name + "_PRIM_AUX" + "_lo" + "_r";
487  std::string name_lo_l = name + "_PRIM_AUX" + "_lo" + "_l";
488  DDLogicalPart dohmCarrierPrimAux_lo_r(name_lo_r, DDMaterial(dohmCarrierMaterial), solid);
489  DDLogicalPart dohmCarrierPrimAux_lo_l(name_lo_l, DDMaterial(dohmCarrierMaterial), solid);
490  name_lo_r = name + "_PRIM" + "_lo" + "_r";
491  name_lo_l = name + "_PRIM" + "_lo" + "_l";
492  DDLogicalPart dohmCarrierPrim_lo_r(name_lo_r, DDMaterial(dohmCarrierMaterial), solid);
493  DDLogicalPart dohmCarrierPrim_lo_l(name_lo_l, DDMaterial(dohmCarrierMaterial), solid);
494  // upper
495  name = idName + "DOHMCarrier_up";
496  double rin_up = rout_lo + 2.*dohmAuxT;
497  double rout_up = rin_up + dohmCarrierT;
498  solid = DDSolidFactory::tubs(DDName(name, idNameSpace), dz_dohm,
499  rin_up, rout_up,
500  -0.5*dphi_dohm, dphi_dohm);
501  LogDebug("TIBGeom") << "DDTIBLayerAlgo_MTCC test: "
502  << DDName(name, idNameSpace) << " Tubs made of "
503  << dohmCarrierMaterial << " from "
504  << -0.5*(dphi_dohm)/CLHEP::deg << " to "
505  << +0.5*(dphi_dohm)/CLHEP::deg << " with Rin "
506  << rin_up << " Rout " << rout_up << " ZHalf "
507  << dz_dohm;
508  // create different name objects for only PRIMary DOHMs and PRIMary+AUXiliary DOHM Carriers
509  std::string name_up_r = name + "_PRIM_AUX" + "_up" + "_r";
510  std::string name_up_l = name + "_PRIM_AUX" + "_up" + "_l";
511  DDLogicalPart dohmCarrierPrimAux_up_r(name_up_r, DDMaterial(dohmCarrierMaterial), solid);
512  DDLogicalPart dohmCarrierPrimAux_up_l(name_up_l, DDMaterial(dohmCarrierMaterial), solid);
513  name_up_r = name + "_PRIM" + "_up" + "_r";
514  name_up_l = name + "_PRIM" + "_up" + "_l";
515  DDLogicalPart dohmCarrierPrim_up_r(name_up_r, DDMaterial(dohmCarrierMaterial), solid);
516  DDLogicalPart dohmCarrierPrim_up_l(name_up_l, DDMaterial(dohmCarrierMaterial), solid);
517  //
518  for (unsigned int i = 0; i < (unsigned int)dohmN; i++) {
519  DDLogicalPart dohmCarrier_lo_r;
520  DDLogicalPart dohmCarrier_lo_l;
521  DDLogicalPart dohmCarrier_up_r;
522  DDLogicalPart dohmCarrier_up_l;
523  // create different name objects for only PRIMary DOHMs and PRIMary+AUXiliary DOHMs
524  bool prim = false;
525  bool aux = false;
526  if((unsigned int)dohmList[i]==2) {
527  prim = true;
528  aux = true;
529  } else if((unsigned int)dohmList[i]==1) {
530  prim = true;
531  aux = false;
532  } else {
533  prim = false;
534  aux = false;
535  }
536 
537  if(prim) {
538  dohmCarrier_lo_r = dohmCarrierPrim_lo_r;
539  dohmCarrier_lo_l = dohmCarrierPrim_lo_l;
540  dohmCarrier_up_r = dohmCarrierPrim_up_r;
541  dohmCarrier_up_l = dohmCarrierPrim_up_l;
542  }
543  if(prim && aux) {
544  dohmCarrier_lo_r = dohmCarrierPrimAux_lo_r;
545  dohmCarrier_lo_l = dohmCarrierPrimAux_lo_l;
546  dohmCarrier_up_r = dohmCarrierPrimAux_up_r;
547  dohmCarrier_up_l = dohmCarrierPrimAux_up_l;
548  }
549  //
550 
551  if(prim) {
552  double phix = ((double)i+0.5)*dphi_dohm;
553  double phideg = phix/CLHEP::deg;
554  // if( phideg>=phiMin/CLHEP::deg && phideg<phiMax/CLHEP::deg ) { // phi range
556  if (phideg != 0) {
557  double theta = 90*CLHEP::deg;
558  double phiy = phix + 90.*CLHEP::deg;
559  std::string rotstr = idName + std::to_string(phideg*10.);
560  rotation = DDRotation(DDName(rotstr, idNameSpace));
561  if (!rotation) {
562  LogDebug("TIBGeom") << "DDTIBLayer_MTCC test: Creating a new "
563  << "rotation: " << rotstr << "\t90., "
564  << phix/CLHEP::deg << ", 90.,"
565  << phiy/CLHEP::deg << ", 0, 0";
566  rotation = DDrot(DDName(rotstr, idNameSpace), theta,phix, theta,phiy,
567  0., 0.);
568  }
569  }
570  // TIB+ DOHM Carrier - lower
571  DDTranslation tran(0, 0, 0.5*layerL-dz_dohm);
572  cpv.position(dohmCarrier_lo_r, parent(), i+1, tran, rotation );
573  LogDebug("TIBGeom") << "DDTIBLayer_MTCC test " << dohmCarrier_lo_r.name()
574  << " z+ number " << i+1 << " positioned in "
575  << parent().name() << " at " << tran
576  << " with " << rotation;
577  // TIB+ DOHM Carrier - upper
578  cpv.position(dohmCarrier_up_r, parent(), i+1+(unsigned int)dohmN, tran, rotation );
579  LogDebug("TIBGeom") << "DDTIBLayer_MTCC test " << dohmCarrier_up_r.name()
580  << " z+ number " << i+1 << " positioned in "
581  << parent().name() << " at " << tran
582  << " with " << rotation;
583  }
584 
585  // } // phi range
586  }
587 
588 
589  // DOHM only PRIMary
590  double dx = 0.5*dohmPrimT;
591  double dy = 0.5*dohmPrimW;
592  double dz = 0.5*dohmPrimL;
593  name = idName + "DOHM_PRIM";
594  solid = DDSolidFactory::box(DDName(name, idNameSpace), dx, dy, dz);
595  DDLogicalPart dohmPrim(solid.ddname(), DDMaterial(dohmPrimMaterial), solid);
596  LogDebug("TIBGeom") << "DDTIBLayerAlgo_MTCC test: "
597  << DDName(name, idNameSpace) << " Box made of "
598  << dohmPrimMaterial << " of dimensions " << dx << ", "
599  << dy << ", " << dz;
600  name = idName + "DOHM_PRIM_Cable";
601  double dx_cable = 0.25*dohmPrimT;
602  double dy_cable = 0.40*dohmPrimW;
603  double dz_cable = 0.5*dohmPrimL;
604  solid = DDSolidFactory::box(DDName(name, idNameSpace), dx_cable, dy_cable, dz_cable);
605  DDLogicalPart dohmCablePrim(solid.ddname(), DDMaterial(dohmCableMaterial), solid);
606  LogDebug("TIBGeom") << "DDTIBLayerAlgo_MTCC test: "
607  << DDName(name, idNameSpace) << " Box made of "
608  << dohmCableMaterial << " of dimensions " << dx_cable
609  << ", " << dy_cable << ", " << dz_cable;
610  // TIB+ DOHM
611  DDTranslation tran(rout_dohm+0.5*dohmPrimT, 0. , 0.);
612  cpv.position(dohmPrim, dohmCarrierPrim_lo_r, 1, tran, DDRotation() );
613  LogDebug("TIBGeom") << "DDTIBLayer_MTCC test " << dohmPrim.name()
614  << " z+ number " << 1 << " positioned in "
615  << dohmCarrierPrim_lo_r.name() << " at " << tran
616  << " with no rotation";
617  tran = DDTranslation(rout_dohm+dx_cable, 0.5*dohmPrimW , 0.);
618  cpv.position(dohmCablePrim, dohmCarrierPrim_lo_r, 1, tran, DDRotation() );
619  LogDebug("TIBGeom") << "DDTIBLayer_MTCC test " << dohmCablePrim.name()
620  << " copy number " << 1 << " positioned in "
621  << dohmCarrierPrim_lo_r.name()
622  << " at " << tran << " with no rotation";
623  tran = DDTranslation(rout_dohm+dx_cable, -0.5*dohmPrimW , 0.);
624  cpv.position(dohmCablePrim, dohmCarrierPrim_lo_r, 2, tran, DDRotation() );
625  LogDebug("TIBGeom") << "DDTIBLayer_MTCC test " << dohmCablePrim.name()
626  << " copy number " << 2 << " positioned in "
627  << dohmCarrierPrim_lo_r.name()
628  << " at " << tran << " with no rotation";
629 
630  // DOHM PRIMary + AUXiliary
631  dx = 0.5*dohmPrimT;
632  dy = 0.5*dohmPrimW;
633  dz = 0.5*dohmPrimL;
634  name = idName + "DOHM_PRIM";
635  solid = DDSolidFactory::box(DDName(name, idNameSpace), dx, dy, dz);
636  LogDebug("TIBGeom") << "DDTIBLayerAlgo_MTCC test: "
637  << DDName(name, idNameSpace) << " Box made of "
638  << dohmPrimMaterial << " of dimensions " << dx << ", "
639  << dy << ", " << dz;
640  dohmPrim = DDLogicalPart(solid.ddname(), DDMaterial(dohmPrimMaterial), solid);
641  name = idName + "DOHM_PRIM_Cable";
642  dx_cable = 0.25*dohmPrimT;
643  dy_cable = 0.40*dohmPrimW;
644  dz_cable = 0.5*dohmPrimL;
645  solid = DDSolidFactory::box(DDName(name, idNameSpace), dx_cable, dy_cable, dz_cable);
646  dohmCablePrim = DDLogicalPart(solid.ddname(), DDMaterial(dohmCableMaterial), solid);
647  LogDebug("TIBGeom") << "DDTIBLayerAlgo_MTCC test: "
648  << DDName(name, idNameSpace) << " Box made of "
649  << dohmCableMaterial << " of dimensions " << dx_cable
650  << ", " << dy_cable << ", " << dz_cable;
651  dx = 0.5*dohmAuxT;
652  dy = 0.5*dohmAuxW;
653  dz = 0.5*dohmAuxL;
654  name = idName + "DOHM_AUX";
655  solid = DDSolidFactory::box(DDName(name, idNameSpace), dx, dy, dz);
656  DDLogicalPart dohmAux(solid.ddname(), DDMaterial(dohmAuxMaterial), solid);
657  LogDebug("TIBGeom") << "DDTIBLayerAlgo_MTCC test: "
658  << DDName(name, idNameSpace) << " Box made of "
659  << dohmAuxMaterial << " of dimensions " << dx << ", "
660  << dy << ", " << dz;
661  name = idName + "DOHM_AUX_Cable";
662  solid = DDSolidFactory::box(DDName(name, idNameSpace), dx_cable, dy_cable, dz_cable);
663  DDLogicalPart dohmCableAux(solid.ddname(), DDMaterial(dohmCableMaterial), solid);
664  LogDebug("TIBGeom") << "DDTIBLayerAlgo_MTCC test: "
665  << DDName(name, idNameSpace) << " Box made of "
666  << dohmCableMaterial << " of dimensions " << dx_cable
667  << ", " << dy_cable << ", " << dz_cable;
668  // TIB+ DOHM
669  tran = DDTranslation(rout_dohm+0.5*dohmPrimT, -0.75*dohmPrimW , 0.);
670  cpv.position(dohmPrim, dohmCarrierPrimAux_lo_r, 1, tran, DDRotation() );
671  LogDebug("TIBGeom") << "DDTIBLayer_MTCC test " << dohmAux.name()
672  << " z+ number " << 1 << " positioned in "
673  << dohmCarrierPrimAux_lo_r.name() << " at " << tran
674  << " with no rotation";
675  tran = DDTranslation(rout_dohm+dx_cable, -0.75*dohmPrimW+0.5*dohmPrimW , 0.);
676  cpv.position(dohmCablePrim, dohmCarrierPrimAux_lo_r, 1, tran, DDRotation() );
677  LogDebug("TIBGeom") << "DDTIBLayer_MTCC test " << dohmCablePrim.name()
678  << " copy number " << 1 << " positioned in "
679  << dohmCarrierPrimAux_lo_r.name() << " at " << tran
680  << " with no rotation";
681  tran = DDTranslation(rout_dohm+dx_cable, -0.75*dohmPrimW-0.5*dohmPrimW , 0.);
682  cpv.position(dohmCablePrim, dohmCarrierPrimAux_lo_r, 2, tran, DDRotation() );
683  LogDebug("TIBGeom") << "DDTIBLayer_MTCC test " << dohmCablePrim.name()
684  << " copy number " << 2 << " positioned in "
685  << dohmCarrierPrimAux_lo_r.name() << " at " << tran
686  << " with no rotation";
687  tran = DDTranslation(rout_dohm+0.5*dohmAuxT, 0.75*dohmAuxW , 0.);
688  cpv.position(dohmAux, dohmCarrierPrimAux_lo_r, 1, tran, DDRotation() );
689  LogDebug("TIBGeom") << "DDTIBLayer_MTCC test " << dohmAux.name()
690  << " z+ number " << 1 << " positioned in "
691  << dohmCarrierPrimAux_lo_r.name()
692  << " at (0,0,0) with no rotation";
693  tran = DDTranslation(rout_dohm+dx_cable, 0.75*dohmAuxW+0.5*dohmPrimW , 0.);
694  cpv.position(dohmCableAux, dohmCarrierPrimAux_lo_r, 1, tran, DDRotation() );
695  LogDebug("TIBGeom") << "DDTIBLayer_MTCC test " << dohmCableAux.name()
696  << " copy number " << 1 << " positioned in "
697  << dohmCarrierPrimAux_lo_r.name()
698  << " at " << tran << " with no rotation";
699 }
#define LogDebug(id)
std::string dohmCarrierMaterial
const N & name() const
Definition: DDBase.h:74
DDMaterial is used to define and access material information.
Definition: DDMaterial.h:43
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()
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
Represents a uniquely identifyable rotation matrix.
Definition: DDTransform.h:68
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:93
DDRotation DDrot(const DDName &name, std::unique_ptr< DDRotationMatrix > rot)
Definition of a uniquely identifiable rotation matrix named by DDName name.
Definition: DDRotation.cc:80
static DDSolid tubs(const DDName &name, double zhalf, double rIn, double rOut, double startPhi, double deltaPhi)
Definition: DDSolid.cc:865
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:704
void execute(DDCompactView &cpv) override
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:53
const N & ddname() const
Definition: DDBase.h:76