CMS 3D CMS Logo

Public Member Functions | Private Attributes

DDHCalXtalAlgo Class Reference

#include <DDHCalXtalAlgo.h>

List of all members.

Public Member Functions

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

Private Attributes

double angwidth
double dx
double dz
int iaxis
std::string idName
std::string idNameSpace
std::vector< std::string > names
double offset
double radius

Detailed Description

Definition at line 10 of file DDHCalXtalAlgo.h.


Constructor & Destructor Documentation

DDHCalXtalAlgo::DDHCalXtalAlgo ( )

Definition at line 16 of file DDHCalXtalAlgo.cc.

References LogDebug.

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

Definition at line 20 of file DDHCalXtalAlgo.cc.

{}

Member Function Documentation

void DDHCalXtalAlgo::execute ( DDCompactView cpv)

Definition at line 51 of file DDHCalXtalAlgo.cc.

References abs, angle(), DDrot(), i, LogDebug, h::names, evf::evtn::offset(), dbtoconf::parent, phi, pos, DDCompactView::position(), CosmicsPD_Skims::radius, idealTransformation::rotation, funct::sin(), and theta().

                                               {

  double theta[3], phi[3], pos[3];
  phi[0] = 0;
  phi[1] = 90*CLHEP::deg;
  theta[1-iaxis] = 90*CLHEP::deg;
  pos[1-iaxis]   = 0;
  int number = (int)(names.size());
  for (int i=0; i<number; i++) {
    double angle = 0.5*angwidth*(2*i+1-number);
    theta[iaxis] = 90*CLHEP::deg + angle;
    if (angle>0) {
      theta[2]   = angle;
      phi[2]     = 90*iaxis*CLHEP::deg;
    } else {
      theta[2]   =-angle;
      phi[2]     = 90*(2-3*iaxis)*CLHEP::deg;
    }
    pos[iaxis]   = angle*(dz+radius);
    pos[2]       = dx*abs(sin(angle)) + offset;
  
    DDRotation rotation;
    string rotstr = names[i];
    DDTranslation tran(pos[0], pos[1], pos[2]);
    DDName parentName = parent().name(); 

    if (abs(angle) > 0.01*CLHEP::deg) {
      LogDebug("HCalGeom") << "DDHCalXtalAlgo test: Creating a new rotation " 
                           << rotstr << "\t" << theta[0]/CLHEP::deg << "," 
                           << phi[0]/CLHEP::deg << "," << theta[1]/CLHEP::deg 
                           << "," << phi[1]/CLHEP::deg << "," 
                           << theta[2]/CLHEP::deg << ","  << phi[2]/CLHEP::deg;
      rotation = DDrot(DDName(rotstr, idNameSpace), theta[0], phi[0], theta[1],
                       phi[1], theta[2], phi[2]);
    }
    cpv.position(DDName(idName, idNameSpace), parentName, i+1, tran, rotation);
    LogDebug("HCalGeom") << "DDHCalXtalAlgo test: "
                         << DDName(idName,idNameSpace) << " number " << i+1 
                         << " positioned in " << parentName << " at " << tran
                         << " with " << rotation;
  }
}
void DDHCalXtalAlgo::initialize ( const DDNumericArguments nArgs,
const DDVectorArguments vArgs,
const DDMapArguments mArgs,
const DDStringArguments sArgs,
const DDStringVectorArguments vsArgs 
)

Definition at line 22 of file DDHCalXtalAlgo.cc.

References i, LogDebug, h::names, DDCurrentNamespace::ns(), evf::evtn::offset(), dbtoconf::parent, and CosmicsPD_Skims::radius.

                                                                        {

  radius     = nArgs["Radius"];
  offset     = nArgs["Offset"];
  dx         = nArgs["Dx"];
  dz         = nArgs["Dz"];
  angwidth   = nArgs["AngWidth"];
  iaxis      = int (nArgs["Axis"]);
  names      = vsArgs["Names"];

  LogDebug("HCalGeom") << "DDHCalXtalAlgo debug: Parameters for positioning:: "
                       << "Axis " << iaxis << "\tRadius " << radius 
                       << "\tOffset " << offset << "\tDx " << dx << "\tDz " 
                       << dz << "\tAngWidth " << angwidth/CLHEP::deg 
                       << "\tNumbers " << names.size();
  for (unsigned int i = 0; i < names.size(); i++)
    LogDebug("HCalGeom") << "\tnames[" << i << "] = " << names[i];

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

Member Data Documentation

double DDHCalXtalAlgo::angwidth [private]

Definition at line 30 of file DDHCalXtalAlgo.h.

double DDHCalXtalAlgo::dx [private]

Definition at line 28 of file DDHCalXtalAlgo.h.

double DDHCalXtalAlgo::dz [private]

Definition at line 29 of file DDHCalXtalAlgo.h.

int DDHCalXtalAlgo::iaxis [private]

Definition at line 31 of file DDHCalXtalAlgo.h.

std::string DDHCalXtalAlgo::idName [private]

Definition at line 35 of file DDHCalXtalAlgo.h.

std::string DDHCalXtalAlgo::idNameSpace [private]

Definition at line 34 of file DDHCalXtalAlgo.h.

std::vector<std::string> DDHCalXtalAlgo::names [private]

Definition at line 32 of file DDHCalXtalAlgo.h.

double DDHCalXtalAlgo::offset [private]

Definition at line 27 of file DDHCalXtalAlgo.h.

double DDHCalXtalAlgo::radius [private]

Definition at line 26 of file DDHCalXtalAlgo.h.