CMS 3D CMS Logo

Functions
DDTECModuleAlgo.cc File Reference
#include "DD4hep/DetFactoryHelper.h"
#include <DD4hep/DD4hepUnits.h>
#include "DataFormats/Math/interface/angle_units.h"
#include "DetectorDescription/DDCMS/interface/DDPlugins.h"
#include "FWCore/MessageLogger/interface/MessageLogger.h"

Go to the source code of this file.

Functions

static long algorithm (Detector &, cms::DDParsingContext &ctxt, xml_h e)
 
 DD4HEP_OPEN_PLUGIN (dd4hep, ddcms_det_element_DDCMS_track_DDTECModuleAlgo)
 

Function Documentation

◆ algorithm()

static long algorithm ( Detector &  ,
cms::DDParsingContext ctxt,
xml_h  e 
)
static

Definition at line 12 of file DDTECModuleAlgo.cc.

12  {
13  cms::DDNamespace ns(ctxt, e, true);
14  DDAlgoArguments args(ctxt, e);
15  Volume mother = ns.volume(args.parentName());
16 
17  //variables:
18  //double noOverlapShift = args.value<double>("NoOverlapShift");
19  int ringNo = args.value<int>("RingNo");
20  bool isStereo = args.value<int>("isStereo") == 1;
21  bool isRing6 = (ringNo == 6);
22  double rPos =
23  args.value<double>("RPos"); //Position in R relativ to the center of the TEC ( this is the coord-sys of Tubs)
24  double posCorrectionPhi = isStereo ? args.value<double>("PosCorrectionPhi")
25  : 0e0; // the Phi position of the stereo Modules has to be corrected
26  string standardRot = args.value<string>(
27  "StandardRotation"); //Rotation that aligns the mother(Tub ) coordinate System with the components
28  string genMat = args.value<string>("GeneralMaterial"); //General material name
29  double moduleThick = args.value<double>("ModuleThick"); //Module thickness
30  double detTilt = args.value<double>("DetTilt"); //Tilt of stereo detector
31  double fullHeight = args.value<double>("FullHeight"); //Height
32  double dlTop = args.value<double>("DlTop"); //Width at top of wafer
33  double dlBottom = args.value<double>("DlBottom"); //Width at bottom of wafer
34  double dlHybrid = args.value<double>("DlHybrid"); //Width at the hybrid end
35  double frameWidth = args.value<double>("FrameWidth"); //Frame width
36  double frameThick = args.value<double>("FrameThick"); // thickness
37  double frameOver = args.value<double>("FrameOver"); // overlap (on sides)
38  string topFrameMat = args.value<string>("TopFrameMaterial"); //Top frame material
39  double topFrameHeight = args.value<double>("TopFrameHeight"); // height
40  double topFrameThick = args.value<double>("TopFrameThick"); // thickness
41  double topFrameTopWidth = args.value<double>("TopFrameTopWidth"); // Width at the top
42  double topFrameBotWidth = args.value<double>("TopFrameBotWidth"); // Width at the bottom
43  double topFrame2Width = isStereo ? args.value<double>("TopFrame2Width") : 0e0; // Stereo:2ndPart Width
44  double topFrame2LHeight = isStereo ? args.value<double>("TopFrame2LHeight") : 0e0; // left height
45  double topFrame2RHeight = isStereo ? args.value<double>("TopFrame2RHeight") : 0e0; // right height
46  double topFrameZ = args.value<double>("TopFrameZ"); // z-positions
47 
48  double resizeH = 0.96;
49  string sideFrameMat = args.value<string>("SideFrameMaterial"); //Side frame material
50  double sideFrameThick = args.value<double>("SideFrameThick"); // thickness
51  double sideFrameLWidth = args.value<double>("SideFrameLWidth"); // Left Width (for stereo modules upper one)
52  double sideFrameLWidthLow = isStereo ? args.value<double>("SideFrameLWidthLow")
53  : 0e0; // Width (only for stereo modules: lower Width)
54  double sideFrameLHeight = resizeH * args.value<double>("SideFrameLHeight"); // Height
55  double sideFrameLtheta = args.value<double>("SideFrameLtheta"); // angle of the trapezoid shift
56  double sideFrameRWidth = args.value<double>("SideFrameRWidth"); // Right Width (for stereo modules upper one)
57  double sideFrameRWidthLow = isStereo ? args.value<double>("SideFrameRWidthLow")
58  : 0e0; // Width (only for stereo modules: lower Width)
59  double sideFrameRHeight = resizeH * args.value<double>("SideFrameRHeight"); // Height
60  double sideFrameRtheta = args.value<double>("SideFrameRtheta"); // angle of the trapezoid shift
61  vector<double> siFrSuppBoxWidth = args.value<vector<double> >("SiFrSuppBoxWidth"); // Supp.Box Width
62  vector<double> siFrSuppBoxHeight = args.value<vector<double> >("SiFrSuppBoxHeight"); // Height
63  vector<double> siFrSuppBoxYPos = args.value<vector<double> >(
64  "SiFrSuppBoxYPos"); // y-position of the supplies box (with HV an thermal sensor...)
65  double sideFrameZ = args.value<double>("SideFrameZ"); // z-positions
66  double siFrSuppBoxThick = args.value<double>("SiFrSuppBoxThick"); // thickness
67  string siFrSuppBoxMat = args.value<string>("SiFrSuppBoxMaterial"); // material
68  string waferMat = args.value<string>("WaferMaterial"); //Wafer material
69  double waferPosition = args.value<double>(
70  "WaferPosition"); // position of the wafer (was formaly done by adjusting topFrameHeigt)
71  double sideWidthTop = args.value<double>("SideWidthTop"); // widths on the side Top
72  double sideWidthBottom = args.value<double>("SideWidthBottom"); // Bottom
73  string waferRot = args.value<string>("WaferRotation"); // rotation matrix
74  string activeMat = args.value<string>("ActiveMaterial"); //Sensitive material
75  double activeHeight = args.value<double>("ActiveHeight"); // height
76  double waferThick = args.value<double>("WaferThick"); // wafer thickness (active = wafer - backplane)
77  string activeRot = args.value<string>("ActiveRotation"); // Rotation matrix
78  double activeZ = args.value<double>("ActiveZ"); // z-positions
79  double backplaneThick = args.value<double>("BackPlaneThick"); // thickness
80  double inactiveDy = ringNo > 3 ? args.value<double>("InactiveDy") : 0e0; //InactiveStrip Hight of ( rings > 3)
81  double inactivePos = ringNo > 3 ? args.value<double>("InactivePos") : 0e0; // y-Position
82  string inactiveMat = ringNo > 3 ? args.value<string>("InactiveMaterial") : string(); // material
83  string hybridMat = args.value<string>("HybridMaterial"); //Hybrid material
84  double hybridHeight = args.value<double>("HybridHeight"); // height
85  double hybridWidth = args.value<double>("HybridWidth"); // width
86  double hybridThick = args.value<double>("HybridThick"); // thickness
87  double hybridZ = args.value<double>("HybridZ"); // z-positions
88  string pitchMat = args.value<string>("PitchMaterial"); //Pitch adapter material
89  double pitchWidth = args.value<double>("PitchWidth"); // width
90  double pitchHeight = args.value<double>("PitchHeight"); // height
91  double pitchThick = args.value<double>("PitchThick"); // thickness
92  double pitchZ = args.value<double>("PitchZ"); // z-positions
93  string pitchRot = args.value<string>("PitchRotation"); // rotation matrix
94  string bridgeMat = args.value<string>("BridgeMaterial"); //Bridge material
95  double bridgeWidth = args.value<double>("BridgeWidth"); // width
96  double bridgeThick = args.value<double>("BridgeThick"); // thickness
97  double bridgeHeight = args.value<double>("BridgeHeight"); // height
98  double bridgeSep = args.value<double>("BridgeSeparation"); // separation
99  vector<double> siReenforceHeight = args.value<vector<double> >("SiReenforcementHeight"); // SiReenforcement Height
100  vector<double> siReenforceWidth = args.value<vector<double> >("SiReenforcementWidth"); // Width
101  vector<double> siReenforceYPos = args.value<vector<double> >("SiReenforcementPosY"); // Y - Position
102  double siReenforceThick = args.value<double>("SiReenforcementThick"); // Thick
103  string siReenforceMat = args.value<string>("SiReenforcementMaterial"); // Materieal
104 
105  edm::LogVerbatim("TECGeom") << "debug: ModuleThick " << moduleThick << " Detector Tilt " << convertRadToDeg(detTilt)
106  << " Height " << fullHeight << " dl(Top) " << dlTop << " dl(Bottom) " << dlBottom
107  << " dl(Hybrid) " << dlHybrid << " rPos " << rPos << " standrad rotation " << standardRot;
108  edm::LogVerbatim("TECGeom") << "debug: Frame Width " << frameWidth << " Thickness " << frameThick << " Overlap "
109  << frameOver;
110  edm::LogVerbatim("TECGeom") << "debug: Top Frame Material " << topFrameMat << " Height " << topFrameHeight
111  << " Top Width " << topFrameTopWidth << " Bottom Width " << topFrameTopWidth
112  << " Thickness " << topFrameThick << " positioned at" << topFrameZ;
113  edm::LogVerbatim("TECGeom") << "debug : Side Frame Material " << sideFrameMat << " Thickness " << sideFrameThick
114  << " left Leg's Width: " << sideFrameLWidth << " left Leg's Height: " << sideFrameLHeight
115  << " left Leg's tilt(theta): " << sideFrameLtheta
116  << " right Leg's Width: " << sideFrameRWidth
117  << " right Leg's Height: " << sideFrameRHeight
118  << " right Leg's tilt(theta): " << sideFrameRtheta
119  << "Supplies Box's Material: " << siFrSuppBoxMat << " positioned at" << sideFrameZ;
120  for (int i = 0; i < (int)(siFrSuppBoxWidth.size()); i++)
121  edm::LogVerbatim("TECGeom") << " Supplies Box" << i << "'s Width: " << siFrSuppBoxWidth[i] << " Supplies Box" << i
122  << "'s Height: " << siFrSuppBoxHeight[i] << " Supplies Box" << i
123  << "'s y Position: " << siFrSuppBoxYPos[i];
124  edm::LogVerbatim("TECGeom") << "debug: Wafer Material " << waferMat << " Side Width Top" << sideWidthTop
125  << " Side Width Bottom" << sideWidthBottom << " and positioned at " << waferPosition
126  << " positioned with rotation"
127  << " matrix:" << waferRot;
128  edm::LogVerbatim("TECGeom") << "debug: Active Material " << activeMat << " Height " << activeHeight << " rotated by "
129  << activeRot << " translated by (0,0," << -0.5 * backplaneThick << ")"
130  << " Thickness/Z" << waferThick - backplaneThick << "/" << activeZ;
131  edm::LogVerbatim("TECGeom") << "debug: Hybrid Material " << hybridMat << " Height " << hybridHeight << " Width "
132  << hybridWidth << " Thickness " << hybridThick << " Z" << hybridZ;
133  edm::LogVerbatim("TECGeom") << "debug: Pitch Adapter Material " << pitchMat << " Height " << pitchHeight
134  << " Thickness " << pitchThick << " position with "
135  << " rotation " << pitchRot << " at Z" << pitchZ;
136  edm::LogVerbatim("TECGeom") << "debug: Bridge Material " << bridgeMat << " Width " << bridgeWidth << " Thickness "
137  << bridgeThick << " Height " << bridgeHeight << " Separation " << bridgeSep;
138  edm::LogVerbatim("TECGeom") << "FALTBOOT DDTECModuleAlgo debug : Si-Reenforcement Material " << sideFrameMat
139  << " Thickness " << siReenforceThick;
140  for (int i = 0; i < (int)(siReenforceWidth.size()); i++)
141  edm::LogVerbatim("TECGeom") << " SiReenforcement" << i << "'s Width: " << siReenforceWidth[i] << " SiReenforcement"
142  << i << "'s Height: " << siReenforceHeight[i] << " SiReenforcement" << i
143  << "'s y Position: " << siReenforceYPos[i];
144 
145  if (!isStereo) {
146  edm::LogVerbatim("TECGeom") << "This is a normal module, in ring " << ringNo << "!";
147  } else {
148  edm::LogVerbatim("TECGeom") << "This is a stereo module, in ring " << ringNo << "!";
149  edm::LogVerbatim("TECGeom") << "Phi Position corrected by " << posCorrectionPhi << "*rad";
150  edm::LogVerbatim("TECGeom") << "debug: stereo Top Frame 2nd Part left Heigt " << topFrame2LHeight
151  << " right Height " << topFrame2RHeight << " Width " << topFrame2Width;
152  edm::LogVerbatim("TECGeom") << " left Leg's lower Width: " << sideFrameLWidthLow
153  << " right Leg's lower Width: " << sideFrameRWidthLow;
154  }
155 
156  // Execution part:
157 
158  edm::LogVerbatim("TECGeom") << "==>> Constructing DDTECModuleAlgo: ";
159  //declarations
160  double tmp;
161  //names
162  string name;
163  string tag("Rphi");
164  if (isStereo)
165  tag = "Stereo";
166  //usefull constants
167  const double topFrameEndZ = 0.5 * (-waferPosition + fullHeight) + pitchHeight + hybridHeight - topFrameHeight;
168  string idName = ns.noNamespace(mother.name());
169  edm::LogVerbatim("TECGeom") << "idName: " << idName << " parent " << mother.name() << " namespace " << ns.name();
170  Solid solid;
171 
172  //set global parameters
173  Material matter = ns.material(genMat);
174  double dzdif = fullHeight + topFrameHeight;
175  if (isStereo)
176  dzdif += 0.5 * (topFrame2LHeight + topFrame2RHeight);
177 
178  double dxbot = 0.5 * dlBottom + frameWidth - frameOver;
179  double dxtop = 0.5 * dlHybrid + frameWidth - frameOver;
180  // topfr = 0.5*dlBottom * sin(detTilt);
181  if (isRing6) {
182  dxbot = dxtop;
183  dxtop = 0.5 * dlTop + frameWidth - frameOver;
184  // topfr = 0.5*dlTop * sin(detTilt);
185  }
186  double dxdif = dxtop - dxbot;
187 
188  //Frame Sides
189  // left Frame
190  name = idName + "SideFrameLeft";
191  double h1 = 0.5 * sideFrameThick;
192  double dz = 0.5 * sideFrameLHeight;
193  double bl1 = 0.5 * sideFrameLWidth;
194  double bl2 = bl1;
195  double thet = sideFrameLtheta;
196  //for stereo modules
197  if (isStereo)
198  bl1 = 0.5 * sideFrameLWidthLow;
199  solid = Trap(dz, thet, 0, h1, bl1, bl1, 0, h1, bl2, bl2, 0);
200  ns.addSolidNS(name, solid);
201  edm::LogVerbatim("TECGeom") << "Solid: " << name << " " << solid.name() << " Trap made of " << sideFrameMat
202  << " of dimensions " << dz << ", " << thet << ", 0, " << h1 << ", " << bl1 << ", " << bl1
203  << ", 0, " << h1 << ", " << bl2 << ", " << bl2 << ", 0";
204  Volume sideFrameLeft(name, solid, ns.material(sideFrameMat));
205  ns.addVolumeNS(sideFrameLeft);
206  //translate
207  double xpos = -0.5 * topFrameBotWidth + bl2 + tan(fabs(thet)) * dz;
208  double ypos = sideFrameZ;
209  double zpos = topFrameEndZ - dz;
210  //flip ring 6
211  if (isRing6) {
212  zpos *= -1;
213  xpos -= 2 * tan(fabs(thet)) * dz; // because of the flip the tan(..) to be in the other direction
214  }
215  //the stereo modules are on the back of the normal ones...
216  if (isStereo) {
217  xpos = -0.5 * topFrameBotWidth + bl2 * cos(detTilt) + dz * sin(fabs(thet) + detTilt) / cos(fabs(thet));
218  xpos = -xpos;
219  zpos = topFrameEndZ - topFrame2LHeight - 0.5 * sin(detTilt) * (topFrameBotWidth - topFrame2Width) -
220  dz * cos(detTilt + fabs(thet)) / cos(fabs(thet)) + bl2 * sin(detTilt) - 0.1 * dd4hep::mm;
221  }
222  //position
223  mother.placeVolume(
224  sideFrameLeft,
225  isStereo ? 2 : 1,
226  dd4hep::Transform3D(ns.rotation(waferRot),
227  dd4hep::Position(zpos + rPos, isStereo ? xpos + rPos * sin(posCorrectionPhi) : xpos, ypos)));
228 
229  //right Frame
230  name = idName + "SideFrameRight";
231  h1 = 0.5 * sideFrameThick;
232  dz = 0.5 * sideFrameRHeight;
233  bl1 = bl2 = 0.5 * sideFrameRWidth;
234  thet = sideFrameRtheta;
235  if (isStereo)
236  bl1 = 0.5 * sideFrameRWidthLow;
237  solid = Trap(dz, thet, 0, h1, bl1, bl1, 0, h1, bl2, bl2, 0);
238  ns.addSolidNS(name, solid);
239  edm::LogVerbatim("TECGeom") << "Solid:\t" << name << " " << solid.name() << " Trap made of " << sideFrameMat
240  << " of dimensions " << dz << ", " << thet << ", 0, " << h1 << ", " << bl1 << ", " << bl1
241  << ", 0, " << h1 << ", " << bl2 << ", " << bl2 << ", 0";
242  Volume sideFrameRight(name, solid, ns.material(sideFrameMat));
243  ns.addVolumeNS(sideFrameRight);
244  //translate
245  xpos = 0.5 * topFrameBotWidth - bl2 - tan(fabs(thet)) * dz;
246  ypos = sideFrameZ;
247  zpos = topFrameEndZ - dz;
248  if (isRing6) {
249  zpos *= -1;
250  xpos += 2 * tan(fabs(thet)) * dz; // because of the flip the tan(..) has to be in the other direction
251  }
252  if (isStereo) {
253  xpos = 0.5 * topFrameBotWidth - bl2 * cos(detTilt) - dz * sin(fabs(detTilt - fabs(thet))) / cos(fabs(thet));
254  xpos = -xpos;
255  zpos = topFrameEndZ - topFrame2RHeight + 0.5 * sin(detTilt) * (topFrameBotWidth - topFrame2Width) -
256  dz * cos(detTilt - fabs(thet)) / cos(fabs(thet)) - bl2 * sin(detTilt) - 0.1 * dd4hep::mm;
257  }
258  //position it
259  mother.placeVolume(
260  sideFrameRight,
261  isStereo ? 2 : 1,
262  dd4hep::Transform3D(ns.rotation(waferRot),
263  dd4hep::Position(zpos + rPos, isStereo ? xpos + rPos * sin(posCorrectionPhi) : xpos, ypos)));
264  //Supplies Box(es)
265  matter = ns.material(siFrSuppBoxMat);
266  for (int i = 0; i < (int)(siFrSuppBoxWidth.size()); i++) {
267  name = idName + "SuppliesBox" + std::to_string(i);
268 
269  h1 = 0.5 * siFrSuppBoxThick;
270  dz = 0.5 * siFrSuppBoxHeight[i];
271  bl1 = bl2 = 0.5 * siFrSuppBoxWidth[i];
272  thet = sideFrameRtheta;
273  if (isStereo)
274  thet = -atan(fabs(sideFrameRWidthLow - sideFrameRWidth) / (2 * sideFrameRHeight) - tan(fabs(thet)));
275  // ^-- this calculates the lower left angel of the tipped trapezoid, which is the SideFframe...
276 
277  solid = Trap(dz, thet, 0, h1, bl1, bl1, 0, h1, bl2, bl2, 0);
278  edm::LogVerbatim("TECGeom") << "Solid:\t" << name << " " << solid.name() << " Trap made of " << siFrSuppBoxMat
279  << " of dimensions " << dz << ", 0, 0, " << h1 << ", " << bl1 << ", " << bl1 << ", 0, "
280  << h1 << ", " << bl2 << ", " << bl2 << ", 0";
281  Volume siFrSuppBox(name, solid, matter);
282  ns.addVolumeNS(siFrSuppBox);
283  //translate
284  xpos = 0.5 * topFrameBotWidth - sideFrameRWidth - bl1 - siFrSuppBoxYPos[i] * tan(fabs(thet));
285  ypos = sideFrameZ *
286  (0.5 + (siFrSuppBoxThick / sideFrameThick)); //via * so I do not have to worry about the sign of sideFrameZ
287  zpos = topFrameEndZ - siFrSuppBoxYPos[i];
288  if (isRing6) {
289  xpos += 2 * fabs(tan(thet)) * siFrSuppBoxYPos[i]; // the flipped issue again
290  zpos *= -1;
291  }
292  if (isStereo) {
293  xpos = 0.5 * topFrameBotWidth - (sideFrameRWidth + bl1) * cos(detTilt) -
294  sin(fabs(detTilt - fabs(thet))) *
295  (siFrSuppBoxYPos[i] + dz * (1 / cos(thet) - cos(detTilt)) + bl1 * sin(detTilt));
296  xpos = -xpos;
297  zpos = topFrameEndZ - topFrame2RHeight - 0.5 * sin(detTilt) * (topFrameBotWidth - topFrame2Width) -
298  siFrSuppBoxYPos[i] - sin(detTilt) * sideFrameRWidth;
299  }
300  //position it;
301  mother.placeVolume(siFrSuppBox,
302  isStereo ? 2 : 1,
303  dd4hep::Transform3D(
304  ns.rotation(waferRot),
305  dd4hep::Position(zpos + rPos, isStereo ? xpos + rPos * sin(posCorrectionPhi) : xpos, ypos)));
306  }
307 
308  //The Hybrid
309  name = idName + "Hybrid";
310  double dx = 0.5 * hybridWidth;
311  double dy = 0.5 * hybridThick;
312  dz = 0.5 * hybridHeight;
313  solid = Box(dx, dy, dz);
314  ns.addSolidNS(name, solid);
315  edm::LogVerbatim("TECGeom") << "Solid:\t" << name << " " << solid.name() << " Box made of " << hybridMat
316  << " of dimensions " << dx << ", " << dy << ", " << dz;
317  Volume hybrid(name, solid, ns.material(hybridMat));
318  ns.addVolumeNS(hybrid);
319 
320  ypos = hybridZ;
321  zpos = 0.5 * (-waferPosition + fullHeight + hybridHeight) + pitchHeight;
322  if (isRing6)
323  zpos *= -1;
324  //position it
325  mother.placeVolume(
326  hybrid,
327  isStereo ? 2 : 1,
328  dd4hep::Transform3D(ns.rotation(standardRot),
329  dd4hep::Position(zpos + rPos, isStereo ? rPos * sin(posCorrectionPhi) : 0., ypos)));
330 
331  // Wafer
332  name = idName + tag + "Wafer";
333  bl1 = 0.5 * dlBottom;
334  bl2 = 0.5 * dlTop;
335  h1 = 0.5 * waferThick;
336  dz = 0.5 * fullHeight;
337  solid = Trap(dz, 0, 0, h1, bl1, bl1, 0, h1, bl2, bl2, 0);
338  ns.addSolidNS(name, solid);
339  edm::LogVerbatim("TECGeom") << "Solid:\t" << name << " " << solid.name() << " Trap made of " << waferMat
340  << " of dimensions " << dz << ", 0, 0, " << h1 << ", " << bl1 << ", " << bl1 << ", 0, "
341  << h1 << ", " << bl2 << ", " << bl2 << ", 0";
342  Volume wafer(name, solid, ns.material(waferMat));
343 
344  ypos = activeZ;
345  zpos = -0.5 * waferPosition; // former and incorrect topFrameHeight;
346  if (isRing6)
347  zpos *= -1;
348 
349  mother.placeVolume(
350  wafer,
351  isStereo ? 2 : 1,
352  dd4hep::Transform3D(ns.rotation(waferRot),
353  dd4hep::Position(zpos + rPos, isStereo ? rPos * sin(posCorrectionPhi) : 0., ypos)));
354 
355  // Active
356  name = idName + tag + "Active";
357  bl1 -= sideWidthBottom;
358  bl2 -= sideWidthTop;
359  dz = 0.5 * (waferThick - backplaneThick); // inactive backplane
360  h1 = 0.5 * activeHeight;
361  if (isRing6) { //switch bl1 <->bl2
362  tmp = bl2;
363  bl2 = bl1;
364  bl1 = tmp;
365  }
366  solid = Trap(dz, 0, 0, h1, bl2, bl1, 0, h1, bl2, bl1, 0);
367  ns.addSolidNS(name, solid);
368  edm::LogVerbatim("TECGeom") << "Solid:\t" << name << " " << solid.name() << " Trap made of " << activeMat
369  << " of dimensions " << dz << ", 0, 0, " << h1 << ", " << bl2 << ", " << bl1 << ", 0, "
370  << h1 << ", " << bl2 << ", " << bl1 << ", 0";
371  Volume active(name, solid, ns.material(activeMat));
372  ns.addVolumeNS(active);
373 
374  wafer.placeVolume(
375  active, 1, dd4hep::Transform3D(ns.rotation(activeRot), dd4hep::Position(0., -0.5 * backplaneThick, 0.)));
376 
377  //inactive part in rings > 3
378  if (ringNo > 3) {
379  inactivePos -= fullHeight - activeHeight; //inactivePos is measured from the beginning of the _wafer_
380  name = idName + tag + "Inactive";
381  bl1 = 0.5 * dlBottom - sideWidthBottom +
382  ((0.5 * dlTop - sideWidthTop - 0.5 * dlBottom + sideWidthBottom) / activeHeight) *
383  (activeHeight - inactivePos - inactiveDy);
384  bl2 = 0.5 * dlBottom - sideWidthBottom +
385  ((0.5 * dlTop - sideWidthTop - 0.5 * dlBottom + sideWidthBottom) / activeHeight) *
386  (activeHeight - inactivePos + inactiveDy);
387  dz = 0.5 * (waferThick - backplaneThick); // inactive backplane
388  h1 = inactiveDy;
389  if (isRing6) { //switch bl1 <->bl2
390  tmp = bl2;
391  bl2 = bl1;
392  bl1 = tmp;
393  }
394  solid = Trap(dz, 0, 0, h1, bl2, bl1, 0, h1, bl2, bl1, 0);
395  ns.addSolidNS(name, solid);
396  edm::LogVerbatim("TECGeom") << "Solid:\t" << name << " " << solid.name() << " Trap made of " << inactiveMat
397  << " of dimensions " << dz << ", 0, 0, " << h1 << ", " << bl2 << ", " << bl1 << ", 0, "
398  << h1 << ", " << bl2 << ", " << bl1 << ", 0";
399  Volume inactive(name, solid, ns.material(inactiveMat));
400  ns.addVolumeNS(inactive);
401  ypos = inactivePos - 0.5 * activeHeight;
402 
403  active.placeVolume(inactive, 1, dd4hep::Position(0., ypos, 0.));
404  }
405  //Pitch Adapter
406  name = idName + "PA";
407  if (!isStereo) {
408  dx = 0.5 * pitchWidth;
409  dy = 0.5 * pitchThick;
410  dz = 0.5 * pitchHeight;
411  solid = Box(dx, dy, dz);
412  ns.addSolidNS(name, solid);
413  edm::LogVerbatim("TECGeom") << "Solid:\t" << name << " " << solid.name() << " Box made of " << pitchMat
414  << " of dimensions " << dx << ", " << dy << ", " << dz;
415  } else {
416  dz = 0.5 * pitchWidth;
417  h1 = 0.5 * pitchThick;
418  bl1 = 0.5 * pitchHeight + 0.5 * dz * sin(detTilt);
419  bl2 = 0.5 * pitchHeight - 0.5 * dz * sin(detTilt);
420  thet = atan((bl1 - bl2) / (2. * dz));
421  solid = Trap(dz, thet, 0, h1, bl1, bl1, 0, h1, bl2, bl2, 0);
422  ns.addSolidNS(name, solid);
423  edm::LogVerbatim("TECGeom") << "Solid:\t" << name << " " << solid.name() << " Trap made of " << pitchMat
424  << " of dimensions " << dz << ", " << convertRadToDeg(thet) << ", 0, " << h1 << ", "
425  << bl1 << ", " << bl1 << ", 0, " << h1 << ", " << bl2 << ", " << bl2 << ", 0";
426  }
427  xpos = 0;
428  ypos = pitchZ;
429  zpos = 0.5 * (-waferPosition + fullHeight + pitchHeight);
430  if (isRing6)
431  zpos *= -1;
432  if (isStereo)
433  xpos = 0.5 * fullHeight * sin(detTilt);
434 
435  Volume pa(name, solid, ns.material(pitchMat));
436  if (isStereo)
437  mother.placeVolume(pa,
438  2,
439  dd4hep::Transform3D(ns.rotation(pitchRot),
440  dd4hep::Position(zpos + rPos, xpos + rPos * sin(posCorrectionPhi), ypos)));
441  else
442  mother.placeVolume(pa, 1, dd4hep::Transform3D(ns.rotation(standardRot), dd4hep::Position(zpos + rPos, xpos, ypos)));
443 
444  //Top of the frame
445  name = idName + "TopFrame";
446  h1 = 0.5 * topFrameThick;
447  dz = 0.5 * topFrameHeight;
448  bl1 = 0.5 * topFrameBotWidth;
449  bl2 = 0.5 * topFrameTopWidth;
450  if (isRing6) { // ring 6 faces the other way!
451  bl1 = 0.5 * topFrameTopWidth;
452  bl2 = 0.5 * topFrameBotWidth;
453  }
454 
455  solid = Trap(dz, 0, 0, h1, bl1, bl1, 0, h1, bl2, bl2, 0);
456  ns.addSolid(name, solid);
457  edm::LogVerbatim("TECGeom") << "Solid:\t" << name << " " << solid.name() << " Trap made of " << topFrameMat
458  << " of dimensions " << dz << ", 0, 0, " << h1 << ", " << bl1 << ", " << bl1 << ", 0, "
459  << h1 << ", " << bl2 << ", " << bl2 << ", 0";
460  Volume topFrame(name, solid, ns.material(topFrameMat));
461  ns.addVolumeNS(topFrame);
462 
463  if (isStereo) {
464  name = idName + "TopFrame2";
465  //additional object to build the not trapzoid geometry of the stereo topframes
466  dz = 0.5 * topFrame2Width;
467  h1 = 0.5 * topFrameThick;
468  bl1 = 0.5 * topFrame2LHeight;
469  bl2 = 0.5 * topFrame2RHeight;
470  thet = atan((bl1 - bl2) / (2. * dz));
471 
472  solid = Trap(dz, thet, 0, h1, bl1, bl1, 0, h1, bl2, bl2, 0);
473  ns.addSolid(name, solid);
474  edm::LogVerbatim("TECGeom") << "Solid:\t" << name << " " << solid.name() << " Trap made of " << topFrameMat
475  << " of dimensions " << dz << ", " << convertRadToDeg(thet) << ", 0, " << h1 << ", "
476  << bl1 << ", " << bl1 << ", 0, " << h1 << ", " << bl2 << ", " << bl2 << ", 0";
477  }
478 
479  // Position the topframe
480  ypos = topFrameZ;
481  zpos = 0.5 * (-waferPosition + fullHeight - topFrameHeight) + pitchHeight + hybridHeight;
482  if (isRing6) {
483  zpos *= -1;
484  }
485 
486  mother.placeVolume(
487  topFrame,
488  isStereo ? 2 : 1,
489  dd4hep::Transform3D(ns.rotation(standardRot),
490  dd4hep::Position(zpos + rPos, isStereo ? rPos * sin(posCorrectionPhi) : 0., ypos)));
491  if (isStereo) {
492  //create
493  Volume topFrame2(name, solid, ns.material(topFrameMat));
494  zpos -= 0.5 * (topFrameHeight + 0.5 * (topFrame2LHeight + topFrame2RHeight));
495  mother.placeVolume(
496  topFrame2,
497  2,
498  dd4hep::Transform3D(ns.rotation(pitchRot), dd4hep::Position(zpos + rPos, rPos * sin(posCorrectionPhi), ypos)));
499  }
500 
501  //Si - Reencorcement
502  matter = ns.material(siReenforceMat);
503  for (int i = 0; i < (int)(siReenforceWidth.size()); i++) {
504  name = idName + "SiReenforce" + std::to_string(i);
505  h1 = 0.5 * siReenforceThick;
506  dz = 0.5 * siReenforceHeight[i];
507  bl1 = bl2 = 0.5 * siReenforceWidth[i];
508  solid = Trap(dz, 0, 0, h1, bl1, bl1, 0, h1, bl2, bl2, 0);
509  edm::LogVerbatim("TECGeom") << "Solid:\t" << name << " " << solid.name() << " Trap made of " << matter.name()
510  << " of dimensions " << dz << ", 0, 0, " << h1 << ", " << bl1 << ", " << bl1 << ", 0, "
511  << h1 << ", " << bl2 << ", " << bl2 << ", 0";
512  Volume siReenforce(name, solid, matter);
513  ns.addVolumeNS(siReenforce);
514  //translate
515  xpos = 0;
516  ypos = sideFrameZ;
517  zpos = topFrameEndZ - dz - siReenforceYPos[i];
518 
519  if (isRing6)
520  zpos *= -1;
521  if (isStereo) {
522  xpos = (-siReenforceYPos[i] + 0.5 * fullHeight) * sin(detTilt);
523  // thet = detTilt;
524  // if(topFrame2RHeight > topFrame2LHeight) thet *= -1;
525  // zpos -= topFrame2RHeight + sin(thet)*(sideFrameRWidth + 0.5*dlTop);
526  zpos -= topFrame2RHeight + sin(fabs(detTilt)) * 0.5 * topFrame2Width;
527  }
528 
529  mother.placeVolume(siReenforce,
530  isStereo ? 2 : 1,
531  dd4hep::Transform3D(
532  ns.rotation(waferRot),
533  dd4hep::Position(zpos + rPos, isStereo ? xpos + rPos * sin(posCorrectionPhi) : xpos, ypos)));
534  }
535 
536  //Bridge
537  if (bridgeMat != "None") {
538  name = idName + "Bridge";
539  bl2 = 0.5 * bridgeSep + bridgeWidth;
540  bl1 = bl2 - bridgeHeight * dxdif / dzdif;
541  h1 = 0.5 * bridgeThick;
542  dz = 0.5 * bridgeHeight;
543  solid = Trap(dz, 0, 0, h1, bl1, bl1, 0, h1, bl2, bl2, 0);
544  edm::LogVerbatim("TECGeom") << "Solid:\t" << name << " " << solid.name() << " Trap made of " << bridgeMat
545  << " of dimensions " << dz << ", 0, 0, " << h1 << ", " << bl1 << ", " << bl1 << ", 0, "
546  << h1 << ", " << bl2 << ", " << bl2 << ", 0";
547  Volume bridge(name, solid, ns.material(bridgeMat));
548  ns.addVolumeNS(bridge);
549 
550  name = idName + "BridgeGap";
551  bl1 = 0.5 * bridgeSep;
552  solid = Box(bl1, h1, dz);
553  edm::LogVerbatim("TECGeom") << "Solid:\t" << name << " " << solid.name() << " Box made of " << genMat
554  << " of dimensions " << bl1 << ", " << h1 << ", " << dz;
555  Volume bridgeGap(name, solid, ns.material(genMat));
556  ns.addVolumeNS(bridgeGap);
557  /* PlacedVolume pv = */ bridge.placeVolume(bridgeGap, 1);
558  edm::LogVerbatim("TECGeom") << "Solid: " << bridgeGap.name() << " number 1 positioned in " << bridge.name()
559  << " at (0,0,0) with no rotation";
560  }
561  edm::LogVerbatim("TECGeom") << "<<== End of DDTECModuleAlgo construction ...";
562  return 1;
563 }

