CMS 3D CMS Logo

DDTECModuleAlgo.cc

Go to the documentation of this file.
00001 
00002 // File: DDTECModuleAlgo        .cc
00003 // Description: Creation of a TEC Test
00005 
00006 #include <cmath>
00007 #include <algorithm>
00008 
00009 #include "FWCore/MessageLogger/interface/MessageLogger.h"
00010 #include "DetectorDescription/Core/interface/DDPosPart.h"
00011 #include "DetectorDescription/Core/interface/DDLogicalPart.h"
00012 #include "DetectorDescription/Core/interface/DDSolid.h"
00013 #include "DetectorDescription/Core/interface/DDMaterial.h"
00014 #include "DetectorDescription/Core/interface/DDCurrentNamespace.h"
00015 #include "DetectorDescription/Core/interface/DDSplit.h"
00016 #include "Geometry/TrackerCommonData/interface/DDTECModuleAlgo.h"
00017 #include "CLHEP/Units/PhysicalConstants.h"
00018 #include "CLHEP/Units/SystemOfUnits.h"
00019 
00020 
00021 DDTECModuleAlgo::DDTECModuleAlgo() {
00022   LogDebug("TECGeom") << "DDTECModuleAlgo info: Creating an instance";
00023 }
00024 
00025 DDTECModuleAlgo::~DDTECModuleAlgo() {}
00026 
00027 void DDTECModuleAlgo::initialize(const DDNumericArguments & nArgs,
00028                                  const DDVectorArguments & vArgs,
00029                                  const DDMapArguments & ,
00030                                  const DDStringArguments & sArgs,
00031                                  const DDStringVectorArguments & vsArgs) {
00032 
00033   idNameSpace  = DDCurrentNamespace::ns();
00034   genMat       = sArgs["GeneralMaterial"];
00035 
00036   DDName parentName = parent().name(); 
00037 
00038   LogDebug("TECGeom") << "DDTECModuleAlgo debug: Parent " << parentName 
00039                       << " NameSpace " << idNameSpace << " General Material "
00040                       << genMat;
00041   ringNo = (int)nArgs["RingNo"];
00042   moduleThick    = nArgs["ModuleThick"];
00043   detTilt        = nArgs["DetTilt"];
00044   fullHeight     = nArgs["FullHeight"];
00045   dlTop          = nArgs["DlTop"];
00046   dlBottom       = nArgs["DlBottom"];
00047   dlHybrid       = nArgs["DlHybrid"];
00048   rPos           = nArgs["RPos"];
00049   standardRot    = sArgs["StandardRotation"];
00050 
00051   isRing6 = (ringNo == 6);
00052 
00053   LogDebug("TECGeom") << "DDTECModuleAlgo debug: ModuleThick " << moduleThick
00054                       << " Detector Tilt " << detTilt/deg << " Height "
00055                       << fullHeight << " dl(Top) " << dlTop << " dl(Bottom) "
00056                       << dlBottom << " dl(Hybrid) " << dlHybrid
00057                       << " rPos " << rPos << " standrad rotation " 
00058                       << standardRot;
00059 
00060   frameWidth     = nArgs["FrameWidth"];
00061   frameThick     = nArgs["FrameThick"];
00062   frameOver      = nArgs["FrameOver"];
00063   LogDebug("TECGeom") << "DDTECModuleAlgo debug: Frame Width " << frameWidth 
00064                       << " Thickness " << frameThick << " Overlap " 
00065                       << frameOver;
00066 
00067   topFrameMat    = sArgs["TopFrameMaterial"];
00068   topFrameHeight = nArgs["TopFrameHeight"];
00069   topFrameTopWidth= nArgs["TopFrameTopWidth"];
00070   topFrameBotWidth= nArgs["TopFrameBotWidth"];
00071   topFrameThick  = nArgs["TopFrameThick"];
00072   topFrameZ      = nArgs["TopFrameZ"];
00073   LogDebug("TECGeom") << "DDTECModuleAlgo debug: Top Frame Material " 
00074                       << topFrameMat << " Height " << topFrameHeight 
00075                       << " Top Width " << topFrameTopWidth << " Bottom Width "
00076                       << topFrameTopWidth
00077                       << " Thickness " << topFrameThick <<" positioned at"
00078                       << topFrameZ;
00079   double resizeH =0.96;
00080   sideFrameMat   = sArgs["SideFrameMaterial"];
00081   sideFrameThick = nArgs["SideFrameThick"];
00082   sideFrameLWidth =  nArgs["SideFrameLWidth"]; 
00083   sideFrameLHeight = resizeH*nArgs["SideFrameLHeight"];
00084   sideFrameLtheta =  nArgs["SideFrameLtheta"];
00085   sideFrameRWidth =  nArgs["SideFrameRWidth"]; 
00086   sideFrameRHeight = resizeH*nArgs["SideFrameRHeight"];
00087   sideFrameRtheta =  nArgs["SideFrameRtheta"];
00088   siFrSuppBoxWidth  = vArgs["SiFrSuppBoxWidth"];
00089   siFrSuppBoxHeight = vArgs["SiFrSuppBoxHeight"];
00090   siFrSuppBoxYPos = vArgs["SiFrSuppBoxYPos"];
00091   siFrSuppBoxThick =  nArgs["SiFrSuppBoxThick"]; 
00092   siFrSuppBoxMat = sArgs["SiFrSuppBoxMaterial"]; 
00093   sideFrameZ     = nArgs["SideFrameZ"];
00094   LogDebug("TECGeom") << "DDTECModuleAlgo debug : Side Frame Material " 
00095                       << sideFrameMat << " Thickness " << sideFrameThick
00096                       << " left Leg's Width: " << sideFrameLWidth
00097                       << " left Leg's Height: " << sideFrameLHeight
00098                       << " left Leg's tilt(theta): " << sideFrameLtheta
00099                       << " right Leg's Width: " << sideFrameRWidth
00100                       << " right Leg's Height: " << sideFrameRHeight
00101                       << " right Leg's tilt(theta): " << sideFrameRtheta
00102                       << "Supplies Box's Material: " << siFrSuppBoxMat
00103                       << " positioned at" << sideFrameZ;
00104   for (int i= 0; i < (int)(siFrSuppBoxWidth.size());i++){
00105     LogDebug("TECGeom") << " Supplies Box" << i << "'s Width: " 
00106                         << siFrSuppBoxWidth[i] << " Supplies Box" << i
00107                         <<"'s Height: " << siFrSuppBoxHeight[i]
00108                         << " Supplies Box" << i << "'s y Position: " 
00109                         << siFrSuppBoxYPos[i];
00110   }
00111   waferMat       = sArgs["WaferMaterial"];
00112   sideWidthTop   = nArgs["SideWidthTop"];
00113   sideWidthBottom= nArgs["SideWidthBottom"];
00114   waferRot       = sArgs["WaferRotation"];
00115   waferPosition  = nArgs["WaferPosition"];
00116   LogDebug("TECGeom") << "DDTECModuleAlgo debug: Wafer Material " 
00117                       << waferMat << " Side Width Top" << sideWidthTop
00118                       << " Side Width Bottom" << sideWidthBottom
00119                       << " and positioned at "<<waferPosition
00120                       << " positioned with rotation"    << " matrix:"
00121                       << waferRot;
00122 
00123   activeMat      = sArgs["ActiveMaterial"];
00124   activeHeight   = nArgs["ActiveHeight"];
00125   waferThick     = nArgs["WaferThick"];
00126   activeRot      = sArgs["ActiveRotation"];
00127   activeZ        = nArgs["ActiveZ"];
00128   backplaneThick = nArgs["BackPlaneThick"];
00129   LogDebug("TECGeom") << "DDTECModuleAlgo debug: Active Material " 
00130                       << activeMat << " Height " << activeHeight 
00131                       << " rotated by " << activeRot
00132                       << " translated by (0,0," << -0.5 * backplaneThick << ")"
00133                       << " Thickness/Z"
00134                       << waferThick-backplaneThick << "/" << activeZ;
00135 
00136   
00137   hybridMat      = sArgs["HybridMaterial"];
00138   hybridHeight   = nArgs["HybridHeight"];
00139   hybridWidth    = nArgs["HybridWidth"];
00140   hybridThick    = nArgs["HybridThick"];
00141   hybridZ        = nArgs["HybridZ"];
00142   LogDebug("TECGeom") << "DDTECModuleAlgo debug: Hybrid Material " 
00143                       << hybridMat << " Height " << hybridHeight 
00144                       << " Width " << hybridWidth << " Thickness " 
00145                       << hybridThick << " Z"  << hybridZ;
00146 
00147   pitchMat       = sArgs["PitchMaterial"];
00148   pitchHeight    = nArgs["PitchHeight"];
00149   pitchThick     = nArgs["PitchThick"];
00150   pitchWidth     = nArgs["PitchWidth"];
00151   pitchZ         = nArgs["PitchZ"];
00152   pitchRot       = sArgs["PitchRotation"];
00153   LogDebug("TECGeom") << "DDTECModuleAlgo debug: Pitch Adapter Material " 
00154                       << pitchMat << " Height " << pitchHeight 
00155                       << " Thickness " << pitchThick << " position with "
00156                       << " rotation " << pitchRot << " at Z" << pitchZ;
00157 
00158   bridgeMat      = sArgs["BridgeMaterial"];
00159   bridgeWidth    = nArgs["BridgeWidth"];
00160   bridgeThick    = nArgs["BridgeThick"];
00161   bridgeHeight   = nArgs["BridgeHeight"];
00162   bridgeSep      = nArgs["BridgeSeparation"];
00163   LogDebug("TECGeom") << "DDTECModuleAlgo debug: Bridge Material " 
00164                       << bridgeMat << " Width " << bridgeWidth 
00165                       << " Thickness " << bridgeThick << " Height " 
00166                       << bridgeHeight << " Separation "<< bridgeSep;
00167 
00168   siReenforceWidth  = vArgs["SiReenforcementWidth"];
00169   siReenforceHeight = vArgs["SiReenforcementHeight"];
00170   siReenforceYPos =   vArgs["SiReenforcementPosY"];
00171   siReenforceThick =  nArgs["SiReenforcementThick"]; 
00172   siReenforceMat   =  sArgs["SiReenforcementMaterial"];
00173  
00174   LogDebug("TECGeom") << "FALTBOOT DDTECModuleAlgo debug : Si-Reenforcement Material " 
00175                       << sideFrameMat << " Thickness " << siReenforceThick;
00176     
00177   for (int i= 0; i < (int)(siReenforceWidth.size());i++){
00178     LogDebug("TECGeom") << " SiReenforcement"<<i<<"'s Width: " <<     siReenforceWidth[i]
00179                         << " SiReenforcement"<<i<<"'s Height: " <<    siReenforceHeight[i]
00180                         << " SiReenforcement"<<i<<"'s y Position: " <<siReenforceYPos[i];
00181   }
00182   inactiveDy  = 0;
00183   inactivePos = 0;
00184   if(ringNo > 3){
00185     inactiveDy = nArgs["InactiveDy"];
00186     inactivePos = nArgs["InactivePos"];
00187     inactiveMat = sArgs["InactiveMaterial"];
00188   }
00189 
00190   noOverlapShift = nArgs["NoOverlapShift"];
00191   //Everything that is normal/stereo specific comes here
00192   isStereo = (int)nArgs["isStereo"] == 1;
00193   if(!isStereo){
00194     LogDebug("TECGeom") << "This is a normal module, in ring "<<ringNo<<"!"; 
00195   }
00196   else{
00197     LogDebug("TECGeom") << "This is a stereo module, in ring "<<ringNo<<"!"; 
00198     posCorrectionPhi= nArgs["PosCorrectionPhi"];
00199     topFrame2LHeight = nArgs["TopFrame2LHeight"];
00200     topFrame2RHeight = nArgs["TopFrame2RHeight"];
00201     topFrame2Width   = nArgs["TopFrame2Width"];
00202     LogDebug("TECGeom") << "Phi Position corrected by " << posCorrectionPhi << "*rad";
00203     LogDebug("TECGeom") << "DDTECModuleAlgo debug: stereo Top Frame 2nd Part left Heigt " 
00204                         << topFrame2LHeight << " right Height " << topFrame2RHeight 
00205                         << " Width " << topFrame2Width ;
00206     
00207     sideFrameLWidthLow =  nArgs["SideFrameLWidthLow"]; 
00208     sideFrameRWidthLow =  nArgs["SideFrameRWidthLow"]; 
00209 
00210     LogDebug("TECGeom") << " left Leg's lower Width: " << sideFrameLWidthLow
00211                         << " right Leg's lower Width: " << sideFrameRWidthLow;
00212 
00213     // posCorrectionR =  nArgs["PosCorrectionR"]; 
00214     //LogDebug("TECGeom") << "Stereo Module Position Correction with R = " << posCorrectionR;
00215   }
00216 }
00217 
00218 void DDTECModuleAlgo::doPos(DDLogicalPart toPos, DDLogicalPart mother, 
00219                             int copyNr, double x, double y, double z, 
00220                             std::string rotName) {
00221 
00222   DDTranslation tran(z, x, y);
00223   DDRotation rot;
00224   std::string rotstr = DDSplit(rotName).first;
00225   std::string rotns; 
00226   if (rotstr != "NULL") {
00227     rotns = DDSplit(rotName).second;
00228     rot   = DDRotation(DDName(rotstr, rotns));
00229   } else {
00230     rot = DDRotation();
00231   }
00232         
00233   DDpos (toPos, mother, copyNr, tran, rot);
00234   LogDebug("TECGeom") << "DDTECModuleAlgo test: " << toPos.name()
00235                       << " positioned in "<< mother.name() 
00236                       << " at " << tran  << " with " << rot;
00237 }
00238 
00239 void DDTECModuleAlgo::doPos(DDLogicalPart toPos, double x, double y, double z,
00240                             std::string rotName) {
00241   int           copyNr = 1;
00242   if (isStereo) copyNr = 2;
00243 
00244   // This has to be done so that the Mother coordinate System of a Tub resembles 
00245   // the coordinate System of a Trap or Box.
00246   z += rPos;
00247 
00248   if(isStereo){
00249         // z is x , x is y
00250         //z+= rPos*sin(posCorrectionPhi);  <<- this is already corrected with the r position!
00251         x+= rPos*sin(posCorrectionPhi);
00252   }
00253   if (rotName == "NULL") rotName = standardRot;
00254 
00255   doPos(toPos,parent(),copyNr,x,y,z,rotName);
00256 }
00257 
00258 void DDTECModuleAlgo::execute() {
00259 
00260   LogDebug("TECGeom") << "==>> Constructing DDTECModuleAlgo...";
00261   //declarations
00262   double tmp;
00263   double dxdif, dzdif;
00264   double dxbot, dxtop, topfr;
00265   //positions
00266   double xpos, ypos, zpos;
00267   //dimensons
00268   double bl1, bl2;
00269   double h1;
00270   double dx, dy, dz;
00271   double thet;
00272   //names
00273   std::string idName;
00274   std::string name;
00275   std::string tag("Rphi");
00276   if (isStereo) tag = "Stereo";
00277   char buf[5]; //for string operations
00278   //usefull constants
00279   const double topFrameEndZ = 0.5 * (-waferPosition + fullHeight) + pitchHeight + hybridHeight - topFrameHeight;
00280   DDName  parentName = parent().name(); 
00281   idName = DDSplit(parentName).first;
00282   LogDebug("TECGeom") << "==>> " << idName << " parent " << parentName << " namespace " << idNameSpace;
00283   DDSolid solid;
00284 
00285   //set global parameters
00286   DDName matname(DDSplit(genMat).first, DDSplit(genMat).second);
00287   DDMaterial matter(matname);
00288   dzdif = fullHeight + topFrameHeight;
00289   if(isStereo) dzdif += 0.5*(topFrame2LHeight+topFrame2RHeight);
00290   
00291   dxbot = 0.5*dlBottom + frameWidth - frameOver;
00292   dxtop = 0.5*dlHybrid + frameWidth - frameOver;
00293   topfr = 0.5*dlBottom * sin(detTilt);
00294   if(isRing6){
00295         dxbot = dxtop;
00296         dxtop = 0.5*dlTop    + frameWidth - frameOver;
00297         topfr = 0.5*dlTop    * sin(detTilt);
00298   }
00299   dxdif = dxtop - dxbot;
00300 
00301   //Frame Sides
00302   // left Frame
00303   name    = idName + "SideFrameLeft";
00304   matname =  DDName(DDSplit(sideFrameMat).first, DDSplit(sideFrameMat).second);
00305   matter  = DDMaterial(matname);
00306 
00307   h1 = 0.5 * sideFrameThick;
00308   dz = 0.5 * sideFrameLHeight;
00309   bl1 = bl2 = 0.5 * sideFrameLWidth;
00310   thet = sideFrameLtheta;
00311   //for stereo modules
00312   if(isStereo)  bl1 = 0.5 * sideFrameLWidthLow;
00313   solid = DDSolidFactory::trap(DDName(name,idNameSpace), dz, thet, 0, h1, bl1, 
00314                                bl1, 0, h1, bl2, bl2, 0);
00315   LogDebug("TECGeom") << "DDTECModuleAlgo test:\t" << solid.name() 
00316                       << " Trap made of " << matname << " of dimensions "
00317                       << dz << ",  "<<thet<<", 0, " << h1 << ", " << bl1 << ", "
00318                       << bl1 << ", 0, " << h1 << ", " << bl2 << ", " << bl2
00319                       << ", 0";
00320   DDLogicalPart sideFrameLeft(solid.ddname(), matter, solid);
00321   //translate
00322   xpos = - 0.5*topFrameBotWidth +bl2+ tan(fabs(thet)) * dz;
00323   ypos = sideFrameZ;
00324   zpos = topFrameEndZ -dz;
00325   //flip ring 6
00326   if (isRing6){
00327     zpos *= -1;
00328     xpos -= 2*tan(fabs(thet)) * dz; // because of the flip the tan(..) to be in the other direction
00329   }
00330   //the stereo modules are on the back of the normal ones...
00331   if(isStereo) {
00332     xpos = - 0.5*topFrameBotWidth + bl2*cos(detTilt) + dz*sin(fabs(thet)+detTilt)/cos(fabs(thet));
00333     xpos = -xpos;
00334     zpos = topFrameEndZ -topFrame2LHeight- 0.5*sin(detTilt)*(topFrameBotWidth - topFrame2Width)-dz*cos(detTilt+fabs(thet))/cos(fabs(thet))+bl2*sin(detTilt)-0.1*mm;
00335   }
00336   //position
00337   doPos(sideFrameLeft,xpos,ypos,zpos,waferRot);
00338 
00339   //right Frame
00340   name    = idName + "SideFrameRight";
00341   matname = DDName(DDSplit(sideFrameMat).first, DDSplit(sideFrameMat).second);
00342   matter  = DDMaterial(matname);
00343 
00344   h1 = 0.5 * sideFrameThick;
00345   dz = 0.5 * sideFrameRHeight;
00346   bl1 = bl2 = 0.5 * sideFrameRWidth;
00347   thet = sideFrameRtheta;
00348   if(isStereo) bl1 = 0.5 * sideFrameRWidthLow;
00349   solid = DDSolidFactory::trap(DDName(name,idNameSpace), dz, thet, 0, h1, bl1, 
00350                                bl1, 0, h1, bl2, bl2, 0);
00351   LogDebug("TECGeom") << "DDTECModuleAlgo test:\t" << solid.name() 
00352                       << " Trap made of " << matname << " of dimensions "
00353                       << dz << ", "<<thet<<", 0, " << h1 << ", " << bl1 << ", "
00354                       << bl1 << ", 0, " << h1 << ", " << bl2 << ", " << bl2
00355                       << ", 0";
00356   DDLogicalPart sideFrameRight(solid.ddname(), matter, solid);
00357   //translate
00358   xpos =  0.5*topFrameBotWidth -bl2- tan(fabs(thet)) * dz;
00359   ypos = sideFrameZ;
00360   zpos = topFrameEndZ -dz ;        
00361   if (isRing6){
00362     zpos *= -1;
00363     xpos += 2*tan(fabs(thet)) * dz; // because of the flip the tan(..) has to be in the other direction
00364   }
00365   if(isStereo){
00366     xpos = 0.5*topFrameBotWidth - bl2*cos(detTilt) - dz*sin(fabs(detTilt-fabs(thet)))/cos(fabs(thet));
00367     xpos = -xpos;
00368     zpos = topFrameEndZ -topFrame2RHeight+ 0.5*sin(detTilt)*(topFrameBotWidth - topFrame2Width)-dz*cos(detTilt-fabs(thet))/cos(fabs(thet))-bl2*sin(detTilt)-0.1*mm;
00369   }
00370   //position it
00371   doPos(sideFrameRight,xpos,ypos,zpos,waferRot);
00372 
00373 
00374   //Supplies Box(es)
00375   for (int i= 0; i < (int)(siFrSuppBoxWidth.size());i++){
00376     sprintf(buf,"%i",i);
00377     name    = idName + "SuppliesBox"+buf;
00378     matname = DDName(DDSplit(siFrSuppBoxMat).first, DDSplit(siFrSuppBoxMat).second);
00379     matter  = DDMaterial(matname);
00380     
00381     h1 = 0.5 * siFrSuppBoxThick;
00382     dz = 0.5 * siFrSuppBoxHeight[i];
00383     bl1 = bl2 = 0.5 * siFrSuppBoxWidth[i];
00384     thet = sideFrameRtheta;
00385     if(isStereo) thet = -atan(fabs(sideFrameRWidthLow-sideFrameRWidth)/(2*sideFrameRHeight)-tan(fabs(thet)));
00386                    // ^-- this calculates the lower left angel of the tipped trapezoid, which is the SideFframe...
00387 
00388     solid = DDSolidFactory::trap(DDName(name,idNameSpace), dz, thet, 0, h1, bl1, 
00389                                  bl1, 0, h1, bl2, bl2, 0);
00390     LogDebug("TECGeom") << "DDTECModuleAlgo test:\t" << solid.name() 
00391                         << " Trap made of " << matname << " of dimensions "
00392                         << dz << ", 0, 0, " << h1 << ", " << bl1 << ", "
00393                         << bl1 << ", 0, " << h1 << ", " << bl2 << ", " << bl2
00394                         << ", 0";
00395     DDLogicalPart siFrSuppBox(solid.ddname(), matter, solid);
00396     //translate
00397     xpos =  0.5*topFrameBotWidth  -sideFrameRWidth - bl1-siFrSuppBoxYPos[i]*tan(fabs(thet));
00398     ypos = sideFrameZ*(0.5+(siFrSuppBoxThick/sideFrameThick)); //via * so I do not have to worry about the sign of sideFrameZ
00399     zpos = topFrameEndZ - siFrSuppBoxYPos[i];        
00400     if (isRing6){ 
00401       xpos += 2*fabs(tan(thet))*  siFrSuppBoxYPos[i]; // the flipped issue again
00402       zpos *= -1;
00403     }
00404     if(isStereo){ 
00405       xpos = 0.5*topFrameBotWidth - (sideFrameRWidth+bl1)*cos(detTilt) -sin(fabs(detTilt-fabs(thet)))*(siFrSuppBoxYPos[i]+dz*(1/cos(thet)- cos(detTilt))+bl1*sin(detTilt));
00406       xpos =-xpos;
00407       zpos = topFrameEndZ - topFrame2RHeight - 0.5*sin(detTilt)*(topFrameBotWidth - topFrame2Width) - siFrSuppBoxYPos[i]-sin(detTilt)*sideFrameRWidth;
00408     }
00409     //position it;
00410     doPos(siFrSuppBox,xpos,ypos,zpos,waferRot);
00411   }
00412   //The Hybrid
00413   name    = idName + "Hybrid";
00414   matname = DDName(DDSplit(hybridMat).first, DDSplit(hybridMat).second);
00415   matter  = DDMaterial(matname);
00416   dx = 0.5 * hybridWidth;
00417   dy = 0.5 * hybridThick;
00418   dz        = 0.5 * hybridHeight;
00419   solid = DDSolidFactory::box(DDName(name, idNameSpace), dx, dy, dz);
00420   LogDebug("TECGeom") << "DDTECModuleAlgo test:\t" << solid.name() 
00421                                           << " Box made of " << matname << " of dimensions "
00422                                           << dx << ", " << dy << ", " << dz;
00423   DDLogicalPart hybrid(solid.ddname(), matter, solid);
00424 
00425   ypos = hybridZ;
00426   zpos = 0.5 * (-waferPosition + fullHeight + hybridHeight)+pitchHeight;
00427   if (isRing6)  zpos *=-1;
00428   //position it
00429   doPos(hybrid,0,ypos,zpos,"NULL");  
00430 
00431   // Wafer
00432   name    = idName + tag +"Wafer";
00433   matname = DDName(DDSplit(waferMat).first, DDSplit(waferMat).second);
00434   matter  = DDMaterial(matname);
00435   bl1     = 0.5 * dlBottom;
00436   bl2     = 0.5 * dlTop;
00437   h1      = 0.5 * waferThick;
00438   dz      = 0.5 * fullHeight;
00439   solid = DDSolidFactory::trap(DDName(name,idNameSpace), dz, 0, 0, h1, bl1, 
00440                                                            bl1, 0, h1, bl2, bl2, 0);
00441   LogDebug("TECGeom") << "DDTECModuleAlgo test:\t" << solid.name()
00442                         << " Trap made of " << matname << " of dimensions "
00443                         << dz << ", 0, 0, " << h1 << ", " << bl1 << ", "
00444                         << bl1 << ", 0, " << h1 << ", " << bl2 << ", "
00445                         << bl2 << ", 0";
00446   DDLogicalPart wafer(solid.ddname(), matter, solid);
00447   
00448   ypos = activeZ;
00449   zpos =-0.5 * waferPosition;// former and incorrect topFrameHeight;
00450   if (isRing6) zpos *= -1;
00451   
00452   doPos(wafer,0,ypos,zpos,waferRot);
00453   
00454   // Active
00455   name    = idName + tag +"Active";
00456   matname = DDName(DDSplit(activeMat).first, DDSplit(activeMat).second);
00457   matter  = DDMaterial(matname);
00458   bl1    -= sideWidthBottom;
00459   bl2    -= sideWidthTop;
00460   dz      = 0.5 * (waferThick-backplaneThick); // inactive backplane
00461   h1      = 0.5 * activeHeight;
00462   if (isRing6) { //switch bl1 <->bl2
00463     tmp = bl2;  bl2 =bl1;       bl1 = tmp;
00464   }
00465   solid = DDSolidFactory::trap(DDName(name,idNameSpace), dz, 0, 0, h1, bl2, 
00466                                bl1, 0, h1, bl2, bl1, 0);
00467   LogDebug("TECGeom") << "DDTECModuleAlgo test:\t" << solid.name() 
00468                       << " Trap made of " << matname << " of dimensions "
00469                       << dz << ", 0, 0, " << h1 << ", " << bl2 << ", "
00470                       << bl1 << ", 0, " << h1 << ", " << bl2 << ", "
00471                       << bl1 << ", 0";
00472   DDLogicalPart active(solid.ddname(), matter, solid);
00473   doPos(active, wafer, 1, -0.5 * backplaneThick,0,0, activeRot); // from the definition of the wafer local axes and doPos() routine
00474   //inactive part in rings > 3
00475   if(ringNo > 3){
00476     inactivePos -= fullHeight-activeHeight; //inactivePos is measured from the beginning of the _wafer_
00477     name    = idName + tag +"Inactive";
00478     matname = DDName(DDSplit(inactiveMat).first, DDSplit(inactiveMat).second);
00479     matter  = DDMaterial(matname);
00480     bl1     = 0.5*dlBottom-sideWidthBottom
00481               + ((0.5*dlTop-sideWidthTop-0.5*dlBottom+sideWidthBottom)/activeHeight)
00482                 *(activeHeight-inactivePos-inactiveDy);
00483     bl2    =  0.5*dlBottom-sideWidthBottom
00484               + ((0.5*dlTop-sideWidthTop-0.5*dlBottom+sideWidthBottom)/activeHeight)
00485                 *(activeHeight-inactivePos+inactiveDy);
00486     dz      = 0.5 * (waferThick-backplaneThick); // inactive backplane
00487     h1      = inactiveDy;
00488     if (isRing6) { //switch bl1 <->bl2
00489       tmp = bl2;        bl2 =bl1;       bl1 = tmp;
00490     }
00491     solid = DDSolidFactory::trap(DDName(name,idNameSpace), dz, 0, 0, h1, bl2, 
00492                                  bl1, 0, h1, bl2, bl1, 0);
00493     LogDebug("TECGeom") << "DDTECModuleAlgo test:\t" << solid.name() 
00494                         << " Trap made of " << matname << " of dimensions "
00495                         << dz << ", 0, 0, " << h1 << ", " << bl2 << ", "
00496                         << bl1 << ", 0, " << h1 << ", " << bl2 << ", "
00497                         << bl1 << ", 0";  
00498     DDLogicalPart inactive(solid.ddname(), matter, solid);
00499     ypos = inactivePos - 0.5*activeHeight;
00500     doPos(inactive,active, 1, ypos,0,0, "NULL"); // from the definition of the wafer local axes and doPos() routine
00501   }
00502   //Pitch Adapter
00503   name    = idName + "PA";
00504   matname = DDName(DDSplit(pitchMat).first, DDSplit(pitchMat).second);
00505   matter  = DDMaterial(matname);
00506   
00507   if (!isStereo) {
00508         dx      = 0.5 * pitchWidth;
00509         dy      = 0.5 * pitchThick;
00510         dz      = 0.5 * pitchHeight;
00511         solid   = DDSolidFactory::box(DDName(name, idNameSpace), dx, dy, dz);
00512         LogDebug("TECGeom") << "DDTECModuleAlgo test:\t" << solid.name() 
00513                                                 << " Box made of " << matname <<" of dimensions "
00514                                                 << dx << ", " << dy << ", " << dz;
00515   } else {
00516         dz      = 0.5 * pitchWidth;    
00517         h1      = 0.5 * pitchThick;
00518         bl1     = 0.5 * pitchHeight + 0.5 * dz * sin(detTilt);
00519         bl2     = 0.5 * pitchHeight - 0.5 * dz * sin(detTilt);
00520         double thet = atan((bl1-bl2)/(2.*dz));
00521         solid   = DDSolidFactory::trap(DDName(name,idNameSpace), dz, thet, 0, h1,
00522                                                                    bl1, bl1, 0, h1, bl2, bl2, 0);
00523         LogDebug("TECGeom") << "DDTECModuleAlgo test:\t" << solid.name()
00524                                                 << " Trap made of " << matname 
00525                                                 << " of dimensions " << dz << ", " << thet/deg
00526                                                 << ", 0, " << h1 << ", " << bl1 << ", " << bl1
00527                                                 << ", 0, " << h1 << ", " << bl2 << ", " << bl2
00528                                                 << ", 0";
00529     }
00530   xpos = 0;
00531   ypos = pitchZ;
00532   zpos = 0.5 * (-waferPosition + fullHeight + pitchHeight);
00533   if (isRing6) zpos *= -1;
00534   if(isStereo)    xpos    = 0.5 * fullHeight * sin(detTilt);
00535   
00536   DDLogicalPart pa(solid.ddname(), matter, solid);
00537   if(isStereo)doPos(pa, xpos, ypos,zpos, pitchRot);
00538   else        doPos(pa, xpos, ypos,zpos, "NULL");
00539   //Top of the frame
00540   name = idName + "TopFrame";
00541   matname = DDName(DDSplit(topFrameMat).first, DDSplit(topFrameMat).second);
00542   matter  = DDMaterial(matname);
00543   
00544   h1 = 0.5 * topFrameThick;
00545   dz = 0.5 * topFrameHeight;
00546   bl1 = 0.5 * topFrameBotWidth;
00547   bl2 = 0.5 * topFrameTopWidth;
00548   if (isRing6) {    // ring 6 faces the other way!
00549         bl1 = 0.5 * topFrameTopWidth;
00550         bl2 = 0.5 * topFrameBotWidth;
00551   }
00552   
00553   solid = DDSolidFactory::trap(DDName(name,idNameSpace), dz, 0, 0, h1, bl1, 
00554                                                            bl1,0, h1, bl2, bl2, 0);
00555   LogDebug("TECGeom") << "DDTECModuleAlgo test:\t" << solid.name() 
00556                                           << " Trap made of " << matname << " of dimensions " 
00557                                           << dz << ", 0, 0, " << h1 << ", " << bl1 << ", "  
00558                                           << bl1 << ", 0, " << h1 << ", " << bl2 << ", " << bl2
00559                                           << ", 0";
00560   DDLogicalPart topFrame(solid.ddname(), matter, solid);
00561   
00562   if(isStereo){ 
00563         name = idName + "TopFrame2";
00564       //additional object to build the not trapzoid geometry of the stereo topframes
00565         dz      = 0.5 * topFrame2Width;    
00566         h1      = 0.5 * topFrameThick;
00567         bl1     = 0.5 * topFrame2LHeight;
00568         bl2     = 0.5 * topFrame2RHeight;
00569         double thet = atan((bl1-bl2)/(2.*dz));
00570         
00571         solid   = DDSolidFactory::trap(DDName(name,idNameSpace), dz, thet, 0, h1,
00572                                                                    bl1, bl1, 0, h1, bl2, bl2, 0);
00573         LogDebug("TECGeom") << "DDTECModuleAlgo test:\t" << solid.name()
00574                                                 << " Trap made of " << matname 
00575                                                 << " of dimensions " << dz << ", " << thet/deg
00576                                                 << ", 0, " << h1 << ", " << bl1 << ", " << bl1
00577                                                 << ", 0, " << h1 << ", " << bl2 << ", " << bl2
00578                                                 << ", 0";
00579   }
00580   
00581   // Position the topframe
00582   ypos = topFrameZ;
00583   zpos = 0.5 * (-waferPosition + fullHeight - topFrameHeight)+ pitchHeight + hybridHeight;
00584   if(isRing6){
00585         zpos *=-1;
00586   }
00587 
00588   doPos(topFrame, 0,ypos,zpos,"NULL");
00589   if(isStereo){
00590         //create
00591         DDLogicalPart topFrame2(solid.ddname(), matter, solid);
00592         zpos -= 0.5*(topFrameHeight + 0.5*(topFrame2LHeight+topFrame2RHeight));
00593         doPos(topFrame2, 0,ypos,zpos,pitchRot);
00594   }
00595   
00596   //Si - Reencorcement
00597   for (int i= 0; i < (int)(siReenforceWidth.size());i++){
00598         char buf[5];
00599         sprintf(buf,"%i",i);
00600         name    = idName + "SiReenforce"+buf;
00601     matname = DDName(DDSplit(siReenforceMat).first, DDSplit(siReenforceMat).second);
00602     matter  = DDMaterial(matname);
00603     
00604     h1 = 0.5 * siReenforceThick;
00605     dz = 0.5 * siReenforceHeight[i];
00606     bl1 = bl2 = 0.5 * siReenforceWidth[i];
00607     
00608     solid = DDSolidFactory::trap(DDName(name,idNameSpace), dz, 0, 0, h1, bl1, 
00609                                                                  bl1, 0, h1, bl2, bl2, 0);
00610     LogDebug("TECGeom") << "DDTECModuleAlgo test:\t" << solid.name() 
00611                                                 << " Trap made of " << matname << " of dimensions "
00612                                                 << dz << ", 0, 0, " << h1 << ", " << bl1 << ", "
00613                                                 << bl1 << ", 0, " << h1 << ", " << bl2 << ", " << bl2
00614                                                 << ", 0";
00615     DDLogicalPart siReenforce(solid.ddname(), matter, solid);
00616     //translate
00617     xpos =0 ;
00618     ypos =  sideFrameZ;
00619     zpos = topFrameEndZ -dz -siReenforceYPos[i];
00620         
00621     if (isRing6)  zpos *= -1;
00622     if(isStereo){ 
00623           xpos = (-siReenforceYPos[i]+0.5*fullHeight)*sin(detTilt);
00624         //  thet = detTilt;
00625         //  if(topFrame2RHeight > topFrame2LHeight) thet *= -1;
00626         //    zpos -= topFrame2RHeight + sin(thet)*(sideFrameRWidth + 0.5*dlTop);
00627           zpos -= topFrame2RHeight + sin (fabs(detTilt))* 0.5*topFrame2Width;
00628     }
00629     doPos(siReenforce,xpos,ypos,zpos,waferRot);
00630   }
00631 
00632   //Bridge 
00633   if (bridgeMat != "None") {
00634     name    = idName + "Bridge";
00635     matname = DDName(DDSplit(bridgeMat).first, DDSplit(bridgeMat).second);
00636     matter  = DDMaterial(matname);
00637     bl2     = 0.5*bridgeSep + bridgeWidth;
00638     bl1     = bl2 - bridgeHeight * dxdif / dzdif;
00639     h1      = 0.5 * bridgeThick;
00640     dz      = 0.5 * bridgeHeight;
00641     solid = DDSolidFactory::trap(DDName(name,idNameSpace), dz, 0, 0, h1, bl1, 
00642                                  bl1, 0, h1, bl2, bl2, 0);
00643     LogDebug("TECGeom") << "DDTECModuleAlgo test:\t" << solid.name()
00644                         << " Trap made of " << matname << " of dimensions "
00645                         << dz << ", 0, 0, " << h1 << ", " << bl1 << ", "
00646                         << bl1 << ", 0, " << h1 << ", " << bl2 << ", " << bl2
00647                         << ", 0";
00648     DDLogicalPart bridge(solid.ddname(), matter, solid);
00649 
00650     name    = idName + "BridgeGap";
00651     matname = DDName(DDSplit(genMat).first, DDSplit(genMat).second);
00652     matter  = DDMaterial(matname);
00653     bl1     = 0.5*bridgeSep;
00654     solid = DDSolidFactory::box(DDName(name,idNameSpace), bl1, h1, dz);
00655     LogDebug("TECGeom") << "DDTECModuleAlgo test:\t" << solid.name() 
00656                         << " Box made of " << matname << " of dimensions "
00657                         << bl1 << ", " << h1 << ", " << dz;
00658     DDLogicalPart bridgeGap(solid.ddname(), matter, solid);
00659     DDpos (bridgeGap, bridge, 1, DDTranslation(0.0, 0.0, 0.0), DDRotation());
00660     LogDebug("TECGeom") << "DDTECModuleAlgo test: " << bridgeGap.name() 
00661                         << " number 1 positioned in " << bridge.name()
00662                         << " at (0,0,0) with no rotation";
00663   }
00664 
00665   LogDebug("TECGeom") << "<<== End of DDTECModuleAlgo construction ...";
00666 }

Generated on Tue Jun 9 17:37:33 2009 for CMSSW by  doxygen 1.5.4