CMS 3D CMS Logo

DDTIBLayerAlgo.cc
Go to the documentation of this file.
1 #include "DD4hep/DetFactoryHelper.h"
5 
6 using namespace std;
7 using namespace dd4hep;
8 using namespace cms;
9 using namespace cms_units::operators;
10 
11 static long algorithm(Detector& /* description */,
12  cms::DDParsingContext& context,
13  xml_h element,
14  SensitiveDetector& /* sens */) {
15  using VecDouble = vector<double>;
16 
17  cms::DDNamespace ns(context, element, true);
18  DDAlgoArguments args(context, element);
19 
20  string mother = args.parentName();
21  string genMat = args.str("GeneralMaterial"); //General material name
22  double detectorTilt = args.dble("DetectorTilt"); //Detector Tilt
23  double layerL = args.dble("LayerL"); //Length of the layer
24 
25  double radiusLo = args.dble("RadiusLo"); //Radius for detector at lower level
26  int stringsLo = args.integer("StringsLo"); //Number of strings ......
27  string detectorLo = args.str("StringDetLoName"); //Detector string name ......
28 
29  double radiusUp = args.dble("RadiusUp"); //Radius for detector at upper level
30  int stringsUp = args.integer("StringsUp"); //Number of strings ......
31  string detectorUp = args.str("StringDetUpName"); //Detector string name ......
32 
33  double cylinderT = args.dble("CylinderThickness"); //Cylinder thickness
34  double cylinderInR = args.dble("CylinderInnerRadius"); //Cylinder inner radius
35  string cylinderMat = args.str("CylinderMaterial"); //Cylinder material
36  double MFRingInR = args.dble("MFRingInnerRadius"); //Inner Manifold Ring Inner Radius
37  double MFRingOutR = args.dble("MFRingOuterRadius"); //Outer Manifold Ring Outer Radius
38  double MFRingT = args.dble("MFRingThickness"); //Manifold Ring Thickness
39  double MFRingDz = args.dble("MFRingDeltaz"); //Manifold Ring Half Lenght
40  string MFIntRingMat = args.str("MFIntRingMaterial"); //Manifold Ring Material
41  string MFExtRingMat = args.str("MFExtRingMaterial"); //Manifold Ring Material
42 
43  double supportT = args.dble("SupportThickness"); //Cylinder barrel CF skin thickness
44 
45  string centMat = args.str("CentRingMaterial"); //Central rings material
46  VecDouble centRing1par = args.vecDble("CentRing1"); //Central rings parameters
47  VecDouble centRing2par = args.vecDble("CentRing2"); //Central rings parameters
48 
49  string fillerMat = args.str("FillerMaterial"); //Filler material
50  double fillerDz = args.dble("FillerDeltaz"); //Filler Half Length
51 
52  string ribMat = args.str("RibMaterial"); //Rib material
53  VecDouble ribW = args.vecDble("RibWidth"); //Rib width
54  VecDouble ribPhi = args.vecDble("RibPhi"); //Rib Phi position
55 
56  VecDouble dohmListFW = args.vecDble("DOHMListFW"); //DOHM/AUX positions in #strings FW
57  VecDouble dohmListBW = args.vecDble("DOHMListBW"); //DOHM/AUX positions in #strings BW
58 
59  double dohmtoMF = args.dble("DOHMtoMFDist"); //DOHM Distance to MF
60  double dohmCarrierPhiOff = args.dble("DOHMCarrierPhiOffset"); //DOHM Carrier Phi offset wrt horizontal
61  string dohmPrimName = args.str("StringDOHMPrimName"); //DOHM Primary Logical Volume name
62  string dohmAuxName = args.str("StringDOHMAuxName"); //DOHM Auxiliary Logical Volume name
63 
64  string dohmCarrierMaterial = args.str("DOHMCarrierMaterial"); //DOHM Carrier Material
65  string dohmCableMaterial = args.str("DOHMCableMaterial"); //DOHM Cable Material
66  double dohmPrimL = args.dble("DOHMPRIMLength"); //DOHM PRIMary Length
67  string dohmPrimMaterial = args.str("DOHMPRIMMaterial"); //DOHM PRIMary Material
68  double dohmAuxL = args.dble("DOHMAUXLength"); //DOHM AUXiliary Length
69  string dohmAuxMaterial = args.str("DOHMAUXMaterial"); //DOHM AUXiliary Material
70 
71  string pillarMaterial = args.str("PillarMaterial"); //Pillar Material
72 
73  double fwIntPillarDz = args.dble("FWIntPillarDz"); //Internal pillar parameters
74  double fwIntPillarDPhi = args.dble("FWIntPillarDPhi");
75  VecDouble fwIntPillarZ = args.vecDble("FWIntPillarZ");
76  VecDouble fwIntPillarPhi = args.vecDble("FWIntPillarPhi");
77  double bwIntPillarDz = args.dble("BWIntPillarDz");
78  double bwIntPillarDPhi = args.dble("BWIntPillarDPhi");
79  VecDouble bwIntPillarZ = args.vecDble("BWIntPillarZ");
80  VecDouble bwIntPillarPhi = args.vecDble("BWIntPillarPhi");
81 
82  double fwExtPillarDz = args.dble("FWExtPillarDz"); //External pillar parameters
83  double fwExtPillarDPhi = args.dble("FWExtPillarDPhi");
84  VecDouble fwExtPillarZ = args.vecDble("FWExtPillarZ");
85  VecDouble fwExtPillarPhi = args.vecDble("FWExtPillarPhi");
86  double bwExtPillarDz = args.dble("BWExtPillarDz");
87  double bwExtPillarDPhi = args.dble("BWExtPillarDPhi");
88  VecDouble bwExtPillarZ = args.vecDble("BWExtPillarZ");
89  VecDouble bwExtPillarPhi = args.vecDble("BWExtPillarPhi");
90 
92 
93  auto LogPosition = [](dd4hep::PlacedVolume pvl) {
94  edm::LogVerbatim("TIBGeom") << "DDTIBLayerAlgo: " << pvl.volume()->GetName()
95  << " positioned: " << pvl.motherVol()->GetName() << " " << pvl.position();
96  };
97 
98  LogDebug("TIBGeom") << "Parent " << mother << " NameSpace " << ns.name() << " General Material " << genMat;
99  LogDebug("TIBGeom") << "Lower layer Radius " << radiusLo << " Number " << stringsLo << " String " << detectorLo;
100  LogDebug("TIBGeom") << "Upper layer Radius " << radiusUp << " Number " << stringsUp << " String " << detectorUp;
101  LogDebug("TIBGeom") << "Cylinder Material/thickness " << cylinderMat << " " << cylinderT << " Rib Material " << ribMat
102  << " at " << ribW.size() << " positions with width/phi";
103  for (unsigned int i = 0; i < ribW.size(); i++) {
104  LogDebug("TIBGeom") << "\tribW[" << i << "] = " << ribW[i] << "\tribPhi[" << i
105  << "] = " << convertRadToDeg(ribPhi[i]);
106  }
107  LogDebug("TIBGeom") << "DOHM Primary "
108  << " Material " << dohmPrimMaterial << " Length " << dohmPrimL;
109  LogDebug("TIBGeom") << "DOHM Aux "
110  << " Material " << dohmAuxMaterial << " Length " << dohmAuxL;
111  for (double i : dohmListFW) {
112  if (i > 0.)
113  LogDebug("TIBGeom") << "DOHM Primary at FW Position " << i;
114  if (i < 0.)
115  LogDebug("TIBGeom") << "DOHM Aux at FW Position " << -i;
116  }
117  for (double i : dohmListBW) {
118  if (i > 0.)
119  LogDebug("TIBGeom") << "DOHM Primary at BW Position " << i;
120  if (i < 0.)
121  LogDebug("TIBGeom") << "DOHM Aux at BW Position " << -i;
122  }
123  LogDebug("TIBGeom") << "FW Internal Pillar [Dz, DPhi] " << fwIntPillarDz << ", " << fwIntPillarDPhi;
124  for (unsigned int i = 0; i < fwIntPillarZ.size(); i++) {
125  if (fwIntPillarPhi[i] > 0.) {
126  LogDebug("TIBGeom") << " at positions [z, phi] " << fwIntPillarZ[i] << " " << fwIntPillarPhi[i];
127  }
128  }
129  LogDebug("TIBGeom") << "BW Internal Pillar [Dz, DPhi] " << bwIntPillarDz << ", " << bwIntPillarDPhi;
130  for (unsigned int i = 0; i < bwIntPillarZ.size(); i++) {
131  if (bwIntPillarPhi[i] > 0.) {
132  LogDebug("TIBGeom") << " at positions [z, phi] " << bwIntPillarZ[i] << " " << bwIntPillarPhi[i];
133  }
134  }
135  LogDebug("TIBGeom") << "FW External Pillar [Dz, DPhi] " << fwExtPillarDz << ", " << fwExtPillarDPhi;
136  for (unsigned int i = 0; i < fwExtPillarZ.size(); i++) {
137  if (fwExtPillarPhi[i] > 0.) {
138  LogDebug("TIBGeom") << " at positions [z, phi] " << fwExtPillarZ[i] << " " << fwExtPillarPhi[i];
139  }
140  }
141  LogDebug("TIBGeom") << "BW External Pillar [Dz, DPhi] " << bwExtPillarDz << ", " << bwExtPillarDPhi;
142  for (unsigned int i = 0; i < bwExtPillarZ.size(); i++) {
143  if (bwExtPillarPhi[i] > 0.) {
144  LogDebug("TIBGeom") << " at positions [z, phi] " << bwExtPillarZ[i] << " " << bwExtPillarPhi[i];
145  }
146  }
147 
148  const string& idName = mother;
149  double rmin = MFRingInR;
150  double rmax = MFRingOutR;
151  Solid solid = ns.addSolidNS(idName, Tube(rmin, rmax, 0.5 * layerL));
152  LogDebug("TIBGeom") << solid.name() << " Tubs made of " << genMat << " from 0 to " << convertRadToDeg(2_pi)
153  << " with Rin " << rmin << " Rout " << rmax << " ZHalf " << 0.5 * layerL;
154  Volume layer = ns.addVolumeNS(Volume(idName, solid, ns.material(genMat)));
155 
156  //Internal layer first
157  double rin = rmin + MFRingT;
158  // double rout = 0.5*(radiusLo+radiusUp-cylinderT);
159  double rout = cylinderInR;
160  string name = idName + "Down";
161  solid = ns.addSolidNS(name, Tube(rin, rout, 0.5 * layerL));
162  LogDebug("TIBGeom") << solid.name() << " Tubs made of " << genMat << " from 0 to " << convertRadToDeg(2_pi)
163  << " with Rin " << rin << " Rout " << rout << " ZHalf " << 0.5 * layerL;
164  Volume layerIn = ns.addVolumeNS(Volume(name, solid, ns.material(genMat)));
165  pv = layer.placeVolume(layerIn, 1);
166  LogPosition(pv);
167 
168  double rposdet = radiusLo;
169  double dphi = 2_pi / stringsLo;
170  Volume detIn = ns.volume(detectorLo);
171  for (int n = 0; n < stringsLo; n++) {
172  double phi = (n + 0.5) * dphi;
173  double phix = phi - detectorTilt + 90_deg;
174  double theta = 90_deg;
175  double phiy = phix + 90._deg;
176  Rotation3D rotation = makeRotation3D(theta, phix, theta, phiy, 0., 0.);
177  Position trdet(rposdet * cos(phi), rposdet * sin(phi), 0);
178  pv = layerIn.placeVolume(detIn, n + 1, Transform3D(rotation, trdet));
179  LogPosition(pv);
180  }
181  //Now the external layer
182  rin = cylinderInR + cylinderT;
183  rout = rmax - MFRingT;
184  name = idName + "Up";
185  solid = ns.addSolidNS(name, Tube(rin, rout, 0.5 * layerL));
186  LogDebug("TIBGeom") << solid.name() << " Tubs made of " << genMat << " from 0 to " << convertRadToDeg(2_pi)
187  << " with Rin " << rin << " Rout " << rout << " ZHalf " << 0.5 * layerL;
188  Volume layerOut = ns.addVolumeNS(Volume(name, solid, ns.material(genMat)));
189  pv = layer.placeVolume(layerOut, 1);
190  LogPosition(pv);
191 
192  rposdet = radiusUp;
193  dphi = 2_pi / stringsUp;
194  Volume detOut = ns.volume(detectorUp);
195  for (int n = 0; n < stringsUp; n++) {
196  double phi = (n + 0.5) * dphi;
197  double phix = phi - detectorTilt - 90_deg;
198  double theta = 90_deg;
199  double phiy = phix + 90._deg;
200  Rotation3D rotation = makeRotation3D(theta, phix, theta, phiy, 0., 0.);
201  Position trdet(rposdet * cos(phi), rposdet * sin(phi), 0);
202  pv = layerOut.placeVolume(detOut, n + 1, Transform3D(rotation, trdet));
203  LogPosition(pv);
204  }
205 
206  //
207  // Inner cylinder, support wall and ribs
208  //
209  // External skins
210  rin = cylinderInR;
211  rout = cylinderInR + cylinderT;
212  name = idName + "Cylinder";
213  solid = ns.addSolidNS(name, Tube(rin, rout, 0.5 * layerL));
214  LogDebug("TIBGeom") << solid.name() << " Tubs made of " << cylinderMat << " from 0 to " << convertRadToDeg(2_pi)
215  << " with Rin " << rin << " Rout " << rout << " ZHalf " << 0.5 * layerL;
216  Volume cylinder = ns.addVolumeNS(Volume(name, solid, ns.material(cylinderMat)));
217  pv = layer.placeVolume(cylinder, 1);
218  LogPosition(pv);
219 
220  //
221  // inner part of the cylinder
222  //
223  rin += supportT;
224  rout -= supportT;
225  name = idName + "CylinderIn";
226  solid = ns.addSolidNS(name, Tube(rin, rout, 0.5 * layerL));
227  LogDebug("TIBGeom") << solid.name() << " Tubs made of " << genMat << " from 0 to " << convertRadToDeg(2_pi)
228  << " with Rin " << rin << " Rout " << rout << " ZHalf " << 0.5 * layerL;
229  Volume cylinderIn = ns.addVolumeNS(Volume(name, solid, ns.material(genMat)));
230  pv = cylinder.placeVolume(cylinderIn, 1);
231  LogPosition(pv);
232 
233  //
234  // Filler Rings
235  //
236  name = idName + "Filler";
237  solid = ns.addSolidNS(name, Tube(rin, rout, fillerDz));
238  LogDebug("TIBGeom") << solid.name() << " Tubs made of " << fillerMat << " from " << 0. << " to "
239  << convertRadToDeg(2_pi) << " with Rin " << rin << " Rout " << rout << " ZHalf " << fillerDz;
240  Volume cylinderFiller = ns.addVolumeNS(Volume(name, solid, ns.material(fillerMat)));
241  pv = cylinderIn.placeVolume(cylinderFiller, 1, Position(0.0, 0.0, 0.5 * layerL - fillerDz));
242  LogPosition(pv);
243 
244  pv = cylinderIn.placeVolume(cylinderFiller, 2, Position(0.0, 0.0, -0.5 * layerL + fillerDz));
245  LogPosition(pv);
246 
247  //
248  // Ribs
249  //
250  Material matrib = ns.material(ribMat);
251  for (size_t i = 0; i < ribW.size(); i++) {
252  name = idName + "Rib" + std::to_string(i);
253  double width = 2. * ribW[i] / (rin + rout);
254  double dz = 0.5 * layerL - 2. * fillerDz;
255  double _rmi = std::min(rin + 0.5_mm, rout - 0.5_mm);
256  double _rma = std::max(rin + 0.5_mm, rout - 0.5_mm);
257  solid = ns.addSolidNS(name, Tube(_rmi, _rma, dz, -0.5 * width, width));
258  LogDebug("TIBGeom") << solid.name() << " Tubs made of " << ribMat << " from " << -0.5 * convertRadToDeg(width)
259  << " to " << 0.5 * convertRadToDeg(width) << " with Rin " << rin + 0.5_mm << " Rout "
260  << rout - 0.5_mm << " ZHalf " << dz;
261  Volume cylinderRib = ns.addVolumeNS(Volume(name, solid, matrib));
262  double phix = ribPhi[i];
263  double theta = 90_deg;
264  double phiy = phix + 90._deg;
265  Rotation3D rotation = makeRotation3D(theta, phix, theta, phiy, 0., 0.);
266  Position tran(0, 0, 0);
267  pv = cylinderIn.placeVolume(cylinderRib, 1, Transform3D(rotation, tran));
268  LogPosition(pv);
269  }
270 
271  //
272  //Manifold rings
273  //
274  // Inner ones first
275  rin = MFRingInR;
276  rout = rin + MFRingT;
277  name = idName + "InnerMFRing";
278  solid = ns.addSolidNS(name, Tube(rin, rout, MFRingDz));
279  LogDebug("TIBGeom") << solid.name() << " Tubs made of " << MFIntRingMat << " from 0 to " << convertRadToDeg(2_pi)
280  << " with Rin " << rin << " Rout " << rout << " ZHalf " << MFRingDz;
281 
282  Volume inmfr = ns.addVolumeNS(Volume(name, solid, ns.material(MFIntRingMat)));
283 
284  pv = layer.placeVolume(inmfr, 1, Position(0.0, 0.0, -0.5 * layerL + MFRingDz));
285  LogPosition(pv);
286 
287  pv = layer.placeVolume(inmfr, 2, Position(0.0, 0.0, +0.5 * layerL - MFRingDz));
288  LogPosition(pv);
289 
290  // Outer ones
291  rout = MFRingOutR;
292  rin = rout - MFRingT;
293  name = idName + "OuterMFRing";
294  solid = ns.addSolidNS(name, Tube(rin, rout, MFRingDz));
295  LogDebug("TIBGeom") << solid.name() << " Tubs made of " << MFExtRingMat << " from 0 to " << convertRadToDeg(2_pi)
296  << " with Rin " << rin << " Rout " << rout << " ZHalf " << MFRingDz;
297 
298  Volume outmfr = ns.addVolumeNS(Volume(name, solid, ns.material(MFExtRingMat)));
299  pv = layer.placeVolume(outmfr, 1, Position(0.0, 0.0, -0.5 * layerL + MFRingDz));
300  LogPosition(pv);
301  pv = layer.placeVolume(outmfr, 2, Position(0.0, 0.0, +0.5 * layerL - MFRingDz));
302  LogPosition(pv);
303 
304  //
305  //Central Support rings
306  //
307  // Ring 1
308  double centZ = centRing1par[0];
309  double centDz = 0.5 * centRing1par[1];
310  rin = centRing1par[2];
311  rout = centRing1par[3];
312  name = idName + "CentRing1";
313  solid = ns.addSolidNS(name, Tube(rin, rout, centDz));
314 
315  LogDebug("TIBGeom") << solid.name() << " Tubs made of " << centMat << " from 0 to " << convertRadToDeg(2_pi)
316  << " with Rin " << rin << " Rout " << rout << " ZHalf " << centDz;
317 
318  Volume cent1 = ns.addVolumeNS(Volume(name, solid, ns.material(centMat)));
319  pv = layer.placeVolume(cent1, 1, Position(0.0, 0.0, centZ));
320  LogPosition(pv);
321  // Ring 2
322  centZ = centRing2par[0];
323  centDz = 0.5 * centRing2par[1];
324  rin = centRing2par[2];
325  rout = centRing2par[3];
326  name = idName + "CentRing2";
327  solid = ns.addSolidNS(name, Tube(rin, rout, centDz));
328  LogDebug("TIBGeom") << solid.name() << " Tubs made of " << centMat << " from 0 to " << convertRadToDeg(2_pi)
329  << " with Rin " << rin << " Rout " << rout << " ZHalf " << centDz;
330 
331  Volume cent2 = ns.addVolumeNS(Volume(name, solid, ns.material(centMat)));
332  pv = layer.placeVolume(cent2, 1, Position(0e0, 0e0, centZ));
333  LogPosition(pv);
334 
335  //
337  //
338  // Preparing DOHM Carrier solid
339  //
340  name = idName + "DOHMCarrier";
341  double dohmCarrierRin = MFRingOutR - MFRingT;
342  double dohmCarrierRout = MFRingOutR;
343  double dohmCarrierDz = 0.5 * (dohmPrimL + dohmtoMF);
344  double dohmCarrierZ = 0.5 * layerL - 2. * MFRingDz - dohmCarrierDz;
345 
346  solid = ns.addSolidNS(
347  name, Tube(dohmCarrierRin, dohmCarrierRout, dohmCarrierDz, dohmCarrierPhiOff, 180._deg - dohmCarrierPhiOff));
348  LogDebug("TIBGeom") << solid.name() << " Tubs made of " << dohmCarrierMaterial << " from " << dohmCarrierPhiOff
349  << " to " << 180._deg - dohmCarrierPhiOff << " with Rin " << dohmCarrierRin << " Rout "
350  << MFRingOutR << " ZHalf " << dohmCarrierDz;
351 
352  // Define FW and BW carrier logical volume and
353  // place DOHM Primary and auxiliary modules inside it
354  dphi = 2_pi / stringsUp;
355 
356  Rotation3D dohmRotation;
357  double dohmR = 0.5 * (dohmCarrierRin + dohmCarrierRout);
358 
359  for (int j = 0; j < 4; j++) {
360  vector<double> dohmList;
361  Position tran;
362  string rotstr;
363  Rotation3D rotation;
364  int dohmCarrierReplica = 0;
365  int placeDohm = 0;
366 
367  switch (j) {
368  case 0:
369  name = idName + "DOHMCarrierFW";
370  dohmList = dohmListFW;
371  tran = Position(0., 0., dohmCarrierZ);
372  rotstr = idName + "FwUp";
373  rotation = Rotation3D();
374  dohmCarrierReplica = 1;
375  placeDohm = 1;
376  break;
377  case 1:
378  name = idName + "DOHMCarrierFW";
379  dohmList = dohmListFW;
380  tran = Position(0., 0., dohmCarrierZ);
381  rotstr = idName + "FwDown";
382  rotation = makeRotation3D(90._deg, 180._deg, 90._deg, 270._deg, 0., 0.);
383  dohmCarrierReplica = 2;
384  placeDohm = 0;
385  break;
386  case 2:
387  name = idName + "DOHMCarrierBW";
388  dohmList = dohmListBW;
389  tran = Position(0., 0., -dohmCarrierZ);
390  rotstr = idName + "BwUp";
391  rotation = makeRotation3D(90._deg, 180._deg, 90._deg, 90._deg, 180._deg, 0.);
392  dohmCarrierReplica = 1;
393  placeDohm = 1;
394  break;
395  case 3:
396  name = idName + "DOHMCarrierBW";
397  dohmList = dohmListBW;
398  tran = Position(0., 0., -dohmCarrierZ);
399  rotstr = idName + "BwDown";
400  rotation = makeRotation3D(90._deg, 0., 90._deg, 270._deg, 180._deg, 0.);
401  dohmCarrierReplica = 2;
402  placeDohm = 0;
403  break;
404  }
405 
406  Volume dohmCarrier = ns.addVolumeNS(Volume(name, solid, ns.material(dohmCarrierMaterial)));
407  int primReplica = 0;
408  int auxReplica = 0;
409 
410  for (size_t i = 0; i < placeDohm * dohmList.size(); i++) {
411  double phi = (std::abs(dohmList[i]) + 0.5 - 1.) * dphi;
412  double phix = phi + 90_deg;
413  double phideg = convertRadToDeg(phix);
414  if (phideg != 0) {
415  double theta = 90_deg;
416  double phiy = phix + 90._deg;
417  dohmRotation = makeRotation3D(theta, phix, theta, phiy, 0., 0.);
418  }
419  int dohmReplica = 0;
420  double dohmZ = 0.;
421  Volume dohm;
422 
423  if (dohmList[i] < 0.) {
424  // Place a Auxiliary DOHM
425  dohm = ns.volume(dohmAuxName);
426  dohmZ = dohmCarrierDz - 0.5 * dohmAuxL - dohmtoMF;
427  primReplica++;
428  dohmReplica = primReplica;
429  } else {
430  // Place a Primary DOHM
431  dohm = ns.volume(dohmPrimName);
432  dohmZ = dohmCarrierDz - 0.5 * dohmPrimL - dohmtoMF;
433  auxReplica++;
434  dohmReplica = auxReplica;
435  }
436  Position dohmTrasl(dohmR * cos(phi), dohmR * sin(phi), dohmZ);
437  pv = dohmCarrier.placeVolume(dohm, dohmReplica, Transform3D(dohmRotation, dohmTrasl));
438  LogPosition(pv);
439  }
440 
441  pv = layer.placeVolume(dohmCarrier, dohmCarrierReplica, Transform3D(rotation, tran));
442  LogPosition(pv);
443  }
444  //
446  for (int j = 0; j < 4; j++) {
447  vector<double> pillarZ;
448  vector<double> pillarPhi;
449  double pillarDz = 0, pillarDPhi = 0, pillarRin = 0, pillarRout = 0;
450 
451  switch (j) {
452  case 0:
453  name = idName + "FWIntPillar";
454  pillarZ = fwIntPillarZ;
455  pillarPhi = fwIntPillarPhi;
456  pillarRin = MFRingInR;
457  pillarRout = MFRingInR + MFRingT;
458  pillarDz = fwIntPillarDz;
459  pillarDPhi = fwIntPillarDPhi;
460  break;
461  case 1:
462  name = idName + "BWIntPillar";
463  pillarZ = bwIntPillarZ;
464  pillarPhi = bwIntPillarPhi;
465  pillarRin = MFRingInR;
466  pillarRout = MFRingInR + MFRingT;
467  pillarDz = bwIntPillarDz;
468  pillarDPhi = bwIntPillarDPhi;
469  break;
470  case 2:
471  name = idName + "FWExtPillar";
472  pillarZ = fwExtPillarZ;
473  pillarPhi = fwExtPillarPhi;
474  pillarRin = MFRingOutR - MFRingT;
475  pillarRout = MFRingOutR;
476  pillarDz = fwExtPillarDz;
477  pillarDPhi = fwExtPillarDPhi;
478  break;
479  case 3:
480  name = idName + "BWExtPillar";
481  pillarZ = bwExtPillarZ;
482  pillarPhi = bwExtPillarPhi;
483  pillarRin = MFRingOutR - MFRingT;
484  pillarRout = MFRingOutR;
485  pillarDz = bwExtPillarDz;
486  pillarDPhi = bwExtPillarDPhi;
487  break;
488  }
489 
490  solid = ns.addSolidNS(name, Tube(pillarRin, pillarRout, pillarDz, -pillarDPhi, 2. * pillarDPhi));
491  Volume Pillar = ns.addVolumeNS(Volume(name, solid, ns.material(pillarMaterial)));
492  LogDebug("TIBGeom") << solid.name() << " Tubs made of " << pillarMaterial << " from " << -pillarDPhi << " to "
493  << pillarDPhi << " with Rin " << pillarRin << " Rout " << pillarRout << " ZHalf " << pillarDz;
494  Position pillarTran;
495  Rotation3D pillarRota;
496  int pillarReplica = 0;
497  for (unsigned int i = 0; i < pillarZ.size(); i++) {
498  if (pillarPhi[i] > 0.) {
499  pillarTran = Position(0., 0., pillarZ[i]);
500  pillarRota = makeRotation3D(90._deg, pillarPhi[i], 90._deg, 90._deg + pillarPhi[i], 0., 0.);
501  pv = layer.placeVolume(Pillar, i, Transform3D(pillarRota, pillarTran));
502  LogPosition(pv);
503  pillarReplica++;
504  }
505  }
506  }
507  return 1;
508 }
509 
510 // first argument is the type from the xml file
511 DECLARE_DDCMS_DETELEMENT(DDCMS_track_DDTIBLayerAlgo, algorithm)
#define LogDebug(id)
dd4hep::Solid addSolidNS(const std::string &name, dd4hep::Solid solid) const
Definition: DDNamespace.cc:200
dd4hep::Volume volume(const std::string &name, bool exc=true) const
Definition: DDNamespace.cc:184
constexpr NumType convertRadToDeg(NumType radians)
Definition: angle_units.h:21
dd4hep::Volume addVolumeNS(dd4hep::Volume vol) const
Definition: DDNamespace.cc:150
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
static long algorithm(Detector &, cms::DDParsingContext &context, xml_h element, SensitiveDetector &)
Geom::Theta< T > theta() const
int integer(const std::string &nam) const
Shortcut to access integer arguments.
dd4hep::Rotation3D makeRotation3D(double thetaX, double phiX, double thetaY, double phiY, double thetaZ, double phiZ)
std::string_view name() const
Definition: DDNamespace.h:68
dd4hep::PlacedVolume PlacedVolume
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
def pv(vc)
Definition: MetAnalyzer.py:7
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
dd4hep::Material material(const std::string &name) const
Definition: DDNamespace.cc:121
T min(T a, T b)
Definition: MathUtil.h:58
dd4hep::Volume Volume
Namespace of DDCMS conversion namespace.
std::vector< double > vecDble(const std::string &nam) const
Shortcut to access vector<double> arguments.
double dble(const std::string &nam) const
Shortcut to access double arguments.
#define DECLARE_DDCMS_DETELEMENT(name, func)
Definition: DDPlugins.h:30
vector< double > VecDouble
std::string parentName() const
Access value of rParent child node.
std::string str(const std::string &nam) const
Shortcut to access string arguments.