CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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 
17 #include "CLHEP/Units/GlobalPhysicalConstants.h"
18 #include "CLHEP/Units/GlobalSystemOfUnits.h"
19 
20 
22  LogDebug("TECGeom") << "DDTECModuleAlgo info: Creating an instance";
23 }
24 
26 
28  const DDVectorArguments & vArgs,
29  const DDMapArguments & ,
30  const DDStringArguments & sArgs,
31  const DDStringVectorArguments & vsArgs) {
32 
34  genMat = sArgs["GeneralMaterial"];
35 
36  DDName parentName = parent().name();
37 
38  LogDebug("TECGeom") << "DDTECModuleAlgo debug: Parent " << parentName
39  << " NameSpace " << idNameSpace << " General Material "
40  << genMat;
41  ringNo = (int)nArgs["RingNo"];
42  moduleThick = nArgs["ModuleThick"];
43  detTilt = nArgs["DetTilt"];
44  fullHeight = nArgs["FullHeight"];
45  dlTop = nArgs["DlTop"];
46  dlBottom = nArgs["DlBottom"];
47  dlHybrid = nArgs["DlHybrid"];
48  rPos = nArgs["RPos"];
49  standardRot = sArgs["StandardRotation"];
50 
51  isRing6 = (ringNo == 6);
52 
53  LogDebug("TECGeom") << "DDTECModuleAlgo debug: ModuleThick " << moduleThick
54  << " Detector Tilt " << detTilt/CLHEP::deg << " Height "
55  << fullHeight << " dl(Top) " << dlTop << " dl(Bottom) "
56  << dlBottom << " dl(Hybrid) " << dlHybrid
57  << " rPos " << rPos << " standrad rotation "
58  << standardRot;
59 
60  frameWidth = nArgs["FrameWidth"];
61  frameThick = nArgs["FrameThick"];
62  frameOver = nArgs["FrameOver"];
63  LogDebug("TECGeom") << "DDTECModuleAlgo debug: Frame Width " << frameWidth
64  << " Thickness " << frameThick << " Overlap "
65  << frameOver;
66 
67  topFrameMat = sArgs["TopFrameMaterial"];
68  topFrameHeight = nArgs["TopFrameHeight"];
69  topFrameTopWidth= nArgs["TopFrameTopWidth"];
70  topFrameBotWidth= nArgs["TopFrameBotWidth"];
71  topFrameThick = nArgs["TopFrameThick"];
72  topFrameZ = nArgs["TopFrameZ"];
73  LogDebug("TECGeom") << "DDTECModuleAlgo debug: Top Frame Material "
74  << topFrameMat << " Height " << topFrameHeight
75  << " Top Width " << topFrameTopWidth << " Bottom Width "
77  << " Thickness " << topFrameThick <<" positioned at"
78  << topFrameZ;
79  double resizeH =0.96;
80  sideFrameMat = sArgs["SideFrameMaterial"];
81  sideFrameThick = nArgs["SideFrameThick"];
82  sideFrameLWidth = nArgs["SideFrameLWidth"];
83  sideFrameLHeight = resizeH*nArgs["SideFrameLHeight"];
84  sideFrameLtheta = nArgs["SideFrameLtheta"];
85  sideFrameRWidth = nArgs["SideFrameRWidth"];
86  sideFrameRHeight = resizeH*nArgs["SideFrameRHeight"];
87  sideFrameRtheta = nArgs["SideFrameRtheta"];
88  siFrSuppBoxWidth = vArgs["SiFrSuppBoxWidth"];
89  siFrSuppBoxHeight = vArgs["SiFrSuppBoxHeight"];
90  siFrSuppBoxYPos = vArgs["SiFrSuppBoxYPos"];
91  siFrSuppBoxThick = nArgs["SiFrSuppBoxThick"];
92  siFrSuppBoxMat = sArgs["SiFrSuppBoxMaterial"];
93  sideFrameZ = nArgs["SideFrameZ"];
94  LogDebug("TECGeom") << "DDTECModuleAlgo debug : Side Frame Material "
95  << sideFrameMat << " Thickness " << sideFrameThick
96  << " left Leg's Width: " << sideFrameLWidth
97  << " left Leg's Height: " << sideFrameLHeight
98  << " left Leg's tilt(theta): " << sideFrameLtheta
99  << " right Leg's Width: " << sideFrameRWidth
100  << " right Leg's Height: " << sideFrameRHeight
101  << " right Leg's tilt(theta): " << sideFrameRtheta
102  << "Supplies Box's Material: " << siFrSuppBoxMat
103  << " positioned at" << sideFrameZ;
104  for (int i= 0; i < (int)(siFrSuppBoxWidth.size());i++){
105  LogDebug("TECGeom") << " Supplies Box" << i << "'s Width: "
106  << siFrSuppBoxWidth[i] << " Supplies Box" << i
107  <<"'s Height: " << siFrSuppBoxHeight[i]
108  << " Supplies Box" << i << "'s y Position: "
109  << siFrSuppBoxYPos[i];
110  }
111  waferMat = sArgs["WaferMaterial"];
112  sideWidthTop = nArgs["SideWidthTop"];
113  sideWidthBottom= nArgs["SideWidthBottom"];
114  waferRot = sArgs["WaferRotation"];
115  waferPosition = nArgs["WaferPosition"];
116  LogDebug("TECGeom") << "DDTECModuleAlgo debug: Wafer Material "
117  << waferMat << " Side Width Top" << sideWidthTop
118  << " Side Width Bottom" << sideWidthBottom
119  << " and positioned at "<<waferPosition
120  << " positioned with rotation" << " matrix:"
121  << waferRot;
122 
123  activeMat = sArgs["ActiveMaterial"];
124  activeHeight = nArgs["ActiveHeight"];
125  waferThick = nArgs["WaferThick"];
126  activeRot = sArgs["ActiveRotation"];
127  activeZ = nArgs["ActiveZ"];
128  backplaneThick = nArgs["BackPlaneThick"];
129  LogDebug("TECGeom") << "DDTECModuleAlgo debug: Active Material "
130  << activeMat << " Height " << activeHeight
131  << " rotated by " << activeRot
132  << " translated by (0,0," << -0.5 * backplaneThick << ")"
133  << " Thickness/Z"
134  << waferThick-backplaneThick << "/" << activeZ;
135 
136 
137  hybridMat = sArgs["HybridMaterial"];
138  hybridHeight = nArgs["HybridHeight"];
139  hybridWidth = nArgs["HybridWidth"];
140  hybridThick = nArgs["HybridThick"];
141  hybridZ = nArgs["HybridZ"];
142  LogDebug("TECGeom") << "DDTECModuleAlgo debug: Hybrid Material "
143  << hybridMat << " Height " << hybridHeight
144  << " Width " << hybridWidth << " Thickness "
145  << hybridThick << " Z" << hybridZ;
146 
147  pitchMat = sArgs["PitchMaterial"];
148  pitchHeight = nArgs["PitchHeight"];
149  pitchThick = nArgs["PitchThick"];
150  pitchWidth = nArgs["PitchWidth"];
151  pitchZ = nArgs["PitchZ"];
152  pitchRot = sArgs["PitchRotation"];
153  LogDebug("TECGeom") << "DDTECModuleAlgo debug: Pitch Adapter Material "
154  << pitchMat << " Height " << pitchHeight
155  << " Thickness " << pitchThick << " position with "
156  << " rotation " << pitchRot << " at Z" << pitchZ;
157 
158  bridgeMat = sArgs["BridgeMaterial"];
159  bridgeWidth = nArgs["BridgeWidth"];
160  bridgeThick = nArgs["BridgeThick"];
161  bridgeHeight = nArgs["BridgeHeight"];
162  bridgeSep = nArgs["BridgeSeparation"];
163  LogDebug("TECGeom") << "DDTECModuleAlgo debug: Bridge Material "
164  << bridgeMat << " Width " << bridgeWidth
165  << " Thickness " << bridgeThick << " Height "
166  << bridgeHeight << " Separation "<< bridgeSep;
167 
168  siReenforceWidth = vArgs["SiReenforcementWidth"];
169  siReenforceHeight = vArgs["SiReenforcementHeight"];
170  siReenforceYPos = vArgs["SiReenforcementPosY"];
171  siReenforceThick = nArgs["SiReenforcementThick"];
172  siReenforceMat = sArgs["SiReenforcementMaterial"];
173 
174  LogDebug("TECGeom") << "FALTBOOT DDTECModuleAlgo debug : Si-Reenforcement Material "
175  << sideFrameMat << " Thickness " << siReenforceThick;
176 
177  for (int i= 0; i < (int)(siReenforceWidth.size());i++){
178  LogDebug("TECGeom") << " SiReenforcement" << i << "'s Width: "
179  << siReenforceWidth[i] << " SiReenforcement" << i
180  << "'s Height: " << siReenforceHeight[i]
181  << " SiReenforcement" << i << "'s y Position: "
182  <<siReenforceYPos[i];
183  }
184  inactiveDy = 0;
185  inactivePos = 0;
186  if(ringNo > 3){
187  inactiveDy = nArgs["InactiveDy"];
188  inactivePos = nArgs["InactivePos"];
189  inactiveMat = sArgs["InactiveMaterial"];
190  }
191 
192  noOverlapShift = nArgs["NoOverlapShift"];
193  //Everything that is normal/stereo specific comes here
194  isStereo = (int)nArgs["isStereo"] == 1;
195  if(!isStereo){
196  LogDebug("TECGeom") << "This is a normal module, in ring "<<ringNo<<"!";
197  } else {
198  LogDebug("TECGeom") << "This is a stereo module, in ring "<<ringNo<<"!";
199  posCorrectionPhi= nArgs["PosCorrectionPhi"];
200  topFrame2LHeight = nArgs["TopFrame2LHeight"];
201  topFrame2RHeight = nArgs["TopFrame2RHeight"];
202  topFrame2Width = nArgs["TopFrame2Width"];
203  LogDebug("TECGeom") << "Phi Position corrected by " << posCorrectionPhi << "*rad";
204  LogDebug("TECGeom") << "DDTECModuleAlgo debug: stereo Top Frame 2nd Part left Heigt "
205  << topFrame2LHeight << " right Height " << topFrame2RHeight
206  << " Width " << topFrame2Width ;
207 
208  sideFrameLWidthLow = nArgs["SideFrameLWidthLow"];
209  sideFrameRWidthLow = nArgs["SideFrameRWidthLow"];
210 
211  LogDebug("TECGeom") << " left Leg's lower Width: " << sideFrameLWidthLow
212  << " right Leg's lower Width: " << sideFrameRWidthLow;
213 
214  // posCorrectionR = nArgs["PosCorrectionR"];
215  //LogDebug("TECGeom") << "Stereo Module Position Correction with R = " << posCorrectionR;
216  }
217 }
218 
220  int copyNr, double x, double y, double z,
221  std::string rotName, DDCompactView& cpv) {
222 
223  DDTranslation tran(z, x, y);
224  DDRotation rot;
225  std::string rotstr = DDSplit(rotName).first;
226  std::string rotns;
227  if (rotstr != "NULL") {
228  rotns = DDSplit(rotName).second;
229  rot = DDRotation(DDName(rotstr, rotns));
230  } else {
231  rot = DDRotation();
232  }
233 
234  cpv.position(toPos, mother, copyNr, tran, rot);
235  LogDebug("TECGeom") << "DDTECModuleAlgo test: " << toPos.name()
236  << " positioned in "<< mother.name()
237  << " at " << tran << " with " << rot;
238 }
239 
240 void DDTECModuleAlgo::doPos(DDLogicalPart toPos, double x, double y, double z,
241  std::string rotName, DDCompactView& cpv) {
242  int copyNr = 1;
243  if (isStereo) copyNr = 2;
244 
245  // This has to be done so that the Mother coordinate System of a Tub resembles
246  // the coordinate System of a Trap or Box.
247  z += rPos;
248 
249  if(isStereo){
250  // z is x , x is y
251  //z+= rPos*sin(posCorrectionPhi); <<- this is already corrected with the r position!
253  }
254  if (rotName == "NULL") rotName = standardRot;
255 
256  doPos(toPos,parent(),copyNr,x,y,z,rotName, cpv);
257 }
258 
260 
261  LogDebug("TECGeom") << "==>> Constructing DDTECModuleAlgo...";
262  //declarations
263  double tmp;
264  double dxdif, dzdif;
265  double dxbot, dxtop; // topfr;
266  //positions
267  double xpos, ypos, zpos;
268  //dimensons
269  double bl1, bl2;
270  double h1;
271  double dx, dy, dz;
272  double thet;
273  //names
274  std::string idName;
276  std::string tag("Rphi");
277  if (isStereo) tag = "Stereo";
278  char buf[5]; //for string operations
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  sprintf(buf,"%i",i);
378  name = idName + "SuppliesBox"+buf;
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  char buf[5];
599  sprintf(buf,"%i",i);
600  name = idName + "SiReenforce"+buf;
601  matname = DDName(DDSplit(siReenforceMat).first, DDSplit(siReenforceMat).second);
602  matter = DDMaterial(matname);
603 
604  h1 = 0.5 * siReenforceThick;
605  dz = 0.5 * siReenforceHeight[i];
606  bl1 = bl2 = 0.5 * siReenforceWidth[i];
607 
608  solid = DDSolidFactory::trap(DDName(name,idNameSpace), dz, 0, 0, h1, bl1,
609  bl1, 0, h1, bl2, bl2, 0);
610  LogDebug("TECGeom") << "DDTECModuleAlgo test:\t" << solid.name()
611  << " Trap made of " << matname << " of dimensions "
612  << dz << ", 0, 0, " << h1 << ", " << bl1 << ", "
613  << bl1 << ", 0, " << h1 << ", " << bl2 << ", " << bl2
614  << ", 0";
615  DDLogicalPart siReenforce(solid.ddname(), matter, solid);
616  //translate
617  xpos =0 ;
618  ypos = sideFrameZ;
619  zpos = topFrameEndZ -dz -siReenforceYPos[i];
620 
621  if (isRing6) zpos *= -1;
622  if(isStereo){
623  xpos = (-siReenforceYPos[i]+0.5*fullHeight)*sin(detTilt);
624  // thet = detTilt;
625  // if(topFrame2RHeight > topFrame2LHeight) thet *= -1;
626  // zpos -= topFrame2RHeight + sin(thet)*(sideFrameRWidth + 0.5*dlTop);
627  zpos -= topFrame2RHeight + sin (fabs(detTilt))* 0.5*topFrame2Width;
628  }
629  doPos(siReenforce,xpos,ypos,zpos,waferRot, cpv);
630  }
631 
632  //Bridge
633  if (bridgeMat != "None") {
634  name = idName + "Bridge";
635  matname = DDName(DDSplit(bridgeMat).first, DDSplit(bridgeMat).second);
636  matter = DDMaterial(matname);
637  bl2 = 0.5*bridgeSep + bridgeWidth;
638  bl1 = bl2 - bridgeHeight * dxdif / dzdif;
639  h1 = 0.5 * bridgeThick;
640  dz = 0.5 * bridgeHeight;
641  solid = DDSolidFactory::trap(DDName(name,idNameSpace), dz, 0, 0, h1, bl1,
642  bl1, 0, h1, bl2, bl2, 0);
643  LogDebug("TECGeom") << "DDTECModuleAlgo test:\t" << solid.name()
644  << " Trap made of " << matname << " of dimensions "
645  << dz << ", 0, 0, " << h1 << ", " << bl1 << ", "
646  << bl1 << ", 0, " << h1 << ", " << bl2 << ", " << bl2
647  << ", 0";
648  DDLogicalPart bridge(solid.ddname(), matter, solid);
649 
650  name = idName + "BridgeGap";
651  matname = DDName(DDSplit(genMat).first, DDSplit(genMat).second);
652  matter = DDMaterial(matname);
653  bl1 = 0.5*bridgeSep;
654  solid = DDSolidFactory::box(DDName(name,idNameSpace), bl1, h1, dz);
655  LogDebug("TECGeom") << "DDTECModuleAlgo test:\t" << solid.name()
656  << " Box made of " << matname << " of dimensions "
657  << bl1 << ", " << h1 << ", " << dz;
658  DDLogicalPart bridgeGap(solid.ddname(), matter, solid);
659  cpv.position(bridgeGap, bridge, 1, DDTranslation(0.0, 0.0, 0.0), DDRotation());
660  LogDebug("TECGeom") << "DDTECModuleAlgo test: " << bridgeGap.name()
661  << " number 1 positioned in " << bridge.name()
662  << " at (0,0,0) with no rotation";
663  }
664 
665  LogDebug("TECGeom") << "<<== End of DDTECModuleAlgo construction ...";
666 }
#define LogDebug(id)
std::string waferRot
int i
Definition: DBlmapReader.cc:9
std::vector< double > siFrSuppBoxHeight
const N & name() const
Definition: DDBase.h:82
list parent
Definition: dbtoconf.py:74
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:18
susybsm::HSCParticle pa
Definition: classes.h:8
static std::string & ns()
std::string pitchMat
type of data representation of DDCompactView
Definition: DDCompactView.h:77
std::string bridgeMat
float float float z
A DDSolid represents the shape of a part.
Definition: DDSolid.h:35
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< double > > DDTranslation
Definition: DDTranslation.h:7
std::string activeMat
Represents a uniquely identifyable rotation matrix.
Definition: DDTransform.h:66
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:88
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:723
bool first
Definition: L1TdeRCT.cc:79
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:519
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
Definition: DDAxes.h:10
std::string sideFrameMat
const std::string & name() const
Returns the name.
Definition: DDName.cc:87
std::string topFrameMat
std::string inactiveMat
const N & ddname() const
Definition: DDBase.h:84