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