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