CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
DDTIBLayerAlgo.cc
Go to the documentation of this file.
1 // File: DDTIBLayerAlgo.cc
3 // Description: Makes a TIB layer and position the strings with a tilt angle
5 
6 #include <cmath>
7 #include <algorithm>
8 
17 #include "CLHEP/Units/GlobalPhysicalConstants.h"
18 #include "CLHEP/Units/GlobalSystemOfUnits.h"
19 
20 
21 DDTIBLayerAlgo::DDTIBLayerAlgo(): ribW(0),ribPhi(0) {
22  LogDebug("TIBGeom") << "DDTIBLayerAlgo info: Creating an instance";
23 }
24 
26 
28  const DDVectorArguments & vArgs,
29  const DDMapArguments & ,
30  const DDStringArguments & sArgs,
31  const DDStringVectorArguments & ) {
32 
34  genMat = sArgs["GeneralMaterial"];
35  DDName parentName = parent().name();
36  LogDebug("TIBGeom") << "DDTIBLayerAlgo debug: Parent " << parentName
37  << " NameSpace " << idNameSpace
38  << " General Material " << genMat;
39 
40  detectorTilt = nArgs["DetectorTilt"];
41  layerL = nArgs["LayerL"];
42 
43  radiusLo = nArgs["RadiusLo"];
44  stringsLo = int(nArgs["StringsLo"]);
45  detectorLo = sArgs["StringDetLoName"];
46  LogDebug("TIBGeom") << "DDTIBLayerAlgo debug: Lower layer Radius "
47  << radiusLo << " Number " << stringsLo << " String "
48  << detectorLo;
49 
50  radiusUp = nArgs["RadiusUp"];
51  stringsUp = int(nArgs["StringsUp"]);
52  detectorUp = sArgs["StringDetUpName"];
53  LogDebug("TIBGeom") << "DDTIBLayerAlgo debug: Upper layer Radius "
54  << radiusUp << " Number " << stringsUp << " String "
55  << detectorUp;
56 
57  cylinderT = nArgs["CylinderThickness"];
58  cylinderInR = nArgs["CylinderInnerRadius"];
59  cylinderMat = sArgs["CylinderMaterial"];
60  MFRingInR = nArgs["MFRingInnerRadius"];
61  MFRingOutR = nArgs["MFRingOuterRadius"];
62  MFRingT = nArgs["MFRingThickness"];
63  MFRingDz = nArgs["MFRingDeltaz"];
64  MFIntRingMat = sArgs["MFIntRingMaterial"];
65  MFExtRingMat = sArgs["MFExtRingMaterial"];
66 
67  supportT = nArgs["SupportThickness"];
68 
69  centMat = sArgs["CentRingMaterial"];
70  centRing1par = vArgs["CentRing1"];
71  centRing2par = vArgs["CentRing2"];
72 
73  fillerMat = sArgs["FillerMaterial"];
74  fillerDz = nArgs["FillerDeltaz"];
75 
76  ribMat = sArgs["RibMaterial"];
77  ribW = vArgs["RibWidth"];
78  ribPhi = vArgs["RibPhi"];
79  LogDebug("TIBGeom") << "DDTIBLayerAlgo debug: Cylinder Material/"
80  << "thickness " << cylinderMat << " " << cylinderT
81  << " Rib Material " << ribMat << " at "
82  << ribW.size() << " positions with width/phi";
83 
84  for (unsigned int i = 0; i < ribW.size(); i++)
85  LogDebug("TIBGeom") << "\tribW[" << i << "] = " << ribW[i]
86  << "\tribPhi[" << i << "] = " << ribPhi[i]/CLHEP::deg;
87 
88  dohmCarrierPhiOff = nArgs["DOHMCarrierPhiOffset"];
89 
90  dohmtoMF = nArgs["DOHMtoMFDist"];
91 
92  dohmPrimName = sArgs["StringDOHMPrimName"];
93  dohmAuxName = sArgs["StringDOHMAuxName"];
94 
95  dohmCarrierMaterial = sArgs["DOHMCarrierMaterial"];
96  dohmCableMaterial = sArgs["DOHMCableMaterial"];
97  dohmPrimL = nArgs["DOHMPRIMLength"];
98  dohmPrimMaterial = sArgs["DOHMPRIMMaterial"];
99  dohmAuxL = nArgs["DOHMAUXLength"];
100  dohmAuxMaterial = sArgs["DOHMAUXMaterial"];
101  dohmListFW = vArgs["DOHMListFW"];
102  dohmListBW = vArgs["DOHMListBW"];
103  LogDebug("TIBGeom") << "DDTIBLayerAlgo debug: DOHM Primary "
104  << " Material " << dohmPrimMaterial << " Length " << dohmPrimL;
105  LogDebug("TIBGeom") << "DDTIBLayerAlgo debug: DOHM Aux "
106  << " Material " << dohmAuxMaterial << " Length " << dohmAuxL;
107  for (unsigned int i=0; i<dohmListFW.size(); i++) {
108  if (dohmListFW[i]>0.) LogDebug("TIBGeom") << "DOHM Primary at FW Position " << dohmListFW[i];
109  if (dohmListFW[i]<0.) LogDebug("TIBGeom") << "DOHM Aux at FW Position " << -dohmListFW[i];
110  }
111  for (unsigned int i=0; i<dohmListBW.size(); i++) {
112  if (dohmListBW[i]>0.) LogDebug("TIBGeom") << "DOHM Primary at BW Position " << dohmListBW[i];
113  if (dohmListBW[i]<0.) LogDebug("TIBGeom") << "DOHM Aux at BW Position " << -dohmListBW[i];
114  }
115 
116  //Pillar Material
117  pillarMaterial = sArgs["PillarMaterial"];
118 
119  // Internal Pillar Parameters
120  fwIntPillarDz = nArgs["FWIntPillarDz"];
121  fwIntPillarDPhi = nArgs["FWIntPillarDPhi"];
122  fwIntPillarZ = vArgs["FWIntPillarZ"];
123  fwIntPillarPhi = vArgs["FWIntPillarPhi"];
124  bwIntPillarDz = nArgs["BWIntPillarDz"];
125  bwIntPillarDPhi = nArgs["BWIntPillarDPhi"];
126  bwIntPillarZ = vArgs["BWIntPillarZ"];
127  bwIntPillarPhi = vArgs["BWIntPillarPhi"];
128  LogDebug("TIBGeom") << "FW Internal Pillar [Dz, DPhi] "
129  << fwIntPillarDz << ", "
130  << fwIntPillarDPhi;
131  for (unsigned int i=0; i<fwIntPillarZ.size(); i++) {
132  if( fwIntPillarPhi[i]>0. ) {
133  LogDebug("TIBGeom") << " at positions [z, phi] "
134  << fwIntPillarZ[i] << " " << fwIntPillarPhi[i];
135  }
136  }
137  LogDebug("TIBGeom") << "BW Internal Pillar [Dz, DPhi] "
138  << bwIntPillarDz << ", "
139  << bwIntPillarDPhi;
140  for (unsigned int i=0; i<bwIntPillarZ.size(); i++) {
141  if( bwIntPillarPhi[i]>0. ) {
142  LogDebug("TIBGeom") << " at positions [z, phi] "
143  << bwIntPillarZ[i] << " " << bwIntPillarPhi[i];
144  }
145  }
146 
147  // External Pillar Parameters
148  fwExtPillarDz = nArgs["FWExtPillarDz"];
149  fwExtPillarDPhi = nArgs["FWExtPillarDPhi"];
150  fwExtPillarZ = vArgs["FWExtPillarZ"];
151  fwExtPillarPhi = vArgs["FWExtPillarPhi"];
152  bwExtPillarDz = nArgs["BWExtPillarDz"];
153  bwExtPillarDPhi = nArgs["BWExtPillarDPhi"];
154  bwExtPillarZ = vArgs["BWExtPillarZ"];
155  bwExtPillarPhi = vArgs["BWExtPillarPhi"];
156  LogDebug("TIBGeom") << "FW External Pillar [Dz, DPhi] "
157  << fwExtPillarDz << ", "
158  << fwExtPillarDPhi;
159  for (unsigned int i=0; i<fwExtPillarZ.size(); i++) {
160  if( fwExtPillarPhi[i]>0. ) {
161  LogDebug("TIBGeom") << " at positions [z, phi] "
162  << fwExtPillarZ[i] << " " << fwExtPillarPhi[i];
163  }
164  }
165  LogDebug("TIBGeom") << "BW External Pillar [Dz, DPhi] "
166  << bwExtPillarDz << ", "
167  << bwExtPillarDPhi;
168  for (unsigned int i=0; i<bwExtPillarZ.size(); i++) {
169  if( bwExtPillarPhi[i]>0. ) {
170  LogDebug("TIBGeom") << " at positions [z, phi] "
171  << bwExtPillarZ[i] << " " << bwExtPillarPhi[i];
172  }
173  }
174 }
175 
177 
178  LogDebug("TIBGeom") << "==>> Constructing DDTIBLayerAlgo...";
179 
180  DDName parentName = parent().name();
181  const std::string &idName = parentName.name();
182 
183  double rmin = MFRingInR;
184  double rmax = MFRingOutR;
185 
186  DDSolid solid = DDSolidFactory::tubs(DDName(idName, idNameSpace), 0.5*layerL,
187  rmin, rmax, 0, CLHEP::twopi);
188 
189  LogDebug("TIBGeom") << "DDTIBLayerAlgo test: "
190  << DDName(idName,idNameSpace) << " Tubs made of "
191  << genMat << " from 0 to " << CLHEP::twopi/CLHEP::deg
192  << " with Rin " << rmin << " Rout " << rmax
193  << " ZHalf " << 0.5*layerL;
194 
196  DDMaterial matter(matname);
197  DDLogicalPart layer(solid.ddname(), matter, solid);
198 
199  //Internal layer first
200  double rin = rmin+MFRingT;
201  // double rout = 0.5*(radiusLo+radiusUp-cylinderT);
202  double rout = cylinderInR;
203  std::string name = idName + "Down";
204  solid = DDSolidFactory::tubs(DDName(name, idNameSpace), 0.5*layerL,
205  rin, rout, 0, CLHEP::twopi);
206  LogDebug("TIBGeom") << "DDTIBLayerAlgo test: "
207  << DDName(name, idNameSpace) << " Tubs made of "
208  << genMat << " from 0 to " << CLHEP::twopi/CLHEP::deg
209  << " with Rin " << rin << " Rout " << rout
210  << " ZHalf " << 0.5*layerL;
211  DDLogicalPart layerIn(solid.ddname(), matter, solid);
212  cpv.position(layerIn, layer, 1, DDTranslation(0.0, 0.0, 0.0), DDRotation());
213  LogDebug("TIBGeom") << "DDTIBLayerAlgo test: " << layerIn.name()
214  << " number 1 positioned in " << layer.name()
215  << " at (0,0,0) with no rotation";
216 
217  double rposdet = radiusLo;
218  double dphi = CLHEP::twopi/stringsLo;
219  DDName detIn(DDSplit(detectorLo).first, DDSplit(detectorLo).second);
220  for (int n = 0; n < stringsLo; n++) {
221  double phi = (n+0.5)*dphi;
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 + dbl_to_string(phideg*10.);
229  rotation = DDRotation(DDName(rotstr, idNameSpace));
230  if (!rotation) {
231  LogDebug("TIBGeom") << "DDTIBLayerAlgo 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  DDTranslation trdet(rposdet*cos(phi), rposdet*sin(phi), 0);
240  cpv.position(detIn, layerIn, n+1, trdet, rotation);
241  LogDebug("TIBGeom") << "DDTIBLayerAlgo test " << detIn.name()
242  << " number " << n+1 << " positioned in "
243  << layerIn.name() << " at " << trdet << " with "
244  << rotation;
245  }
246 
247  //Now the external layer
248  rin = cylinderInR + cylinderT;
249  rout = rmax-MFRingT;
250  name = idName + "Up";
251  solid = DDSolidFactory::tubs(DDName(name, idNameSpace), 0.5*layerL,
252  rin, rout, 0, CLHEP::twopi);
253  LogDebug("TIBGeom") << "DDTIBLayerAlgo test: "
254  << DDName(name, idNameSpace) << " Tubs made of "
255  << genMat << " from 0 to " << CLHEP::twopi/CLHEP::deg
256  << " with Rin " << rin << " Rout " << rout
257  << " ZHalf " << 0.5*layerL;
258  DDLogicalPart layerOut(solid.ddname(), matter, solid);
259  cpv.position(layerOut, layer, 1, DDTranslation(0.0, 0.0, 0.0), DDRotation());
260  LogDebug("TIBGeom") << "DDTIBLayerAlgo test: " << layerOut.name()
261  << " number 1 positioned in " << layer.name()
262  << " at (0,0,0) with no rotation";
263 
264  rposdet = radiusUp;
265  dphi = CLHEP::twopi/stringsUp;
266  DDName detOut(DDSplit(detectorUp).first, DDSplit(detectorUp).second);
267  for (int n = 0; n < stringsUp; n++) {
268  double phi = (n+0.5)*dphi;
269  double phix = phi - detectorTilt - 90*CLHEP::deg;
270  double phideg = phix/CLHEP::deg;
272  if (phideg != 0) {
273  double theta = 90*CLHEP::deg;
274  double phiy = phix + 90.*CLHEP::deg;
275  std::string rotstr = idName + dbl_to_string(phideg*10.);
276  rotation = DDRotation(DDName(rotstr, idNameSpace));
277  if (!rotation) {
278  LogDebug("TIBGeom") << "DDTIBLayerAlgo test: Creating a new "
279  << "rotation: " << rotstr << "\t90., "
280  << phix/CLHEP::deg << ", 90.,"
281  << phiy/CLHEP::deg << ", 0, 0";
282  rotation = DDrot(DDName(rotstr, idNameSpace), theta, phix, theta, phiy,
283  0., 0.);
284  }
285  }
286  DDTranslation trdet(rposdet*cos(phi), rposdet*sin(phi), 0);
287  cpv.position(detOut, layerOut, n+1, trdet, rotation);
288  LogDebug("TIBGeom") << "DDTIBLayerAlgo test " << detOut.name()
289  << " number " << n+1 << " positioned in "
290  << layerOut.name() << " at " << trdet << " with "
291  << rotation;
292  }
293 
294  //
295  // Inner cylinder, support wall and ribs
296  //
297  // External skins
298  rin = cylinderInR;
299  rout = cylinderInR+cylinderT;
300  name = idName + "Cylinder";
301  solid = DDSolidFactory::tubs(DDName(name, idNameSpace), 0.5*layerL,
302  rin, rout, 0, CLHEP::twopi);
303  LogDebug("TIBGeom") << "DDTIBLayerAlgo test: "
304  << DDName(name, idNameSpace) << " Tubs made of "
305  << cylinderMat << " from 0 to "
306  << CLHEP::twopi/CLHEP::deg << " with Rin " << rin
307  << " Rout " << rout << " ZHalf " << 0.5*layerL;
308  matname = DDName(DDSplit(cylinderMat).first, DDSplit(cylinderMat).second);
309  DDMaterial matcyl(matname);
310  DDLogicalPart cylinder(solid.ddname(), matcyl, solid);
311  cpv.position(cylinder, layer, 1, DDTranslation(0.0, 0.0, 0.0), DDRotation());
312  LogDebug("TIBGeom") << "DDTIBLayerAlgo test: " << cylinder.name()
313  << " number 1 positioned in " << layer.name()
314  << " at (0,0,0) with no rotation";
315  //
316  // inner part of the cylinder
317  //
318  rin += supportT;
319  rout -= supportT;
320  name = idName + "CylinderIn";
321  solid = DDSolidFactory::tubs(DDName(name, idNameSpace), 0.5*layerL,
322  rin, rout, 0, CLHEP::twopi);
323  LogDebug("TIBGeom") << "DDTIBLayerAlgo test: "
324  << DDName(name, idNameSpace) << " Tubs made of "
325  << genMat << " from 0 to " << CLHEP::twopi/CLHEP::deg
326  << " with Rin " << rin << " Rout " << rout
327  << " ZHalf " << 0.5*layerL;
328  DDLogicalPart cylinderIn(solid.ddname(), matter, solid);
329  cpv.position(cylinderIn, cylinder, 1, DDTranslation(0.0, 0.0, 0.0), DDRotation());
330  LogDebug("TIBGeom") << "DDTIBLayerAlgo test: " << cylinderIn.name()
331  << " number 1 positioned in " << cylinder.name()
332  << " at (0,0,0) with no rotation";
333  //
334  // Filler Rings
335  //
336  matname = DDName(DDSplit(fillerMat).first, DDSplit(fillerMat).second);
337  DDMaterial matfiller(matname);
338  name = idName + "Filler";
339  solid = DDSolidFactory::tubs(DDName(name, idNameSpace), fillerDz, rin, rout,
340  0., CLHEP::twopi);
341  LogDebug("TIBGeom") << "DDTIBLayerAlgo test: "
342  << DDName(name, idNameSpace) << " Tubs made of "
343  << fillerMat << " from " << 0. << " to "
344  << CLHEP::twopi/CLHEP::deg << " with Rin " << rin
345  << " Rout " << rout << " ZHalf " << fillerDz;
346  DDLogicalPart cylinderFiller(solid.ddname(), matfiller, solid);
347  cpv.position(cylinderFiller, cylinderIn, 1, DDTranslation(0.0, 0.0, 0.5*layerL-fillerDz), DDRotation());
348  cpv.position(cylinderFiller, cylinderIn, 2, DDTranslation(0.0, 0.0,-0.5*layerL+fillerDz), DDRotation());
349  LogDebug("TIBGeom") << "DDTIBLayerAlgo test " << cylinderFiller.name()
350  << " number 1" << " positioned in "
351  << cylinderIn.name() << " at " << DDTranslation(0.0, 0.0, 0.5*layerL-fillerDz)
352  << " number 2" << " positioned in "
353  << cylinderIn.name() << " at " << DDTranslation(0.0, 0.0,-0.5*layerL+fillerDz);
354 
355  //
356  // Ribs
357  //
358  matname = DDName(DDSplit(ribMat).first, DDSplit(ribMat).second);
359  DDMaterial matrib(matname);
360  for (int i = 0; i < (int)(ribW.size()); i++) {
361  name = idName + "Rib" + dbl_to_string(i);
362  double width = 2.*ribW[i]/(rin+rout);
363  double dz = 0.5*layerL-2.*fillerDz;
364  solid = DDSolidFactory::tubs(DDName(name, idNameSpace), dz,
365  rin+0.5*CLHEP::mm, rout-0.5*CLHEP::mm,
366  -0.5*width, width);
367  LogDebug("TIBGeom") << "DDTIBLayerAlgo test: "
368  << DDName(name, idNameSpace) << " Tubs made of "
369  << ribMat << " from " << -0.5*width/CLHEP::deg <<" to "
370  << 0.5*width/CLHEP::deg << " with Rin "
371  << rin+0.5*CLHEP::mm << " Rout "
372  << rout-0.5*CLHEP::mm << " ZHalf " << dz;
373  DDLogicalPart cylinderRib(solid.ddname(), matrib, solid);
374  double phix = ribPhi[i];
375  double phideg = phix/CLHEP::deg;
377  if (phideg != 0) {
378  double theta = 90*CLHEP::deg;
379  double phiy = phix + 90.*CLHEP::deg;
380  std::string rotstr = idName + dbl_to_string(phideg*10.);
381  rotation = DDRotation(DDName(rotstr, idNameSpace));
382  if (!rotation) {
383  LogDebug("TIBGeom") << "DDTIBLayerAlgo test: Creating a new "
384  << "rotation: " << rotstr << "\t90., "
385  << phix/CLHEP::deg << ", 90.," << phiy/CLHEP::deg
386  << ", 0, 0";
387  rotation = DDrot(DDName(rotstr, idNameSpace), theta, phix, theta, phiy,
388  0., 0.);
389  }
390  }
391  DDTranslation tran(0, 0, 0);
392  cpv.position(cylinderRib, cylinderIn, 1, tran, rotation);
393  LogDebug("TIBGeom") << "DDTIBLayerAlgo test " << cylinderRib.name()
394  << " number 1" << " positioned in "
395  << cylinderIn.name() << " at " << tran << " with "
396  << rotation;
397  }
398 
399  //Manifold rings
400  //
401  // Inner ones first
402  matname = DDName(DDSplit(MFIntRingMat).first, DDSplit(MFIntRingMat).second);
403  DDMaterial matintmfr(matname);
404  rin = MFRingInR;
405  rout = rin + MFRingT;
406  name = idName + "InnerMFRing";
408  rin, rout, 0, CLHEP::twopi);
409 
410  LogDebug("TIBGeom") << "DDTIBLayerAlgo test: "
411  << DDName(name, idNameSpace) << " Tubs made of "
412  << MFIntRingMat << " from 0 to "
413  << CLHEP::twopi/CLHEP::deg << " with Rin " << rin
414  << " Rout " << rout << " ZHalf " << MFRingDz;
415 
416  DDLogicalPart inmfr(solid.ddname(), matintmfr, solid);
417  cpv.position(inmfr, layer, 1, DDTranslation(0.0, 0.0, -0.5*layerL+MFRingDz), DDRotation());
418  cpv.position(inmfr, layer, 2, DDTranslation(0.0, 0.0, +0.5*layerL-MFRingDz), DDRotation());
419  LogDebug("TIBGeom") << "DDTIBLayerAlgo test: " << inmfr.name()
420  << " number 1 and 2 positioned in " << layer.name()
421  << " at (0,0,+-" << 0.5*layerL-MFRingDz << ") with no rotation";
422  // Outer ones
423  matname = DDName(DDSplit(MFExtRingMat).first, DDSplit(MFExtRingMat).second);
424  DDMaterial matextmfr(matname);
425  rout = MFRingOutR;
426  rin = rout - MFRingT;
427  name = idName + "OuterMFRing";
428  solid = DDSolidFactory::tubs(DDName(name, idNameSpace), MFRingDz,
429  rin, rout, 0, CLHEP::twopi);
430 
431  LogDebug("TIBGeom") << "DDTIBLayerAlgo test: "
432  << DDName(name, idNameSpace) << " Tubs made of "
433  << MFExtRingMat << " from 0 to "
434  << CLHEP::twopi/CLHEP::deg << " with Rin " << rin
435  << " Rout " << rout << " ZHalf " << MFRingDz;
436 
437  DDLogicalPart outmfr(solid.ddname(), matextmfr, solid);
438  cpv.position(outmfr, layer, 1, DDTranslation(0.0, 0.0, -0.5*layerL+MFRingDz), DDRotation());
439  cpv.position(outmfr, layer, 2, DDTranslation(0.0, 0.0, +0.5*layerL-MFRingDz), DDRotation());
440  LogDebug("TIBGeom") << "DDTIBLayerAlgo test: " << outmfr.name()
441  << " number 1 and 2 positioned in " << layer.name()
442  << " at (0,0,+-" << 0.5*layerL-MFRingDz
443  << ") with no rotation";
444 
445  //Central Support rings
446  //
447  matname = DDName(DDSplit(centMat).first, DDSplit(centMat).second);
448  DDMaterial matcent(matname);
449  // Ring 1
450  double centZ = centRing1par[0];
451  double centDz = 0.5*centRing1par[1];
452  rin = centRing1par[2];
453  rout = centRing1par[3];
454  name = idName + "CentRing1";
455  solid = DDSolidFactory::tubs(DDName(name, idNameSpace), centDz,
456  rin, rout, 0, CLHEP::twopi);
457 
458  LogDebug("TIBGeom") << "DDTIBLayerAlgo test: "
459  << DDName(name, idNameSpace) << " Tubs made of "
460  << centMat << " from 0 to " << CLHEP::twopi/CLHEP::deg
461  << " with Rin " << rin << " Rout " << rout
462  << " ZHalf " << centDz;
463 
464  DDLogicalPart cent1(solid.ddname(), matcent, solid);
465  cpv.position(cent1, layer, 1, DDTranslation(0.0, 0.0, centZ), DDRotation());
466  LogDebug("TIBGeom") << "DDTIBLayerAlgo test: " << cent1.name()
467  << " positioned in " << layer.name()
468  << " at (0,0," << centZ << ") with no rotation";
469  // Ring 2
470  centZ = centRing2par[0];
471  centDz = 0.5*centRing2par[1];
472  rin = centRing2par[2];
473  rout = centRing2par[3];
474  name = idName + "CentRing2";
475  solid = DDSolidFactory::tubs(DDName(name, idNameSpace), centDz,
476  rin, rout, 0, CLHEP::twopi);
477 
478  LogDebug("TIBGeom") << "DDTIBLayerAlgo test: "
479  << DDName(name, idNameSpace) << " Tubs made of "
480  << centMat << " from 0 to " << CLHEP::twopi/CLHEP::deg
481  << " with Rin " << rin << " Rout " << rout
482  << " ZHalf " << centDz;
483 
484  DDLogicalPart cent2(solid.ddname(), matcent, solid);
485  cpv.position(cent2, layer, 1, DDTranslation(0.0, 0.0, centZ), DDRotation());
486  LogDebug("TIBGeom") << "DDTIBLayerAlgo test: " << cent2.name()
487  << " positioned in " << layer.name()
488  << " at (0,0," << centZ << ") with no rotation";
489 
491  //
492  // Preparing DOHM Carrier solid
493 
494  name = idName + "DOHMCarrier";
495 
496  double dohmCarrierRin = MFRingOutR - MFRingT;
497  double dohmCarrierRout = MFRingOutR;
498  double dohmCarrierDz = 0.5*(dohmPrimL+dohmtoMF);
499  double dohmCarrierZ = 0.5*layerL-2.*MFRingDz-dohmCarrierDz;
500 
501  solid = DDSolidFactory::tubs(DDName(name, idNameSpace), dohmCarrierDz,
502  dohmCarrierRin, dohmCarrierRout,
504  180.*CLHEP::deg-2.*dohmCarrierPhiOff);
505  LogDebug("TIBGeom") << "DDTIBLayerAlgo test: "
506  << DDName(name, idNameSpace) << " Tubs made of "
507  << dohmCarrierMaterial << " from "
508  << dohmCarrierPhiOff << " to "
509  << 180.*CLHEP::deg-dohmCarrierPhiOff << " with Rin "
510  << dohmCarrierRin << " Rout " << MFRingOutR << " ZHalf "
511  << dohmCarrierDz;
512 
513 
514  // Define FW and BW carrier logical volume and
515  // place DOHM Primary and auxiliary modules inside it
516 
517  dphi = CLHEP::twopi/stringsUp;
518 
519  DDRotation dohmRotation;
520 
521  double dohmR = 0.5*(dohmCarrierRin+dohmCarrierRout);
522 
523 
524  for (int j = 0; j<4; j++) {
525 
526  std::vector<double> dohmList;
527  DDTranslation tran;
528  std::string rotstr;
530  int dohmCarrierReplica=0;
531  int placeDohm = 0;
532 
533  switch (j){
534  case 0:
535  name = idName + "DOHMCarrierFW";
536  dohmList = dohmListFW;
537  tran = DDTranslation(0., 0., dohmCarrierZ);
538  rotstr = idName + "FwUp";
539  rotation = DDRotation();
540  dohmCarrierReplica = 1;
541  placeDohm=1;
542  break;
543  case 1:
544  name = idName + "DOHMCarrierFW";
545  dohmList = dohmListFW;
546  tran = DDTranslation(0., 0., dohmCarrierZ);
547  rotstr = idName + "FwDown";
548  rotation = DDrot(DDName(rotstr, idNameSpace), 90.*CLHEP::deg,
549  180.*CLHEP::deg, 90.*CLHEP::deg,270.*CLHEP::deg, 0.,0.);
550  dohmCarrierReplica = 2;
551  placeDohm=0;
552  break;
553  case 2:
554  name = idName + "DOHMCarrierBW";
555  dohmList = dohmListBW;
556  tran = DDTranslation(0., 0., -dohmCarrierZ);
557  rotstr = idName + "BwUp";
558  rotation = DDrot(DDName(rotstr, idNameSpace), 90.*CLHEP::deg,
559  180.*CLHEP::deg, 90.*CLHEP::deg, 90.*CLHEP::deg,
560  180.*CLHEP::deg, 0.);
561  dohmCarrierReplica = 1;
562  placeDohm=1;
563  break;
564  case 3:
565  name = idName + "DOHMCarrierBW";
566  dohmList = dohmListBW;
567  tran = DDTranslation(0., 0., -dohmCarrierZ);
568  rotstr = idName + "BwDown";
569  rotation = DDrot(DDName(rotstr, idNameSpace), 90.*CLHEP::deg, 0.,
570  90.*CLHEP::deg, 270.*CLHEP::deg, 180.*CLHEP::deg, 0.);
571  dohmCarrierReplica = 2;
572  placeDohm=0;
573  break;
574  }
575 
576  DDLogicalPart dohmCarrier(name,DDMaterial(dohmCarrierMaterial),solid);
577 
578  int primReplica = 0;
579  int auxReplica = 0;
580 
581  for (int i = 0; i < placeDohm*((int)(dohmList.size())); i++) {
582 
583  double phi = (std::abs(dohmList[i])+0.5-1.)*dphi;
584  double phix = phi + 90*CLHEP::deg;
585  double phideg = phix/CLHEP::deg;
586  if (phideg != 0) {
587  double theta = 90*CLHEP::deg;
588  double phiy = phix + 90.*CLHEP::deg;
589  std::string rotstr = idName+dbl_to_string(std::abs(dohmList[i])-1.);
590  dohmRotation = DDRotation(DDName(rotstr, idNameSpace));
591  if (!dohmRotation) {
592  LogDebug("TIBGeom") << "DDTIBLayerAlgo test: Creating a new "
593  << "rotation: " << rotstr << "\t" << theta
594  << ", " << phix/CLHEP::deg << ", " << theta
595  << ", " << phiy/CLHEP::deg <<", 0, 0";
596  dohmRotation = DDrot(DDName(rotstr, idNameSpace), theta, phix, theta,
597  phiy, 0., 0.);
598  }
599  }
600 
601  std::string dohmName;
602  int dohmReplica = 0;
603  double dohmZ = 0.;
604 
605  if(dohmList[i]<0.) {
606  // Place a Auxiliary DOHM
607  dohmName = dohmAuxName;
608  dohmZ = dohmCarrierDz - 0.5*dohmAuxL - dohmtoMF;
609  primReplica++;
610  dohmReplica = primReplica;
611 
612  } else {
613  // Place a Primary DOHM
614  dohmName = dohmPrimName;
615  dohmZ = dohmCarrierDz - 0.5*dohmPrimL - dohmtoMF;
616  auxReplica++;
617  dohmReplica = auxReplica;
618  }
619 
620  DDName dohm(DDSplit(dohmName).first, DDSplit(dohmName).second);
621  DDTranslation dohmTrasl(dohmR*cos(phi), dohmR*sin(phi), dohmZ);
622  cpv.position(dohm, dohmCarrier, dohmReplica, dohmTrasl, dohmRotation);
623  LogDebug("TIBGeom") << "DDTIBLayerAlgo test " << dohm.name()
624  << " replica " << dohmReplica << " positioned in "
625  << dohmCarrier.name() << " at " << dohmTrasl << " with "
626  << dohmRotation;
627 
628  }
629 
630 
631  cpv.position(dohmCarrier, parent(), dohmCarrierReplica, tran, rotation );
632  LogDebug("TIBGeom") << "DDTIBLayerAlgo test "
633  << dohmCarrier.name() << " positioned in " << parent().name() << " at "
634  << tran << " with " << rotation;
635 
636  }
637 
639 
640  for (int j = 0; j<4; j++) {
641 
642  matname = DDName(DDSplit(pillarMaterial).first, DDSplit(pillarMaterial).second);
643  DDMaterial pillarMat(matname);
644  std::vector<double> pillarZ;
645  std::vector<double> pillarPhi;
646  double pillarDz=0, pillarDPhi=0, pillarRin=0, pillarRout=0;
647 
648  switch (j){
649  case 0:
650  name = idName + "FWIntPillar";
651  pillarZ = fwIntPillarZ;
652  pillarPhi = fwIntPillarPhi;
653  pillarRin = MFRingInR;
654  pillarRout = MFRingInR + MFRingT;
655  pillarDz = fwIntPillarDz;
656  pillarDPhi = fwIntPillarDPhi;
657  break;
658  case 1:
659  name = idName + "BWIntPillar";
660  pillarZ = bwIntPillarZ;
661  pillarPhi = bwIntPillarPhi;
662  pillarRin = MFRingInR;
663  pillarRout = MFRingInR + MFRingT;
664  pillarDz = bwIntPillarDz;
665  pillarDPhi = bwIntPillarDPhi;
666  break;
667  case 2:
668  name = idName + "FWExtPillar";
669  pillarZ = fwExtPillarZ;
670  pillarPhi = fwExtPillarPhi;
671  pillarRin = MFRingOutR - MFRingT;
672  pillarRout = MFRingOutR;
673  pillarDz = fwExtPillarDz;
674  pillarDPhi = fwExtPillarDPhi;
675  break;
676  case 3:
677  name = idName + "BWExtPillar";
678  pillarZ = bwExtPillarZ;
679  pillarPhi = bwExtPillarPhi;
680  pillarRin = MFRingOutR - MFRingT;
681  pillarRout = MFRingOutR;
682  pillarDz = bwExtPillarDz;
683  pillarDPhi = bwExtPillarDPhi;
684  break;
685  }
686 
687 
688  solid = DDSolidFactory::tubs(DDName(name, idNameSpace), pillarDz,
689  pillarRin, pillarRout,
690  -pillarDPhi, 2.*pillarDPhi);
691 
692  DDLogicalPart Pillar(name,DDMaterial(pillarMat),solid);
693 
694  LogDebug("TIBGeom") << "DDTIBLayerAlgo test: "
695  << DDName(name, idNameSpace) << " Tubs made of "
696  << pillarMat << " from "
697  << -pillarDPhi << " to "
698  << pillarDPhi << " with Rin "
699  << pillarRin << " Rout " << pillarRout << " ZHalf "
700  << pillarDz;
701 
702  DDTranslation pillarTran;
703  DDRotation pillarRota;
704  int pillarReplica = 0;
705  for (unsigned int i=0; i<pillarZ.size(); i++) {
706  if( pillarPhi[i]>0. ) {
707 
708  pillarTran = DDTranslation(0., 0., pillarZ[i]);
709  pillarRota = DDanonymousRot(DDcreateRotationMatrix(90.*CLHEP::deg, pillarPhi[i], 90.*CLHEP::deg, 90.*CLHEP::deg+pillarPhi[i], 0., 0.));
710 
711  cpv.position(Pillar, parent(), i, pillarTran, pillarRota);
712  LogDebug("TIBGeom") << "DDTIBLayerAlgo test "
713  << Pillar.name() << " positioned in "
714  << parent().name() << " at "
715  << pillarTran << " with " << pillarRota
716  << " copy number " << pillarReplica;
717 
718  pillarReplica++;
719  }
720 
721  }
722 
723  }
724 
725 }
#define LogDebug(id)
int i
Definition: DBlmapReader.cc:9
double fwExtPillarDz
const N & name() const
Definition: DDBase.h:82
std::vector< double > centRing2par
list parent
Definition: dbtoconf.py:74
std::vector< double > bwIntPillarPhi
std::vector< double > dohmListFW
DDMaterial is used to define and access material information.
Definition: DDMaterial.h:41
std::string detectorUp
std::string dohmAuxMaterial
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
void execute(DDCompactView &cpv)
std::string MFIntRingMat
std::vector< double > fwIntPillarPhi
Geom::Theta< T > theta() const
void position(const DDLogicalPart &self, const DDLogicalPart &parent, std::string copyno, const DDTranslation &trans, const DDRotation &rot, const DDDivision *div=NULL)
std::vector< double > fwIntPillarZ
DDName is used to identify DDD entities uniquely.
Definition: DDName.h:18
double fwIntPillarDz
static std::string & ns()
std::string dbl_to_string(const double &in)
Converts only the integer part of a double to a string.
Definition: DDutils.cc:12
std::vector< double > bwExtPillarZ
std::string cylinderMat
type of data representation of DDCompactView
Definition: DDCompactView.h:77
std::string fillerMat
A DDSolid represents the shape of a part.
Definition: DDSolid.h:35
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< double > > DDTranslation
Definition: DDTranslation.h:7
DDRotation DDanonymousRot(DDRotationMatrix *rot)
Defines a anonymous rotation or rotation-reflection matrix.
Definition: DDRotation.cc:194
std::string centMat
Represents a uniquely identifyable rotation matrix.
Definition: DDTransform.h:66
U second(std::pair< T, U > const &p)
std::string dohmPrimName
std::string genMat
double dohmCarrierPhiOff
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
int j
Definition: DBlmapReader.cc:9
A DDLogicalPart aggregates information concerning material, solid and sensitveness ...
Definition: DDLogicalPart.h:88
static DDSolid tubs(const DDName &name, double zhalf, double rIn, double rOut, double startPhi, double deltaPhi)
Definition: DDSolid.cc:788
std::vector< double > centRing1par
std::string ribMat
std::vector< double > fwExtPillarPhi
bool first
Definition: L1TdeRCT.cc:79
std::string MFExtRingMat
virtual ~DDTIBLayerAlgo()
DDRotation DDrot(const DDName &name, DDRotationMatrix *rot)
Definition of a uniquely identifiable rotation matrix named by DDName name.
Definition: DDRotation.cc:90
std::vector< double > bwIntPillarZ
std::string idNameSpace
double bwExtPillarDPhi
std::vector< double > bwExtPillarPhi
double fwExtPillarDPhi
std::vector< double > ribPhi
std::vector< double > dohmListBW
std::string pillarMaterial
std::pair< std::string, std::string > DDSplit(const std::string &n)
split into (name,namespace), separator = &#39;:&#39;
Definition: DDSplit.cc:4
void initialize(const DDNumericArguments &nArgs, const DDVectorArguments &vArgs, const DDMapArguments &mArgs, const DDStringArguments &sArgs, const DDStringVectorArguments &vsArgs)
std::string dohmCableMaterial
std::string dohmAuxName
std::string dohmPrimMaterial
std::string detectorLo
std::vector< double > ribW
const std::string & name() const
Returns the name.
Definition: DDName.cc:87
double fwIntPillarDPhi
double bwIntPillarDz
std::vector< double > fwExtPillarZ
double bwIntPillarDPhi
double bwExtPillarDz
std::string dohmCarrierMaterial
const N & ddname() const
Definition: DDBase.h:84
Definition: DDAxes.h:10
DDRotationMatrix * DDcreateRotationMatrix(double thetaX, double phiX, double thetaY, double phiY, double thetaZ, double phiZ)
create a new DDRotationMatrix in the GEANT3 style.
Definition: DDRotation.cc:165