CMS 3D CMS Logo

DDHCalTBCableAlgo Class Reference

#include <Geometry/HcalAlgo/interface/DDHCalTBCableAlgo.h>

List of all members.

Public Member Functions

 DDHCalTBCableAlgo ()
void execute ()
void initialize (const DDNumericArguments &nArgs, const DDVectorArguments &vArgs, const DDMapArguments &mArgs, const DDStringArguments &sArgs, const DDStringVectorArguments &vsArgs)
virtual ~DDHCalTBCableAlgo ()

Private Attributes

std::string absMat
double gap2
std::string genMat
std::string idName
std::string idNameSpace
double length1
double length2
int nhalf
int nsectors
int nsectortot
double rin
std::vector< double > rmax
std::string rotns
std::vector< double > theta
double thick
double width1
double width2
std::vector< double > zoff


Detailed Description

Definition at line 10 of file DDHCalTBCableAlgo.h.


Constructor & Destructor Documentation

DDHCalTBCableAlgo::DDHCalTBCableAlgo (  ) 

Definition at line 22 of file DDHCalTBCableAlgo.cc.

References LogDebug.

00022                                     : theta(0),rmax(0),zoff(0) {
00023   LogDebug("HCalGeom") << "DDHCalTBCableAlgo info: Creating an instance";
00024 }

DDHCalTBCableAlgo::~DDHCalTBCableAlgo (  )  [virtual]

Definition at line 26 of file DDHCalTBCableAlgo.cc.

00026 {}


Member Function Documentation

void DDHCalTBCableAlgo::execute (  ) 

Definition at line 72 of file DDHCalTBCableAlgo.cc.

References absMat, DDSolidFactory::box(), funct::cos(), dbl_to_string(), DDBase< N, C >::ddname(), DDpos(), DDrot(), DDSplit(), first, gap2, genMat, i, idName, idNameSpace, length1, length2, LogDebug, name, DDBase< N, C >::name(), nhalf, nsectors, nsectortot, dbtoconf::parent, phi, pi, DDSolidFactory::polyhedra(), r1, r2, r3, rin, rmax, rot, rotns, edm::second(), funct::sin(), funct::tan(), theta, thick, DDSolidFactory::trap(), width1, width2, and zoff.

