CMS 3D CMS Logo

Public Member Functions | Private Attributes

DDTrackerPhiAlgo Class Reference

#include <DDTrackerPhiAlgo.h>

List of all members.

Public Member Functions

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

Private Attributes

std::string childName
std::string idNameSpace
int incrcn
size_t numcopies
std::vector< double > phi
double radius
size_t startcn
double tilt
std::vector< double > zpos

Detailed Description

Definition at line 10 of file DDTrackerPhiAlgo.h.


Constructor & Destructor Documentation

DDTrackerPhiAlgo::DDTrackerPhiAlgo ( )

Definition at line 18 of file DDTrackerPhiAlgo.cc.

References LogDebug.

                                   : startcn(1), incrcn(1) {
  LogDebug("TrackerGeom") << "DDTrackerPhiAlgo info: Creating an instance";
}
DDTrackerPhiAlgo::~DDTrackerPhiAlgo ( ) [virtual]

Definition at line 22 of file DDTrackerPhiAlgo.cc.

{}

Member Function Documentation

void DDTrackerPhiAlgo::execute ( DDCompactView cpv)

Definition at line 76 of file DDTrackerPhiAlgo.cc.

References childName, funct::cos(), dbl_to_string(), DDrot(), DDSplit(), first, i, idNameSpace, incrcn, LogDebug, numcopies, dbtoconf::parent, phi, DDCompactView::position(), radius, idealTransformation::rotation, edm::second(), funct::sin(), startcn, AlCaHLTBitMon_QueryRunRegistry::string, theta(), tilt, and zpos.

                                                 {

  DDName mother = parent().name();
  DDName child(DDSplit(childName).first, DDSplit(childName).second);
  double theta  = 90.*CLHEP::deg;
  size_t i  = 0;
  int ci = startcn;
  for ( ; i < numcopies; ++i) {
    double phix = phi[i] + tilt;
    double phiy = phix + 90.*CLHEP::deg;
    double phideg = phi[i]/CLHEP::deg;

    std::string rotstr = DDSplit(childName).first + dbl_to_string(phideg);
    DDRotation rotation = DDRotation(DDName(rotstr, idNameSpace));
    if (!rotation) {
      LogDebug("TrackerGeom") << "DDTrackerPhiAlgo test: Creating a new "
                              << "rotation: " << rotstr << "\t" << "90., "
                              << phix/CLHEP::deg << ", 90.," 
                              << phiy/CLHEP::deg << ", 0, 0";
      rotation = DDrot(DDName(rotstr, idNameSpace), theta, phix, theta, phiy,
                       0., 0.);
    }
        
    double xpos = radius*cos(phi[i]);
    double ypos = radius*sin(phi[i]);
    DDTranslation tran(xpos, ypos, zpos[i]);
  
   cpv.position(child, mother, ci, tran, rotation);
    LogDebug("TrackerGeom") << "DDTrackerPhiAlgo test: " << child << " number "
                            << ci << " positioned in " << mother << " at "
                            << tran  << " with " << rotation;
    ci=ci+incrcn;
  }
}
void DDTrackerPhiAlgo::initialize ( const DDNumericArguments nArgs,
const DDVectorArguments vArgs,
const DDMapArguments mArgs,
const DDStringArguments sArgs,
const DDStringVectorArguments vsArgs 
)

Definition at line 24 of file DDTrackerPhiAlgo.cc.

References childName, i, idNameSpace, incrcn, LogDebug, DDCurrentNamespace::ns(), numcopies, dbtoconf::parent, phi, radius, startcn, tilt, and zpos.

                                                                     {

  if ( nArgs.find("StartCopyNo") != nArgs.end() ) {
    startcn = size_t(nArgs["StartCopyNo"]);
  } else {
    startcn = 1;
  }
  if ( nArgs.find("IncrCopyNo") != nArgs.end() ) {
    incrcn = int(nArgs["IncrCopyNo"]);
  } else {
    incrcn = 1;
  }


  radius     = nArgs["Radius"];
  tilt       = nArgs["Tilt"];
  phi        = vArgs["Phi"];
  zpos       = vArgs["ZPos"];

  if ( nArgs.find("NumCopies") != nArgs.end() ) {
    numcopies = size_t(nArgs["NumCopies"]);
    if ( numcopies != phi.size() ) {
      edm::LogError("TrackerGeom") << "DDTrackerPhiAlgo error: Parameter "
                                   << "NumCopies does not agree with the size "
                                   << "of the Phi vector. It was adjusted to "
                                   << "be the size of the Phi vector and may "
                                   << "lead to crashes or errors.";
    } 
  } else {
    numcopies = phi.size();
  }
    
  LogDebug("TrackerGeom") << "DDTrackerPhiAlgo debug: Parameters for position"
                          << "ing:: " << " Radius " << radius << " Tilt " 
                          << tilt/CLHEP::deg << " Copies " << phi.size() 
                          << " at";
  for (int i=0; i<(int)(phi.size()); i++)
    LogDebug("TrackerGeom") << "\t[" << i << "] phi = " << phi[i]/CLHEP::deg 
                            << " z = " << zpos[i];

  idNameSpace = DDCurrentNamespace::ns();
  childName   = sArgs["ChildName"]; 
  DDName parentName = parent().name();
  LogDebug("TrackerGeom") <<  "DDTrackerPhiAlgo debug: Parent " << parentName
                          <<"\tChild " << childName << " NameSpace " 
                          << idNameSpace;
}

Member Data Documentation

std::string DDTrackerPhiAlgo::childName [private]

Definition at line 33 of file DDTrackerPhiAlgo.h.

Referenced by execute(), and initialize().

std::string DDTrackerPhiAlgo::idNameSpace [private]

Definition at line 32 of file DDTrackerPhiAlgo.h.

Referenced by execute(), and initialize().

int DDTrackerPhiAlgo::incrcn [private]

Definition at line 36 of file DDTrackerPhiAlgo.h.

Referenced by execute(), and initialize().

size_t DDTrackerPhiAlgo::numcopies [private]

Definition at line 37 of file DDTrackerPhiAlgo.h.

Referenced by execute(), and initialize().

std::vector<double> DDTrackerPhiAlgo::phi [private]

Definition at line 29 of file DDTrackerPhiAlgo.h.

Referenced by execute(), and initialize().

double DDTrackerPhiAlgo::radius [private]

Definition at line 27 of file DDTrackerPhiAlgo.h.

Referenced by execute(), and initialize().

size_t DDTrackerPhiAlgo::startcn [private]

Definition at line 35 of file DDTrackerPhiAlgo.h.

Referenced by execute(), and initialize().

double DDTrackerPhiAlgo::tilt [private]

Definition at line 28 of file DDTrackerPhiAlgo.h.

Referenced by execute(), and initialize().

std::vector<double> DDTrackerPhiAlgo::zpos [private]

Definition at line 30 of file DDTrackerPhiAlgo.h.

Referenced by execute(), and initialize().