CMS 3D CMS Logo

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