CMS 3D CMS Logo

DDTIBLayerAlgo_MTCC.cc

Go to the documentation of this file.
00001 
00002 // File: DDTIBLayerAlgo_MTCC.cc
00003 // Description: Makes a TIB layer and position the strings with a tilt angle
00005 
00006 #include <cmath>
00007 #include <algorithm>
00008 
00009 #include "FWCore/MessageLogger/interface/MessageLogger.h"
00010 #include "DetectorDescription/Base/interface/DDutils.h"
00011 #include "DetectorDescription/Core/interface/DDPosPart.h"
00012 #include "DetectorDescription/Core/interface/DDLogicalPart.h"
00013 #include "DetectorDescription/Core/interface/DDSolid.h"
00014 #include "DetectorDescription/Core/interface/DDMaterial.h"
00015 #include "DetectorDescription/Core/interface/DDCurrentNamespace.h"
00016 #include "DetectorDescription/Core/interface/DDSplit.h"
00017 #include "Geometry/MTCCTrackerCommonData/interface/DDTIBLayerAlgo_MTCC.h"
00018 #include "CLHEP/Units/PhysicalConstants.h"
00019 #include "CLHEP/Units/SystemOfUnits.h"
00020 
00021 DDTIBLayerAlgo_MTCC::DDTIBLayerAlgo_MTCC(): ribW(0),ribPhi(0) {
00022   LogDebug("TIBGeom") << "DDTIBLayerAlgo_MTCC info: Creating an instance";
00023 }
00024 
00025 DDTIBLayerAlgo_MTCC::~DDTIBLayerAlgo_MTCC() {}
00026 
00027 void DDTIBLayerAlgo_MTCC::initialize(const DDNumericArguments & nArgs,
00028                                      const DDVectorArguments & vArgs,
00029                                      const DDMapArguments & ,
00030                                      const DDStringArguments & sArgs,
00031                                      const DDStringVectorArguments & ) {
00032   
00033   idNameSpace  = DDCurrentNamespace::ns();
00034   genMat       = sArgs["GeneralMaterial"];
00035   DDName parentName = parent().name(); 
00036   LogDebug("TIBGeom") << "DDTIBLayerAlgo_MTCC debug: Parent " << parentName 
00037                       << " NameSpace " << idNameSpace << " General Material " 
00038                       << genMat;
00039   
00040   detectorTilt = nArgs["DetectorTilt"];
00041   layerL       = nArgs["LayerL"];
00042   detectorTol  = nArgs["LayerTolerance"];
00043   detectorW    = nArgs["DetectorWidth"];
00044   detectorT    = nArgs["DetectorThickness"];
00045   coolTubeW    = nArgs["CoolTubeWidth"];
00046   coolTubeT    = nArgs["CoolTubeThickness"];
00047   LogDebug("TIBGeom") << "DDTIBLayerAlgo_MTCC debug: Tilt Angle " 
00048                       << detectorTilt/deg << " Layer Length/tolerance " 
00049                       << layerL << " " << detectorTol
00050                       << " Detector layer Width/Thick " << detectorW << ", " 
00051                       << detectorT << " Cooling Tube/Cable layer Width/Thick " 
00052                       << coolTubeW << ", " << coolTubeT;
00053   
00054   radiusLo     = nArgs["RadiusLo"];
00055   phioffLo     = nArgs["PhiOffsetLo"];
00056   phiMinLo     = nArgs["PhiMinimumLo"];
00057   phiMaxLo     = nArgs["PhiMaximumLo"];
00058   stringsLo    = int(nArgs["StringsLo"]);
00059   stringLoList = vArgs["StringLoList"];
00060   detectorLo   = sArgs["StringDetLoName"];
00061   emptyDetectorLo = sArgs["EmptyStringDetLoName"];
00062   roffDetLo    = nArgs["ROffsetDetLo"];
00063   coolCableLo  = sArgs["StringCabLoName"];
00064   emptyCoolCableLo = sArgs["EmptyStringCabLoName"];
00065   roffCableLo  = nArgs["ROffsetCabLo"];
00066   LogDebug("TIBGeom") << "DDTIBLayerAlgo_MTCC debug: Lower layer Radius " 
00067                       << radiusLo << " Phi offset " << phioffLo/deg << " min "
00068                       << phiMinLo/deg << " max " << phiMaxLo/deg
00069                       << " Number " << stringsLo << " String " << detectorLo 
00070                       << " at offset " << roffDetLo << " String " 
00071                       << coolCableLo << " at offset " << roffCableLo
00072                       << " Strings filled: ";
00073   for(unsigned int i=0; i<stringLoList.size(); i++) {
00074     LogDebug("TIBGeom") << "String " << i << " " << (int)stringLoList[i];
00075   }
00076   LogDebug("TIBGeom") << " Empty String " << emptyDetectorLo  << " at offset "
00077                       << roffDetLo << " Empty String " << emptyCoolCableLo 
00078                       << " at offset " << roffCableLo;
00079   
00080   radiusUp     = nArgs["RadiusUp"];
00081   phioffUp     = nArgs["PhiOffsetUp"];
00082   phiMinUp     = nArgs["PhiMinimumUp"];
00083   phiMaxUp     = nArgs["PhiMaximumUp"];
00084   stringsUp    = int(nArgs["StringsUp"]);
00085   stringUpList = vArgs["StringUpList"];
00086   detectorUp   = sArgs["StringDetUpName"];
00087   emptyDetectorUp = sArgs["EmptyStringDetUpName"];
00088   roffDetUp    = nArgs["ROffsetDetUp"];
00089   coolCableUp  = sArgs["StringCabUpName"];
00090   emptyCoolCableUp = sArgs["EmptyStringCabUpName"];
00091   roffCableUp  = nArgs["ROffsetCabUp"];
00092   LogDebug("TIBGeom") << "DDTIBLayerAlgo_MTCC debug: Upper layer Radius " 
00093                       << radiusUp << " Phi offset " << phioffUp/deg << " min "
00094                       << phiMinUp/deg << " max " << phiMaxUp/deg
00095                       << " Number " << stringsUp << " String " << detectorUp 
00096                       << " at offset " << roffDetUp << " String " 
00097                       << coolCableUp << " at offset " << roffCableUp
00098                       << " Strings filled: ";
00099   for(unsigned int i=0; i<stringUpList.size(); i++) {
00100     LogDebug("TIBGeom") << "String " << i << " " << (int)stringUpList[i];
00101   }
00102   LogDebug("TIBGeom") << " Empty String " << emptyDetectorUp  << " at offset "
00103                       << roffDetUp << " Empty String " << emptyCoolCableUp 
00104                       << " at offset " << roffCableUp;
00105   
00106   cylinderT    = nArgs["CylinderThickness"];
00107   cylinderMat  = sArgs["CylinderMaterial"];
00108   supportW     = nArgs["SupportWidth"];
00109   supportT     = nArgs["SupportThickness"];
00110   supportMat   = sArgs["SupportMaterial"];
00111   ribMat       = sArgs["RibMaterial"];
00112   ribW         = vArgs["RibWidth"];
00113   ribPhi       = vArgs["RibPhi"];
00114   LogDebug("TIBGeom") << "DDTIBLayerAlgo_MTCC debug: Cylinder Material/"
00115                       << "thickness " << cylinderMat << " " << cylinderT 
00116                       << " Support Wall Material/Width/Thickness " 
00117                       << supportMat << " " << supportW << " " << supportT 
00118                       << " Rib Material " << ribMat << " at "
00119                       << ribW.size() << " positions with width/phi";
00120   for (unsigned int i = 0; i < ribW.size(); i++)
00121     LogDebug("TIBGeom") << "Rib " <<  i << " " <<  ribW[i] << " " 
00122                         << ribPhi[i]/deg;
00123   
00124   dohmN               = int(nArgs["DOHMPhiNumber"]);
00125   dohmCarrierW        = nArgs["DOHMCarrierWidth"];
00126   dohmCarrierT        = nArgs["DOHMCarrierThickness"];
00127   dohmCarrierR        = nArgs["DOHMCarrierRadialHeight"];
00128   dohmCarrierMaterial = sArgs["DOHMCarrierMaterial"];
00129   dohmCableMaterial   = sArgs["DOHMCableMaterial"];
00130   dohmPrimW           = nArgs["DOHMPRIMWidth"];
00131   dohmPrimL           = nArgs["DOHMPRIMLength"];
00132   dohmPrimT           = nArgs["DOHMPRIMThickness"];
00133   dohmPrimMaterial    = sArgs["DOHMPRIMMaterial"];
00134   dohmAuxW            = nArgs["DOHMAUXWidth"];
00135   dohmAuxL            = nArgs["DOHMAUXLength"];
00136   dohmAuxT            = nArgs["DOHMAUXThickness"];
00137   dohmAuxMaterial     = sArgs["DOHMAUXMaterial"];
00138   dohmList            = vArgs["DOHMList"];
00139   LogDebug("TIBGeom") << "DDTIBLayerAlgo_MTCC debug: DOHM PRIMary " << dohmN
00140                       << " Width/Length/Thickness " << " Material " 
00141                       << dohmPrimMaterial << " " << dohmPrimW << " " 
00142                       << dohmPrimL << " " << dohmPrimT
00143                       << " at positions:";
00144   for(unsigned int i=0; i<dohmList.size(); i++) {
00145     if((int)dohmList[i]>0) LogDebug("TIBGeom") <<  i+1 << ",";
00146   }
00147   LogDebug("TIBGeom") << "DDTIBLayerAlgo_MTCC debug: DOHM AUXiliary "
00148                       << " Material " << dohmAuxMaterial << " " 
00149                       << dohmAuxW << " " << dohmAuxL << " " << dohmAuxT
00150                       << " at positions:";
00151   for(unsigned int i=0; i<dohmList.size(); i++) {
00152     if((int)dohmList[i]==2) LogDebug("TIBGeom") << i+1 << ",";
00153   }
00154   LogDebug("TIBGeom") << " in Carrier Width/Thickness/Radius " 
00155                       << dohmCarrierW << " " << dohmCarrierT << " " 
00156                       << dohmCarrierR << " Carrier Material " 
00157                       << dohmCarrierMaterial
00158                       << "\n with cables and connectors Material " 
00159                       << dohmCableMaterial << "\n"
00160                       << "DDTIBLayerAlgo_MTCC debug: no DOHM "
00161                       << " at positions: ";
00162   for(unsigned int i=0; i<dohmList.size(); i++) {
00163     if((int)dohmList[i]==0) LogDebug("TIBGeom") << i+1 << ",";
00164   }
00165   
00166 }
00167 
00168 
00169 void DDTIBLayerAlgo_MTCC::execute() {
00170   
00171   LogDebug("TIBGeom") << "==>> Constructing DDTIBLayerAlgo_MTCC...";
00172   
00173   //Parameters for the tilt of the layer
00174   double rotsi  = std::abs(detectorTilt);
00175   double redgd1 = 0.5*(detectorW*sin(rotsi)+detectorT*cos(rotsi));
00176   double redgd2 = 0.5*(detectorW*cos(rotsi)-detectorT*sin(rotsi));
00177   double redgc1 = 0.5*(coolTubeW*sin(rotsi)+coolTubeT*cos(rotsi));
00178   double redgc2 = 0.5*(coolTubeW*cos(rotsi)-coolTubeT*sin(rotsi));
00179   LogDebug("TIBGeom") << "DDTIBLayerAlgo_MTCC test DeltaR (Detector Tilt) " 
00180                       << redgd1 << ", " << redgd2 << " DeltaR (Cable+Cool) "
00181                       << redgc1 << ", " << redgc2;
00182   
00183   DDName parentName = parent().name(); 
00184   std::string idName = DDSplit(parentName).first;
00185   double rmin = radiusLo + roffDetLo - redgd1 - detectorTol;
00186   double rmax = sqrt((radiusUp+roffDetUp+redgd1)*(radiusUp+roffDetUp+redgd1)+
00187                      redgd2*redgd2) + detectorTol;
00188   DDSolid solid = DDSolidFactory::tubs(DDName(idName, idNameSpace), 0.5*layerL,
00189                                        rmin, rmax, 0, twopi);
00190   LogDebug("TIBGeom") << "DDTIBLayerAlgo_MTCC test: " 
00191                       << DDName(idName,idNameSpace) << " Tubs made of " 
00192                       << genMat << " from 0 to " << twopi/deg << " with Rin "
00193                       << rmin << " Rout " << rmax << " ZHalf " << 0.5*layerL;
00194   DDName matname(DDSplit(genMat).first, DDSplit(genMat).second);
00195   DDMaterial matter(matname);
00196   DDLogicalPart layer(solid.ddname(), matter, solid);
00197   
00198   //Lower part first
00199   double rin  = rmin;
00200   double rout = 0.5*(radiusLo+radiusUp-cylinderT);
00201   std::string name = idName + "Down";
00202   solid = DDSolidFactory::tubs(DDName(name, idNameSpace), 0.5*layerL,
00203                                rin, rout, 0, twopi);
00204   LogDebug("TIBGeom") << "DDTIBLayerAlgo_MTCC test: "
00205                       << DDName(name, idNameSpace) << " Tubs made of " 
00206                       << genMat << " from 0 to " << twopi/deg << " with Rin " 
00207                       << rin << " Rout " << rout << " ZHalf " << 0.5*layerL;
00208   DDLogicalPart layerIn(solid.ddname(), matter, solid);
00209   DDpos (layerIn, layer, 1, DDTranslation(0.0, 0.0, 0.0), DDRotation());
00210   LogDebug("TIBGeom") << "DDTIBLayerAlgo_MTCC test: " << layerIn.name() 
00211                       << " number 1 positioned in " << layer.name()
00212                       << " at (0,0,0) with no rotation";
00213   
00214   double rposdet = radiusLo + roffDetLo;
00215   double rposcab = rposdet + roffCableLo;
00216   double dphi    = twopi/stringsLo;
00217   DDName detIn(DDSplit(detectorLo).first, DDSplit(detectorLo).second);
00218   DDName cabIn(DDSplit(coolCableLo).first, DDSplit(coolCableLo).second);
00219   for (int n = 0; n < stringsLo; n++) {
00220     double phi    = phioffLo + n*dphi;
00221     if( phi>=phiMinLo && phi<phiMaxLo ) { // phi range
00222       double phix   = phi - detectorTilt + 90*deg;
00223       double phideg = phix/deg;
00224       DDRotation rotation;
00225       if (phideg != 0) {
00226         double theta  = 90*deg;
00227         double phiy   = phix + 90.*deg;
00228         std::string rotstr = idName + dbl_to_string(phideg*10.);
00229         rotation = DDRotation(DDName(rotstr, idNameSpace));
00230         if (!rotation) {
00231           LogDebug("TIBGeom") << "DDTIBLayer_MTCC test: Creating a new "
00232                               << "rotation: " << rotstr << "\t90., " 
00233                               << phix/deg << ", 90.," << phiy/deg << ", 0, 0";
00234           rotation = DDrot(DDName(rotstr, idNameSpace), theta,phix, theta,phiy,
00235                            0., 0.);
00236         }
00237       }
00238       
00239       // fill strings in the stringLoList with modules, the others with only structure
00240       bool empty=true;
00241       for(unsigned int i=0; i<stringLoList.size(); i++) {
00242         if(n+1==(int)stringLoList[i]) {
00243           empty=false;
00244         }
00245       }
00246       if(empty) {
00247         if(emptyDetectorLo!="nothing") {
00248           DDName emptyDetIn(DDSplit(emptyDetectorLo).first, DDSplit(emptyDetectorLo).second);
00249           DDTranslation trdet(rposdet*cos(phi), rposdet*sin(phi), 0);
00250           DDpos (emptyDetIn, layerIn, n+1, trdet, rotation);
00251           LogDebug("TIBGeom") << "DDTIBLayer_MTCC test " << emptyDetIn.name()
00252                               << " number " << n+1 << " positioned in " 
00253                               << layerIn.name() << " at " << trdet 
00254                               << " with " << rotation;      
00255         }
00256         if(emptyCoolCableLo!="nothing") {
00257           DDName emptyCabIn(DDSplit(emptyCoolCableLo).first, DDSplit(emptyCoolCableLo).second);
00258           DDTranslation trcab(rposcab*cos(phi), rposcab*sin(phi), 0);
00259           DDpos (emptyCabIn, layerIn, n+1, trcab, rotation);
00260           LogDebug("TIBGeom") << "DDTIBLayer_MTCC test " << emptyCabIn.name() 
00261                               << " number " << n+1 << " positioned in " 
00262                               << layerIn.name() << " at " << trcab 
00263                               << " with " << rotation;
00264         }
00265       } else {
00266         DDTranslation trdet(rposdet*cos(phi), rposdet*sin(phi), 0);
00267         DDpos (detIn, layerIn, n+1, trdet, rotation);
00268         LogDebug("TIBGeom") << "DDTIBLayer_MTCC test " << detIn.name() 
00269                             << " number " << n+1 << " positioned in " 
00270                             << layerIn.name() << " at " << trdet 
00271                             << " with " << rotation;
00272         DDTranslation trcab(rposcab*cos(phi), rposcab*sin(phi), 0);
00273         DDpos (cabIn, layerIn, n+1, trcab, rotation);
00274         LogDebug("TIBGeom") << "DDTIBLayer_MTCC test " << cabIn.name() 
00275                             << " number " << n+1 << " positioned in " 
00276                             << layerIn.name() << " at " << trcab 
00277                             << " with " << rotation;
00278       }
00279       //
00280       
00281     } // phi range
00282     
00283   }
00284   
00285   //Now the upper part
00286   rin  = 0.5*(radiusLo+radiusUp+cylinderT);
00287   rout = rmax;
00288   name = idName + "Up";
00289   solid = DDSolidFactory::tubs(DDName(name, idNameSpace), 0.5*layerL,
00290                                rin, rout, 0, twopi);
00291   LogDebug("TIBGeom") << "DDTIBLayerAlgo_MTCC test: " 
00292                       << DDName(name, idNameSpace) << " Tubs made of " 
00293                       << genMat << " from 0 to " << twopi/deg << " with Rin "
00294                       << rin << " Rout " << rout << " ZHalf " << 0.5*layerL;
00295   DDLogicalPart layerOut(solid.ddname(), matter, solid);
00296   DDpos (layerOut, layer, 1, DDTranslation(0.0, 0.0, 0.0), DDRotation());
00297   LogDebug("TIBGeom") << "DDTIBLayerAlgo_MTCC test: " << layerOut.name() 
00298                       << " number 1 positioned in " << layer.name()
00299                       << " at (0,0,0) with no rotation";
00300   
00301   rposdet = radiusUp + roffDetUp;
00302   rposcab = rposdet + roffCableUp;
00303   dphi    = twopi/stringsUp;
00304   DDName detOut(DDSplit(detectorUp).first, DDSplit(detectorUp).second);
00305   DDName cabOut(DDSplit(coolCableUp).first, DDSplit(coolCableUp).second);
00306   for (int n = 0; n < stringsUp; n++) {
00307     double phi    = phioffUp + n*dphi;
00308     if( phi>=phiMinUp && phi<phiMaxUp ) { // phi range
00309       double phix   = phi - detectorTilt - 90*deg;
00310       double phideg = phix/deg;
00311       DDRotation rotation;
00312       if (phideg != 0) {
00313         double theta  = 90*deg;
00314         double phiy   = phix + 90.*deg;
00315         std::string rotstr = idName + dbl_to_string(phideg*10.);
00316         rotation = DDRotation(DDName(rotstr, idNameSpace));
00317         if (!rotation) {
00318           LogDebug("TIBGeom") << "DDTIBLayer_MTCC test: Creating a new "
00319                               << "rotation: " << rotstr << "\t90., " 
00320                               << phix/deg << ", 90.," << phiy/deg << ", 0, 0";
00321           rotation = DDrot(DDName(rotstr, idNameSpace), theta,phix, theta,phiy,
00322                            0., 0.);
00323         }
00324       }
00325       
00326       // fill strings in the stringUpList with modules, the others with only structure
00327       bool empty=true;
00328       for(unsigned int i=0; i<stringUpList.size(); i++) {
00329         if(n+1==(int)stringUpList[i]) {
00330           empty=false;
00331         }
00332       }
00333       if(empty) {
00334         if(emptyDetectorUp!="nothing") {
00335           DDName emptyDetOut(DDSplit(emptyDetectorUp).first, DDSplit(emptyDetectorUp).second);
00336           DDTranslation trdet(rposdet*cos(phi), rposdet*sin(phi), 0);
00337           DDpos (emptyDetOut, layerOut, n+1, trdet, rotation);
00338           LogDebug("TIBGeom") << "DDTIBLayer test " << emptyDetOut.name()
00339                               << " number " << n+1 << " positioned in " 
00340                               << layerOut.name() << " at " << trdet 
00341                               << " with " << rotation;
00342           
00343         }
00344         if(emptyCoolCableUp!="nothing") {
00345           DDName emptyCabOut(DDSplit(emptyCoolCableUp).first, DDSplit(emptyCoolCableUp).second);
00346           DDTranslation trcab(rposcab*cos(phi), rposcab*sin(phi), 0);
00347           DDpos (emptyCabOut, layerOut, n+1, trcab, rotation);
00348           LogDebug("TIBGeom") << "DDTIBLayer_MTCC test " << emptyCabOut.name()
00349                               << " number " << n+1 << " positioned in " 
00350                               << layerOut.name() << " at " << trcab 
00351                               << " with " << rotation;
00352         }
00353       } else {
00354         DDTranslation trdet(rposdet*cos(phi), rposdet*sin(phi), 0);
00355         DDpos (detOut, layerOut, n+1, trdet, rotation);
00356         LogDebug("TIBGeom") << "DDTIBLayer test " << detOut.name() 
00357                             << " number " << n+1 << " positioned in " 
00358                             << layerOut.name() << " at " << trdet 
00359                             << " with " << rotation;
00360         DDTranslation trcab(rposcab*cos(phi), rposcab*sin(phi), 0);
00361         DDpos (cabOut, layerOut, n+1, trcab, rotation);
00362         LogDebug("TIBGeom") << "DDTIBLayer_MTCC test " << cabOut.name() 
00363                             << " number " << n+1 << " positioned in " 
00364                             << layerOut.name() << " at " << trcab 
00365                             << " with " << rotation;
00366       }
00367       //
00368       
00369     } // phi range
00370     
00371   }
00372   
00373   double phiMin  = phiMinUp-phioffUp;   // lower phi for cylinders
00374   double phiMax  = phiMaxUp-phioffUp;   // upper phi for cylinders
00375   double phidiff = fabs(phiMax-phiMin); // cylinders will not be twopi but phidiff
00376   //Finally the inner cylinder, support wall and ribs
00377   rin  = 0.5*(radiusLo+radiusUp-cylinderT);
00378   rout = 0.5*(radiusLo+radiusUp+cylinderT);
00379   name = idName + "Cylinder";
00380   solid = DDSolidFactory::tubs(DDName(name, idNameSpace), 0.25*layerL,
00381                                rin, rout, phiMin, phidiff);
00382   LogDebug("TIBGeom") << "DDTIBLayerAlgo_MTCC test: " 
00383                       << DDName(name, idNameSpace) << " Tubs made of " 
00384                       << cylinderMat << " from " << phiMin/deg << " to "
00385                       << (phiMin+phidiff)/deg << " with Rin " << rin 
00386                       << " Rout " << rout << " ZHalf " << 0.25*layerL;
00387   matname = DDName(DDSplit(cylinderMat).first, DDSplit(cylinderMat).second);
00388   DDMaterial matcyl(matname);
00389   DDLogicalPart cylinder(solid.ddname(), matcyl, solid);
00390   DDpos (cylinder, layer, 1, DDTranslation(0.0,0.0,0.25*layerL), DDRotation());
00391   LogDebug("TIBGeom") << "DDTIBLayerAlgo_MTCC test: " << cylinder.name() 
00392                       << " number 1 positioned in " << layer.name()
00393                       << " at (0,0," << 0.25*layerL << ") with no rotation";
00394   rin  += supportT;
00395   rout -= supportT;
00396   name  = idName + "CylinderIn";
00397   solid = DDSolidFactory::tubs(DDName(name, idNameSpace), 0.5*layerL,
00398                                rin, rout, phiMin, phidiff);
00399   LogDebug("TIBGeom") << "DDTIBLayerAlgo_MTCC test: " 
00400                       << DDName(name, idNameSpace) << " Tubs made of " 
00401                       << genMat << " from " << phiMin/deg << " to " 
00402                       << (phiMin+phidiff)/deg << phidiff/deg << " with Rin " 
00403                       << rin << " Rout " << rout << " ZHalf " << 0.5*layerL;
00404   DDLogicalPart cylinderIn(solid.ddname(), matter, solid);
00405   DDpos (cylinderIn, cylinder, 1, DDTranslation(0.0, 0.0, -0.25*layerL), DDRotation());
00406   LogDebug("TIBGeom") << "DDTIBLayerAlgo_MTCC test: " << cylinderIn.name() 
00407                       << " number 1 positioned in " << cylinder.name()
00408                       << " at (0,0," << -0.25*layerL << ") with no rotation";
00409   name  = idName + "CylinderInSup";
00410   solid = DDSolidFactory::tubs(DDName(name, idNameSpace), 0.5*supportW,
00411                                rin, rout, phiMin, phidiff);
00412   LogDebug("TIBGeom") << "DDTIBLayerAlgo_MTCC test: " 
00413                       << DDName(name, idNameSpace) << " Tubs made of " 
00414                       << genMat << " from " << phiMin/deg << " to " 
00415                       << (phiMin+phidiff)/deg << " with Rin " << rin 
00416                       << " Rout " << rout << " ZHalf " << 0.5*supportW;
00417   matname = DDName(DDSplit(supportMat).first, DDSplit(supportMat).second);
00418   DDMaterial matsup(matname);
00419   DDLogicalPart cylinderSup(solid.ddname(), matsup, solid);
00420   DDpos (cylinderSup, cylinderIn, 1, DDTranslation(0., 0., 0.), DDRotation());
00421   LogDebug("TIBGeom") << "DDTIBLayerAlgo_MTCC test: " << cylinderSup.name() 
00422                       << " number 1 positioned in " << cylinderIn.name()
00423                       << " at (0,0,0) with no rotation";
00424   matname = DDName(DDSplit(ribMat).first, DDSplit(ribMat).second);
00425   DDMaterial matrib(matname);
00426   for (unsigned int i = 0; i < ribW.size(); i++) {
00427     name = idName + "Rib" + dbl_to_string(i);
00428     double width = 2.*ribW[i]/(rin+rout);
00429     double dz    = 0.25*(layerL - supportW);
00430     solid = DDSolidFactory::tubs(DDName(name, idNameSpace), dz, rin, rout, 
00431                                  -0.5*width, width);
00432     LogDebug("TIBGeom") << "DDTIBLayerAlgo_MTCC test: " 
00433                         << DDName(name, idNameSpace) << " Tubs made of " 
00434                         << ribMat << " from " << -0.5*width/deg
00435                         << " to " << 0.5*width/deg << " with Rin " << rin 
00436                         << " Rout " << rout << " ZHalf "  << dz;
00437     DDLogicalPart cylinderRib(solid.ddname(), matrib, solid);
00438     double phix   = ribPhi[i];
00439     double phideg = phix/deg;
00440     if( phideg>=phiMin/deg && phideg<phiMax/deg ) { // phi range
00441       DDRotation rotation;
00442       if (phideg != 0) {
00443         double theta  = 90*deg;
00444         double phiy   = phix + 90.*deg;
00445         std::string rotstr = idName + dbl_to_string(phideg*10.);
00446         rotation = DDRotation(DDName(rotstr, idNameSpace));
00447         if (!rotation) {
00448           LogDebug("TIBGeom") << "DDTIBLayer_MTCC test: Creating a new "
00449                               << "rotation: " << rotstr << "\t90., " 
00450                               << phix/deg << ", 90.," << phiy/deg << ", 0, 0";
00451           rotation = DDrot(DDName(rotstr, idNameSpace), theta,phix, theta,phiy,
00452                            0., 0.);
00453         }
00454       }
00455       DDTranslation tran(0, 0, +0.25*(layerL+supportW));
00456       DDpos (cylinderRib, cylinderIn, 1, tran, rotation);
00457       LogDebug("TIBGeom") << "DDTIBLayer_MTCC test " << cylinderRib.name() 
00458                           << " number 1 positioned in " << cylinderIn.name() 
00459                           << " at " << tran << " with " << rotation;
00460     } // phi range
00461   }
00462 
00463   
00464   // DOHM + carrier (portadohm)
00465   double dz_dohm    = 0.5*dohmCarrierW;
00466   double dphi_dohm  = twopi/((double)dohmN);
00467   double rout_dohm  = 0.5*(radiusLo+radiusUp+cylinderT)+dohmCarrierR;
00468   
00469   // DOHM Carrier TIB+ & TIB-
00470   // lower
00471   name = idName + "DOHMCarrier_lo";
00472   double rin_lo  = rout_dohm;
00473   double rout_lo = rin_lo + dohmCarrierT;
00474   solid = DDSolidFactory::tubs(DDName(name, idNameSpace), dz_dohm, 
00475                                rin_lo, rout_lo, 
00476                                -0.5*dphi_dohm, dphi_dohm);
00477   LogDebug("TIBGeom") << "DDTIBLayerAlgo_MTCC test: " 
00478                       << DDName(name, idNameSpace) << " Tubs made of " 
00479                       << dohmCarrierMaterial << " from " 
00480                       << -0.5*(dphi_dohm)/deg << " to " 
00481                       << -0.5*(dphi_dohm)/deg+dphi_dohm/deg << " with Rin " 
00482                       << rin_lo << " Rout " << rout_lo << " ZHalf "  
00483                       << dz_dohm;
00484   // create different name objects for only PRIMary DOHMs and PRIMary+AUXiliary DOHM Carriers
00485   std::string name_lo_r = name + "_PRIM_AUX" + "_lo" + "_r";
00486   std::string name_lo_l = name + "_PRIM_AUX" + "_lo" + "_l";
00487   DDLogicalPart dohmCarrierPrimAux_lo_r(name_lo_r, DDMaterial(dohmCarrierMaterial), solid);
00488   DDLogicalPart dohmCarrierPrimAux_lo_l(name_lo_l, DDMaterial(dohmCarrierMaterial), solid);
00489   name_lo_r = name + "_PRIM" + "_lo" + "_r";
00490   name_lo_l = name + "_PRIM" + "_lo" + "_l";
00491   DDLogicalPart dohmCarrierPrim_lo_r(name_lo_r, DDMaterial(dohmCarrierMaterial), solid);
00492   DDLogicalPart dohmCarrierPrim_lo_l(name_lo_l, DDMaterial(dohmCarrierMaterial), solid);
00493   // upper
00494   name = idName + "DOHMCarrier_up";
00495   double rin_up  = rout_lo + 2.*dohmAuxT;
00496   double rout_up = rin_up + dohmCarrierT;
00497   solid = DDSolidFactory::tubs(DDName(name, idNameSpace), dz_dohm, 
00498                                rin_up, rout_up, 
00499                                -0.5*dphi_dohm, dphi_dohm);
00500   LogDebug("TIBGeom") << "DDTIBLayerAlgo_MTCC test: " 
00501                       << DDName(name, idNameSpace) << " Tubs made of " 
00502                       << dohmCarrierMaterial << " from " 
00503                       << -0.5*(dphi_dohm)/deg << " to " 
00504                       << -0.5*(dphi_dohm)/deg+dphi_dohm/deg << " with Rin " 
00505                       << rin_up << " Rout " << rout_up << " ZHalf "
00506                       << dz_dohm;
00507   // create different name objects for only PRIMary DOHMs and PRIMary+AUXiliary DOHM Carriers
00508   std::string name_up_r = name + "_PRIM_AUX" + "_up" + "_r";
00509   std::string name_up_l = name + "_PRIM_AUX" + "_up" + "_l";
00510   DDLogicalPart dohmCarrierPrimAux_up_r(name_up_r, DDMaterial(dohmCarrierMaterial), solid);
00511   DDLogicalPart dohmCarrierPrimAux_up_l(name_up_l, DDMaterial(dohmCarrierMaterial), solid);
00512   name_up_r = name + "_PRIM" + "_up" + "_r";
00513   name_up_l = name + "_PRIM" + "_up" + "_l";
00514   DDLogicalPart dohmCarrierPrim_up_r(name_up_r, DDMaterial(dohmCarrierMaterial), solid);
00515   DDLogicalPart dohmCarrierPrim_up_l(name_up_l, DDMaterial(dohmCarrierMaterial), solid);
00516   //
00517   for (unsigned int i = 0; i < (unsigned int)dohmN; i++) {
00518     DDLogicalPart dohmCarrier_lo_r;
00519     DDLogicalPart dohmCarrier_lo_l;
00520     DDLogicalPart dohmCarrier_up_r;
00521     DDLogicalPart dohmCarrier_up_l;
00522     // create different name objects for only PRIMary DOHMs and PRIMary+AUXiliary DOHMs
00523     bool prim = false;
00524     bool aux  = false;
00525     if((unsigned int)dohmList[i]==2) {
00526       prim = true;
00527       aux  = true;
00528     } else if((unsigned int)dohmList[i]==1) {
00529       prim = true;
00530       aux  = false;
00531     } else {
00532       prim = false;
00533       aux  = false;      
00534     }
00535     
00536     if(prim) {
00537       dohmCarrier_lo_r = dohmCarrierPrim_lo_r;
00538       dohmCarrier_lo_l = dohmCarrierPrim_lo_l;
00539       dohmCarrier_up_r = dohmCarrierPrim_up_r;
00540       dohmCarrier_up_l = dohmCarrierPrim_up_l;
00541     }
00542     if(prim && aux) {
00543       dohmCarrier_lo_r = dohmCarrierPrimAux_lo_r;
00544       dohmCarrier_lo_l = dohmCarrierPrimAux_lo_l;
00545       dohmCarrier_up_r = dohmCarrierPrimAux_up_r;
00546       dohmCarrier_up_l = dohmCarrierPrimAux_up_l;
00547     }
00548     //
00549     
00550     if(prim) {
00551       double phix   = ((double)i+0.5)*dphi_dohm;
00552       double phideg = phix/deg;
00553       //    if( phideg>=phiMin/deg && phideg<phiMax/deg ) { // phi range
00554       DDRotation rotation;
00555       if (phideg != 0) {
00556         double theta  = 90*deg;
00557         double phiy   = phix + 90.*deg;
00558         std::string rotstr = idName + dbl_to_string(phideg*10.);
00559         rotation = DDRotation(DDName(rotstr, idNameSpace));
00560         if (!rotation) {
00561           LogDebug("TIBGeom") << "DDTIBLayer_MTCC test: Creating a new "
00562                               << "rotation: " << rotstr << "\t90., " 
00563                               << phix/deg << ", 90.," << phiy/deg << ", 0, 0";
00564           rotation = DDrot(DDName(rotstr, idNameSpace), theta,phix, theta,phiy,
00565                            0., 0.);
00566         }
00567       }
00568       // TIB+ DOHM Carrier - lower
00569       DDTranslation tran(0, 0, 0.5*layerL-dz_dohm);
00570       DDpos (dohmCarrier_lo_r, parent(), i+1, tran, rotation );
00571       LogDebug("TIBGeom") << "DDTIBLayer_MTCC test " << dohmCarrier_lo_r.name()
00572                           << " z+ number " << i+1 << " positioned in " 
00573                           << parent().name() << " at " << tran
00574                           << " with " << rotation;
00575       // TIB+ DOHM Carrier - upper
00576       DDpos (dohmCarrier_up_r, parent(), i+1+(unsigned int)dohmN, tran, rotation );
00577       LogDebug("TIBGeom") << "DDTIBLayer_MTCC test " << dohmCarrier_up_r.name()
00578                           << " z+ number " << i+1 << " positioned in " 
00579                           << parent().name() << " at " << tran
00580                           << " with " << rotation;
00581     }
00582     
00583     //    } // phi range
00584   }
00585   
00586   
00587   // DOHM only PRIMary
00588   double dx = 0.5*dohmPrimT;
00589   double dy = 0.5*dohmPrimW;
00590   double dz = 0.5*dohmPrimL;
00591   name = idName + "DOHM_PRIM";
00592   solid = DDSolidFactory::box(DDName(name, idNameSpace), dx, dy, dz);
00593   DDLogicalPart dohmPrim(solid.ddname(), DDMaterial(dohmPrimMaterial), solid);
00594   LogDebug("TIBGeom") << "DDTIBLayerAlgo_MTCC test: "
00595                       << DDName(name, idNameSpace) << " Box made of " 
00596                       << dohmPrimMaterial << " of dimensions " << dx << ", " 
00597                       << dy << ", " << dz;
00598   name = idName + "DOHM_PRIM_Cable";
00599   double dx_cable = 0.25*dohmPrimT;
00600   double dy_cable = 0.40*dohmPrimW;
00601   double dz_cable = 0.5*dohmPrimL;
00602   solid = DDSolidFactory::box(DDName(name, idNameSpace), dx_cable, dy_cable, dz_cable);
00603   DDLogicalPart dohmCablePrim(solid.ddname(), DDMaterial(dohmCableMaterial), solid);
00604   LogDebug("TIBGeom") << "DDTIBLayerAlgo_MTCC test: "
00605                       << DDName(name, idNameSpace) << " Box made of "
00606                       << dohmCableMaterial << " of dimensions " << dx_cable
00607                       << ", " << dy_cable << ", " << dz_cable;
00608   // TIB+ DOHM
00609   DDTranslation tran(rout_dohm+0.5*dohmPrimT, 0. , 0.);
00610   DDpos (dohmPrim, dohmCarrierPrim_lo_r, 1, tran, DDRotation() );
00611   LogDebug("TIBGeom") << "DDTIBLayer_MTCC test " << dohmPrim.name() 
00612                       << " z+ number " << 1 << " positioned in " 
00613                       << dohmCarrierPrim_lo_r.name() << " at " << tran 
00614                       << " with no rotation";
00615   tran = DDTranslation(rout_dohm+dx_cable, 0.5*dohmPrimW , 0.);
00616   DDpos (dohmCablePrim, dohmCarrierPrim_lo_r, 1, tran, DDRotation() );
00617   LogDebug("TIBGeom") << "DDTIBLayer_MTCC test " << dohmCablePrim.name() 
00618                       << " copy number " << 1 << " positioned in "
00619                       << dohmCarrierPrim_lo_r.name()
00620                       << " at " << tran << " with no rotation";
00621   tran = DDTranslation(rout_dohm+dx_cable, -0.5*dohmPrimW , 0.);
00622   DDpos (dohmCablePrim, dohmCarrierPrim_lo_r, 2, tran, DDRotation() );
00623   LogDebug("TIBGeom") << "DDTIBLayer_MTCC test " << dohmCablePrim.name()
00624                       << " copy number " << 2 << " positioned in " 
00625                       << dohmCarrierPrim_lo_r.name()
00626                       << " at " << tran << " with no rotation";
00627   
00628   // DOHM PRIMary + AUXiliary
00629   dx = 0.5*dohmPrimT;
00630   dy = 0.5*dohmPrimW;
00631   dz = 0.5*dohmPrimL;
00632   name = idName + "DOHM_PRIM";
00633   solid = DDSolidFactory::box(DDName(name, idNameSpace), dx, dy, dz);
00634   LogDebug("TIBGeom") << "DDTIBLayerAlgo_MTCC test: " 
00635                       << DDName(name, idNameSpace) << " Box made of "
00636                       << dohmPrimMaterial << " of dimensions " << dx << ", " 
00637                       << dy << ", " << dz;
00638   dohmPrim = DDLogicalPart(solid.ddname(), DDMaterial(dohmPrimMaterial), solid);
00639   name = idName + "DOHM_PRIM_Cable";
00640   dx_cable = 0.25*dohmPrimT;
00641   dy_cable = 0.40*dohmPrimW;
00642   dz_cable = 0.5*dohmPrimL;
00643   solid = DDSolidFactory::box(DDName(name, idNameSpace), dx_cable, dy_cable, dz_cable);
00644   dohmCablePrim = DDLogicalPart(solid.ddname(), DDMaterial(dohmCableMaterial), solid);
00645   LogDebug("TIBGeom") << "DDTIBLayerAlgo_MTCC test: "
00646                       << DDName(name, idNameSpace) << " Box made of " 
00647                       << dohmCableMaterial << " of dimensions " << dx_cable 
00648                       << ", " << dy_cable << ", " << dz_cable;
00649   dx = 0.5*dohmAuxT;
00650   dy = 0.5*dohmAuxW;
00651   dz = 0.5*dohmAuxL;
00652   name = idName + "DOHM_AUX";
00653   solid = DDSolidFactory::box(DDName(name, idNameSpace), dx, dy, dz);
00654   DDLogicalPart dohmAux(solid.ddname(), DDMaterial(dohmAuxMaterial), solid);
00655   LogDebug("TIBGeom") << "DDTIBLayerAlgo_MTCC test: " 
00656                       << DDName(name, idNameSpace) << " Box made of " 
00657                       << dohmAuxMaterial << " of dimensions " << dx << ", " 
00658                       << dy << ", " << dz;
00659   name = idName + "DOHM_AUX_Cable";
00660   solid = DDSolidFactory::box(DDName(name, idNameSpace), dx_cable, dy_cable, dz_cable);
00661   DDLogicalPart dohmCableAux(solid.ddname(), DDMaterial(dohmCableMaterial), solid);
00662   LogDebug("TIBGeom") << "DDTIBLayerAlgo_MTCC test: " 
00663                       << DDName(name, idNameSpace) << " Box made of " 
00664                       << dohmCableMaterial << " of dimensions " << dx_cable 
00665                       << ", " << dy_cable << ", " << dz_cable;
00666   // TIB+ DOHM
00667   tran = DDTranslation(rout_dohm+0.5*dohmPrimT, -0.75*dohmPrimW , 0.);
00668   DDpos (dohmPrim, dohmCarrierPrimAux_lo_r, 1, tran, DDRotation() );
00669   LogDebug("TIBGeom") << "DDTIBLayer_MTCC test " << dohmAux.name() 
00670                       << " z+ number " << 1 << " positioned in " 
00671                       << dohmCarrierPrimAux_lo_r.name() << " at " << tran 
00672                       << " with no rotation";
00673   tran = DDTranslation(rout_dohm+dx_cable, -0.75*dohmPrimW+0.5*dohmPrimW , 0.);
00674   DDpos (dohmCablePrim, dohmCarrierPrimAux_lo_r, 1, tran, DDRotation() );
00675   LogDebug("TIBGeom") << "DDTIBLayer_MTCC test " << dohmCablePrim.name() 
00676                       << " copy number " << 1 << " positioned in " 
00677                       << dohmCarrierPrimAux_lo_r.name() << " at " << tran 
00678                       << " with no rotation";
00679   tran = DDTranslation(rout_dohm+dx_cable, -0.75*dohmPrimW-0.5*dohmPrimW , 0.);
00680   DDpos (dohmCablePrim, dohmCarrierPrimAux_lo_r, 2, tran, DDRotation() );
00681   LogDebug("TIBGeom") << "DDTIBLayer_MTCC test " << dohmCablePrim.name() 
00682                       << " copy number " << 2 << " positioned in "
00683                       << dohmCarrierPrimAux_lo_r.name() << " at " << tran 
00684                       << " with no rotation";
00685   tran = DDTranslation(rout_dohm+0.5*dohmAuxT, 0.75*dohmAuxW , 0.);
00686   DDpos (dohmAux, dohmCarrierPrimAux_lo_r, 1, tran, DDRotation() );
00687   LogDebug("TIBGeom") << "DDTIBLayer_MTCC test " << dohmAux.name() 
00688                       << " z+ number " << 1 << " positioned in " 
00689                       << dohmCarrierPrimAux_lo_r.name()
00690                       << " at (0,0,0) with no rotation";
00691   tran = DDTranslation(rout_dohm+dx_cable, 0.75*dohmAuxW+0.5*dohmPrimW , 0.);
00692   DDpos (dohmCableAux, dohmCarrierPrimAux_lo_r, 1, tran, DDRotation() );
00693   LogDebug("TIBGeom") << "DDTIBLayer_MTCC test " << dohmCableAux.name() 
00694                       << " copy number " << 1 << " positioned in " 
00695                       << dohmCarrierPrimAux_lo_r.name()
00696                       << " at " << tran << " with no rotation";
00697 }

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