00072                                 {
00073   
00074   LogDebug("HCalGeom") << "==>> Constructing DDHCalTBCableAlgo...";
00075   unsigned int i=0;
00076 
00077   double alpha = pi/nsectors;
00078   double dphi  = nsectortot*twopi/nsectors;
00079 
00080   double zstep0 = zoff[1]+rmax[1]*tan(theta[1])+(rin-rmax[1])*tan(theta[2]);
00081   double zstep1 = zstep0+thick/cos(theta[2]);
00082   double zstep2 = zoff[3];
00083  
00084   double rstep0 = rin + (zstep2-zstep1)/tan(theta[2]);
00085   double rstep1 = rin + (zstep1-zstep0)/tan(theta[2]);
00086 
00087   vector<double> pgonZ;
00088   pgonZ.push_back(zstep0); 
00089   pgonZ.push_back(zstep1);
00090   pgonZ.push_back(zstep2); 
00091   pgonZ.push_back(zstep2+thick/cos(theta[2])); 
00092 
00093   vector<double> pgonRmin;
00094   pgonRmin.push_back(rin); 
00095   pgonRmin.push_back(rin);
00096   pgonRmin.push_back(rstep0); 
00097   pgonRmin.push_back(rmax[2]); 
00098 
00099   vector<double> pgonRmax;
00100   pgonRmax.push_back(rin); 
00101   pgonRmax.push_back(rstep1); 
00102   pgonRmax.push_back(rmax[2]); 
00103   pgonRmax.push_back(rmax[2]); 
00104 
00105   string name("Null");
00106   DDSolid solid;
00107   solid = DDSolidFactory::polyhedra(DDName(idName, idNameSpace),
00108                                     nsectortot, -alpha, dphi, pgonZ, 
00109                                     pgonRmin, pgonRmax);
00110   LogDebug("HCalGeom") << "DDHCalTBCableAlgo test: " 
00111                        << DDName(idName,idNameSpace) << " Polyhedra made of " 
00112                        << genMat << " with " << nsectortot << " sectors from "
00113                        << -alpha/deg << " to " << (-alpha+dphi)/deg 
00114                        << " and with " << pgonZ.size() << " sections";
00115   for (i = 0; i <pgonZ.size(); i++) 
00116     LogDebug("HCalGeom") << "\t\tZ = " << pgonZ[i] << "\tRmin = " 
00117                          << pgonRmin[i] << "\tRmax = " << pgonRmax[i];
00118   
00119   DDName matname(DDSplit(genMat).first, DDSplit(genMat).second); 
00120   DDMaterial matter(matname);
00121   DDLogicalPart genlogic(solid.ddname(), matter, solid);
00122 
00123   DDName parentName = parent().name(); 
00124   DDTranslation r0(0.0, 0.0, 0.0);
00125   DDRotation rot;
00126   DDpos(DDName(idName, idNameSpace), parentName, 1, r0, rot);
00127   LogDebug("HCalGeom") << "DDHCalTBCableAlgo test: " 
00128                        << DDName(idName,idNameSpace) << " number 1 positioned "
00129                        << "in " << parentName << " at " << r0 << " with "<<rot;
00130   
00131   if (nhalf != 1) {
00132     rot = DDRotation(DDName("180D", rotns));
00133     DDpos (DDName(idName, idNameSpace), parentName, 2, r0, rot);
00134     LogDebug("HCalGeom") << "DDHCalTBCableAlgo test: " 
00135                          << DDName(idName,idNameSpace) <<" number 2 positioned"
00136                          << "in " << parentName  << " at " << r0 << " with "
00137                          << rot;
00138   } 
00139   
00140   //Construct sector (from -alpha to +alpha)
00141   name = idName + "Module";
00142   LogDebug("HCalGeom") << "DDHCalTBCableAlgo test: " 
00143                        << DDName(name,idNameSpace) << " Polyhedra made of " 
00144                        << genMat << " with 1 sector from " << -alpha/deg 
00145                        << " to " << alpha/deg << " and with " << pgonZ.size() 
00146                        << " sections";
00147   for (i = 0; i < pgonZ.size(); i++) 
00148     LogDebug("HCalGeom") << "\t\tZ = " << pgonZ[i] << "\tRmin = " 
00149                          << pgonRmin[i] << "\tRmax = " << pgonRmax[i];
00150   solid =   DDSolidFactory::polyhedra(DDName(name, idNameSpace),
00151                                       1, -alpha, 2*alpha, pgonZ,
00152                                       pgonRmin, pgonRmax);
00153   DDLogicalPart seclogic(solid.ddname(), matter, solid);
00154   
00155   for (int ii=0; ii<nsectortot; ii++) {
00156     double phi    = ii*2*alpha;
00157     double phideg = phi/deg;
00158     
00159     DDRotation rotation;
00160     string rotstr("NULL");
00161     if (phideg != 0) {
00162       rotstr = "R"; 
00163       if (phideg < 100) rotstr = "R0"; 
00164       rotstr = rotstr + dbl_to_string(phideg);
00165       rotation = DDRotation(DDName(rotstr, rotns)); 
00166       if (!rotation) {
00167         LogDebug("HCalGeom") << "DDHCalTBCableAlgo test: Creating a new "
00168                              << "rotation " << rotstr << "\t90," << phideg 
00169                              << ", 90, " << (phideg+90) << ", 0, 0";
00170         rotation = DDrot(DDName(rotstr, idNameSpace), 90*deg, phideg*deg, 
00171                          90*deg, (90+phideg)*deg, 0*deg,  0*deg);
00172       }
00173     } 
00174   
00175     DDpos (seclogic, genlogic, ii+1, DDTranslation(0.0, 0.0, 0.0), rotation);
00176     LogDebug("HCalGeom") << "DDHCalTBCableAlgo test: " << seclogic.name() 
00177                          << " number " << ii+1 << " positioned in " 
00178                          << genlogic.name() << " at (0,0,0) with " << rotation;
00179   }
00180   
00181   //Now a trapezoid of air
00182   double rinl  = pgonRmin[0] + thick * sin(theta[2]);
00183   double routl = pgonRmax[2] - thick * sin(theta[2]);
00184   double dx1   = rinl * tan(alpha);
00185   double dx2   = 0.90 * routl * tan(alpha);
00186   double dy    = 0.50 * thick;
00187   double dz    = 0.50 * (routl -rinl);
00188   name  = idName + "Trap";
00189   solid = DDSolidFactory::trap(DDName(name, idNameSpace), dz, 0, 0, dy, dx1, 
00190                                dx1, 0, dy, dx2, dx2, 0);
00191   LogDebug("HCalGeom") << "DDHCalTBCableAlgo test: " << solid.name() 
00192                        <<" Trap made of " << genMat << " of dimensions " << dz 
00193                        << ", 0, 0, " << dy << ", " << dx1 << ", " << dx1 
00194                        << ", 0, " << dy << ", " << dx2 << ", "  << dx2 <<", 0";
00195   DDLogicalPart glog(solid.ddname(), matter, solid);
00196 
00197   string rotstr = name;
00198   LogDebug("HCalGeom") << "DDHCalTBCableAlgo test: Creating a new rotation: " 
00199                        << rotstr << "\t90, 270, " << (180-theta[2]/deg) 
00200                        << ", 0, " << (90-theta[2]/deg) << ", 0";
00201   rot = DDrot(DDName(rotstr, idNameSpace), 90*deg, 270*deg, 
00202               180*deg-theta[2], 0*deg, 90*deg-theta[2], 0*deg);
00203   DDTranslation r1(0.5*(rinl+routl), 0, 0.5*(pgonZ[1]+pgonZ[2]));
00204   DDpos(glog, seclogic, 1, r1, rot);
00205   LogDebug("HCalGeom") << "DDHCalTBCableAlgo test: " << glog.name() 
00206                        << " number 1 positioned in " << seclogic.name() 
00207                        << " at " << r1 << " with " << rot;
00208 
00209   //Now the cable of type 1
00210   name = idName + "Cable1";
00211   double phi  = atan((dx2-dx1)/(2*dz));
00212   double xmid = 0.5*(dx1+dx2)-1.0;
00213   solid = DDSolidFactory::box(DDName(name, idNameSpace), 0.5*width1,
00214                               0.5*thick, 0.5*length1);
00215   LogDebug("HCalGeom") << "DDHCalTBCableAlgo test: " << solid.name() 
00216                        << " Box made of " << absMat << " of dimension " 
00217                        << 0.5*width1 << ", " << 0.5*thick << ", " 
00218                        << 0.5*length1;
00219   DDName absname(DDSplit(absMat).first, DDSplit(absMat).second); 
00220   DDMaterial absmatter(absname);
00221   DDLogicalPart cablog1(solid.ddname(), absmatter, solid);
00222 
00223   rotstr = idName + "Left";
00224   LogDebug("HCalGeom") << "DDHCalTBCableAlgo test: Creating a new rotation " 
00225                        << rotstr << "\t"  << (90+phi/deg) << "," << 0  << "," 
00226                        << 90 << "," << 90 << "," << phi/deg << "," << 0;
00227   DDRotation rot2 = DDrot(DDName(rotstr, idNameSpace), 90*deg+phi, 0*deg, 
00228                           90*deg, 90*deg, phi, 0*deg);
00229   DDTranslation r2((xmid-0.5*width1*cos(phi)), 0, 0);
00230   DDpos(cablog1, glog, 1, r2, rot2);
00231   LogDebug("HCalGeom") << "DDHCalTBCableAlgo test: " << cablog1.name() 
00232                        << " number 1 positioned in " << glog.name() << " at "
00233                        << r2    << " with " << rot2;
00234 
00235   rotstr = idName + "Right";
00236   LogDebug("HCalGeom") << "DDHCalTBCableAlgo test: Creating a new rotation " 
00237                        << rotstr << "\t"  << (90-phi/deg) << ", 0, 90, 90, " 
00238                        << -phi/deg << ", 0";
00239   DDRotation rot3 = DDrot(DDName(rotstr, idNameSpace), 90*deg-phi, 0*deg, 
00240                           90*deg, 90*deg, -phi, 0*deg);
00241   DDTranslation r3(-(xmid-0.5*width1*cos(phi)), 0, 0);
00242   DDpos(cablog1, glog, 2, r3, rot3);
00243   LogDebug("HCalGeom") << "DDHCalTBCableAlgo test: " << cablog1.name() 
00244                        << " number 2 positioned in "  << glog.name() << " at " 
00245                        << r3 << " with " << rot3;
00246 
00247   //Now the cable of type 2
00248   name = idName + "Cable2";
00249   solid = DDSolidFactory::box(DDName(name, idNameSpace), 0.5*width2,
00250                               0.5*thick, 0.5*length2);
00251   LogDebug("HCalGeom") << "DDHCalTBCableAlgo test: " << solid.name() 
00252                        << " Box made of " << absMat << " of dimension " 
00253                        << 0.5*width2 << ", " << 0.5*thick << ", "<<0.5*length2;
00254   DDLogicalPart cablog2(solid.ddname(), absmatter, solid);
00255 
00256   double xpos = 0.5*(width2+gap2);
00257   DDpos (cablog2, glog, 1, DDTranslation(xpos, 0.0, 0.0), DDRotation());
00258   LogDebug("HCalGeom") << "DDHCalTBCableAlgo test: " << cablog2.name() 
00259                        << " number 1 positioned in "  << glog.name() << " at ("
00260                        << xpos << ",  0, 0) with no rotation";
00261   DDpos (cablog2, glog, 2, DDTranslation(-xpos, 0.0, 0.0), DDRotation());
00262   LogDebug("HCalGeom") << "DDHCalTBCableAlgo test: " << cablog2.name() 
00263                        << " number 2 positioned in "  << glog.name() << " at ("
00264                        <<-xpos << ", 0, 0) with no rotation";
00265 
00266   LogDebug("HCalGeom") << "<<== End of DDHCalTBCableAlgo construction ...";
00267 }

