CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_10_patch1/src/Geometry/MTCCTrackerCommonData/plugins/DDTIBRadCableAlgo_MTCC.cc

Go to the documentation of this file.
00001 
00002 // File: DDTIBRadCableAlgo_MTCC.cc
00003 // Description: Equipping the side disks of TIB with cables etc
00005 
00006 #include <cmath>
00007 #include <algorithm>
00008 
00009 #include "FWCore/MessageLogger/interface/MessageLogger.h"
00010 #include "DetectorDescription/Base/interface/DDdebug.h"
00011 #include "DetectorDescription/Base/interface/DDutils.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/plugins/DDTIBRadCableAlgo_MTCC.h"
00018 #include "CLHEP/Units/GlobalPhysicalConstants.h"
00019 #include "CLHEP/Units/GlobalSystemOfUnits.h"
00020 
00021 DDTIBRadCableAlgo_MTCC::DDTIBRadCableAlgo_MTCC(): layRin(0),cableMat(0),strucMat(0), layers(0) {
00022   LogDebug("TIBGeom") << "DDTIBRadCableAlgo_MTCC info: Creating an instance";
00023 }
00024 
00025 DDTIBRadCableAlgo_MTCC::~DDTIBRadCableAlgo_MTCC() {}
00026 
00027 void DDTIBRadCableAlgo_MTCC::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   unsigned int i;
00035   DDName parentName = parent().name();
00036   LogDebug("TIBGeom") << "DDTIBRadCableAlgo_MTCC debug: Parent " << parentName 
00037                       << " NameSpace " << idNameSpace;
00038 
00039   rMin         = nArgs["RMin"];
00040   rMax         = nArgs["RMax"];
00041   layRin       = vArgs["RadiusLo"];    
00042   deltaR       = nArgs["DeltaR"];
00043   LogDebug("TIBGeom") << "DDTIBRadCableAlgo_MTCC debug: Disk Rmin " << rMin
00044                       << "\tRMax " << rMax  << "\tSeparation of layers " 
00045                       << deltaR <<" with " << layRin.size() <<" layers at R =";
00046   for (i = 0; i < layRin.size(); i++)
00047     LogDebug("TIBGeom") << " " << i << " : " << layRin[i];
00048   
00049   cylinderT    = nArgs["CylinderThick"];
00050   supportT     = nArgs["SupportThick"];
00051   supportDR    = nArgs["SupportDR"];
00052   supportMat   = sArgs["SupportMaterial"];
00053   LogDebug("TIBGeom") << "DDTIBRadCableAlgo_MTCC debug: SupportCylinder "
00054                       << "Thickness " << cylinderT << "\tSupportDisk "
00055                       << "Thickness " << supportT << "\tExtra width along R " 
00056                       << supportDR << "\tMaterial: " << supportMat;
00057 
00058   cableT       = nArgs["CableThick"];     
00059   cableMat     = vsArgs["CableMaterial"];
00060   LogDebug("TIBGeom") << "DDTIBRadCableAlgo_MTCC debug: Cable Thickness "
00061                       << cableT  << " with materials: ";
00062   for (i = 0; i < cableMat.size(); i++)
00063     LogDebug("TIBGeom") << " " << i << " : " << cableMat[i];
00064 
00065   strucMat     = vsArgs["StructureMaterial"];
00066   LogDebug("TIBGeom") << "DDTIBRadCableAlgo_MTCC debug: " << strucMat.size()
00067                       << " materials for open structure:";
00068   for (i=0; i<strucMat.size(); i++)
00069     LogDebug("TIBGeom") << " " << i << " : " << strucMat[i];
00070   
00071   layers       = vArgs["Layers"];
00072   LogDebug("TIBGeom") << "DDTIBRadCableAlgo_MTCC debug: " << layers.size()
00073                       << " layers:";
00074   for (i=0; i<layers.size(); i++)
00075     LogDebug("TIBGeom") << " " << i << " : " << layers[i];
00076   
00077 }
00078 
00079 void DDTIBRadCableAlgo_MTCC::execute(DDCompactView& cpv) {
00080   
00081   LogDebug("TIBGeom") << "==>> Constructing DDTIBRadCableAlgo_MTCC...";
00082   DDName diskName = parent().name();
00083 
00084   DDSolid solid;
00085   std::string  name;
00086   double  rin, rout;
00087 
00088   // Loop over sub disks
00089   DDName suppName(DDSplit(supportMat).first, DDSplit(supportMat).second);
00090   DDMaterial suppMatter(suppName);
00091   double diskDz = 0.5 * (supportT + cableT*layRin.size());
00092   double dz     = 0.5*supportT;
00093 
00094   for (unsigned int i=0; i<layRin.size(); i++) {
00095 
00096     // fill only layers in layers list
00097     bool empty=true;
00098     for(unsigned int j=0; j<layers.size(); j++) {
00099       if(i+1==(unsigned int)layers[j]) {
00100         empty=false;
00101       }
00102     }
00103     
00104     if(!empty) {
00105       //Support disks
00106       name  = "TIBSupportSideDisk" + dbl_to_string(i);
00107       rin   = layRin[i]+0.5*(deltaR-cylinderT)-supportDR;
00108       rout  = layRin[i]+0.5*(deltaR+cylinderT)+supportDR;
00109       solid = DDSolidFactory::tubs(DDName(name, idNameSpace), dz, rin, 
00110                                    rout, 0, CLHEP::twopi);
00111       LogDebug("TIBGeom") << "DDTIBRadCableAlgo_MTCC test: " 
00112                           << DDName(name, idNameSpace) << " Tubs made of "
00113                           << supportMat << " from 0 to " 
00114                           << CLHEP::twopi/CLHEP::deg << " with Rin " << rin 
00115                           << " Rout " << rout << " ZHalf " << dz;
00116       DDLogicalPart suppLogic(DDName(name, idNameSpace), suppMatter, solid);
00117       
00118       DDTranslation r1(0, 0, (dz-diskDz));
00119       cpv.position(DDName(name,idNameSpace), diskName, i+1, r1, DDRotation());
00120       LogDebug("TIBGeom") << "DDTIBRadCableAlgo_MTCC test: " 
00121                           << DDName(name,idNameSpace) << " number " << i+1 
00122                           << " positioned in " << diskName << " at " << r1 
00123                           << " with no rotation";
00124       
00125       //Open Structure
00126       name  = "TIBOpenZone" + dbl_to_string(i);
00127       rout  = rin;
00128       if (i == 0) rin = rMin;
00129       else        rin = layRin[i-1]+0.5*(deltaR+cylinderT)+supportDR;
00130       solid = DDSolidFactory::tubs(DDName(name, idNameSpace), dz, rin, 
00131                                    rout, 0, CLHEP::twopi);
00132       LogDebug("TIBGeom") << "DDTIBRadCableAlgo_MTCC test: "
00133                           << DDName(name, idNameSpace) << " Tubs made of " 
00134                           << strucMat[i] << " from 0 to "
00135                           << CLHEP::twopi/CLHEP::deg << " with Rin " << rin 
00136                           << " Rout " << rout << " ZHalf " << dz;
00137       DDName strucName(DDSplit(strucMat[i]).first, DDSplit(strucMat[i]).second);
00138       DDMaterial strucMatter(strucName);
00139       DDLogicalPart strucLogic(DDName(name, idNameSpace), strucMatter, solid);
00140       
00141       DDTranslation r2(0, 0, (dz-diskDz));
00142       cpv.position(DDName(name,idNameSpace), diskName, i+1, r2, DDRotation());
00143       LogDebug("TIBGeom") << "DDTIBRadCableAlgo_MTCC test: " 
00144                           << DDName(name,idNameSpace) << " number " << i+1 
00145                           << " positioned in " << diskName 
00146                           << " at " << r2 << " with no rotation";
00147       
00148       //Now the radial cable
00149       name  = "TIBRadCable" + dbl_to_string(i);
00150       double rv = layRin[i]+0.5*deltaR;
00151       std::vector<double> pgonZ;
00152       pgonZ.push_back(-0.5*cableT); 
00153       pgonZ.push_back(cableT*(rv/rMax-0.5));
00154       pgonZ.push_back(0.5*cableT);
00155       std::vector<double> pgonRmin;
00156       pgonRmin.push_back(rv); 
00157       pgonRmin.push_back(rv); 
00158       pgonRmin.push_back(rv); 
00159       std::vector<double> pgonRmax;
00160       pgonRmax.push_back(rMax); 
00161       pgonRmax.push_back(rMax); 
00162       pgonRmax.push_back(rv); 
00163       solid = DDSolidFactory::polycone(DDName(name, idNameSpace), 0,
00164                                        CLHEP::twopi,pgonZ, pgonRmin, pgonRmax);
00165       LogDebug("TIBGeom") << "DDTIBRadCableAlgo_MTCC test: "
00166                           << DDName(name, idNameSpace) 
00167                           << " Polycone made of " << cableMat[i]
00168                           << " from 0 to " << CLHEP::twopi/CLHEP::deg 
00169                           << " and with " << pgonZ.size() << " sections";
00170       for (unsigned int ii = 0; ii <pgonZ.size(); ii++) 
00171         LogDebug("TIBGeom") << "\t" << "\tZ = " << pgonZ[ii] << "\tRmin = " 
00172                             << pgonRmin[ii] << "\tRmax = " << pgonRmax[ii];
00173       DDName cableName(DDSplit(cableMat[i]).first,DDSplit(cableMat[i]).second);
00174       LogDebug("TIBGeom") << " material cableName " << i << " " << cableName;
00175       DDMaterial cableMatter(cableName);
00176       DDLogicalPart cableLogic(DDName(name, idNameSpace), cableMatter, solid);
00177       
00178       DDTranslation r3(0, 0, (diskDz-(i+0.5)*cableT));
00179       cpv.position(DDName(name,idNameSpace), diskName, i+1, r3, DDRotation());
00180       LogDebug("TIBGeom") << "DDTIBRadCableAlgo_MTCC test: " 
00181                           << DDName(name,idNameSpace) << " number " << i+1
00182                           << " positioned in " << diskName << " at "
00183                           << r3 << " with no rotation";
00184       
00185     }
00186     //
00187     
00188     // fill only layers in layers list
00189     empty=true;
00190     for(unsigned int j=0; j<layers.size(); j++) {
00191       if(i+1==(unsigned int)layers[j]) {
00192         empty=false;
00193       }
00194     }
00195     
00196     if(!empty) {
00197       //Now the last open zone
00198       unsigned int i = layRin.size();
00199       rin  = layRin[i-1]+0.5*(deltaR+cylinderT)+supportDR;
00200       rout = rMax;
00201       name  = "TIBOpenZone" + dbl_to_string(i);
00202       solid = DDSolidFactory::tubs(DDName(name, idNameSpace), dz, rin, 
00203                                    rout, 0, CLHEP::twopi);
00204       LogDebug("TIBGeom") << "DDTIBRadCableAlgo_MTCC test: "
00205                           << DDName(name, idNameSpace) << " Tubs made of "
00206                           << strucMat[i] << " from 0 to " 
00207                           << CLHEP::twopi/CLHEP::deg << " with Rin " << rin 
00208                           << " Rout " << rout << " ZHalf " << dz;
00209       DDName strucName(DDSplit(strucMat[i]).first,DDSplit(strucMat[i]).second);
00210       DDMaterial strucMatter(strucName);
00211       DDLogicalPart strucLogic(DDName(name, idNameSpace), strucMatter, solid);
00212       
00213       DDTranslation r2(0, 0, (dz-diskDz));
00214       cpv.position(DDName(name,idNameSpace), diskName, i+1, r2, DDRotation());
00215       LogDebug("TIBGeom") << "DDTIBRadCableAlgo_MTCC test: "
00216                           << DDName(name,idNameSpace) << " number " << i+1 
00217                           << " positioned in " << diskName 
00218                           << " at " << r2 << " with no rotation";
00219     } 
00220   }
00221   LogDebug("TIBGeom") << "<<== End of DDTIBRadCableAlgo_MTCC construction ...";
00222  
00223 }