CMS 3D CMS Logo

/data/doxygen/doxygen-1.7.3/gen/CMSSW_4_2_8/src/Geometry/TrackerCommonData/src/DDTOBRadCableAlgo.cc

Go to the documentation of this file.
00001 
00002 // File: DDTOBRadCableAlgo.cc
00003 // Description: Equipping the side disks of TOB with cables etc
00005 
00006 #include <cmath>
00007 #include <algorithm>
00008 
00009 #include "FWCore/MessageLogger/interface/MessageLogger.h"
00010 #include "DetectorDescription/Core/interface/DDLogicalPart.h"
00011 #include "DetectorDescription/Core/interface/DDSolid.h"
00012 #include "DetectorDescription/Core/interface/DDMaterial.h"
00013 #include "DetectorDescription/Core/interface/DDCurrentNamespace.h"
00014 #include "DetectorDescription/Core/interface/DDSplit.h"
00015 #include "Geometry/TrackerCommonData/interface/DDTOBRadCableAlgo.h"
00016 #include "CLHEP/Units/GlobalPhysicalConstants.h"
00017 #include "CLHEP/Units/GlobalSystemOfUnits.h"
00018 
00019 
00020 DDTOBRadCableAlgo::DDTOBRadCableAlgo():
00021   rodRin(0),rodRout(0),cableM(0),connM(0),
00022   coolR1(0),coolR2(0),coolRin(0),coolRout1(0),coolRout2(0),
00023   coolStartPhi1(0),coolDeltaPhi1(0),
00024   coolStartPhi2(0),coolDeltaPhi2(0),
00025   names(0) {
00026   LogDebug("TOBGeom") <<"DDTOBRadCableAlgo info: Creating an instance";
00027 }
00028 
00029 DDTOBRadCableAlgo::~DDTOBRadCableAlgo() {}
00030 
00031 void DDTOBRadCableAlgo::initialize(const DDNumericArguments & nArgs,
00032                                    const DDVectorArguments & vArgs,
00033                                    const DDMapArguments &,
00034                                    const DDStringArguments & sArgs,
00035                                    const DDStringVectorArguments & vsArgs) {
00036 
00037   idNameSpace  = DDCurrentNamespace::ns();
00038   DDName parentName = parent().name();
00039   LogDebug("TOBGeom") << "DDTOBRadCableAlgo debug: Parent " << parentName
00040                       << " NameSpace " << idNameSpace;
00041 
00042   diskDz       = nArgs["DiskDz"];
00043   rMax         = nArgs["RMax"];
00044   cableT       = nArgs["CableT"];     
00045   rodRin       = vArgs["RodRin"];    
00046   rodRout      = vArgs["RodRout"];
00047   cableM       = vsArgs["CableMaterial"];
00048   LogDebug("TOBGeom") << "DDTOBRadCableAlgo debug: Disk Half width " << diskDz 
00049                       << "\tRMax " << rMax  << "\tCable Thickness " << cableT 
00050                       << "\tRadii of disk position and cable materials:";
00051   for (int i=0; i<(int)(rodRin.size()); i++)
00052     LogDebug("TOBGeom") << "\t[" << i << "]\tRin = " << rodRin[i] 
00053                         << "\tRout = " << rodRout[i] << "  " << cableM[i];
00054 
00055   connW        = nArgs["ConnW"];     
00056   connT        = nArgs["ConnT"];    
00057   connM        = vsArgs["ConnMaterial"];
00058   LogDebug("TOBGeom") << "DDTOBRadCableAlgo debug: Connector Width = " 
00059                       << connW << "\tThickness = " << connT 
00060                       << "\tMaterials: ";
00061   for (int i=0; i<(int)(connM.size()); i++)
00062     LogDebug("TOBGeom") << "\tconnM[" << i << "] = " << connM[i];
00063 
00064   coolR1        = vArgs["CoolR1"];
00065   coolR2        = vArgs["CoolR2"];
00066   coolRin       = nArgs["CoolRin"];
00067   coolRout1     = nArgs["CoolRout1"];
00068   coolRout2     = nArgs["CoolRout2"];
00069   coolStartPhi1 = nArgs["CoolStartPhi1"];
00070   coolDeltaPhi1 = nArgs["CoolDeltaPhi1"];
00071   coolStartPhi2 = nArgs["CoolStartPhi2"];
00072   coolDeltaPhi2 = nArgs["CoolDeltaPhi2"];
00073   coolM1        = sArgs["CoolMaterial1"];
00074   coolM2        = sArgs["CoolMaterial2"];
00075   LogDebug("TOBGeom") << "DDTOBRadCableAlgo debug: Cool Manifold Torus Rin = " << coolRin
00076                       << " Rout = " << coolRout1
00077                       << "\t Phi start = " << coolStartPhi1 << " Phi Range = " << coolDeltaPhi1
00078                       << "\t Material = " << coolM1
00079                       << "\t Radial positions:";
00080   for (int i=0; i<(int)(coolR1.size()); i++)
00081     LogDebug("TOBGeom") << "\t[" << i <<"]\tR = " << coolR1[i];
00082   for (int i=0; i<(int)(coolR2.size()); i++)
00083     LogDebug("TOBGeom") << "\t[" << i <<"]\tR = " << coolR2[i];
00084   LogDebug("TOBGeom") << "DDTOBRadCableAlgo debug: Cooling Fluid Torus Rin = " << coolRin
00085                       << " Rout = " << coolRout2
00086                       << "\t Phi start = " << coolStartPhi2 << " Phi Range = " << coolDeltaPhi2
00087                       << "\t Material = " << coolM2
00088                       << "\t Radial positions:";
00089   for (int i=0; i<(int)(coolR1.size()); i++)
00090     LogDebug("TOBGeom") << "\t[" << i <<"]\tR = " << coolR1[i];
00091   for (int i=0; i<(int)(coolR2.size()); i++)
00092     LogDebug("TOBGeom") << "\t[" << i <<"]\tR = " << coolR2[i];
00093   
00094   names        = vsArgs["RingName"];      
00095   for (int i=0; i<(int)(names.size()); i++)
00096     LogDebug("TOBGeom") << "DDTOBRadCableAlgo debug: names[" << i
00097                         << "] = " << names[i];
00098 }
00099 
00100 void DDTOBRadCableAlgo::execute(DDCompactView& cpv) {
00101   
00102   LogDebug("TOBGeom") << "==>> Constructing DDTOBRadCableAlgo...";
00103   DDName diskName = parent().name();
00104 
00105   // Loop over sub disks
00106   for (int i=0; i<(int)(names.size()); i++) {
00107 
00108     DDSolid solid;
00109     std::string  name;
00110     double  dz, rin, rout;
00111     
00112     // Cooling Manifolds
00113     name  = "TOBCoolingManifold" + names[i] + "a";
00114     dz    = coolRout1;
00115     DDName manifoldName_a(name, idNameSpace);
00116     solid = DDSolidFactory::torus(manifoldName_a,coolRin,coolRout1,coolR1[i],coolStartPhi1,coolDeltaPhi1);
00117     LogDebug("TOBGeom") << "DDTOBRadCableAlgo test: " 
00118                         << DDName(name, idNameSpace) << " Torus made of " 
00119                         << coolM1 << " from " << coolStartPhi1/CLHEP::deg 
00120                         << " to " << (coolStartPhi1+coolDeltaPhi1)/CLHEP::deg 
00121                         << " with Rin " << coolRin << " Rout " << coolRout1
00122                         << " R torus " << coolR1[i];
00123     DDName coolManifoldName_a(DDSplit(coolM1).first, DDSplit(coolM1).second);
00124     DDMaterial coolManifoldMatter_a(coolManifoldName_a);
00125     DDLogicalPart coolManifoldLogic_a(DDName(name, idNameSpace), 
00126                                       coolManifoldMatter_a, solid);
00127     
00128     DDTranslation r1(0, 0, (dz-diskDz));
00129     cpv.position(DDName(name,idNameSpace), diskName, i+1, r1, DDRotation());
00130     LogDebug("TOBGeom") << "DDTOBRadCableAlgo test: " 
00131                         << DDName(name,idNameSpace) << " number " << i+1 
00132                         << " positioned in " << diskName << " at " << r1
00133                         << " with no rotation";
00134     // Cooling Fluid (in Cooling Manifold)
00135     name  = "TOBCoolingManifoldFluid" + names[i] + "a";
00136     solid = DDSolidFactory::torus(DDName(name, idNameSpace),coolRin,coolRout2,
00137                                   coolR1[i],coolStartPhi2,coolDeltaPhi2);
00138     LogDebug("TOBGeom") << "DDTOBRadCableAlgo test: " 
00139                         << DDName(name, idNameSpace) << " Torus made of " 
00140                         << coolM2 << " from " << coolStartPhi2/CLHEP::deg 
00141                         << " to " << (coolStartPhi2+coolDeltaPhi2)/CLHEP::deg 
00142                         << " with Rin " << coolRin << " Rout " << coolRout2
00143                         << " R torus " << coolR1[i];
00144     DDName coolManifoldFluidName_a(DDSplit(coolM2).first, 
00145                                    DDSplit(coolM2).second);
00146     DDMaterial coolManifoldFluidMatter_a(coolManifoldFluidName_a);
00147     DDLogicalPart coolManifoldFluidLogic_a(DDName(name, idNameSpace),
00148                                            coolManifoldFluidMatter_a, solid);
00149     cpv.position(DDName(name,idNameSpace), manifoldName_a, i+1, DDTranslation(),
00150           DDRotation());
00151     LogDebug("TOBGeom") << "DDTOBRadCableAlgo test: " 
00152                         << DDName(name,idNameSpace) << " number " << i+1 
00153                         << " positioned in " << coolManifoldName_a
00154                         << " with no translation and no rotation";
00155     //
00156     name  = "TOBCoolingManifold" + names[i] + "r";
00157     dz    = coolRout1;
00158     DDName manifoldName_r(name, idNameSpace);
00159     solid = DDSolidFactory::torus(manifoldName_r,coolRin,coolRout1,coolR2[i],
00160                                   coolStartPhi1,coolDeltaPhi1);
00161     LogDebug("TOBGeom") << "DDTOBRadCableAlgo test: " 
00162                         << DDName(name, idNameSpace) << " Torus made of " 
00163                         << coolM1 << " from " << coolStartPhi1/CLHEP::deg 
00164                         << " to " << (coolStartPhi1+coolDeltaPhi1)/CLHEP::deg 
00165                         << " with Rin " << coolRin << " Rout " << coolRout1
00166                         << " R torus " << coolR2[i];
00167     DDName coolManifoldName_r(DDSplit(coolM1).first, DDSplit(coolM1).second);
00168     DDMaterial coolManifoldMatter_r(coolManifoldName_r);
00169     DDLogicalPart coolManifoldLogic_r(DDName(name, idNameSpace), 
00170                                       coolManifoldMatter_r, solid);
00171     
00172     r1 = DDTranslation(0, 0, (dz-diskDz));
00173     cpv.position(DDName(name,idNameSpace), diskName, i+1, r1, DDRotation());
00174     LogDebug("TOBGeom") << "DDTOBRadCableAlgo test: " 
00175                         << DDName(name,idNameSpace) << " number " << i+1 
00176                         << " positioned in " << diskName << " at " << r1
00177                         << " with no rotation";
00178     // Cooling Fluid (in Cooling Manifold)
00179     name  = "TOBCoolingManifoldFluid" + names[i] + "r";
00180     solid = DDSolidFactory::torus(DDName(name, idNameSpace),coolRin,coolRout2,
00181                                   coolR2[i],coolStartPhi2,coolDeltaPhi2);
00182     LogDebug("TOBGeom") << "DDTOBRadCableAlgo test: " 
00183                         << DDName(name, idNameSpace) << " Torus made of " 
00184                         << coolM2 << " from " << coolStartPhi2/CLHEP::deg 
00185                         << " to " << (coolStartPhi2+coolDeltaPhi2)/CLHEP::deg 
00186                         << " with Rin " << coolRin << " Rout " << coolRout2
00187                         << " R torus " << coolR2[i];
00188     DDName coolManifoldFluidName_r(DDSplit(coolM2).first, 
00189                                    DDSplit(coolM2).second);
00190     DDMaterial coolManifoldFluidMatter_r(coolManifoldFluidName_r);
00191     DDLogicalPart coolManifoldFluidLogic_r(DDName(name, idNameSpace), 
00192                                            coolManifoldFluidMatter_r, solid);
00193     cpv.position(DDName(name,idNameSpace), manifoldName_r, i+1, DDTranslation(), 
00194           DDRotation());
00195     LogDebug("TOBGeom") << "DDTOBRadCableAlgo test: " 
00196                         << DDName(name,idNameSpace) << " number " << i+1 
00197                         << " positioned in " << coolManifoldName_r
00198                         << " with no translation and no rotation";
00199     
00200     // Connectors
00201     name  = "TOBConn" + names[i];
00202     dz    = 0.5*connT;
00203     rin   = 0.5*(rodRin[i]+rodRout[i])-0.5*connW;
00204     rout  = 0.5*(rodRin[i]+rodRout[i])+0.5*connW;
00205     solid = DDSolidFactory::tubs(DDName(name, idNameSpace), dz, rin, 
00206                                  rout, 0, CLHEP::twopi);
00207     LogDebug("TOBGeom") << "DDTOBRadCableAlgo test: " 
00208                         << DDName(name, idNameSpace) << " Tubs made of " 
00209                         << connM[i] << " from 0 to " << CLHEP::twopi/CLHEP::deg
00210                         << " with Rin " << rin << " Rout " << rout 
00211                         << " ZHalf " << dz;
00212     DDName connName(DDSplit(connM[i]).first, DDSplit(connM[i]).second);
00213     DDMaterial connMatter(connName);
00214     DDLogicalPart connLogic(DDName(name, idNameSpace), connMatter, solid);
00215 
00216     DDTranslation r2(0, 0, (dz-diskDz));
00217     cpv.position(DDName(name,idNameSpace), diskName, i+1, r2, DDRotation());
00218     LogDebug("TOBGeom") << "DDTOBRadCableAlgo test: " 
00219                         << DDName(name,idNameSpace) << " number " << i+1 
00220                         << " positioned in " << diskName << " at " << r2 
00221                         << " with no rotation";
00222 
00223     // Now the radial cable
00224     name  = "TOBRadServices" + names[i];
00225     rin   = 0.5*(rodRin[i]+rodRout[i]);
00226     rout = ( i+1 == (int)(names.size()) ? rMax : 0.5*(rodRin[i+1]+rodRout[i+1]));
00227     std::vector<double> pgonZ;
00228     pgonZ.push_back(-0.5*cableT); 
00229     pgonZ.push_back(cableT*(rin/rMax-0.5));
00230     pgonZ.push_back(0.5*cableT);
00231     std::vector<double> pgonRmin;
00232     pgonRmin.push_back(rin); 
00233     pgonRmin.push_back(rin); 
00234     pgonRmin.push_back(rin); 
00235     std::vector<double> pgonRmax;
00236     pgonRmax.push_back(rout); 
00237     pgonRmax.push_back(rout); 
00238     pgonRmax.push_back(rout); 
00239     solid = DDSolidFactory::polycone(DDName(name,idNameSpace), 0, CLHEP::twopi,
00240                                      pgonZ, pgonRmin, pgonRmax);
00241     LogDebug("TOBGeom") << "DDTOBRadCableAlgo test: " 
00242                         << DDName(name, idNameSpace) <<" Polycone made of "
00243                         << cableM[i] << " from 0 to " 
00244                         << CLHEP::twopi/CLHEP::deg << " and with " 
00245                         << pgonZ.size() << " sections";
00246     for (int ii = 0; ii < (int)(pgonZ.size()); ii++) 
00247       LogDebug("TOBGeom") << "\t[" << ii << "]\tZ = " << pgonZ[ii] 
00248                           << "\tRmin = " << pgonRmin[ii] << "\tRmax = " 
00249                           << pgonRmax[ii];
00250     DDName cableName(DDSplit(cableM[i]).first, DDSplit(cableM[i]).second);
00251     DDMaterial cableMatter(cableName);
00252     DDLogicalPart cableLogic(DDName(name, idNameSpace), cableMatter, solid);
00253 
00254     DDTranslation r3(0, 0, (diskDz-(i+0.5)*cableT));
00255     cpv.position(DDName(name,idNameSpace), diskName, i+1, r3, DDRotation());
00256     LogDebug("TOBGeom") << "DDTOBRadCableAlgo test: " 
00257                         << DDName(name,idNameSpace) << " number " <<i+1
00258                         << " positioned in " << diskName << " at " << r3
00259                         << " with no rotation";
00260     
00261   }
00262 
00263   LogDebug("TOBGeom") << "<<== End of DDTOBRadCableAlgo construction ...";
00264 }