CMS 3D CMS Logo

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