CMS 3D CMS Logo

Public Member Functions | Private Attributes

DDTIDRingAlgo Class Reference

#include <DDTIDRingAlgo.h>

List of all members.

Public Member Functions

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

Private Attributes

std::string iccName
std::string idNameSpace
std::vector< std::string > moduleName
int number
double rICC
double rModule
double sICC
double startAngle
std::vector< double > zICC
std::vector< double > zModule

Detailed Description

Definition at line 10 of file DDTIDRingAlgo.h.


Constructor & Destructor Documentation

DDTIDRingAlgo::DDTIDRingAlgo ( )

Definition at line 20 of file DDTIDRingAlgo.cc.

References LogDebug.

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

Definition at line 24 of file DDTIDRingAlgo.cc.

{}

Member Function Documentation

void DDTIDRingAlgo::execute ( DDCompactView cpv)

Definition at line 57 of file DDTIDRingAlgo.cc.

References funct::cos(), dbl_to_string(), DDrot(), DDSplit(), first, i, iccName, idNameSpace, LogDebug, module(), moduleName, DDName::name(), number, dbtoconf::parent, DDCompactView::position(), rICC, rModule, edm::second(), sICC, funct::sin(), startAngle, theta(), zICC, and zModule.

                                              {

  double theta = 90.*CLHEP::deg;
  double phiy  = 0.*CLHEP::deg;
  double dphi  = CLHEP::twopi/number;

  DDName mother = parent().name();
  DDName module;
  DDName icc(DDSplit(iccName).first, DDSplit(iccName).second);

  //Loop over modules
  for (int i=0; i<number; i++) {

    //First the module
    double phiz = startAngle + i*dphi;
    double xpos = rModule*cos(phiz);
    double ypos = rModule*sin(phiz);
    double zpos, thetay, phix;
    if (i%2 == 0) {
      phix   = phiz + 90.*CLHEP::deg;
      thetay = 0*CLHEP::deg;
      zpos   = zModule[0];
      module = DDName(DDSplit(moduleName[0]).first, 
                      DDSplit(moduleName[0]).second);
    } else {
      phix   = phiz - 90.*CLHEP::deg;
      thetay = 180*CLHEP::deg;
      zpos   = zModule[1];
      module = DDName(DDSplit(moduleName[1]).first, 
                      DDSplit(moduleName[1]).second);
    }
    
    // stereo face inside toward structure, rphi face outside
    phix   = phix   - 180.*CLHEP::deg;
    thetay = thetay + 180.*CLHEP::deg;
    //
    
    DDTranslation trmod(xpos, ypos, zpos);
    double phideg = phiz/CLHEP::deg;
    DDRotation rotation;
    std::string rotstr = mother.name() + dbl_to_string(phideg*10.);
    rotation = DDRotation(DDName(rotstr, idNameSpace));
    if (!rotation) {
      LogDebug("TIDGeom") << "DDTIDRingAlgo test: Creating a new rotation "
                          << rotstr << "\t" << theta/CLHEP::deg << ", " 
                          << phix/CLHEP::deg << ", " << thetay/CLHEP::deg 
                          << ", " << phiy/CLHEP::deg << ", "
                          << theta/CLHEP::deg << ", " << phiz/CLHEP::deg;
      rotation = DDrot(DDName(rotstr, idNameSpace), theta, phix, thetay, phiy,
                       theta, phiz);
    }
  
   cpv.position(module, mother, i+1, trmod, rotation);
    LogDebug("TIDGeom") << "DDTIDRingAlgo test: " << module << " number "
                        << i+1 << " positioned in " << mother << " at "
                        << trmod << " with " << rotation;

    //Now the ICC
    if (i%2 == 0 ) {
      zpos = zICC[0];
      xpos = rICC*cos(phiz) + sICC*sin(phiz);
      ypos = rICC*sin(phiz) - sICC*cos(phiz);
    } else {
      zpos = zICC[1];
      xpos = rICC*cos(phiz) - sICC*sin(phiz);
      ypos = rICC*sin(phiz) + sICC*cos(phiz);
    }
    DDTranslation tricc(xpos, ypos, zpos);
   cpv.position(icc, mother, i+1, tricc, rotation);
    LogDebug("TIDGeom") << "DDTIDRingAlgo test: " << icc << " number " 
                        << i+1 << " positioned in " << mother << " at "
                        << tricc << " with " << rotation;

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

Definition at line 26 of file DDTIDRingAlgo.cc.

References iccName, idNameSpace, LogDebug, moduleName, DDCurrentNamespace::ns(), number, dbtoconf::parent, rICC, rModule, sICC, startAngle, zICC, and zModule.

                                                                       {

  idNameSpace        = DDCurrentNamespace::ns();
  moduleName         = vsArgs["ModuleName"]; 
  iccName            = sArgs["ICCName"]; 
  DDName parentName = parent().name();
  LogDebug("TIDGeom") << "DDTIDRingAlgo debug: Parent " << parentName 
                      << "\tModule " << moduleName[0] << ", "
                      << moduleName[1] << "\tICC " << iccName 
                      << "\tNameSpace " << idNameSpace;

  number            = int (nArgs["Number"]);
  startAngle        = nArgs["StartAngle"];
  rModule           = nArgs["ModuleR"];
  zModule           = vArgs["ModuleZ"];
  rICC              = nArgs["ICCR"];
  sICC              = nArgs["ICCShift"];
  zICC              = vArgs["ICCZ"];

  LogDebug("TIDGeom") <<"DDTIDRingAlgo debug: Parameters for positioning--"
                      << " StartAngle " << startAngle/CLHEP::deg
                      << " Copy Numbers " << number << " Modules at R " 
                      << rModule << " Z " << zModule[0] << ", " << zModule[1] 
                      << " ICCs at R " << rICC << " Z " << zICC[0] << ", " 
                      << zICC[1]; 
}

Member Data Documentation

std::string DDTIDRingAlgo::iccName [private]

Definition at line 29 of file DDTIDRingAlgo.h.

Referenced by execute(), and initialize().

std::string DDTIDRingAlgo::idNameSpace [private]

Definition at line 27 of file DDTIDRingAlgo.h.

Referenced by execute(), and initialize().

std::vector<std::string> DDTIDRingAlgo::moduleName [private]

Definition at line 28 of file DDTIDRingAlgo.h.

Referenced by execute(), and initialize().

int DDTIDRingAlgo::number [private]

Definition at line 31 of file DDTIDRingAlgo.h.

Referenced by execute(), and initialize().

double DDTIDRingAlgo::rICC [private]

Definition at line 35 of file DDTIDRingAlgo.h.

Referenced by execute(), and initialize().

double DDTIDRingAlgo::rModule [private]

Definition at line 33 of file DDTIDRingAlgo.h.

Referenced by execute(), and initialize().

double DDTIDRingAlgo::sICC [private]

Definition at line 36 of file DDTIDRingAlgo.h.

Referenced by execute(), and initialize().

double DDTIDRingAlgo::startAngle [private]

Definition at line 32 of file DDTIDRingAlgo.h.

Referenced by execute(), and initialize().

std::vector<double> DDTIDRingAlgo::zICC [private]

Definition at line 37 of file DDTIDRingAlgo.h.

Referenced by execute(), and initialize().

std::vector<double> DDTIDRingAlgo::zModule [private]

Definition at line 34 of file DDTIDRingAlgo.h.

Referenced by execute(), and initialize().