void DDHCalTBCableAlgo::initialize ( const DDNumericArguments nArgs,
const DDVectorArguments vArgs,
const DDMapArguments mArgs,
const DDStringArguments sArgs,
const DDStringVectorArguments vsArgs 
)

Definition at line 29 of file DDHCalTBCableAlgo.cc.

References absMat, gap2, genMat, i, idName, idNameSpace, int, length1, length2, LogDebug, nhalf, DDCurrentNamespace::ns(), nsectors, nsectortot, dbtoconf::parent, rin, rmax, rotns, theta, thick, width1, width2, and zoff.

00033                                                                      {
00034 
00035   genMat      = sArgs["MaterialName"];
00036   nsectors    = int (nArgs["NSector"]);
00037   nsectortot  = int (nArgs["NSectorTot"]);
00038   nhalf       = int (nArgs["NHalf"]);
00039   rin         = nArgs["RIn"];
00040   theta       = vArgs["Theta"];
00041   rmax        = vArgs["RMax"];
00042   zoff        = vArgs["ZOff"];
00043 
00044   absMat      = sArgs["AbsMatName"];
00045   thick       = nArgs["Thickness"];
00046   width1      = nArgs["Width1"];
00047   length1     = nArgs["Length1"];
00048   width2      = nArgs["Width2"];
00049   length2     = nArgs["Length2"];
00050   gap2        = nArgs["Gap2"];
00051 
00052   LogDebug("HCalGeom") << "DDHCalTBCableAlgo debug: General material " 
00053                        << genMat << "\tSectors "  << nsectors << ", " 
00054                        << nsectortot << "\tHalves " << nhalf << "\tRin " <<rin;
00055   for (unsigned int i = 0; i < theta.size(); i++)
00056     LogDebug("HCalGeom") << "\t" << i << " Theta " << theta[i] << " rmax " 
00057                          << rmax[i] << " zoff " << zoff[i];
00058   LogDebug("HCalGeom") << "\tCable mockup made of " << absMat << "\tThick " 
00059                        << thick << "\tLength and width " << length1 << ", "
00060                        << width1 <<" and "      << length2 << ", " << width2 
00061                        << " Gap " << gap2;
00062 
00063   idName      = sArgs["MotherName"];
00064   idNameSpace = DDCurrentNamespace::ns();
00065   rotns       = sArgs["RotNameSpace"];
00066   DDName parentName = parent().name(); 
00067   LogDebug("HCalGeom") << "DDHCalTBCableAlgo debug: Parent " << parentName
00068                        << " idName " << idName << " NameSpace " << idNameSpace
00069                        << " for solids etc. and " << rotns << " for rotations";
00070 }


