CMS 3D CMS Logo

Public Member Functions | Private Attributes

DDTIDAxialCableAlgo Class Reference

#include <DDTIDAxialCableAlgo.h>

List of all members.

Public Member Functions

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

Private Attributes

std::vector< double > angles
std::string childName
std::string idNameSpace
std::string matIn
std::string matOut
double rMax
double rMin
double rTop
double thick
double width
double zBend
double zEnd
std::vector< double > zposRing
std::vector< double > zposWheel

Detailed Description

Definition at line 10 of file DDTIDAxialCableAlgo.h.


Constructor & Destructor Documentation

DDTIDAxialCableAlgo::DDTIDAxialCableAlgo ( )

Definition at line 21 of file DDTIDAxialCableAlgo.cc.

References LogDebug.

                                         {
  LogDebug("TIDGeom") << "DDTIDAxialCableAlgo info: Creating an instance";
}
DDTIDAxialCableAlgo::~DDTIDAxialCableAlgo ( ) [virtual]

Definition at line 25 of file DDTIDAxialCableAlgo.cc.

{}

Member Function Documentation

void DDTIDAxialCableAlgo::execute ( DDCompactView cpv)

Definition at line 74 of file DDTIDAxialCableAlgo.cc.

References angles, childName, dbl_to_string(), DDrot(), DDSplit(), first, i, idNameSpace, gen::k, LogDebug, matIn, matOut, mergeVDriftHistosByStation::name, dbtoconf::parent, DDSolidFactory::polycone(), DDCompactView::position(), alignCSCRings::r, rMax, rMin, idealTransformation::rotation, rTop, edm::second(), theta(), thick, DDSolidFactory::tubs(), width, z, zBend, zEnd, zposRing, and zposWheel.

                                                    {

  DDName mother = parent().name();
  std::vector<DDName> logs;
  double thk = thick/zposRing.size();
  double r   = rMin;
  double thktot = 0;
  double z;

  //Cables between the wheels
  for (int k=0; k<(int)(zposWheel.size()); k++) {

    std::vector<double> pconZ, pconRmin, pconRmax;
    for (int i=0; i<(int)(zposRing.size()); i++) {
      thktot += thk;
      z       = zposWheel[k] + zposRing[i] - 0.5*thk;
      if (i != 0) {
        pconZ.push_back(z);
        pconRmin.push_back(r);
        pconRmax.push_back(rMax);
      }
      r       = rMin;
      pconZ.push_back(z);
      pconRmin.push_back(r);
      pconRmax.push_back(rMax);
      z      += thk;
      pconZ.push_back(z);
      pconRmin.push_back(r);
      pconRmax.push_back(rMax);
      r       = rMax - thktot;
      pconZ.push_back(z);
      pconRmin.push_back(r);
      pconRmax.push_back(rMax);
    }
    if (k >= ((int)(zposWheel.size())-1)) z = zBend;
    else z = zposWheel[k+1] + zposRing[0] - 0.5*thk;
    pconZ.push_back(z);
    pconRmin.push_back(r);
    pconRmax.push_back(rMax);
    
    std::string name = childName + dbl_to_string(k);
    DDSolid solid = DDSolidFactory::polycone(DDName(name, idNameSpace),
                                             -0.5*width, width, pconZ, 
                                             pconRmin, pconRmax);

    LogDebug("TIDGeom") << "DDTIDAxialCableAlgo test: " 
                        << DDName(name,idNameSpace) << " Polycone made of "
                        << matIn << " from " << -0.5*width/CLHEP::deg << " to "
                        << 0.5*width/CLHEP::deg << " and with " << pconZ.size()
                        << " sections ";
    for (int i = 0; i <(int)(pconZ.size()); i++) 
      LogDebug("TIDGeom") <<  "\t[" << i  << "]\tZ = " << pconZ[i] 
                          << "\tRmin = "<< pconRmin[i] << "\tRmax = " 
                          << pconRmax[i];

    DDName mat(DDSplit(matIn).first, DDSplit(matIn).second); 
    DDMaterial matter(mat);
    DDLogicalPart genlogic(DDName(name, idNameSpace), matter, solid);
    logs.push_back(DDName(name, idNameSpace));
  }

  //Cable in the vertical part
  std::vector<double> pconZ, pconRmin, pconRmax;
  r = thktot*rMax/rTop;
  z = zBend - thktot;
  LogDebug("TIDGeom") << "DDTIDAxialCableAlgo test: Thk " << thk 
                      << " Total " << thktot << " rMax " << rMax 
                      << " rTop " << rTop << " dR " << r << " z " << z;
  pconZ.push_back(z);
  pconRmin.push_back(rMax);
  pconRmax.push_back(rMax);
  z = zBend - r;
  pconZ.push_back(z);
  pconRmin.push_back(rMax);
  pconRmax.push_back(rTop);
  pconZ.push_back(zBend);
  pconRmin.push_back(rMax);
  pconRmax.push_back(rTop);

  std::string name = childName + dbl_to_string(zposWheel.size());
  DDSolid solid = DDSolidFactory::polycone(DDName(name, idNameSpace),
                                           -0.5*width, width, pconZ, 
                                           pconRmin, pconRmax);

  LogDebug("TIDGeom") << "DDTIDAxialCableAlgo test: " 
                      << DDName(name, idNameSpace) << " Polycone made of "
                      << matIn << " from " << -0.5*width/CLHEP::deg << " to "
                      << 0.5*width/CLHEP::deg << " and with "  << pconZ.size()
                      << " sections ";
  for (int i = 0; i < (int)(pconZ.size()); i++) 
    LogDebug("TIDGeom") << "\t[" << i << "]\tZ = " << pconZ[i] 
                        << "\tRmin = "<< pconRmin[i] << "\tRmax = " 
                        << pconRmax[i];

  DDName mat(DDSplit(matIn).first, DDSplit(matIn).second); 
  DDMaterial matter(mat);
  DDLogicalPart genlogic(DDName(name, idNameSpace), matter, solid);
  logs.push_back(DDName(name, idNameSpace));

  //Cable in the outer part
  name = childName + dbl_to_string(zposWheel.size()+1);
  r    = rTop-r;
  solid = DDSolidFactory::tubs(DDName(name, idNameSpace), 0.5*(zEnd-zBend),
                               r, rTop, -0.5*width, width);
  LogDebug("TIDGeom") << "DDTIDAxialCableAlgo test: " 
                      << DDName(name, idNameSpace) << " Tubs made of " 
                      << matOut << " from " << -0.5*width/CLHEP::deg << " to " 
                      << 0.5*width/CLHEP::deg << " with Rin " << r << " Rout " 
                      << rTop << " ZHalf " << 0.5*(zEnd-zBend);
  mat    = DDName(DDSplit(matOut).first, DDSplit(matOut).second);
  matter = DDMaterial(mat);
  genlogic = DDLogicalPart(DDName(name, idNameSpace), matter, solid);
  logs.push_back(DDName(name, idNameSpace));

  //Position the cables
  double theta = 90.*CLHEP::deg;
  for (int i=0; i<(int)(angles.size()); i++) {
    double phix = angles[i];
    double phiy = phix + 90.*CLHEP::deg;
    double phideg = phix/CLHEP::deg;

    DDRotation rotation;
    if (phideg != 0) {
      std::string rotstr = childName + dbl_to_string(phideg*10.);
      rotation = DDRotation(DDName(rotstr, idNameSpace));
      if (!rotation) {
        LogDebug("TIDGeom") << "DDTIDAxialCableAlgo test: Creating a new "
                            << "rotation: " << rotstr << " " 
                            << theta/CLHEP::deg << ", " << phix/CLHEP::deg 
                            << ", " << theta/CLHEP::deg << ", " 
                            << phiy/CLHEP::deg << ", 0, 0";
        rotation = DDrot(DDName(rotstr, idNameSpace), theta, phix, theta, 
                         phiy, 0., 0.);
      }
    }
    
    for (int k=0; k<(int)(logs.size()); k++) {
      DDTranslation tran(0,0,0);
      if (k == ((int)(logs.size())-1))
        tran = DDTranslation(0,0,0.5*(zEnd+zBend));
     cpv.position(logs[k], mother, i+1, tran, rotation);
      LogDebug("TIDGeom") << "DDTIDAxialCableAlgo test " << logs[k] 
                          << " number " << i+1 << " positioned in "
                          << mother << " at " << tran << " with "
                          << rotation;
    }
  }
}
void DDTIDAxialCableAlgo::initialize ( const DDNumericArguments nArgs,
const DDVectorArguments vArgs,
const DDMapArguments mArgs,
const DDStringArguments sArgs,
const DDStringVectorArguments vsArgs 
)

