CMS 3D CMS Logo

Public Member Functions | Private Attributes

DDHCalAngular Class Reference

#include <DDHCalAngular.h>

List of all members.

Public Member Functions

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

Private Attributes

std::string childName
std::string idNameSpace
int incrCopyNo
int n
double rangeAngle
std::string rotns
double shiftX
double shiftY
double startAngle
int startCopyNo
double zoffset

Detailed Description

Definition at line 10 of file DDHCalAngular.h.


Constructor & Destructor Documentation

DDHCalAngular::DDHCalAngular ( )

Definition at line 16 of file DDHCalAngular.cc.

References LogDebug.

                             {
  LogDebug("HCalGeom") << "DDHCalAngular test: Creating an instance";
}
DDHCalAngular::~DDHCalAngular ( ) [virtual]

Definition at line 20 of file DDHCalAngular.cc.

{}

Member Function Documentation

void DDHCalAngular::execute ( DDCompactView cpv)

Definition at line 53 of file DDHCalAngular.cc.

References childName, funct::cos(), dbl_to_string(), DDrot(), idNameSpace, incrCopyNo, LogDebug, n, dbtoconf::parent, phi, DDCompactView::position(), rangeAngle, idealTransformation::rotation, rotns, shiftX, shiftY, funct::sin(), startAngle, startCopyNo, and zoffset.

                                              {

  double dphi   = rangeAngle/n;
  double phi    = startAngle;
  int    copyNo = startCopyNo;

  for (int ii=0; ii<n; ii++) {

    double phideg = phi/CLHEP::deg;
    int    iphi;
    if (phideg > 0) iphi = int(phideg+0.1);
    else            iphi = int(phideg-0.1);
    if (iphi >= 360) iphi   -= 360;
    phideg = iphi;
    DDRotation rotation;
    std::string rotstr("NULL");

    if (iphi != 0) {
      rotstr = "R"; 
      if (phideg >=0 && phideg < 100) rotstr = "R0"; 
      rotstr = rotstr + dbl_to_string(phideg);
      rotation = DDRotation(DDName(rotstr, rotns)); 
      if (!rotation) {
        LogDebug("HCalGeom") << "DDHCalAngular test: Creating a new rotation "
                             << DDName(rotstr, idNameSpace) << "\t90, " 
                             << phideg << ", 90, " << (phideg+90) << ", 0, 0";
        rotation = DDrot(DDName(rotstr, rotns), 90*CLHEP::deg, 
                         phideg*CLHEP::deg, 90*CLHEP::deg, 
                         (90+phideg)*CLHEP::deg, 0*CLHEP::deg,  0*CLHEP::deg);
      } 
    }
    
    double xpos = shiftX*cos(phi) - shiftY*sin(phi);
    double ypos = shiftX*sin(phi) + shiftY*cos(phi);
    DDTranslation tran(xpos, ypos, zoffset);
  
    DDName parentName = parent().name(); 
   cpv.position(DDName(childName,idNameSpace), parentName, copyNo, tran, rotation);
    LogDebug("HCalGeom") << "DDHCalAngular test: " 
                         << DDName(childName, idNameSpace) << " number " 
                         << copyNo << " positioned in " << parentName << " at "
                         << tran << " with " << rotation;
    phi    += dphi;
    copyNo += incrCopyNo;
  }
}
void DDHCalAngular::initialize ( const DDNumericArguments nArgs,
const DDVectorArguments vArgs,
const DDMapArguments mArgs,
const DDStringArguments sArgs,
const DDStringVectorArguments vsArgs 
)

Definition at line 22 of file DDHCalAngular.cc.

References childName, idNameSpace, incrCopyNo, LogDebug, n, DDCurrentNamespace::ns(), dbtoconf::parent, rangeAngle, rotns, shiftX, shiftY, startAngle, startCopyNo, and zoffset.

                                                                 {

  startAngle  = nArgs["startAngle"];
  rangeAngle  = nArgs["rangeAngle"];
  shiftX      = nArgs["shiftX"];
  shiftY      = nArgs["shiftY"];
  zoffset     = nArgs["zoffset"];
  n           = int (nArgs["n"]);
  startCopyNo = int (nArgs["startCopyNo"]);
  incrCopyNo  = int (nArgs["incrCopyNo"]);
  LogDebug("HCalGeom") << "DDHCalAngular debug: Parameters for positioning-- "
                       << n << " copies in " << rangeAngle/CLHEP::deg 
                       << " from " << startAngle/CLHEP::deg << "\tShifts " 
                       << shiftX << ", " << shiftY 
                       << " along x, y axes; \tZoffest " << zoffset
                       << "\tStart and inremental copy nos " << startCopyNo 
                       << ", " << incrCopyNo;

  rotns       = sArgs["RotNameSpace"];
  idNameSpace = DDCurrentNamespace::ns();
  childName   = sArgs["ChildName"]; 
  DDName parentName = parent().name(); 
  LogDebug("HCalGeom") << "DDHCalAngular debug: Parent " << parentName 
                       << "\tChild " << childName << "\tNameSpace "
                       << idNameSpace << "\tRotation Namespace " << rotns;
}

Member Data Documentation

std::string DDHCalAngular::childName [private]

Definition at line 37 of file DDHCalAngular.h.

Referenced by execute(), and initialize().

std::string DDHCalAngular::idNameSpace [private]

Definition at line 36 of file DDHCalAngular.h.

Referenced by execute(), and initialize().

Definition at line 33 of file DDHCalAngular.h.

Referenced by execute(), and initialize().

int DDHCalAngular::n [private]

Definition at line 31 of file DDHCalAngular.h.

Referenced by execute(), and initialize().

double DDHCalAngular::rangeAngle [private]

Definition at line 27 of file DDHCalAngular.h.

Referenced by execute(), and initialize().

std::string DDHCalAngular::rotns [private]

Definition at line 35 of file DDHCalAngular.h.

Referenced by execute(), and initialize().

double DDHCalAngular::shiftX [private]

Definition at line 29 of file DDHCalAngular.h.

Referenced by execute(), and initialize().

double DDHCalAngular::shiftY [private]

Definition at line 28 of file DDHCalAngular.h.

Referenced by execute(), and initialize().

double DDHCalAngular::startAngle [private]

Definition at line 26 of file DDHCalAngular.h.

Referenced by execute(), and initialize().

Definition at line 32 of file DDHCalAngular.h.

Referenced by execute(), and initialize().

double DDHCalAngular::zoffset [private]

Definition at line 30 of file DDHCalAngular.h.

Referenced by execute(), and initialize().