CMS 3D CMS Logo

Public Member Functions | Private Attributes

DDHCalForwardAlgo Class Reference

#include <DDHCalForwardAlgo.h>

List of all members.

Public Member Functions

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

Private Attributes

double cellDx
double cellDy
double cellDz
std::string cellMat
std::vector< std::string > childName
std::string idNameSpace
std::vector< int > number
std::vector< int > size
double startY
std::vector< int > type

Detailed Description

Definition at line 10 of file DDHCalForwardAlgo.h.


Constructor & Destructor Documentation

DDHCalForwardAlgo::DDHCalForwardAlgo ( )

Definition at line 19 of file DDHCalForwardAlgo.cc.

References LogDebug.

                                    : number(0),size(0),type(0) {
  LogDebug("HCalGeom") << "DDHCalForwardAlgo info: Creating an instance";
}
DDHCalForwardAlgo::~DDHCalForwardAlgo ( ) [virtual]

Definition at line 23 of file DDHCalForwardAlgo.cc.

{}

Member Function Documentation

void DDHCalForwardAlgo::execute ( DDCompactView cpv)

Definition at line 60 of file DDHCalForwardAlgo.cc.

References DDSolidFactory::box(), cellDx, cellDy, cellDz, cellMat, childName, dbl_to_string(), DDBase< N, C >::ddname(), DDSplit(), first, i, idNameSpace, j, gen::k, LogDebug, AlCaRecoCosmics_cfg::name, DDName::name(), number, dbtoconf::parent, DDCompactView::position(), edm::second(), size, and startY.

                                                  {
  
  LogDebug("HCalGeom") << "==>> Constructing DDHCalForwardAlgo...";

  DDName parentName = parent().name(); 
  double ypos       = startY;
  int    box        = 0;

  for (unsigned int i=0; i<number.size(); i++) {
    double dx   = cellDx*size[i];
    int    indx = type[i];
    for (int j=0; j<number[i]; j++) {
      box++;
      string name = parentName.name() + dbl_to_string(box);
      DDSolid solid = DDSolidFactory::box(DDName(name, idNameSpace),
                                          dx, cellDy, cellDz);
      LogDebug("HCalGeom") << "DDHCalForwardAlgo test: " 
                           << DDName(name, idNameSpace) << " Box made of " 
                           << cellMat << " of Size " << dx << ", " << cellDy
                           << ", " << cellDz;
  
      DDName matname(DDSplit(cellMat).first, DDSplit(cellMat).second); 
      DDMaterial matter(matname);
      DDLogicalPart genlogic(solid.ddname(), matter, solid);

      DDTranslation r0(0.0, ypos, 0.0);
      DDRotation rot;
      cpv.position(solid.ddname(), parentName, box, r0, rot);
      LogDebug("HCalGeom") << "DDHCalForwardAlgo test: " << solid.ddname() 
                           << " number " << box << " positioned in " 
                           << parentName << " at " << r0 << " with " << rot;
  
      DDName child(DDSplit(childName[indx]).first, 
                   DDSplit(childName[indx]).second); 
      double xpos = -dx + cellDx;
      ypos       += 2*cellDy;
      indx        = 1 - indx;

      for (int k=0; k<size[i]; k++) {
        DDTranslation r1(xpos, 0.0, 0.0);
        cpv.position(child, solid.ddname(), k+1, r1, rot);
        LogDebug("HCalGeom") << "DDHCalForwardAlgo test: " << child 
                             << " number " << k+1 << " positioned in " 
                             << solid.ddname() << " at " << r1 << " with "
                             << rot;
        xpos += 2*cellDx;
      }
    }  
  }
  LogDebug("HCalGeom") << "<<== End of DDHCalForwardAlgo construction ...";
}
void DDHCalForwardAlgo::initialize ( const DDNumericArguments nArgs,
const DDVectorArguments vArgs,
const DDMapArguments mArgs,
const DDStringArguments sArgs,
const DDStringVectorArguments vsArgs 
)

Definition at line 26 of file DDHCalForwardAlgo.cc.

References cellDx, cellDy, cellDz, cellMat, childName, dbl_to_int(), i, idNameSpace, LogDebug, DDCurrentNamespace::ns(), number, dbtoconf::parent, size, and startY.

                                                                           {

  cellMat     = sArgs["CellMaterial"];
  cellDx      = nArgs["CellDx"];
  cellDy      = nArgs["CellDy"];
  cellDz      = nArgs["CellDz"];
  startY      = nArgs["StartY"];

  childName   = vsArgs["Child"];
  number      = dbl_to_int(vArgs["Number"]);
  size        = dbl_to_int(vArgs["Size"]);
  type        = dbl_to_int(vArgs["Type"]);

  LogDebug("HCalGeom") << "DDHCalForwardAlgo debug: Cell material " << cellMat
                       << "\tCell Size "  << cellDx << ", " << cellDy << ", "
                       << cellDz << "\tStarting Y " << startY << "\tChildren "
                       << childName[0] << ", " << childName[1] << "\n"
                       << "                         Cell positioning done for "
                       << number.size() << " times";
  for (unsigned int i = 0; i < number.size(); i++)
    LogDebug("HCalGeom") << "\t" << i << " Number of children " << size[i] 
                         << " occurence " << number[i] << " first child index "
                         << type[i];

  idNameSpace = DDCurrentNamespace::ns();
  DDName parentName = parent().name(); 
  LogDebug("HCalGeom") << "DDHCalForwardAlgo debug: Parent " << parentName
                       << " NameSpace " << idNameSpace;
}

Member Data Documentation

double DDHCalForwardAlgo::cellDx [private]

Definition at line 27 of file DDHCalForwardAlgo.h.

Referenced by execute(), and initialize().

double DDHCalForwardAlgo::cellDy [private]

Definition at line 27 of file DDHCalForwardAlgo.h.

Referenced by execute(), and initialize().

double DDHCalForwardAlgo::cellDz [private]

Definition at line 27 of file DDHCalForwardAlgo.h.

Referenced by execute(), and initialize().

std::string DDHCalForwardAlgo::cellMat [private]

Definition at line 26 of file DDHCalForwardAlgo.h.

Referenced by execute(), and initialize().

std::vector<std::string> DDHCalForwardAlgo::childName [private]

Definition at line 29 of file DDHCalForwardAlgo.h.

Referenced by execute(), and initialize().

std::string DDHCalForwardAlgo::idNameSpace [private]

Definition at line 34 of file DDHCalForwardAlgo.h.

Referenced by execute(), and initialize().

std::vector<int> DDHCalForwardAlgo::number [private]

Definition at line 30 of file DDHCalForwardAlgo.h.

Referenced by execute(), and initialize().

std::vector<int> DDHCalForwardAlgo::size [private]

Definition at line 31 of file DDHCalForwardAlgo.h.

Referenced by execute(), and initialize().

double DDHCalForwardAlgo::startY [private]

Definition at line 28 of file DDHCalForwardAlgo.h.

Referenced by execute(), and initialize().

std::vector<int> DDHCalForwardAlgo::type [private]

Definition at line 32 of file DDHCalForwardAlgo.h.