Definition at line 27 of file DDTIDAxialCableAlgo.cc.

References angles, childName, i, idNameSpace, LogDebug, matIn, matOut, DDCurrentNamespace::ns(), dbtoconf::parent, rMax, rMin, rTop, thick, width, zBend, zEnd, zposRing, and zposWheel.

                                                                       {

  zBend       = nArgs["ZBend"];
  zEnd        = nArgs["ZEnd"];
  rMin        = nArgs["RMin"];
  rMax        = nArgs["RMax"];
  rTop        = nArgs["RTop"];
  width       = nArgs["Width"];
  thick       = nArgs["Thick"];
  angles      = vArgs["Angles"];
  zposWheel   = vArgs["ZPosWheel"];
  zposRing    = vArgs["ZPosRing"];

  LogDebug("TIDGeom") << "DDTIDAxialCableAlgo debug: Parameters for creating "
                      << (zposWheel.size()+2) << " axial cables and position"
                      << "ing " << angles.size() << " copies in Service volume"
                      << "\n                            zBend " << zBend 
                      << " zEnd " << zEnd << " rMin " << rMin << " rMax " 
                      << rMax << " Cable width " << width/CLHEP::deg 
                      << " thickness " << thick << " with Angles";
  for (int i=0; i<(int)(angles.size()); i++)
    LogDebug("TIDGeom") << "\tangles[" << i << "] = " << angles[i]/CLHEP::deg;
  LogDebug("TIDGeom") << "                          Wheels " 
                      << zposWheel.size() << " at Z";
  for (int i=0; i<(int)(zposWheel.size()); i++)
    LogDebug("TIDGeom") << "\tzposWheel[" << i <<"] = " << zposWheel[i];
  LogDebug("TIDGeom") << "                          each with " 
                      << zposRing.size() << " Rings at Z";
  for (int i=0; i<(int)(zposRing.size()); i++)
    LogDebug("TIDGeom") << "\tzposRing[" << i <<"] = " << zposRing[i];

  idNameSpace = DDCurrentNamespace::ns();
  childName   = sArgs["ChildName"]; 
  matIn       = sArgs["MaterialIn"]; 
  matOut      = sArgs["MaterialOut"]; 

  DDName parentName = parent().name();
  LogDebug("TIDGeom") << "DDTIDAxialCableAlgo debug: Parent " << parentName
                      << "\tChild " << childName << " NameSpace " 
                      << idNameSpace << "\tMaterial " << matIn << " and " 
                      << matOut;
}

