CMS 3D CMS Logo

DDTECModuleAlgo.cc
Go to the documentation of this file.
1 // File: DDTECModuleAlgo .cc
3 // Description: Creation of a TEC Test
5 
6 #include <cmath>
7 #include <algorithm>
8 #include <cstdio>
9 #include <string>
10 #include <utility>
11 
19 #include "CLHEP/Units/GlobalPhysicalConstants.h"
20 #include "CLHEP/Units/GlobalSystemOfUnits.h"
21 
22 
24  LogDebug("TECGeom") << "DDTECModuleAlgo info: Creating an instance";
25 }
26 
28 
30  const DDVectorArguments & vArgs,
31  const DDMapArguments & ,
32  const DDStringArguments & sArgs,
33  const DDStringVectorArguments & vsArgs) {
34 
36  genMat = sArgs["GeneralMaterial"];
37 
38  DDName parentName = parent().name();
39 
40  LogDebug("TECGeom") << "DDTECModuleAlgo debug: Parent " << parentName
41  << " NameSpace " << idNameSpace << " General Material "
42  << genMat;
43  ringNo = (int)nArgs["RingNo"];
44  moduleThick = nArgs["ModuleThick"];
45  detTilt = nArgs["DetTilt"];
46  fullHeight = nArgs["FullHeight"];
47  dlTop = nArgs["DlTop"];
48  dlBottom = nArgs["DlBottom"];
49  dlHybrid = nArgs["DlHybrid"];
50  rPos = nArgs["RPos"];
51  standardRot = sArgs["StandardRotation"];
52 
53  isRing6 = (ringNo == 6);
54 
55  LogDebug("TECGeom") << "DDTECModuleAlgo debug: ModuleThick " << moduleThick
56  << " Detector Tilt " << detTilt/CLHEP::deg << " Height "
57  << fullHeight << " dl(Top) " << dlTop << " dl(Bottom) "
58  << dlBottom << " dl(Hybrid) " << dlHybrid
59  << " rPos " << rPos << " standrad rotation "
60  << standardRot;
61 
62  frameWidth = nArgs["FrameWidth"];
63  frameThick = nArgs["FrameThick"];
64  frameOver = nArgs["FrameOver"];
65  LogDebug("TECGeom") << "DDTECModuleAlgo debug: Frame Width " << frameWidth
66  << " Thickness " << frameThick << " Overlap "
67  << frameOver;
68 
69  topFrameMat = sArgs["TopFrameMaterial"];
70  topFrameHeight = nArgs["TopFrameHeight"];
71  topFrameTopWidth= nArgs["TopFrameTopWidth"];
72  topFrameBotWidth= nArgs["TopFrameBotWidth"];
73  topFrameThick = nArgs["TopFrameThick"];
74  topFrameZ = nArgs["TopFrameZ"];
75  LogDebug("TECGeom") << "DDTECModuleAlgo debug: Top Frame Material "
76  << topFrameMat << " Height " << topFrameHeight
77  << " Top Width " << topFrameTopWidth << " Bottom Width "
79  << " Thickness " << topFrameThick <<" positioned at"
80  << topFrameZ;
81  double resizeH =0.96;
82  sideFrameMat = sArgs["SideFrameMaterial"];
83  sideFrameThick = nArgs["SideFrameThick"];
84  sideFrameLWidth = nArgs["SideFrameLWidth"];
85  sideFrameLHeight = resizeH*nArgs["SideFrameLHeight"];
86  sideFrameLtheta = nArgs["SideFrameLtheta"];
87  sideFrameRWidth = nArgs["SideFrameRWidth"];
88  sideFrameRHeight = resizeH*nArgs["SideFrameRHeight"];
89  sideFrameRtheta = nArgs["SideFrameRtheta"];
90  siFrSuppBoxWidth = vArgs["SiFrSuppBoxWidth"];
91  siFrSuppBoxHeight = vArgs["SiFrSuppBoxHeight"];
92  siFrSuppBoxYPos = vArgs["SiFrSuppBoxYPos"];
93  siFrSuppBoxThick = nArgs["SiFrSuppBoxThick"];
94  siFrSuppBoxMat = sArgs["SiFrSuppBoxMaterial"];
95  sideFrameZ = nArgs["SideFrameZ"];
96  LogDebug("TECGeom") << "DDTECModuleAlgo debug : Side Frame Material "
97  << sideFrameMat << " Thickness " << sideFrameThick
98  << " left Leg's Width: " << sideFrameLWidth
99  << " left Leg's Height: " << sideFrameLHeight
100  << " left Leg's tilt(theta): " << sideFrameLtheta
101  << " right Leg's Width: " << sideFrameRWidth
102  << " right Leg's Height: " << sideFrameRHeight
103  << " right Leg's tilt(theta): " << sideFrameRtheta
104  << "Supplies Box's Material: " << siFrSuppBoxMat
105  << " positioned at" << sideFrameZ;
106  for (int i= 0; i < (int)(siFrSuppBoxWidth.size());i++){
107  LogDebug("TECGeom") << " Supplies Box" << i << "'s Width: "
108  << siFrSuppBoxWidth[i] << " Supplies Box" << i
109  <<"'s Height: " << siFrSuppBoxHeight[i]
110  << " Supplies Box" << i << "'s y Position: "
111  << siFrSuppBoxYPos[i];
112  }
113  waferMat = sArgs["WaferMaterial"];
114  sideWidthTop = nArgs["SideWidthTop"];
115  sideWidthBottom= nArgs["SideWidthBottom"];
116  waferRot = sArgs["WaferRotation"];
117  waferPosition = nArgs["WaferPosition"];
118  LogDebug("TECGeom") << "DDTECModuleAlgo debug: Wafer Material "
119  << waferMat << " Side Width Top" << sideWidthTop
120  << " Side Width Bottom" << sideWidthBottom
121  << " and positioned at "<<waferPosition
122  << " positioned with rotation" << " matrix:"
123  << waferRot;
124 
125  activeMat = sArgs["ActiveMaterial"];
126  activeHeight = nArgs["ActiveHeight"];
127  waferThick = nArgs["WaferThick"];
128  activeRot = sArgs["ActiveRotation"];
129  activeZ = nArgs["ActiveZ"];
130  backplaneThick = nArgs["BackPlaneThick"];
131  LogDebug("TECGeom") << "DDTECModuleAlgo debug: Active Material "
132  << activeMat << " Height " << activeHeight
133  << " rotated by " << activeRot
134  << " translated by (0,0," << -0.5 * backplaneThick << ")"
135  << " Thickness/Z"
136  << waferThick-backplaneThick << "/" << activeZ;
137 
138 
139  hybridMat = sArgs["HybridMaterial"];
140  hybridHeight = nArgs["HybridHeight"];
141  hybridWidth = nArgs["HybridWidth"];
142  hybridThick = nArgs["HybridThick"];
143  hybridZ = nArgs["HybridZ"];
144  LogDebug("TECGeom") << "DDTECModuleAlgo debug: Hybrid Material "
145  << hybridMat << " Height " << hybridHeight
146  << " Width " << hybridWidth << " Thickness "
147  << hybridThick << " Z" << hybridZ;
148 
149  pitchMat = sArgs["PitchMaterial"];
150  pitchHeight = nArgs["PitchHeight"];
151  pitchThick = nArgs["PitchThick"];
152  pitchWidth = nArgs["PitchWidth"];
153  pitchZ = nArgs["PitchZ"];
154  pitchRot = sArgs["PitchRotation"];
155  LogDebug("TECGeom") << "DDTECModuleAlgo debug: Pitch Adapter Material "
156  << pitchMat << " Height " << pitchHeight
157  << " Thickness " << pitchThick << " position with "
158  << " rotation " << pitchRot << " at Z" << pitchZ;
159 
160  bridgeMat = sArgs["BridgeMaterial"];
161  bridgeWidth = nArgs["BridgeWidth"];
162  bridgeThick = nArgs["BridgeThick"];
163  bridgeHeight = nArgs["BridgeHeight"];
164  bridgeSep = nArgs["BridgeSeparation"];
165  LogDebug("TECGeom") << "DDTECModuleAlgo debug: Bridge Material "
166  << bridgeMat << " Width " << bridgeWidth
167  << " Thickness " << bridgeThick << " Height "
168  << bridgeHeight << " Separation "<< bridgeSep;
169 
170  siReenforceWidth = vArgs["SiReenforcementWidth"];
171  siReenforceHeight = vArgs["SiReenforcementHeight"];
172  siReenforceYPos = vArgs["SiReenforcementPosY"];
173  siReenforceThick = nArgs["SiReenforcementThick"];
174  siReenforceMat = sArgs["SiReenforcementMaterial"];
175 
176  LogDebug("TECGeom") << "FALTBOOT DDTECModuleAlgo debug : Si-Reenforcement Material "
177  << sideFrameMat << " Thickness " << siReenforceThick;
178 
179  for (int i= 0; i < (int)(siReenforceWidth.size());i++){
180  LogDebug("TECGeom") << " SiReenforcement" << i << "'s Width: "
181  << siReenforceWidth[i] << " SiReenforcement" << i
182  << "'s Height: " << siReenforceHeight[i]
183  << " SiReenforcement" << i << "'s y Position: "
184  <<siReenforceYPos[i];
185  }
186  inactiveDy = 0;
187  inactivePos = 0;
188  if(ringNo > 3){
189  inactiveDy = nArgs["InactiveDy"];
190  inactivePos = nArgs["InactivePos"];
191  inactiveMat = sArgs["InactiveMaterial"];
192  }
193 
194  noOverlapShift = nArgs["NoOverlapShift"];
195  //Everything that is normal/stereo specific comes here
196  isStereo = (int)nArgs["isStereo"] == 1;
197  if(!isStereo){
198  LogDebug("TECGeom") << "This is a normal module, in ring "<<ringNo<<"!";
199  } else {
200  LogDebug("TECGeom") << "This is a stereo module, in ring "<<ringNo<<"!";
201  posCorrectionPhi= nArgs["PosCorrectionPhi"];
202  topFrame2LHeight = nArgs["TopFrame2LHeight"];
203  topFrame2RHeight = nArgs["TopFrame2RHeight"];
204  topFrame2Width = nArgs["TopFrame2Width"];
205  LogDebug("TECGeom") << "Phi Position corrected by " << posCorrectionPhi << "*rad";
206  LogDebug("TECGeom") << "DDTECModuleAlgo debug: stereo Top Frame 2nd Part left Heigt "
207  << topFrame2LHeight << " right Height " << topFrame2RHeight
208  << " Width " << topFrame2Width ;
209 
210  sideFrameLWidthLow = nArgs["SideFrameLWidthLow"];
211  sideFrameRWidthLow = nArgs["SideFrameRWidthLow"];
212 
213  LogDebug("TECGeom") << " left Leg's lower Width: " << sideFrameLWidthLow
214  << " right Leg's lower Width: " << sideFrameRWidthLow;
215 
216  // posCorrectionR = nArgs["PosCorrectionR"];
217  //LogDebug("TECGeom") << "Stereo Module Position Correction with R = " << posCorrectionR;
218  }
219 }
220 
221 void DDTECModuleAlgo::doPos(const DDLogicalPart& toPos, const DDLogicalPart& mother,
222  int copyNr, double x, double y, double z,
223  const std::string& rotName, DDCompactView& cpv) {
224 
225  DDTranslation tran(z, x, y);
226  DDRotation rot;
227  std::string rotstr = DDSplit(rotName).first;
228  std::string rotns;
229  if (rotstr != "NULL") {
230  rotns = DDSplit(rotName).second;
231  rot = DDRotation(DDName(rotstr, rotns));
232  } else {
233  rot = DDRotation();
234  }
235 
236  cpv.position(toPos, mother, copyNr, tran, rot);
237  LogDebug("TECGeom") << "DDTECModuleAlgo test: " << toPos.name()
238  << " positioned in "<< mother.name()
239  << " at " << tran << " with " << rot;
240 }
241 
242 void DDTECModuleAlgo::doPos(DDLogicalPart toPos, double x, double y, double z,
243  std::string rotName, DDCompactView& cpv) {
244  int copyNr = 1;
245  if (isStereo) copyNr = 2;
246 
247  // This has to be done so that the Mother coordinate System of a Tub resembles
248  // the coordinate System of a Trap or Box.
249  z += rPos;
250 
251  if(isStereo){
252  // z is x , x is y
253  //z+= rPos*sin(posCorrectionPhi); <<- this is already corrected with the r position!
255  }
256  if (rotName == "NULL") rotName = standardRot;
257 
258  doPos(std::move(toPos),parent(),copyNr,x,y,z,rotName, cpv);
259 }
260 
262 
263  LogDebug("TECGeom") << "==>> Constructing DDTECModuleAlgo...";
264  //declarations
265  double tmp;
266  double dxdif, dzdif;
267  double dxbot, dxtop; // topfr;
268  //positions
269  double xpos, ypos, zpos;
270  //dimensons
271  double bl1, bl2;
272  double h1;
273  double dx, dy, dz;
274  double thet;
275  //names
278  std::string tag("Rphi");
279  if (isStereo) tag = "Stereo";
280  //usefull constants
281  const double topFrameEndZ = 0.5 * (-waferPosition + fullHeight) + pitchHeight + hybridHeight - topFrameHeight;
282  DDName parentName = parent().name();
283  idName = parentName.name();
284  LogDebug("TECGeom") << "==>> " << idName << " parent " << parentName << " namespace " << idNameSpace;
285  DDSolid solid;
286 
287  //set global parameters
289  DDMaterial matter(matname);
290  dzdif = fullHeight + topFrameHeight;
291  if(isStereo) dzdif += 0.5*(topFrame2LHeight+topFrame2RHeight);
292 
293  dxbot = 0.5*dlBottom + frameWidth - frameOver;
294  dxtop = 0.5*dlHybrid + frameWidth - frameOver;
295  // topfr = 0.5*dlBottom * sin(detTilt);
296  if (isRing6) {
297  dxbot = dxtop;
298  dxtop = 0.5*dlTop + frameWidth - frameOver;
299  // topfr = 0.5*dlTop * sin(detTilt);
300  }
301  dxdif = dxtop - dxbot;
302 
303  //Frame Sides
304  // left Frame
305  name = idName + "SideFrameLeft";
306  matname = DDName(DDSplit(sideFrameMat).first, DDSplit(sideFrameMat).second);
307  matter = DDMaterial(matname);
308 
309  h1 = 0.5 * sideFrameThick;
310  dz = 0.5 * sideFrameLHeight;
311  bl1 = bl2 = 0.5 * sideFrameLWidth;
312  thet = sideFrameLtheta;
313  //for stereo modules
314  if(isStereo) bl1 = 0.5 * sideFrameLWidthLow;
315  solid = DDSolidFactory::trap(DDName(name,idNameSpace), dz, thet, 0, h1, bl1,
316  bl1, 0, h1, bl2, bl2, 0);
317  LogDebug("TECGeom") << "DDTECModuleAlgo test:\t" << solid.name()
318  << " Trap made of " << matname << " of dimensions "
319  << dz << ", "<<thet<<", 0, " << h1 << ", " << bl1 << ", "
320  << bl1 << ", 0, " << h1 << ", " << bl2 << ", " << bl2
321  << ", 0";
322  DDLogicalPart sideFrameLeft(solid.ddname(), matter, solid);
323  //translate
324  xpos = - 0.5*topFrameBotWidth +bl2+ tan(fabs(thet)) * dz;
325  ypos = sideFrameZ;
326  zpos = topFrameEndZ -dz;
327  //flip ring 6
328  if (isRing6){
329  zpos *= -1;
330  xpos -= 2*tan(fabs(thet)) * dz; // because of the flip the tan(..) to be in the other direction
331  }
332  //the stereo modules are on the back of the normal ones...
333  if(isStereo) {
334  xpos = - 0.5*topFrameBotWidth + bl2*cos(detTilt) + dz*sin(fabs(thet)+detTilt)/cos(fabs(thet));
335  xpos = -xpos;
336  zpos = topFrameEndZ -topFrame2LHeight- 0.5*sin(detTilt)*(topFrameBotWidth - topFrame2Width)-dz*cos(detTilt+fabs(thet))/cos(fabs(thet))+bl2*sin(detTilt)-0.1*CLHEP::mm;
337  }
338  //position
339  doPos(sideFrameLeft,xpos,ypos,zpos,waferRot, cpv);
340 
341  //right Frame
342  name = idName + "SideFrameRight";
343  matname = DDName(DDSplit(sideFrameMat).first, DDSplit(sideFrameMat).second);
344  matter = DDMaterial(matname);
345 
346  h1 = 0.5 * sideFrameThick;
347  dz = 0.5 * sideFrameRHeight;
348  bl1 = bl2 = 0.5 * sideFrameRWidth;
349  thet = sideFrameRtheta;
350  if(isStereo) bl1 = 0.5 * sideFrameRWidthLow;
351  solid = DDSolidFactory::trap(DDName(name,idNameSpace), dz, thet, 0, h1, bl1,
352  bl1, 0, h1, bl2, bl2, 0);
353  LogDebug("TECGeom") << "DDTECModuleAlgo test:\t" << solid.name()
354  << " Trap made of " << matname << " of dimensions "
355  << dz << ", "<<thet<<", 0, " << h1 << ", " << bl1 << ", "
356  << bl1 << ", 0, " << h1 << ", " << bl2 << ", " << bl2
357  << ", 0";
358  DDLogicalPart sideFrameRight(solid.ddname(), matter, solid);
359  //translate
360  xpos = 0.5*topFrameBotWidth -bl2- tan(fabs(thet)) * dz;
361  ypos = sideFrameZ;
362  zpos = topFrameEndZ -dz ;
363  if (isRing6){
364  zpos *= -1;
365  xpos += 2*tan(fabs(thet)) * dz; // because of the flip the tan(..) has to be in the other direction
366  }
367  if(isStereo){
368  xpos = 0.5*topFrameBotWidth - bl2*cos(detTilt) - dz*sin(fabs(detTilt-fabs(thet)))/cos(fabs(thet));
369  xpos = -xpos;
370  zpos = topFrameEndZ -topFrame2RHeight+ 0.5*sin(detTilt)*(topFrameBotWidth - topFrame2Width)-dz*cos(detTilt-fabs(thet))/cos(fabs(thet))-bl2*sin(detTilt)-0.1*CLHEP::mm;
371  }
372  //position it
373  doPos(sideFrameRight,xpos,ypos,zpos,waferRot, cpv);
374 
375 
376  //Supplies Box(es)
377  for (int i= 0; i < (int)(siFrSuppBoxWidth.size());i++){
378  name = idName + "SuppliesBox" + std::to_string(i);
379  matname = DDName(DDSplit(siFrSuppBoxMat).first, DDSplit(siFrSuppBoxMat).second);
380  matter = DDMaterial(matname);
381 
382  h1 = 0.5 * siFrSuppBoxThick;
383  dz = 0.5 * siFrSuppBoxHeight[i];
384  bl1 = bl2 = 0.5 * siFrSuppBoxWidth[i];
385  thet = sideFrameRtheta;
386  if(isStereo) thet = -atan(fabs(sideFrameRWidthLow-sideFrameRWidth)/(2*sideFrameRHeight)-tan(fabs(thet)));
387  // ^-- this calculates the lower left angel of the tipped trapezoid, which is the SideFframe...
388 
389  solid = DDSolidFactory::trap(DDName(name,idNameSpace), dz, thet,0, h1, bl1,
390  bl1, 0, h1, bl2, bl2, 0);
391  LogDebug("TECGeom") << "DDTECModuleAlgo test:\t" << solid.name()
392  << " Trap made of " << matname << " of dimensions "
393  << dz << ", 0, 0, " << h1 << ", " << bl1 << ", "
394  << bl1 << ", 0, " << h1 << ", " << bl2 << ", " << bl2
395  << ", 0";
396  DDLogicalPart siFrSuppBox(solid.ddname(), matter, solid);
397  //translate
398  xpos = 0.5*topFrameBotWidth -sideFrameRWidth - bl1-siFrSuppBoxYPos[i]*tan(fabs(thet));
399  ypos = sideFrameZ*(0.5+(siFrSuppBoxThick/sideFrameThick)); //via * so I do not have to worry about the sign of sideFrameZ
400  zpos = topFrameEndZ - siFrSuppBoxYPos[i];
401  if (isRing6){
402  xpos += 2*fabs(tan(thet))* siFrSuppBoxYPos[i]; // the flipped issue again
403  zpos *= -1;
404  }
405  if(isStereo){
406  xpos = 0.5*topFrameBotWidth - (sideFrameRWidth+bl1)*cos(detTilt) -sin(fabs(detTilt-fabs(thet)))*(siFrSuppBoxYPos[i]+dz*(1/cos(thet)- cos(detTilt))+bl1*sin(detTilt));
407  xpos =-xpos;
408  zpos = topFrameEndZ - topFrame2RHeight - 0.5*sin(detTilt)*(topFrameBotWidth - topFrame2Width) - siFrSuppBoxYPos[i]-sin(detTilt)*sideFrameRWidth;
409  }
410  //position it;
411  doPos(siFrSuppBox,xpos,ypos,zpos,waferRot,cpv);
412  }
413  //The Hybrid
414  name = idName + "Hybrid";
415  matname = DDName(DDSplit(hybridMat).first, DDSplit(hybridMat).second);
416  matter = DDMaterial(matname);
417  dx = 0.5 * hybridWidth;
418  dy = 0.5 * hybridThick;
419  dz = 0.5 * hybridHeight;
420  solid = DDSolidFactory::box(DDName(name, idNameSpace), dx, dy, dz);
421  LogDebug("TECGeom") << "DDTECModuleAlgo test:\t" << solid.name()
422  << " Box made of " << matname << " of dimensions "
423  << dx << ", " << dy << ", " << dz;
424  DDLogicalPart hybrid(solid.ddname(), matter, solid);
425 
426  ypos = hybridZ;
427  zpos = 0.5 * (-waferPosition + fullHeight + hybridHeight)+pitchHeight;
428  if (isRing6) zpos *=-1;
429  //position it
430  doPos(hybrid,0,ypos,zpos,"NULL", cpv);
431 
432  // Wafer
433  name = idName + tag +"Wafer";
434  matname = DDName(DDSplit(waferMat).first, DDSplit(waferMat).second);
435  matter = DDMaterial(matname);
436  bl1 = 0.5 * dlBottom;
437  bl2 = 0.5 * dlTop;
438  h1 = 0.5 * waferThick;
439  dz = 0.5 * fullHeight;
440  solid = DDSolidFactory::trap(DDName(name,idNameSpace), dz, 0, 0, h1, bl1,
441  bl1, 0, h1, bl2, bl2, 0);
442  LogDebug("TECGeom") << "DDTECModuleAlgo test:\t" << solid.name()
443  << " Trap made of " << matname << " of dimensions "
444  << dz << ", 0, 0, " << h1 << ", " << bl1 << ", "
445  << bl1 << ", 0, " << h1 << ", " << bl2 << ", "
446  << bl2 << ", 0";
447  DDLogicalPart wafer(solid.ddname(), matter, solid);
448 
449  ypos = activeZ;
450  zpos =-0.5 * waferPosition;// former and incorrect topFrameHeight;
451  if (isRing6) zpos *= -1;
452 
453  doPos(wafer,0,ypos,zpos,waferRot,cpv);
454 
455  // Active
456  name = idName + tag +"Active";
457  matname = DDName(DDSplit(activeMat).first, DDSplit(activeMat).second);
458  matter = DDMaterial(matname);
459  bl1 -= sideWidthBottom;
460  bl2 -= sideWidthTop;
461  dz = 0.5 * (waferThick-backplaneThick); // inactive backplane
462  h1 = 0.5 * activeHeight;
463  if (isRing6) { //switch bl1 <->bl2
464  tmp = bl2; bl2 =bl1; bl1 = tmp;
465  }
466  solid = DDSolidFactory::trap(DDName(name,idNameSpace), dz, 0, 0, h1, bl2,
467  bl1, 0, h1, bl2, bl1, 0);
468  LogDebug("TECGeom") << "DDTECModuleAlgo test:\t" << solid.name()
469  << " Trap made of " << matname << " of dimensions "
470  << dz << ", 0, 0, " << h1 << ", " << bl2 << ", "
471  << bl1 << ", 0, " << h1 << ", " << bl2 << ", "
472  << bl1 << ", 0";
473  DDLogicalPart active(solid.ddname(), matter, solid);
474  doPos(active, wafer, 1, -0.5 * backplaneThick,0,0, activeRot, cpv); // from the definition of the wafer local axes and doPos() routine
475  //inactive part in rings > 3
476  if(ringNo > 3){
477  inactivePos -= fullHeight-activeHeight; //inactivePos is measured from the beginning of the _wafer_
478  name = idName + tag +"Inactive";
479  matname = DDName(DDSplit(inactiveMat).first, DDSplit(inactiveMat).second);
480  matter = DDMaterial(matname);
481  bl1 = 0.5*dlBottom-sideWidthBottom
482  + ((0.5*dlTop-sideWidthTop-0.5*dlBottom+sideWidthBottom)/activeHeight)
483  *(activeHeight-inactivePos-inactiveDy);
484  bl2 = 0.5*dlBottom-sideWidthBottom
485  + ((0.5*dlTop-sideWidthTop-0.5*dlBottom+sideWidthBottom)/activeHeight)
486  *(activeHeight-inactivePos+inactiveDy);
487  dz = 0.5 * (waferThick-backplaneThick); // inactive backplane
488  h1 = inactiveDy;
489  if (isRing6) { //switch bl1 <->bl2
490  tmp = bl2; bl2 =bl1; bl1 = tmp;
491  }
492  solid = DDSolidFactory::trap(DDName(name,idNameSpace), dz, 0, 0, h1, bl2,
493  bl1, 0, h1, bl2, bl1, 0);
494  LogDebug("TECGeom") << "DDTECModuleAlgo test:\t" << solid.name()
495  << " Trap made of " << matname << " of dimensions "
496  << dz << ", 0, 0, " << h1 << ", " << bl2 << ", "
497  << bl1 << ", 0, " << h1 << ", " << bl2 << ", "
498  << bl1 << ", 0";
499  DDLogicalPart inactive(solid.ddname(), matter, solid);
500  ypos = inactivePos - 0.5*activeHeight;
501  doPos(inactive,active, 1, ypos,0,0, "NULL", cpv); // from the definition of the wafer local axes and doPos() routine
502  }
503  //Pitch Adapter
504  name = idName + "PA";
505  matname = DDName(DDSplit(pitchMat).first, DDSplit(pitchMat).second);
506  matter = DDMaterial(matname);
507 
508  if (!isStereo) {
509  dx = 0.5 * pitchWidth;
510  dy = 0.5 * pitchThick;
511  dz = 0.5 * pitchHeight;
512  solid = DDSolidFactory::box(DDName(name, idNameSpace), dx, dy, dz);
513  LogDebug("TECGeom") << "DDTECModuleAlgo test:\t" << solid.name()
514  << " Box made of " << matname <<" of dimensions "
515  << dx << ", " << dy << ", " << dz;
516  } else {
517  dz = 0.5 * pitchWidth;
518  h1 = 0.5 * pitchThick;
519  bl1 = 0.5 * pitchHeight + 0.5 * dz * sin(detTilt);
520  bl2 = 0.5 * pitchHeight - 0.5 * dz * sin(detTilt);
521  double thet = atan((bl1-bl2)/(2.*dz));
522  solid = DDSolidFactory::trap(DDName(name,idNameSpace), dz, thet, 0, h1,
523  bl1, bl1, 0, h1, bl2, bl2, 0);
524  LogDebug("TECGeom") << "DDTECModuleAlgo test:\t" << solid.name()
525  << " Trap made of " << matname
526  << " of dimensions " << dz << ", " << thet/CLHEP::deg
527  << ", 0, " << h1 << ", " << bl1 << ", " << bl1
528  << ", 0, " << h1 << ", " << bl2 << ", " << bl2
529  << ", 0";
530  }
531  xpos = 0;
532  ypos = pitchZ;
533  zpos = 0.5 * (-waferPosition + fullHeight + pitchHeight);
534  if (isRing6) zpos *= -1;
535  if(isStereo) xpos = 0.5 * fullHeight * sin(detTilt);
536 
537  DDLogicalPart pa(solid.ddname(), matter, solid);
538  if(isStereo)doPos(pa, xpos, ypos,zpos, pitchRot, cpv);
539  else doPos(pa, xpos, ypos,zpos, "NULL", cpv);
540  //Top of the frame
541  name = idName + "TopFrame";
542  matname = DDName(DDSplit(topFrameMat).first, DDSplit(topFrameMat).second);
543  matter = DDMaterial(matname);
544 
545  h1 = 0.5 * topFrameThick;
546  dz = 0.5 * topFrameHeight;
547  bl1 = 0.5 * topFrameBotWidth;
548  bl2 = 0.5 * topFrameTopWidth;
549  if (isRing6) { // ring 6 faces the other way!
550  bl1 = 0.5 * topFrameTopWidth;
551  bl2 = 0.5 * topFrameBotWidth;
552  }
553 
554  solid = DDSolidFactory::trap(DDName(name,idNameSpace), dz, 0, 0, h1, bl1,
555  bl1,0, h1, bl2, bl2, 0);
556  LogDebug("TECGeom") << "DDTECModuleAlgo test:\t" << solid.name()
557  << " Trap made of " << matname << " of dimensions "
558  << dz << ", 0, 0, " << h1 << ", " << bl1 << ", "
559  << bl1 << ", 0, " << h1 << ", " << bl2 << ", " << bl2
560  << ", 0";
561  DDLogicalPart topFrame(solid.ddname(), matter, solid);
562 
563  if(isStereo){
564  name = idName + "TopFrame2";
565  //additional object to build the not trapzoid geometry of the stereo topframes
566  dz = 0.5 * topFrame2Width;
567  h1 = 0.5 * topFrameThick;
568  bl1 = 0.5 * topFrame2LHeight;
569  bl2 = 0.5 * topFrame2RHeight;
570  double thet = atan((bl1-bl2)/(2.*dz));
571 
572  solid = DDSolidFactory::trap(DDName(name,idNameSpace), dz, thet, 0, h1,
573  bl1, bl1, 0, h1, bl2, bl2, 0);
574  LogDebug("TECGeom") << "DDTECModuleAlgo test:\t" << solid.name()
575  << " Trap made of " << matname << " of dimensions "
576  << dz << ", " << thet/CLHEP::deg << ", 0, " << h1
577  << ", " << bl1 << ", " << bl1 << ", 0, " << h1
578  << ", " << bl2 << ", " << bl2 << ", 0";
579  }
580 
581  // Position the topframe
582  ypos = topFrameZ;
584  if(isRing6){
585  zpos *=-1;
586  }
587 
588  doPos(topFrame, 0,ypos,zpos,"NULL", cpv);
589  if(isStereo){
590  //create
591  DDLogicalPart topFrame2(solid.ddname(), matter, solid);
592  zpos -= 0.5*(topFrameHeight + 0.5*(topFrame2LHeight+topFrame2RHeight));
593  doPos(topFrame2, 0,ypos,zpos,pitchRot, cpv);
594  }
595 
596  //Si - Reencorcement
597  for (int i= 0; i < (int)(siReenforceWidth.size());i++){
598  name = idName + "SiReenforce" + std::to_string(i);
599  matname = DDName(DDSplit(siReenforceMat).first, DDSplit(siReenforceMat).second);
600  matter = DDMaterial(matname);
601 
602  h1 = 0.5 * siReenforceThick;
603  dz = 0.5 * siReenforceHeight[i];
604  bl1 = bl2 = 0.5 * siReenforceWidth[i];
605 
606  solid = DDSolidFactory::trap(DDName(name,idNameSpace), dz, 0, 0, h1, bl1,
607  bl1, 0, h1, bl2, bl2, 0);
608  LogDebug("TECGeom") << "DDTECModuleAlgo test:\t" << solid.name()
609  << " Trap made of " << matname << " of dimensions "
610  << dz << ", 0, 0, " << h1 << ", " << bl1 << ", "
611  << bl1 << ", 0, " << h1 << ", " << bl2 << ", " << bl2
612  << ", 0";
613  DDLogicalPart siReenforce(solid.ddname(), matter, solid);
614  //translate
615  xpos =0 ;
616  ypos = sideFrameZ;
617  zpos = topFrameEndZ -dz -siReenforceYPos[i];
618 
619  if (isRing6) zpos *= -1;
620  if(isStereo){
621  xpos = (-siReenforceYPos[i]+0.5*fullHeight)*sin(detTilt);
622  // thet = detTilt;
623  // if(topFrame2RHeight > topFrame2LHeight) thet *= -1;
624  // zpos -= topFrame2RHeight + sin(thet)*(sideFrameRWidth + 0.5*dlTop);
625  zpos -= topFrame2RHeight + sin (fabs(detTilt))* 0.5*topFrame2Width;
626  }
627  doPos(siReenforce,xpos,ypos,zpos,waferRot, cpv);
628  }
629 
630  //Bridge
631  if (bridgeMat != "None") {
632  name = idName + "Bridge";
633  matname = DDName(DDSplit(bridgeMat).first, DDSplit(bridgeMat).second);
634  matter = DDMaterial(matname);
635  bl2 = 0.5*bridgeSep + bridgeWidth;
636  bl1 = bl2 - bridgeHeight * dxdif / dzdif;
637  h1 = 0.5 * bridgeThick;
638  dz = 0.5 * bridgeHeight;
639  solid = DDSolidFactory::trap(DDName(name,idNameSpace), dz, 0, 0, h1, bl1,
640  bl1, 0, h1, bl2, bl2, 0);
641  LogDebug("TECGeom") << "DDTECModuleAlgo test:\t" << solid.name()
642  << " Trap made of " << matname << " of dimensions "
643  << dz << ", 0, 0, " << h1 << ", " << bl1 << ", "
644  << bl1 << ", 0, " << h1 << ", " << bl2 << ", " << bl2
645  << ", 0";
646  DDLogicalPart bridge(solid.ddname(), matter, solid);
647 
648  name = idName + "BridgeGap";
649  matname = DDName(DDSplit(genMat).first, DDSplit(genMat).second);
650  matter = DDMaterial(matname);
651  bl1 = 0.5*bridgeSep;
652  solid = DDSolidFactory::box(DDName(name,idNameSpace), bl1, h1, dz);
653  LogDebug("TECGeom") << "DDTECModuleAlgo test:\t" << solid.name()
654  << " Box made of " << matname << " of dimensions "
655  << bl1 << ", " << h1 << ", " << dz;
656  DDLogicalPart bridgeGap(solid.ddname(), matter, solid);
657  cpv.position(bridgeGap, bridge, 1, DDTranslation(0.0, 0.0, 0.0), DDRotation());
658  LogDebug("TECGeom") << "DDTECModuleAlgo test: " << bridgeGap.name()
659  << " number 1 positioned in " << bridge.name()
660  << " at (0,0,0) with no rotation";
661  }
662 
663  LogDebug("TECGeom") << "<<== End of DDTECModuleAlgo construction ...";
664 }
#define LogDebug(id)
std::string waferRot
std::vector< double > siFrSuppBoxHeight
const N & name() const
Definition: DDBase.h:78
double sideFrameLWidthLow
DDMaterial is used to define and access material information.
Definition: DDMaterial.h:41
std::vector< double > siFrSuppBoxWidth
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
DDName is used to identify DDD entities uniquely.
Definition: DDName.h:15
susybsm::HSCParticle pa
Definition: classes.h:8
static std::string & ns()
std::string pitchMat
type of data representation of DDCompactView
Definition: DDCompactView.h:90
void initialize(const DDNumericArguments &nArgs, const DDVectorArguments &vArgs, const DDMapArguments &mArgs, const DDStringArguments &sArgs, const DDStringVectorArguments &vsArgs) override
std::string bridgeMat
A DDSolid represents the shape of a part.
Definition: DDSolid.h:38
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< double > > DDTranslation
Definition: DDTranslation.h:7
std::string activeMat
Represents a uniquely identifyable rotation matrix.
Definition: DDTransform.h:67
U second(std::pair< T, U > const &p)
std::string siReenforceMat
std::string hybridMat
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
Tan< T >::type tan(const T &t)
Definition: Tan.h:22
A DDLogicalPart aggregates information concerning material, solid and sensitveness ...
Definition: DDLogicalPart.h:92
std::string siFrSuppBoxMat
std::vector< double > siReenforceYPos
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:917
std::string pitchRot
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:819
~DDTECModuleAlgo() override
void execute(DDCompactView &cpv) override
double sideFrameRWidthLow
std::vector< double > siReenforceWidth
std::string waferMat
std::string idNameSpace
void position(const DDLogicalPart &self, const DDLogicalPart &parent, const std::string &copyno, const DDTranslation &trans, const DDRotation &rot, const DDDivision *div=0)
std::vector< double > siFrSuppBoxYPos
void doPos(const DDLogicalPart &toPos, const DDLogicalPart &mother, int copyNr, double x, double y, double z, const std::string &rotName, DDCompactView &cpv)
std::vector< std::vector< double > > tmp
Definition: MVATrainer.cc:100
std::string activeRot
std::string genMat
std::string standardRot
std::vector< double > siReenforceHeight
std::pair< std::string, std::string > DDSplit(const std::string &n)
split into (name,namespace), separator = &#39;:&#39;
Definition: DDSplit.cc:3
std::string sideFrameMat
const std::string & name() const
Returns the name.
Definition: DDName.cc:90
std::string topFrameMat
def move(src, dest)
Definition: eostools.py:510
std::string inactiveMat
const N & ddname() const
Definition: DDBase.h:80