CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_2_9/src/Geometry/TrackerCommonData/plugins/DDTIDModuleAlgo.cc

Go to the documentation of this file.
00001 
00002 // File: DDTIDModuleAlgo.cc
00003 // Description: Creation of a TID Module
00005 #include <cmath>
00006 #include <algorithm>
00007 
00008 #include "FWCore/MessageLogger/interface/MessageLogger.h"
00009 #include "DetectorDescription/Core/interface/DDLogicalPart.h"
00010 #include "DetectorDescription/Core/interface/DDSolid.h"
00011 #include "DetectorDescription/Core/interface/DDMaterial.h"
00012 #include "DetectorDescription/Core/interface/DDCurrentNamespace.h"
00013 #include "DetectorDescription/Core/interface/DDSplit.h"
00014 #include "Geometry/TrackerCommonData/plugins/DDTIDModuleAlgo.h"
00015 #include "CLHEP/Units/GlobalPhysicalConstants.h"
00016 #include "CLHEP/Units/GlobalSystemOfUnits.h"
00017 
00018 
00019 DDTIDModuleAlgo::DDTIDModuleAlgo() {
00020   LogDebug("TIDGeom") << "DDTIDModuleAlgo info: Creating an instance";
00021 }
00022 
00023 DDTIDModuleAlgo::~DDTIDModuleAlgo() {}
00024 
00025 void DDTIDModuleAlgo::initialize(const DDNumericArguments & nArgs,
00026                                  const DDVectorArguments & vArgs,
00027                                  const DDMapArguments & ,
00028                                  const DDStringArguments & sArgs,
00029                                  const DDStringVectorArguments & vsArgs) {
00030 
00031   int i;
00032   genMat       = sArgs["GeneralMaterial"];
00033   detectorN    = (int)(nArgs["DetectorNumber"]);
00034   DDName parentName = parent().name(); 
00035 
00036   LogDebug("TIDGeom") << "DDTIDModuleAlgo debug: Parent " << parentName 
00037                       << " General Material " << genMat 
00038                       << " Detector Planes " << detectorN;
00039 
00040   moduleThick       = nArgs["ModuleThick"];
00041   detTilt           = nArgs["DetTilt"];
00042   fullHeight        = nArgs["FullHeight"];
00043   dlTop             = nArgs["DlTop"];
00044   dlBottom          = nArgs["DlBottom"];
00045   dlHybrid          = nArgs["DlHybrid"];
00046   std::string comp  = sArgs["DoComponents"];
00047   if (comp == "No" || comp == "NO" || comp == "no") doComponents = false;
00048   else                                              doComponents = true;
00049 
00050   LogDebug("TIDGeom") << "DDTIDModuleAlgo debug: ModuleThick " 
00051                       << moduleThick << " Detector Tilt " << detTilt/CLHEP::deg
00052                       << " Height " << fullHeight << " dl(Top) " << dlTop
00053                       << " dl(Bottom) " << dlBottom << " dl(Hybrid) "
00054                       << dlHybrid << " doComponents " << doComponents;
00055 
00056   boxFrameName      = sArgs["BoxFrameName"];
00057   boxFrameMat       = sArgs["BoxFrameMaterial"];
00058   boxFrameThick     = nArgs["BoxFrameThick"];
00059   boxFrameHeight    = nArgs["BoxFrameHeight"];
00060   boxFrameWidth     = nArgs["BoxFrameWidth"];
00061   bottomFrameHeight = nArgs["BottomFrameHeight"];
00062   bottomFrameOver   = nArgs["BottomFrameOver"];
00063   LogDebug("TIDGeom") << "DDTIDModuleAlgo debug: " << boxFrameName 
00064                       << " Material " << boxFrameMat << " Thickness " 
00065                       << boxFrameThick << " width " << boxFrameWidth 
00066                       <<  " height " << boxFrameHeight
00067                       << " Extra Height at Bottom " << bottomFrameHeight 
00068                       << " Overlap " << bottomFrameOver;
00069 
00070   topFrameHeight    = nArgs["TopFrameHeight"];
00071   topFrameOver      = nArgs["TopFrameOver"];
00072   sideFrameName     = vsArgs["SideFrameName"];
00073   sideFrameMat      = sArgs["SideFrameMaterial"];
00074   sideFrameWidth    = nArgs["SideFrameWidth"];
00075   sideFrameThick    = nArgs["SideFrameThick"];
00076   sideFrameOver     = nArgs["SideFrameOver"];
00077   holeFrameName     = vsArgs["HoleFrameName"];
00078   holeFrameRot      = vsArgs["HoleFrameRotation"];
00079   for (i = 0; i < detectorN; i++)
00080     LogDebug("TIDGeom") << "DDTIDModuleAlgo debug : " << sideFrameName[i] 
00081                         << " Material " << sideFrameMat << " Width " 
00082                         << sideFrameWidth << " Thickness " << sideFrameThick
00083                         << " Overlap " << sideFrameOver << " Hole  "
00084                         << holeFrameName[i];
00085 
00086   kaptonName     = vsArgs["KaptonName"];
00087   kaptonMat      = sArgs["KaptonMaterial"];
00088   kaptonThick    = nArgs["KaptonThick"];
00089   kaptonOver     = nArgs["KaptonOver"];
00090   holeKaptonName     = vsArgs["HoleKaptonName"];
00091   holeKaptonRot      = vsArgs["HoleKaptonRotation"];
00092   for (i = 0; i < detectorN; i++)
00093     LogDebug("TIDGeom") << "DDTIDModuleAlgo debug : " << kaptonName[i] 
00094                         << " Material " << kaptonMat 
00095                         << " Thickness " << kaptonThick
00096                         << " Overlap " << kaptonOver << " Hole  "
00097                         << holeKaptonName[i];
00098 
00099 
00100   waferName         = vsArgs["WaferName"];
00101   waferMat          = sArgs["WaferMaterial"];
00102   sideWidthTop      = nArgs["SideWidthTop"];
00103   sideWidthBottom   = nArgs["SideWidthBottom"];
00104 
00105   LogDebug("TIDGeom") << "DDTIDModuleAlgo debug: Wafer Material " 
00106                       << waferMat  << " Side Width Top " << sideWidthTop
00107                       << " Side Width Bottom " << sideWidthBottom;
00108   for (i = 0; i < detectorN; i++)
00109     LogDebug("TIDGeom") << "\twaferName[" << i << "] = " << waferName[i];
00110 
00111   activeName        = vsArgs["ActiveName"];
00112   activeMat         = sArgs["ActiveMaterial"];
00113   activeHeight      = nArgs["ActiveHeight"];
00114   waferThick        = vArgs["WaferThick"];
00115   activeRot         = sArgs["ActiveRotation"];
00116   backplaneThick    = vArgs["BackPlaneThick"];
00117   LogDebug("TIDGeom") << "DDTIDModuleAlgo debug: Active Material " 
00118                       << activeMat << " Height " << activeHeight 
00119                       << " rotated by " << activeRot;
00120   for (i = 0; i < detectorN; i++)
00121     LogDebug("TIDGeom") << " translated by (0," << -0.5*backplaneThick[i] 
00122                         << ",0)\tactiveName[" << i << "] = " << activeName[i]
00123                         << " of thickness " << waferThick[i]-backplaneThick[i];
00124   
00125   hybridName        = sArgs["HybridName"];
00126   hybridMat         = sArgs["HybridMaterial"];
00127   hybridHeight      = nArgs["HybridHeight"];
00128   hybridWidth       = nArgs["HybridWidth"];
00129   hybridThick       = nArgs["HybridThick"];
00130   LogDebug("TIDGeom") << "DDTIDModuleAlgo debug: " << hybridName 
00131                       << " Material " << hybridMat << " Height " 
00132                       << hybridHeight << " Width " << hybridWidth 
00133                       << " Thickness " << hybridThick;
00134 
00135   pitchName         = vsArgs["PitchName"];
00136   pitchMat          = sArgs["PitchMaterial"];
00137   pitchHeight       = nArgs["PitchHeight"];
00138   pitchThick        = nArgs["PitchThick"];
00139   pitchStereoTol    = nArgs["PitchStereoTolerance"];
00140 
00141   LogDebug("TIDGeom") << "DDTIDModuleAlgo debug: Pitch Adapter Material "
00142                       << pitchMat << " Height " << pitchHeight
00143                       << " Thickness " << pitchThick;
00144   for (i = 0; i < detectorN; i++)
00145     LogDebug("TIDGeom") <<  "\tpitchName[" << i << "] = " << pitchName[i];
00146 
00147   coolName         = sArgs["CoolInsertName"];
00148   coolMat          = sArgs["CoolInsertMaterial"];
00149   coolHeight       = nArgs["CoolInsertHeight"];
00150   coolThick        = nArgs["CoolInsertThick"];
00151   coolWidth        = nArgs["CoolInsertWidth"];
00152   LogDebug("TIDGeom") << "DDTIDModuleAlgo debug: Cool Element Material "
00153                       << coolMat << " Height " << coolHeight
00154                       << " Thickness " << coolThick << " Width " << coolWidth;
00155 }
00156 
00157 void DDTIDModuleAlgo::execute(DDCompactView& cpv) {
00158   
00159   LogDebug("TIDGeom") << "==>> Constructing DDTIDModuleAlgo...";
00160 
00161   DDName parentName = parent().name(); 
00162   DDName name;
00163 
00164   double sidfr = sideFrameWidth - sideFrameOver;      // width of side frame on the sides of module 
00165   double botfr;                                       // width of side frame at the the bottom of the modules 
00166   double topfr;                                       // width of side frame at the the top of the modules 
00167   double kaptonHeight; 
00168   if (dlHybrid > dlTop) {
00169     // ring 1, ring 2
00170     topfr = topFrameHeight - pitchHeight - topFrameOver;      
00171     botfr = bottomFrameHeight - bottomFrameOver; 
00172     kaptonHeight = fullHeight + botfr;
00173   } else {
00174     // ring 3
00175     topfr = topFrameHeight - topFrameOver;      
00176     botfr = bottomFrameHeight - bottomFrameOver - pitchHeight; 
00177     kaptonHeight = fullHeight + topfr;
00178   }
00179 
00180   double sideFrameHeight = fullHeight + pitchHeight + botfr + topfr; 
00181   double kaptonWidth = sidfr + kaptonOver;
00182 
00183   double  dxbot = 0.5*dlBottom + sidfr;
00184   double  dxtop = 0.5*dlTop + sidfr;
00185   double  dxtopenv, dxbotenv;           // top/bot width of the module envelope trap
00186 
00187   // Envelope 
00188   if (dlHybrid > dlTop) {
00189     // ring 1, ring 2
00190     dxtopenv = dxbot + (dxtop-dxbot)*(fullHeight+pitchHeight+topfr+hybridHeight)/fullHeight;
00191     dxbotenv = dxtop - (dxtop-dxbot)*(fullHeight+botfr)/fullHeight;
00192   } else {
00193     // ring 3
00194     dxtopenv = dxbot + (dxtop-dxbot)*(fullHeight+topfr)/fullHeight;
00195     dxbotenv = dxbot;
00196   }
00197   double bl1   = dxbotenv;
00198   double bl2   = dxtopenv;
00199   double h1    = 0.5 * moduleThick;
00200   double dz    = 0.5 * (boxFrameHeight + sideFrameHeight);
00201 
00202   DDSolid solidUncut, solidCut;
00203   DDSolid    solid = DDSolidFactory::trap(parentName, dz, 0, 0,
00204                                           h1, bl1, bl1, 0, h1, bl2, bl2, 0);
00205   DDName     matname = DDName(DDSplit(genMat).first, DDSplit(genMat).second);
00206   DDMaterial matter  = DDMaterial(matname);
00207   DDLogicalPart module(solid.ddname(), matter, solid);
00208   LogDebug("TIDGeom") << "DDTIDModuleAlgo test:\t" << solid.name() 
00209                       << " Trap made of " << genMat << " of dimensions " << dz 
00210                       << ", 0, 0, " << h1  << ", " << bl1 << ", " << bl1 
00211                       << ", 0, " << h1 << ", " << bl2  << ", " << bl2 
00212                       << ", 0";
00213 
00214   if (doComponents) {
00215 
00216     //Box frame
00217     name    = DDName(DDSplit(boxFrameName).first,DDSplit(boxFrameName).second);
00218     matname = DDName(DDSplit(boxFrameMat).first, DDSplit(boxFrameMat).second);
00219     matter  = DDMaterial(matname);
00220     double dx = 0.5 * boxFrameWidth;
00221     double dy = 0.5 * boxFrameThick;
00222     double dz = 0.5 * boxFrameHeight; 
00223     solid = DDSolidFactory::box(name, dx, dy, dz);
00224     LogDebug("TIDGeom") << "DDTIDModuleAlgo test:\t" << solid.name() 
00225                         << " Box made of " << matname << " of dimensions " 
00226                         << dx << ", " << dy << ", " << dz;
00227     DDLogicalPart boxFrame(solid.ddname(), matter, solid);
00228 
00229 
00230     // Hybrid
00231     name    = DDName(DDSplit(hybridName).first, DDSplit(hybridName).second);
00232     matname = DDName(DDSplit(hybridMat).first, DDSplit(hybridMat).second);
00233     matter  = DDMaterial(matname);
00234     dx = 0.5 * hybridWidth;
00235     dy = 0.5 * hybridThick;
00236     dz        = 0.5 * hybridHeight;
00237     solid = DDSolidFactory::box(name, dx, dy, dz);
00238     LogDebug("TIDGeom") << "DDTIDModuleAlgo test:\t" << solid.name() 
00239                         << " Box made of " << matname << " of dimensions " 
00240                         << dx << ", " << dy << ", " << dz;
00241     DDLogicalPart hybrid(solid.ddname(), matter, solid);
00242 
00243     // Cool Insert
00244     name    = DDName(DDSplit(coolName).first, DDSplit(coolName).second);
00245     matname = DDName(DDSplit(coolMat).first, DDSplit(coolMat).second);
00246     matter  = DDMaterial(matname);
00247     dx = 0.5 * coolWidth;
00248     dy = 0.5 * coolThick;
00249     dz        = 0.5 * coolHeight;
00250     solid = DDSolidFactory::box(name, dx, dy, dz);
00251     LogDebug("TIDGeom") << "DDTIDModuleAlgo test:\t" << solid.name() 
00252                         << " Box made of " << matname << " of dimensions " 
00253                         << dx << ", " << dy << ", " << dz;
00254     DDLogicalPart cool(solid.ddname(), matter, solid);
00255 
00256     // Loop over detectors to be placed
00257     for (int k = 0; k < detectorN; k++) {
00258 
00259       double bbl1, bbl2; // perhaps useless (bl1 enough)
00260 
00261       // Frame Sides
00262       name    = DDName(DDSplit(sideFrameName[k]).first,
00263                        DDSplit(sideFrameName[k]).second);
00264       matname = DDName(DDSplit(sideFrameMat).first,
00265                        DDSplit(sideFrameMat).second);
00266       matter  = DDMaterial(matname);
00267       if (dlHybrid > dlTop) {
00268         // ring 1, ring 2
00269         bbl1 = dxtop - (dxtop-dxbot)*(fullHeight+botfr)/fullHeight;
00270         bbl2 = dxbot + (dxtop-dxbot)*(fullHeight+pitchHeight+topfr)/fullHeight;
00271       } else {
00272         // ring 3
00273         bbl1 = dxtop - (dxtop-dxbot)*(fullHeight+pitchHeight+botfr)/fullHeight;
00274         bbl2 = dxbot + (dxtop-dxbot)*(fullHeight+topfr)/fullHeight;
00275       }
00276       h1 = 0.5 * sideFrameThick;
00277       dz = 0.5 * sideFrameHeight;
00278       solid = DDSolidFactory::trap(name, dz, 0, 0, h1, bbl1, bbl1, 0, 
00279                                    h1,  bbl2, bbl2, 0);
00280       LogDebug("TIDGeom") << "DDTIDModuleAlgo test:\t" << solid.name() 
00281                           << " Trap made of " << matname << " of dimensions "
00282                           << dz << ", 0, 0, " << h1 << ", " << bbl1 << ", " 
00283                           << bbl1 << ", 0, " << h1 << ", " << bbl2 << ", " 
00284                           << bbl2 << ", 0";
00285       DDLogicalPart sideFrame(solid.ddname(), matter, solid);
00286 
00287       std::string rotstr, rotns; 
00288       DDRotation rot;
00289 
00290       // Hole in the frame below the wafer 
00291       name    = DDName(DDSplit(holeFrameName[k]).first,
00292                        DDSplit(holeFrameName[k]).second);
00293       matname = DDName(DDSplit(genMat).first, DDSplit(genMat).second);
00294       matter  = DDMaterial(matname);
00295       double xpos, zpos;
00296       dz        = fullHeight - bottomFrameOver - topFrameOver;
00297       bbl1     = dxbot - sideFrameWidth + bottomFrameOver*(dxtop-dxbot)/fullHeight;
00298       bbl2     = dxtop - sideFrameWidth - topFrameOver*(dxtop-dxbot)/fullHeight;
00299       if (dlHybrid > dlTop) {
00300         // ring 1, ring 2
00301         zpos    = -(topFrameHeight+0.5*dz-0.5*sideFrameHeight);
00302       } else {
00303         // ring 3
00304         zpos    = bottomFrameHeight+0.5*dz-0.5*sideFrameHeight;
00305       }
00306       dz     /= 2.;
00307       solid = DDSolidFactory::trap(name, dz, 0,0, h1,bbl1,bbl1, 0, 
00308                                    h1,bbl2,bbl2, 0);
00309       LogDebug("TIDGeom") << "DDTIDModuleAlgo test:\t" << solid.name() 
00310                           << " Trap made of " << matname << " of dimensions "
00311                           << dz << ", 0, 0, " << h1 << ", " << bbl1 << ", " 
00312                           << bbl1 << ", 0, " << h1 << ", " << bbl2 << ", " 
00313                           << bbl2 << ", 0";
00314       DDLogicalPart holeFrame(solid.ddname(), matter, solid);      
00315 
00316       rotstr = DDSplit(holeFrameRot[k]).first;
00317       if (rotstr != "NULL") {
00318         rotns = DDSplit(holeFrameRot[k]).second;
00319         rot   = DDRotation(DDName(rotstr, rotns));      
00320       } else {
00321         rot     = DDRotation();
00322       }
00323      cpv.position(holeFrame, sideFrame, 1, DDTranslation(0.0, 0.0, zpos), rot );   
00324       LogDebug("TIDGeom") << "DDTIDModuleAlgo test: " << holeFrame.name() 
00325                           << " number 1 positioned in " << sideFrame.name()
00326                           << " at (0,0," << zpos << ") with no rotation";
00327 
00328       // Kapton circuit
00329       //  name = DDName(DDSplit(kaptonName[k]).first,DDSplit(kaptonName[k]).second);
00330       matname = DDName(DDSplit(kaptonMat).first,DDSplit(kaptonMat).second);
00331       matter  = DDMaterial(matname);
00332       double kaptonExtraHeight=0;      // kapton extra height in the stereo
00333       if (dlHybrid > dlTop) {
00334         // ring 1, ring 2
00335         bbl1 = dxtop - (dxtop-dxbot)*(fullHeight+botfr)/fullHeight;
00336         if ( k == 1 ) {
00337           kaptonExtraHeight = dlTop*sin(detTilt)-fullHeight*(1-cos(detTilt));
00338           kaptonExtraHeight = 0.5*fabs(kaptonExtraHeight);
00339           bbl2 = dxbot + (dxtop-dxbot)*(fullHeight+kaptonExtraHeight)/fullHeight;
00340         }
00341         else {
00342           bbl2 = dxtop;
00343         }
00344       } else {
00345         // ring 3
00346         bbl2 = dxbot + (dxtop-dxbot)*(fullHeight+topfr)/fullHeight;
00347         if ( k == 1) {
00348           kaptonExtraHeight = dlBottom*sin(detTilt)-fullHeight*(1-cos(detTilt));
00349           kaptonExtraHeight = 0.5*fabs(kaptonExtraHeight);
00350           bbl1 = dxtop - (dxtop-dxbot)*(fullHeight+kaptonExtraHeight)/fullHeight;
00351         }  else {
00352           bbl1 = dxbot;
00353         }
00354       }
00355       h1 = 0.5 * kaptonThick;
00356       dz = 0.5 * (kaptonHeight+kaptonExtraHeight);
00357 
00358       // For the stereo create the uncut solid, the solid to be removed and then the subtraction solid
00359       if ( k == 1 ) {
00360         // Uncut solid
00361         std::string kaptonUncutName=kaptonName[k]+"Uncut";
00362         name    = DDName(DDSplit(kaptonUncutName).first,
00363                          DDSplit(kaptonUncutName).second);
00364         solidUncut = DDSolidFactory::trap(name, dz, 0, 0, h1, bbl1, bbl1, 0,
00365                                           h1,  bbl2, bbl2, 0);
00366 
00367         // Piece to be cut
00368         std::string kaptonCutName=kaptonName[k]+"Cut";
00369         name    = DDName(DDSplit(kaptonCutName).first,
00370                          DDSplit(kaptonCutName).second);         
00371 
00372         if (dlHybrid > dlTop) {
00373           dz   = 0.5 * dlTop;
00374         } else {
00375           dz   = 0.5 * dlBottom;
00376         }
00377         h1      = 0.5 * kaptonThick;
00378         bbl1     =  fabs(dz*sin(detTilt));
00379         bbl2     =  bbl1*0.000001;
00380         double thet = atan((bbl1-bbl2)/(2*dz)); 
00381         solidCut  = DDSolidFactory::trap(name, dz, thet, 0, h1, bbl1, bbl1, 0,
00382                                          h1, bbl2, bbl2, 0);
00383 
00384         std::string aRot("tidmodpar:9PYX"); 
00385         rotstr  = DDSplit(aRot).first;
00386         rotns = DDSplit(aRot).second;
00387         rot   = DDRotation(DDName(rotstr, rotns));
00388 
00389         xpos = -0.5 * fullHeight * sin(detTilt);
00390         zpos = 0.5 * kaptonHeight - bbl2;
00391 
00392         // Subtraction Solid
00393         name   = DDName(DDSplit(kaptonName[k]).first,
00394                         DDSplit(kaptonName[k]).second);  
00395         solid  = DDSolidFactory::subtraction(name, solidUncut, solidCut, 
00396                                              DDTranslation(xpos,0.0,zpos),rot);
00397       } else {
00398         name   = DDName(DDSplit(kaptonName[k]).first,
00399                         DDSplit(kaptonName[k]).second);
00400         solid  = DDSolidFactory::trap(name, dz, 0, 0, h1, bbl1, bbl1, 0, 
00401                                       h1,  bbl2, bbl2, 0);
00402       }
00403 
00404       DDLogicalPart kapton(solid.ddname(), matter, solid);         
00405       LogDebug("TIDGeom") << "DDTIDModuleAlgo test:\t" << solid.name() 
00406                           << " SUBTRACTION SOLID Trap made of " << matname 
00407                           << " of dimensions " << dz << ", 0, 0, " << h1 
00408                           << ", " << bbl1 << ", " << bbl1 << ", 0, " << h1 
00409                           << ", " << bbl2 << ", " << bbl2 << ", 0";
00410 
00411 
00412       // Hole in the kapton below the wafer 
00413       name    = DDName(DDSplit(holeKaptonName[k]).first,
00414                        DDSplit(holeKaptonName[k]).second);
00415       matname = DDName(DDSplit(genMat).first, DDSplit(genMat).second);
00416       matter  = DDMaterial(matname);
00417       dz      = fullHeight - kaptonOver;
00418       xpos = 0; 
00419       if (dlHybrid > dlTop) {
00420         // ring 1, ring 2
00421         bbl1 = dxbot - kaptonWidth + kaptonOver*(dxtop-dxbot)/fullHeight;
00422         bbl2 = dxtop - kaptonWidth;
00423         zpos = 0.5*(kaptonHeight-kaptonExtraHeight-dz); 
00424         if ( k == 1 ) {
00425           zpos -= 0.5*kaptonOver*(1-cos(detTilt));
00426           xpos = -0.5*kaptonOver*sin(detTilt); 
00427         }
00428       } else {
00429         // ring 3
00430         bbl1 = dxbot - kaptonWidth;
00431         bbl2 = dxtop - kaptonWidth - kaptonOver*(dxtop-dxbot)/fullHeight;
00432         zpos = -0.5*(kaptonHeight-kaptonExtraHeight-dz);
00433       }
00434       dz     /= 2.;
00435       solid = DDSolidFactory::trap(name, dz, 0,0, h1,bbl1,bbl1, 0, 
00436                                    h1,bbl2,bbl2, 0);
00437       LogDebug("TIDGeom") << "DDTIDModuleAlgo test:\t" << solid.name() 
00438                           << " Trap made of " << matname << " of dimensions "
00439                           << dz << ", 0, 0, " << h1 << ", " << bbl1 << ", " 
00440                           << bbl1 << ", 0, " << h1 << ", " << bbl2 << ", " 
00441                           << bbl2 << ", 0";
00442       DDLogicalPart holeKapton(solid.ddname(), matter, solid);      
00443 
00444       rotstr = DDSplit(holeKaptonRot[k]).first;
00445       if (rotstr != "NULL") {
00446         rotns = DDSplit(holeKaptonRot[k]).second;
00447         rot   = DDRotation(DDName(rotstr, rotns));      
00448       } else {
00449         rot     = DDRotation();
00450       }
00451      cpv.position(holeKapton, kapton, 1, DDTranslation(xpos, 0.0, zpos), rot );   
00452       LogDebug("TIDGeom") << "DDTIDModuleAlgo test: " << holeKapton.name() 
00453                           << " number 1 positioned in " << kapton.name()
00454                           << " at (0,0," << zpos << ") with no rotation";
00455 
00456 
00457 
00458       // Wafer
00459       name    = DDName(DDSplit(waferName[k]).first,
00460                        DDSplit(waferName[k]).second);
00461       matname = DDName(DDSplit(waferMat).first, DDSplit(waferMat).second);
00462       matter  = DDMaterial(matname);
00463       if (k == 0 && dlHybrid < dlTop) {
00464         bl1     = 0.5 * dlTop;
00465         bl2     = 0.5 * dlBottom;
00466       } else {
00467         bl1     = 0.5 * dlBottom;
00468         bl2     = 0.5 * dlTop;
00469       }
00470       h1      = 0.5 * waferThick[k];
00471       dz      = 0.5 * fullHeight;
00472       solid = DDSolidFactory::trap(name, dz, 0,0, h1,bl1,bl1,0, h1,bl2,bl2,0);
00473       LogDebug("TIDGeom") << "DDTIDModuleAlgo test:\t" << solid.name() 
00474                           << " Trap made of " << matname << " of dimensions "
00475                           << dz << ", 0, 0, " << h1 << ", " << bl1 << ", " 
00476                           << bl1 << ", 0, " << h1 << ", " << bl2 << ", "
00477                           << bl2 << ", 0";
00478       DDLogicalPart wafer(solid.ddname(), matter, solid);
00479 
00480       // Active
00481       name    = DDName(DDSplit(activeName[k]).first,
00482                        DDSplit(activeName[k]).second);
00483       matname = DDName(DDSplit(activeMat).first, DDSplit(activeMat).second);
00484       matter  = DDMaterial(matname);
00485       if (k == 0 && dlHybrid < dlTop) {
00486         bl1    -= sideWidthTop;
00487         bl2    -= sideWidthBottom;
00488       }
00489       else {
00490         bl1    -= sideWidthBottom;
00491         bl2    -= sideWidthTop;
00492       }
00493       dz      = 0.5 * (waferThick[k] - backplaneThick[k]); // inactive backplane
00494       h1      = 0.5 * activeHeight;
00495       solid = DDSolidFactory::trap(name, dz, 0,0, h1,bl2,bl1,0, h1,bl2,bl1,0);
00496       LogDebug("TIDGeom") << "DDTIDModuleAlgo test:\t" << solid.name() 
00497                           << " Trap made of " << matname << " of dimensions "
00498                           << dz << ", 0, 0, " << h1 << ", " << bl2 << ", " 
00499                           << bl1 << ", 0, " << h1 << ", " << bl2 << ", "
00500                           << bl1 << ", 0";
00501       DDLogicalPart active(solid.ddname(), matter, solid);
00502       rotstr = DDSplit(activeRot).first;
00503       if (rotstr != "NULL") {
00504         rotns = DDSplit(activeRot).second;
00505         rot   = DDRotation(DDName(rotstr, rotns));
00506       } else {
00507         rot     = DDRotation();
00508       }
00509       DDTranslation tran(0.0,-0.5 * backplaneThick[k],0.0); // from the definition of the wafer local axes
00510      cpv.position(active, wafer, 1, tran, rot);  // inactive backplane
00511       LogDebug("TIDGeom") << "DDTIDModuleAlgo test: " << active.name() 
00512                           << " number 1 positioned in " << wafer.name() 
00513                           << " at " << tran << " with " << rot;
00514       
00515       //Pitch Adapter
00516       name    = DDName(DDSplit(pitchName[k]).first,
00517                        DDSplit(pitchName[k]).second);
00518       matname = DDName(DDSplit(pitchMat).first, DDSplit(pitchMat).second);
00519       matter  = DDMaterial(matname);
00520       if (dlHybrid > dlTop) {
00521         dz   = 0.5 * dlTop;
00522       } else {
00523         dz   = 0.5 * dlBottom;
00524       }
00525       if (k == 0) {
00526         dx      = dz;
00527         dy      = 0.5 * pitchThick;
00528         dz      = 0.5 * pitchHeight;
00529         solid   = DDSolidFactory::box(name, dx, dy, dz);
00530         LogDebug("TIDGeom") << "DDTIDModuleAlgo test:\t" << solid.name()
00531                             << " Box made of " << matname << " of dimensions"
00532                             << " " << dx << ", " << dy << ", " << dz;
00533       } else {
00534         h1      = 0.5 * pitchThick;
00535         bl1     = 0.5 * pitchHeight + 0.5 * dz * sin(detTilt);
00536         bl2     = 0.5 * pitchHeight - 0.5 * dz * sin(detTilt);
00537 
00538         dz -=0.5*pitchStereoTol;
00539         bl1-=pitchStereoTol;
00540         bl2-=pitchStereoTol;
00541 
00542         double thet = atan((bl1-bl2)/(2.*dz));
00543         solid   = DDSolidFactory::trap(name, dz, thet, 0, h1, bl1, bl1, 0, 
00544                                        h1, bl2, bl2, 0);
00545         LogDebug("TIDGeom") << "DDTIDModuleAlgo test:\t" << solid.name() 
00546                             << " Trap made of " << matname << " of "
00547                             << "dimensions " << dz << ", " << thet/CLHEP::deg 
00548                             << ", 0, " << h1 << ", " << bl1 << ", " << bl1 
00549                             << ", 0, " << h1 << ", " << bl2 << ", " << bl2 
00550                             << ", 0";
00551       }
00552       DDLogicalPart pa(solid.ddname(), matter, solid);
00553     }
00554   }
00555   LogDebug("TIDGeom") << "<<== End of DDTIDModuleAlgo construction ...";
00556 }