Member Data Documentation

std::vector<double> DDTIDAxialCableAlgo::angles [private]

Definition at line 34 of file DDTIDAxialCableAlgo.h.

Referenced by execute(), and initialize().

std::string DDTIDAxialCableAlgo::childName [private]

Definition at line 39 of file DDTIDAxialCableAlgo.h.

Referenced by execute(), and initialize().

std::string DDTIDAxialCableAlgo::idNameSpace [private]

Definition at line 38 of file DDTIDAxialCableAlgo.h.

Referenced by execute(), and initialize().

std::string DDTIDAxialCableAlgo::matIn [private]

Definition at line 40 of file DDTIDAxialCableAlgo.h.

Referenced by execute(), and initialize().

std::string DDTIDAxialCableAlgo::matOut [private]

Definition at line 41 of file DDTIDAxialCableAlgo.h.

Referenced by execute(), and initialize().

double DDTIDAxialCableAlgo::rMax [private]

Definition at line 30 of file DDTIDAxialCableAlgo.h.

Referenced by execute(), and initialize().

double DDTIDAxialCableAlgo::rMin [private]

Definition at line 29 of file DDTIDAxialCableAlgo.h.

Referenced by execute(), and initialize().

double DDTIDAxialCableAlgo::rTop [private]

Definition at line 31 of file DDTIDAxialCableAlgo.h.

Referenced by execute(), and initialize().

double DDTIDAxialCableAlgo::thick [private]

Definition at line 33 of file DDTIDAxialCableAlgo.h.

Referenced by execute(), and initialize().

double DDTIDAxialCableAlgo::width [private]

Definition at line 32 of file DDTIDAxialCableAlgo.h.

Referenced by execute(), and initialize().

double DDTIDAxialCableAlgo::zBend [private]

Definition at line 27 of file DDTIDAxialCableAlgo.h.

Referenced by execute(), and initialize().

double DDTIDAxialCableAlgo::zEnd [private]

Definition at line 28 of file DDTIDAxialCableAlgo.h.

Referenced by execute(), and initialize().

std::vector<double> DDTIDAxialCableAlgo::zposRing [private]

Definition at line 36 of file DDTIDAxialCableAlgo.h.

Referenced by execute(), and initialize().

std::vector<double> DDTIDAxialCableAlgo::zposWheel [private]

Definition at line 35 of file DDTIDAxialCableAlgo.h.

Referenced by execute(), and initialize().