Member Data Documentation

std::string DDHCalTBCableAlgo::absMat [private]

Definition at line 34 of file DDHCalTBCableAlgo.h.

Referenced by execute(), and initialize().

double DDHCalTBCableAlgo::gap2 [private]

Definition at line 38 of file DDHCalTBCableAlgo.h.

Referenced by execute(), and initialize().

std::string DDHCalTBCableAlgo::genMat [private]

Definition at line 26 of file DDHCalTBCableAlgo.h.

Referenced by execute(), and initialize().

std::string DDHCalTBCableAlgo::idName [private]

Definition at line 40 of file DDHCalTBCableAlgo.h.

Referenced by execute(), and initialize().

std::string DDHCalTBCableAlgo::idNameSpace [private]

Definition at line 41 of file DDHCalTBCableAlgo.h.

Referenced by execute(), and initialize().

double DDHCalTBCableAlgo::length1 [private]

Definition at line 36 of file DDHCalTBCableAlgo.h.

Referenced by execute(), and initialize().

double DDHCalTBCableAlgo::length2 [private]

Definition at line 37 of file DDHCalTBCableAlgo.h.

Referenced by execute(), and initialize().

int DDHCalTBCableAlgo::nhalf [private]

Definition at line 29 of file DDHCalTBCableAlgo.h.

