CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
DDTIDModuleAlgo.cc
Go to the documentation of this file.
1 // File: DDTIDModuleAlgo.cc
3 // Description: Creation of a TID Module
5 
15 #include "CLHEP/Units/GlobalPhysicalConstants.h"
16 #include "CLHEP/Units/GlobalSystemOfUnits.h"
17 
18 #include <string>
19 #include <vector>
20 
21 using namespace std;
22 
23 class DDTIDModuleAlgo : public DDAlgorithm {
24 public:
25  //Constructor and Destructor
27  ~DDTIDModuleAlgo() override;
28 
29  void initialize(const DDNumericArguments& nArgs,
30  const DDVectorArguments& vArgs,
31  const DDMapArguments& mArgs,
32  const DDStringArguments& sArgs,
33  const DDStringVectorArguments& vsArgs) override;
34 
35  void execute(DDCompactView& cpv) override;
36 
37 private:
38  string genMat; //General material name
39  int detectorN; //Detector planes
40  double moduleThick; //Module thickness
41  double detTilt; //Tilt of stereo detector
42  double fullHeight; //Height
43  double dlTop; //Width at top of wafer
44  double dlBottom; //Width at bottom of wafer
45  double dlHybrid; //Width at the hybrid end
46  bool doComponents; //Components to be made
47 
48  string boxFrameName; //Top frame name
49  string boxFrameMat; // material
50  double boxFrameHeight; // height
51  double boxFrameThick; // thickness
52  double boxFrameWidth; // extra width
53  double bottomFrameHeight; //Bottom of the frame
54  double bottomFrameOver; // overlap
55  double topFrameHeight; //Top of the frame
56  double topFrameOver; // overlap
57  vector<string> sideFrameName; //Side frame name
58  string sideFrameMat; // material
59  double sideFrameWidth; // width
60  double sideFrameThick; // thickness
61  double sideFrameOver; // overlap (wrt wafer)
62  vector<string> holeFrameName; //Hole in the frame name
63  vector<string> holeFrameRot; // Rotation matrix
64 
65  vector<string> kaptonName; //Kapton circuit name
66  string kaptonMat; // material
67  // double kaptonWidth; // width -> computed internally from sideFrameWidth and kaptonOver
68  double kaptonThick; // thickness
69  double kaptonOver; // overlap (wrt Wafer)
70  vector<string> holeKaptonName; //Hole in the kapton circuit name
71  vector<string> holeKaptonRot; // Rotation matrix
72 
73  vector<string> waferName; //Wafer name
74  string waferMat; // material
75  double sideWidthTop; // width on the side Top
76  double sideWidthBottom; // Bottom
77  vector<string> activeName; //Sensitive name
78  string activeMat; // material
79  double activeHeight; // height
80  vector<double> waferThick; // wafer thickness (active = wafer - backplane)
81  string activeRot; // Rotation matrix
82  vector<double> backplaneThick; // thickness
83  string hybridName; //Hybrid name
84  string hybridMat; // material
85  double hybridHeight; // height
86  double hybridWidth; // width
87  double hybridThick; // thickness
88  vector<string> pitchName; //Pitch adapter name
89  string pitchMat; // material
90  double pitchHeight; // height
91  double pitchThick; // thickness
92  double pitchStereoTol; // tolerance in dimensions of the stereo
93  string coolName; // Cool insert name
94  string coolMat; // material
95  double coolHeight; // height
96  double coolThick; // thickness
97  double coolWidth; // width
98 };
99 
100 DDTIDModuleAlgo::DDTIDModuleAlgo() { LogDebug("TIDGeom") << "DDTIDModuleAlgo info: Creating an instance"; }
101 
103 
105  const DDVectorArguments& vArgs,
106  const DDMapArguments&,
107  const DDStringArguments& sArgs,
108  const DDStringVectorArguments& vsArgs) {
109  int i;
110  genMat = sArgs["GeneralMaterial"];
111  detectorN = (int)(nArgs["DetectorNumber"]);
112  DDName parentName(parent().name());
113 
114  LogDebug("TIDGeom") << "DDTIDModuleAlgo debug: Parent " << parentName << " General Material " << genMat
115  << " Detector Planes " << detectorN;
116 
117  moduleThick = nArgs["ModuleThick"];
118  detTilt = nArgs["DetTilt"];
119  fullHeight = nArgs["FullHeight"];
120  dlTop = nArgs["DlTop"];
121  dlBottom = nArgs["DlBottom"];
122  dlHybrid = nArgs["DlHybrid"];
123  string comp = sArgs["DoComponents"];
124  if (comp == "No" || comp == "NO" || comp == "no")
125  doComponents = false;
126  else
127  doComponents = true;
128 
129  LogDebug("TIDGeom") << "DDTIDModuleAlgo debug: ModuleThick " << moduleThick << " Detector Tilt "
130  << detTilt / CLHEP::deg << " Height " << fullHeight << " dl(Top) " << dlTop << " dl(Bottom) "
131  << dlBottom << " dl(Hybrid) " << dlHybrid << " doComponents " << doComponents;
132 
133  boxFrameName = sArgs["BoxFrameName"];
134  boxFrameMat = sArgs["BoxFrameMaterial"];
135  boxFrameThick = nArgs["BoxFrameThick"];
136  boxFrameHeight = nArgs["BoxFrameHeight"];
137  boxFrameWidth = nArgs["BoxFrameWidth"];
138  bottomFrameHeight = nArgs["BottomFrameHeight"];
139  bottomFrameOver = nArgs["BottomFrameOver"];
140  LogDebug("TIDGeom") << "DDTIDModuleAlgo debug: " << boxFrameName << " Material " << boxFrameMat << " Thickness "
141  << boxFrameThick << " width " << boxFrameWidth << " height " << boxFrameHeight
142  << " Extra Height at Bottom " << bottomFrameHeight << " Overlap " << bottomFrameOver;
143 
144  topFrameHeight = nArgs["TopFrameHeight"];
145  topFrameOver = nArgs["TopFrameOver"];
146  sideFrameName = vsArgs["SideFrameName"];
147  sideFrameMat = sArgs["SideFrameMaterial"];
148  sideFrameWidth = nArgs["SideFrameWidth"];
149  sideFrameThick = nArgs["SideFrameThick"];
150  sideFrameOver = nArgs["SideFrameOver"];
151  holeFrameName = vsArgs["HoleFrameName"];
152  holeFrameRot = vsArgs["HoleFrameRotation"];
153  for (i = 0; i < detectorN; i++)
154  LogDebug("TIDGeom") << "DDTIDModuleAlgo debug : " << sideFrameName[i] << " Material " << sideFrameMat << " Width "
155  << sideFrameWidth << " Thickness " << sideFrameThick << " Overlap " << sideFrameOver
156  << " Hole " << holeFrameName[i];
157 
158  kaptonName = vsArgs["KaptonName"];
159  kaptonMat = sArgs["KaptonMaterial"];
160  kaptonThick = nArgs["KaptonThick"];
161  kaptonOver = nArgs["KaptonOver"];
162  holeKaptonName = vsArgs["HoleKaptonName"];
163  holeKaptonRot = vsArgs["HoleKaptonRotation"];
164  for (i = 0; i < detectorN; i++)
165  LogDebug("TIDGeom") << "DDTIDModuleAlgo debug : " << kaptonName[i] << " Material " << kaptonMat << " Thickness "
166  << kaptonThick << " Overlap " << kaptonOver << " Hole " << holeKaptonName[i];
167 
168  waferName = vsArgs["WaferName"];
169  waferMat = sArgs["WaferMaterial"];
170  sideWidthTop = nArgs["SideWidthTop"];
171  sideWidthBottom = nArgs["SideWidthBottom"];
172 
173  LogDebug("TIDGeom") << "DDTIDModuleAlgo debug: Wafer Material " << waferMat << " Side Width Top " << sideWidthTop
174  << " Side Width Bottom " << sideWidthBottom;
175  for (i = 0; i < detectorN; i++)
176  LogDebug("TIDGeom") << "\twaferName[" << i << "] = " << waferName[i];
177 
178  activeName = vsArgs["ActiveName"];
179  activeMat = sArgs["ActiveMaterial"];
180  activeHeight = nArgs["ActiveHeight"];
181  waferThick = vArgs["WaferThick"];
182  activeRot = sArgs["ActiveRotation"];
183  backplaneThick = vArgs["BackPlaneThick"];
184  LogDebug("TIDGeom") << "DDTIDModuleAlgo debug: Active Material " << activeMat << " Height " << activeHeight
185  << " rotated by " << activeRot;
186  for (i = 0; i < detectorN; i++)
187  LogDebug("TIDGeom") << " translated by (0," << -0.5 * backplaneThick[i] << ",0)\tactiveName[" << i
188  << "] = " << activeName[i] << " of thickness " << waferThick[i] - backplaneThick[i];
189 
190  hybridName = sArgs["HybridName"];
191  hybridMat = sArgs["HybridMaterial"];
192  hybridHeight = nArgs["HybridHeight"];
193  hybridWidth = nArgs["HybridWidth"];
194  hybridThick = nArgs["HybridThick"];
195  LogDebug("TIDGeom") << "DDTIDModuleAlgo debug: " << hybridName << " Material " << hybridMat << " Height "
196  << hybridHeight << " Width " << hybridWidth << " Thickness " << hybridThick;
197 
198  pitchName = vsArgs["PitchName"];
199  pitchMat = sArgs["PitchMaterial"];
200  pitchHeight = nArgs["PitchHeight"];
201  pitchThick = nArgs["PitchThick"];
202  pitchStereoTol = nArgs["PitchStereoTolerance"];
203 
204  LogDebug("TIDGeom") << "DDTIDModuleAlgo debug: Pitch Adapter Material " << pitchMat << " Height " << pitchHeight
205  << " Thickness " << pitchThick;
206  for (i = 0; i < detectorN; i++)
207  LogDebug("TIDGeom") << "\tpitchName[" << i << "] = " << pitchName[i];
208 
209  coolName = sArgs["CoolInsertName"];
210  coolMat = sArgs["CoolInsertMaterial"];
211  coolHeight = nArgs["CoolInsertHeight"];
212  coolThick = nArgs["CoolInsertThick"];
213  coolWidth = nArgs["CoolInsertWidth"];
214  LogDebug("TIDGeom") << "DDTIDModuleAlgo debug: Cool Element Material " << coolMat << " Height " << coolHeight
215  << " Thickness " << coolThick << " Width " << coolWidth;
216 }
217 
219  LogDebug("TIDGeom") << "==>> Constructing DDTIDModuleAlgo...";
220 
221  DDName parentName(parent().name());
222 
223  double sidfr = sideFrameWidth - sideFrameOver; // width of side frame on the sides of module
224  double botfr; // width of side frame at the the bottom of the modules
225  double topfr; // width of side frame at the the top of the modules
226  double kaptonHeight;
227  if (dlHybrid > dlTop) {
228  // ring 1, ring 2
229  topfr = topFrameHeight - pitchHeight - topFrameOver;
230  botfr = bottomFrameHeight - bottomFrameOver;
231  kaptonHeight = fullHeight + botfr;
232  } else {
233  // ring 3
234  topfr = topFrameHeight - topFrameOver;
235  botfr = bottomFrameHeight - bottomFrameOver - pitchHeight;
236  kaptonHeight = fullHeight + topfr;
237  }
238 
239  double sideFrameHeight = fullHeight + pitchHeight + botfr + topfr;
240  double kaptonWidth = sidfr + kaptonOver;
241 
242  double dxbot = 0.5 * dlBottom + sidfr;
243  double dxtop = 0.5 * dlTop + sidfr;
244  double dxtopenv, dxbotenv; // top/bot width of the module envelope trap
245 
246  // Envelope
247  if (dlHybrid > dlTop) {
248  // ring 1, ring 2
249  dxtopenv = dxbot + (dxtop - dxbot) * (fullHeight + pitchHeight + topfr + hybridHeight) / fullHeight;
250  dxbotenv = dxtop - (dxtop - dxbot) * (fullHeight + botfr) / fullHeight;
251  } else {
252  // ring 3
253  dxtopenv = dxbot + (dxtop - dxbot) * (fullHeight + topfr) / fullHeight;
254  dxbotenv = dxbot;
255  }
256  double bl1 = dxbotenv;
257  double bl2 = dxtopenv;
258  double h1 = 0.5 * moduleThick;
259  double dz = 0.5 * (boxFrameHeight + sideFrameHeight);
260 
261  DDSolid solidUncut, solidCut;
262  DDSolid solid = DDSolidFactory::trap(parentName, dz, 0, 0, h1, bl1, bl1, 0, h1, bl2, bl2, 0);
263  DDMaterial matter = DDMaterial(DDName(DDSplit(genMat).first, DDSplit(genMat).second));
264  DDLogicalPart module(solid.ddname(), matter, solid);
265  LogDebug("TIDGeom") << "DDTIDModuleAlgo test:\t" << solid.name() << " Trap made of " << genMat << " of dimensions "
266  << dz << ", 0, 0, " << h1 << ", " << bl1 << ", " << bl1 << ", 0, " << h1 << ", " << bl2 << ", "
267  << bl2 << ", 0";
268 
269  if (doComponents) {
270  //Box frame
271  matter = DDMaterial(DDName(DDSplit(boxFrameMat).first, DDSplit(boxFrameMat).second));
272  double dx = 0.5 * boxFrameWidth;
273  double dy = 0.5 * boxFrameThick;
274  double dz = 0.5 * boxFrameHeight;
275  solid = DDSolidFactory::box(DDName(DDSplit(boxFrameName).first, DDSplit(boxFrameName).second), dx, dy, dz);
276  LogDebug("TIDGeom") << "DDTIDModuleAlgo test:\t" << solid.name() << " Box made of " << matter.ddname()
277  << " of dimensions " << dx << ", " << dy << ", " << dz;
278  DDLogicalPart boxFrame(solid.ddname(), matter, solid);
279 
280  // Hybrid
281  matter = DDMaterial(DDName(DDSplit(hybridMat).first, DDSplit(hybridMat).second));
282  dx = 0.5 * hybridWidth;
283  dy = 0.5 * hybridThick;
284  dz = 0.5 * hybridHeight;
285  solid = DDSolidFactory::box(DDName(DDSplit(hybridName).first, DDSplit(hybridName).second), dx, dy, dz);
286  LogDebug("TIDGeom") << "DDTIDModuleAlgo test:\t" << solid.name() << " Box made of " << matter.ddname()
287  << " of dimensions " << dx << ", " << dy << ", " << dz;
288  DDLogicalPart hybrid(solid.ddname(), matter, solid);
289 
290  // Cool Insert
291  matter = DDMaterial(DDName(DDSplit(coolMat).first, DDSplit(coolMat).second));
292  dx = 0.5 * coolWidth;
293  dy = 0.5 * coolThick;
294  dz = 0.5 * coolHeight;
295  solid = DDSolidFactory::box(DDName(DDSplit(coolName).first, DDSplit(coolName).second), dx, dy, dz);
296  LogDebug("TIDGeom") << "DDTIDModuleAlgo test:\t" << solid.name() << " Box made of " << matter.ddname()
297  << " of dimensions " << dx << ", " << dy << ", " << dz;
298  DDLogicalPart cool(solid.ddname(), matter, solid);
299 
300  // Loop over detectors to be placed
301  for (int k = 0; k < detectorN; k++) {
302  double bbl1, bbl2; // perhaps useless (bl1 enough)
303 
304  // Frame Sides
305  matter = DDMaterial(DDName(DDSplit(sideFrameMat).first, DDSplit(sideFrameMat).second));
306  if (dlHybrid > dlTop) {
307  // ring 1, ring 2
308  bbl1 = dxtop - (dxtop - dxbot) * (fullHeight + botfr) / fullHeight;
309  bbl2 = dxbot + (dxtop - dxbot) * (fullHeight + pitchHeight + topfr) / fullHeight;
310  } else {
311  // ring 3
312  bbl1 = dxtop - (dxtop - dxbot) * (fullHeight + pitchHeight + botfr) / fullHeight;
313  bbl2 = dxbot + (dxtop - dxbot) * (fullHeight + topfr) / fullHeight;
314  }
315  h1 = 0.5 * sideFrameThick;
316  dz = 0.5 * sideFrameHeight;
317  solid = DDSolidFactory::trap(DDName(DDSplit(sideFrameName[k]).first, DDSplit(sideFrameName[k]).second),
318  dz,
319  0,
320  0,
321  h1,
322  bbl1,
323  bbl1,
324  0,
325  h1,
326  bbl2,
327  bbl2,
328  0);
329  LogDebug("TIDGeom") << "DDTIDModuleAlgo test:\t" << solid.name() << " Trap made of " << matter.ddname()
330  << " of dimensions " << dz << ", 0, 0, " << h1 << ", " << bbl1 << ", " << bbl1 << ", 0, "
331  << h1 << ", " << bbl2 << ", " << bbl2 << ", 0";
332  DDLogicalPart sideFrame(solid.ddname(), matter, solid);
333 
334  string rotstr, rotns;
335  DDRotation rot;
336 
337  // Hole in the frame below the wafer
338  matter = DDMaterial(DDName(DDSplit(genMat).first, DDSplit(genMat).second));
339  double xpos, zpos;
340  dz = fullHeight - bottomFrameOver - topFrameOver;
341  bbl1 = dxbot - sideFrameWidth + bottomFrameOver * (dxtop - dxbot) / fullHeight;
342  bbl2 = dxtop - sideFrameWidth - topFrameOver * (dxtop - dxbot) / fullHeight;
343  if (dlHybrid > dlTop) {
344  // ring 1, ring 2
345  zpos = -(topFrameHeight + 0.5 * dz - 0.5 * sideFrameHeight);
346  } else {
347  // ring 3
348  zpos = bottomFrameHeight + 0.5 * dz - 0.5 * sideFrameHeight;
349  }
350  dz /= 2.;
351  solid = DDSolidFactory::trap(DDName(DDSplit(holeFrameName[k]).first, DDSplit(holeFrameName[k]).second),
352  dz,
353  0,
354  0,
355  h1,
356  bbl1,
357  bbl1,
358  0,
359  h1,
360  bbl2,
361  bbl2,
362  0);
363  LogDebug("TIDGeom") << "DDTIDModuleAlgo test:\t" << solid.name() << " Trap made of " << matter.ddname()
364  << " of dimensions " << dz << ", 0, 0, " << h1 << ", " << bbl1 << ", " << bbl1 << ", 0, "
365  << h1 << ", " << bbl2 << ", " << bbl2 << ", 0";
366  DDLogicalPart holeFrame(solid.ddname(), matter, solid);
367 
368  rotstr = DDSplit(holeFrameRot[k]).first;
369  if (rotstr != "NULL") {
370  rotns = DDSplit(holeFrameRot[k]).second;
371  rot = DDRotation(DDName(rotstr, rotns));
372  } else {
373  rot = DDRotation();
374  }
375  cpv.position(holeFrame, sideFrame, 1, DDTranslation(0.0, 0.0, zpos), rot);
376  LogDebug("TIDGeom") << "DDTIDModuleAlgo test: " << holeFrame.name() << " number 1 positioned in "
377  << sideFrame.name() << " at (0,0," << zpos << ") with no rotation";
378 
379  // Kapton circuit
380  matter = DDMaterial(DDName(DDSplit(kaptonMat).first, DDSplit(kaptonMat).second));
381  double kaptonExtraHeight = 0; // kapton extra height in the stereo
382  if (dlHybrid > dlTop) {
383  // ring 1, ring 2
384  bbl1 = dxtop - (dxtop - dxbot) * (fullHeight + botfr) / fullHeight;
385  if (k == 1) {
386  kaptonExtraHeight = dlTop * sin(detTilt) - fullHeight * (1 - cos(detTilt));
387  kaptonExtraHeight = 0.5 * fabs(kaptonExtraHeight);
388  bbl2 = dxbot + (dxtop - dxbot) * (fullHeight + kaptonExtraHeight) / fullHeight;
389  } else {
390  bbl2 = dxtop;
391  }
392  } else {
393  // ring 3
394  bbl2 = dxbot + (dxtop - dxbot) * (fullHeight + topfr) / fullHeight;
395  if (k == 1) {
396  kaptonExtraHeight = dlBottom * sin(detTilt) - fullHeight * (1 - cos(detTilt));
397  kaptonExtraHeight = 0.5 * fabs(kaptonExtraHeight);
398  bbl1 = dxtop - (dxtop - dxbot) * (fullHeight + kaptonExtraHeight) / fullHeight;
399  } else {
400  bbl1 = dxbot;
401  }
402  }
403  h1 = 0.5 * kaptonThick;
404  dz = 0.5 * (kaptonHeight + kaptonExtraHeight);
405 
406  // For the stereo create the uncut solid, the solid to be removed and then the subtraction solid
407  if (k == 1) {
408  // Uncut solid
409  string kaptonUncutName = kaptonName[k] + "Uncut";
410  solidUncut = DDSolidFactory::trap(DDName(DDSplit(kaptonUncutName).first, DDSplit(kaptonUncutName).second),
411  dz,
412  0,
413  0,
414  h1,
415  bbl1,
416  bbl1,
417  0,
418  h1,
419  bbl2,
420  bbl2,
421  0);
422 
423  // Piece to be cut
424  string kaptonCutName = kaptonName[k] + "Cut";
425 
426  if (dlHybrid > dlTop) {
427  dz = 0.5 * dlTop;
428  } else {
429  dz = 0.5 * dlBottom;
430  }
431  h1 = 0.5 * kaptonThick;
432  bbl1 = fabs(dz * sin(detTilt));
433  bbl2 = bbl1 * 0.000001;
434  double thet = atan((bbl1 - bbl2) / (2 * dz));
435  solidCut = DDSolidFactory::trap(DDName(DDSplit(kaptonCutName).first, DDSplit(kaptonCutName).second),
436  dz,
437  thet,
438  0,
439  h1,
440  bbl1,
441  bbl1,
442  0,
443  h1,
444  bbl2,
445  bbl2,
446  0);
447 
448  string aRot("tidmodpar:9PYX");
449  rotstr = DDSplit(aRot).first;
450  rotns = DDSplit(aRot).second;
451  rot = DDRotation(DDName(rotstr, rotns));
452 
453  xpos = -0.5 * fullHeight * sin(detTilt);
454  zpos = 0.5 * kaptonHeight - bbl2;
455 
456  // Subtraction Solid
457  solid = DDSolidFactory::subtraction(DDName(DDSplit(kaptonName[k]).first, DDSplit(kaptonName[k]).second),
458  solidUncut,
459  solidCut,
460  DDTranslation(xpos, 0.0, zpos),
461  rot);
462  } else {
463  solid = DDSolidFactory::trap(DDName(DDSplit(kaptonName[k]).first, DDSplit(kaptonName[k]).second),
464  dz,
465  0,
466  0,
467  h1,
468  bbl1,
469  bbl1,
470  0,
471  h1,
472  bbl2,
473  bbl2,
474  0);
475  }
476 
477  DDLogicalPart kapton(solid.ddname(), matter, solid);
478  LogDebug("TIDGeom") << "DDTIDModuleAlgo test:\t" << solid.name() << " SUBTRACTION SOLID Trap made of "
479  << matter.ddname() << " of dimensions " << dz << ", 0, 0, " << h1 << ", " << bbl1 << ", "
480  << bbl1 << ", 0, " << h1 << ", " << bbl2 << ", " << bbl2 << ", 0";
481 
482  // Hole in the kapton below the wafer
483  matter = DDMaterial(DDName(DDSplit(genMat).first, DDSplit(genMat).second));
484  dz = fullHeight - kaptonOver;
485  xpos = 0;
486  if (dlHybrid > dlTop) {
487  // ring 1, ring 2
488  bbl1 = dxbot - kaptonWidth + kaptonOver * (dxtop - dxbot) / fullHeight;
489  bbl2 = dxtop - kaptonWidth;
490  zpos = 0.5 * (kaptonHeight - kaptonExtraHeight - dz);
491  if (k == 1) {
492  zpos -= 0.5 * kaptonOver * (1 - cos(detTilt));
493  xpos = -0.5 * kaptonOver * sin(detTilt);
494  }
495  } else {
496  // ring 3
497  bbl1 = dxbot - kaptonWidth;
498  bbl2 = dxtop - kaptonWidth - kaptonOver * (dxtop - dxbot) / fullHeight;
499  zpos = -0.5 * (kaptonHeight - kaptonExtraHeight - dz);
500  }
501  dz /= 2.;
502  solid = DDSolidFactory::trap(DDName(DDSplit(holeKaptonName[k]).first, DDSplit(holeKaptonName[k]).second),
503  dz,
504  0,
505  0,
506  h1,
507  bbl1,
508  bbl1,
509  0,
510  h1,
511  bbl2,
512  bbl2,
513  0);
514  LogDebug("TIDGeom") << "DDTIDModuleAlgo test:\t" << solid.name() << " Trap made of " << matter.ddname()
515  << " of dimensions " << dz << ", 0, 0, " << h1 << ", " << bbl1 << ", " << bbl1 << ", 0, "
516  << h1 << ", " << bbl2 << ", " << bbl2 << ", 0";
517  DDLogicalPart holeKapton(solid.ddname(), matter, solid);
518 
519  rotstr = DDSplit(holeKaptonRot[k]).first;
520  if (rotstr != "NULL") {
521  rotns = DDSplit(holeKaptonRot[k]).second;
522  rot = DDRotation(DDName(rotstr, rotns));
523  } else {
524  rot = DDRotation();
525  }
526  cpv.position(holeKapton, kapton, 1, DDTranslation(xpos, 0.0, zpos), rot);
527  LogDebug("TIDGeom") << "DDTIDModuleAlgo test: " << holeKapton.name() << " number 1 positioned in "
528  << kapton.name() << " at (0,0," << zpos << ") with no rotation";
529 
530  // Wafer
531  matter = DDMaterial(DDName(DDSplit(waferMat).first, DDSplit(waferMat).second));
532  if (k == 0 && dlHybrid < dlTop) {
533  bl1 = 0.5 * dlTop;
534  bl2 = 0.5 * dlBottom;
535  } else {
536  bl1 = 0.5 * dlBottom;
537  bl2 = 0.5 * dlTop;
538  }
539  h1 = 0.5 * waferThick[k];
540  dz = 0.5 * fullHeight;
541  solid = DDSolidFactory::trap(
542  DDName(DDSplit(waferName[k]).first, DDSplit(waferName[k]).second), dz, 0, 0, h1, bl1, bl1, 0, h1, bl2, bl2, 0);
543  LogDebug("TIDGeom") << "DDTIDModuleAlgo test:\t" << solid.name() << " Trap made of " << matter.ddname()
544  << " of dimensions " << dz << ", 0, 0, " << h1 << ", " << bl1 << ", " << bl1 << ", 0, " << h1
545  << ", " << bl2 << ", " << bl2 << ", 0";
546  DDLogicalPart wafer(solid.ddname(), matter, solid);
547 
548  // Active
549  matter = DDMaterial(DDName(DDSplit(activeMat).first, DDSplit(activeMat).second));
550  if (k == 0 && dlHybrid < dlTop) {
551  bl1 -= sideWidthTop;
552  bl2 -= sideWidthBottom;
553  } else {
554  bl1 -= sideWidthBottom;
555  bl2 -= sideWidthTop;
556  }
557  dz = 0.5 * (waferThick[k] - backplaneThick[k]); // inactive backplane
558  h1 = 0.5 * activeHeight;
559  solid = DDSolidFactory::trap(DDName(DDSplit(activeName[k]).first, DDSplit(activeName[k]).second),
560  dz,
561  0,
562  0,
563  h1,
564  bl2,
565  bl1,
566  0,
567  h1,
568  bl2,
569  bl1,
570  0);
571  LogDebug("TIDGeom") << "DDTIDModuleAlgo test:\t" << solid.name() << " Trap made of " << matter.ddname()
572  << " of dimensions " << dz << ", 0, 0, " << h1 << ", " << bl2 << ", " << bl1 << ", 0, " << h1
573  << ", " << bl2 << ", " << bl1 << ", 0";
574  DDLogicalPart active(solid.ddname(), matter, solid);
575  rotstr = DDSplit(activeRot).first;
576  if (rotstr != "NULL") {
577  rotns = DDSplit(activeRot).second;
578  rot = DDRotation(DDName(rotstr, rotns));
579  } else {
580  rot = DDRotation();
581  }
582  DDTranslation tran(0.0, -0.5 * backplaneThick[k], 0.0); // from the definition of the wafer local axes
583  cpv.position(active, wafer, 1, tran, rot); // inactive backplane
584  LogDebug("TIDGeom") << "DDTIDModuleAlgo test: " << active.name() << " number 1 positioned in " << wafer.name()
585  << " at " << tran << " with " << rot;
586 
587  //Pitch Adapter
588  matter = DDMaterial(DDName(DDSplit(pitchMat).first, DDSplit(pitchMat).second));
589  if (dlHybrid > dlTop) {
590  dz = 0.5 * dlTop;
591  } else {
592  dz = 0.5 * dlBottom;
593  }
594  if (k == 0) {
595  dx = dz;
596  dy = 0.5 * pitchThick;
597  dz = 0.5 * pitchHeight;
598  solid = DDSolidFactory::box(DDName(DDSplit(pitchName[k]).first, DDSplit(pitchName[k]).second), dx, dy, dz);
599  LogDebug("TIDGeom") << "DDTIDModuleAlgo test:\t" << solid.name() << " Box made of " << matter.ddname()
600  << " of dimensions"
601  << " " << dx << ", " << dy << ", " << dz;
602  } else {
603  h1 = 0.5 * pitchThick;
604  bl1 = 0.5 * pitchHeight + 0.5 * dz * sin(detTilt);
605  bl2 = 0.5 * pitchHeight - 0.5 * dz * sin(detTilt);
606 
607  dz -= 0.5 * pitchStereoTol;
608  bl1 -= pitchStereoTol;
609  bl2 -= pitchStereoTol;
610 
611  double thet = atan((bl1 - bl2) / (2. * dz));
612  solid = DDSolidFactory::trap(DDName(DDSplit(pitchName[k]).first, DDSplit(pitchName[k]).second),
613  dz,
614  thet,
615  0,
616  h1,
617  bl1,
618  bl1,
619  0,
620  h1,
621  bl2,
622  bl2,
623  0);
624  LogDebug("TIDGeom") << "DDTIDModuleAlgo test:\t" << solid.name() << " Trap made of " << matter.ddname()
625  << " of "
626  << "dimensions " << dz << ", " << thet / CLHEP::deg << ", 0, " << h1 << ", " << bl1 << ", "
627  << bl1 << ", 0, " << h1 << ", " << bl2 << ", " << bl2 << ", 0";
628  }
629  DDLogicalPart pa(solid.ddname(), matter, solid);
630  }
631  }
632  LogDebug("TIDGeom") << "<<== End of DDTIDModuleAlgo construction ...";
633 }
634 
635 DEFINE_EDM_PLUGIN(DDAlgorithmFactory, DDTIDModuleAlgo, "track:DDTIDModuleAlgo");
void execute(DDCompactView &cpv) override
static AlgebraicMatrix initialize()
vector< string > holeKaptonName
vector< string > kaptonName
const N & name() const
Definition: DDBase.h:59
vector< string > holeFrameRot
void position(const DDLogicalPart &self, const DDLogicalPart &parent, const std::string &copyno, const DDTranslation &trans, const DDRotation &rot, const DDDivision *div=nullptr)
vector< double > backplaneThick
DDMaterial is used to define and access material information.
Definition: DDMaterial.h:45
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
DDName is used to identify DDD entities uniquely.
Definition: DDName.h:17
vector< string > holeFrameName
Compact representation of the geometrical detector hierarchy.
Definition: DDCompactView.h:81
vector< string > holeKaptonRot
vector< string > sideFrameName
A DDSolid represents the shape of a part.
Definition: DDSolid.h:39
Represents a uniquely identifyable rotation matrix.
Definition: DDTransform.h:57
U second(std::pair< T, U > const &p)
vector< double > waferThick
vector< string > waferName
vector< string > pitchName
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
A DDLogicalPart aggregates information concerning material, solid and sensitveness ...
Definition: DDLogicalPart.h:93
int32_t waferThick(const int32_t property)
Definition: HGCalProperty.cc:9
static DDSolid trap(const DDName &name, double pDz, double pTheta, double pPhi, double pDy1, double pDx1, double pDx2, double pAlp1, double pDy2, double pDx3, double pDx4, double pAlp2)
Definition: DDSolid.cc:609
static DDSolid box(const DDName &name, double xHalf, double yHalf, double zHalf)
Creates a box with side length 2*xHalf, 2*yHalf, 2*zHalf.
Definition: DDSolid.cc:547
vector< string > activeName
static DDSolid subtraction(const DDName &name, const DDSolid &a, const DDSolid &b, const DDTranslation &t, const DDRotation &r)
Definition: DDSolid.cc:599
~DDTIDModuleAlgo() override
#define DEFINE_EDM_PLUGIN(factory, type, name)
std::pair< std::string, std::string > DDSplit(const std::string &n)
split into (name,namespace), separator = &#39;:&#39;
Definition: DDSplit.cc:3
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< double > > DDTranslation
Definition: DDTranslation.h:7
void initialize(const DDNumericArguments &nArgs, const DDVectorArguments &vArgs, const DDMapArguments &mArgs, const DDStringArguments &sArgs, const DDStringVectorArguments &vsArgs) override
tuple module
Definition: callgraph.py:69
#define LogDebug(id)
const N & ddname() const
Definition: DDBase.h:61