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