Referenced by execute(), and initialize().

int DDHCalTBCableAlgo::nsectors [private]

Definition at line 27 of file DDHCalTBCableAlgo.h.

Referenced by execute(), and initialize().

int DDHCalTBCableAlgo::nsectortot [private]

Definition at line 28 of file DDHCalTBCableAlgo.h.

Referenced by execute(), and initialize().

double DDHCalTBCableAlgo::rin [private]

Definition at line 30 of file DDHCalTBCableAlgo.h.

Referenced by execute(), and initialize().

std::vector<double> DDHCalTBCableAlgo::rmax [private]

Definition at line 32 of file DDHCalTBCableAlgo.h.

Referenced by execute(), and initialize().

std::string DDHCalTBCableAlgo::rotns [private]

Definition at line 42 of file DDHCalTBCableAlgo.h.

Referenced by execute(), and initialize().

std::vector<double> DDHCalTBCableAlgo::theta [private]

Definition at line 31 of file DDHCalTBCableAlgo.h.

Referenced by execute(), and initialize().

double DDHCalTBCableAlgo::thick [private]

Definition at line 35 of file DDHCalTBCableAlgo.h.

Referenced by execute(), and initialize().

double DDHCalTBCableAlgo::width1 [private]

Definition at line 36 of file DDHCalTBCableAlgo.h.

Referenced by execute(), and initialize().

double DDHCalTBCableAlgo::width2 [private]

Definition at line 37 of file DDHCalTBCableAlgo.h.

Referenced by execute(), and initialize().

std::vector<double> DDHCalTBCableAlgo::zoff [private]

Definition at line 33 of file DDHCalTBCableAlgo.h.

Referenced by execute(), and initialize().


The documentation for this class was generated from the following files:
Generated on Tue Jun 9 18:17:58 2009 for CMSSW by  doxygen 1.5.4