References cms::DDNamespace::addSolid(), cms::DDNamespace::addSolidNS(), cms::DDNamespace::addVolumeNS(), writedatasetfile::args, angle_units::operators::convertRadToDeg(), funct::cos(), PVValHelper::dx, PVValHelper::dy, PVValHelper::dz, MillePedeFileConverter_cfg::e, mps_fire::i, versionedElectronIDProducer_cfi::idName, createfilelist::int, cms::DDNamespace::material(), g4SimHits_cfi::Material, Skims_PA_cff::name, cms::DDNamespace::name(), cms::DDNamespace::noNamespace(), PixelTestBeamValidation_cfi::Position, cms::DDNamespace::rotation(), funct::sin(), GlobalPosition_Frontier_DevDB_cff::tag, funct::tan(), createJobs::tmp, cms::DDNamespace::volume(), and HGCalProperty::waferThick().

◆ DD4HEP_OPEN_PLUGIN()

DD4HEP_OPEN_PLUGIN ( dd4hep  ,
ddcms_det_element_DDCMS_track_DDTECModuleAlgo   
)

Definition at line 566 of file DDTECModuleAlgo.cc.

writedatasetfile.args
args
Definition: writedatasetfile.py:18
mps_fire.i
i
Definition: mps_fire.py:428
g4SimHits_cfi.Material
Material
Definition: g4SimHits_cfi.py:582
angle_units::operators::convertRadToDeg
constexpr NumType convertRadToDeg(NumType radians)
Definition: angle_units.h:21
cms::DDNamespace
Definition: DDNamespace.h:16
versionedElectronIDProducer_cfi.idName
idName
Definition: versionedElectronIDProducer_cfi.py:11
createJobs.tmp
tmp
align.sh
Definition: createJobs.py:716
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
GlobalPosition_Frontier_DevDB_cff.tag
tag
Definition: GlobalPosition_Frontier_DevDB_cff.py:11
PixelTestBeamValidation_cfi.Position
Position
Definition: PixelTestBeamValidation_cfi.py:75
cms::Volume
dd4hep::Volume Volume
Definition: DDFilteredView.h:47
funct::tan
Tan< T >::type tan(const T &t)
Definition: Tan.h:22
createfilelist.int
int
Definition: createfilelist.py:10
HGCalProperty::waferThick
int32_t waferThick(const int32_t property)
Definition: HGCalProperty.cc:9
cms::DDAlgoArguments
Definition: DDAlgoArguments.h:28
PVValHelper::dy
Definition: PVValidationHelpers.h:50
PVValHelper::dz
Definition: PVValidationHelpers.h:51
edm::LogVerbatim
Log< level::Info, true > LogVerbatim
Definition: MessageLogger.h:128
Skims_PA_cff.name
name
Definition: Skims_PA_cff.py:17
edm::Log
Definition: MessageLogger.h:70
PVValHelper::dx
Definition: PVValidationHelpers.h:49
MillePedeFileConverter_cfg.e
e
Definition: MillePedeFileConverter_cfg.py:37