CMS 3D CMS Logo

DDHCalLinearXY.cc

Go to the documentation of this file.
00001 
00002 // File: DDHCalLinearXY.cc
00003 // Description: Position nxXny copies at given intervals along x and y axis
00005 
00006 #include <cmath>
00007 #include <algorithm>
00008 
00009 #include "FWCore/MessageLogger/interface/MessageLogger.h"
00010 #include "DetectorDescription/Core/interface/DDPosPart.h"
00011 #include "DetectorDescription/Core/interface/DDCurrentNamespace.h"
00012 #include "DetectorDescription/Core/interface/DDSplit.h"
00013 #include "Geometry/HcalAlgo/interface/DDHCalLinearXY.h"
00014 
00015 
00016 DDHCalLinearXY::DDHCalLinearXY() {
00017   LogDebug("HCalGeom") <<"DDHCalLinearXY info: Creating an instance";
00018 }
00019 
00020 DDHCalLinearXY::~DDHCalLinearXY() {}
00021 
00022 void DDHCalLinearXY::initialize(const DDNumericArguments & nArgs,
00023                                    const DDVectorArguments & vArgs,
00024                                    const DDMapArguments & ,
00025                                    const DDStringArguments & sArgs,
00026                                    const DDStringVectorArguments &) {
00027 
00028   numberX   = int(nArgs["NumberX"]);
00029   deltaX    = nArgs["DeltaX"];
00030   numberY   = int(nArgs["NumberY"]);
00031   deltaY    = nArgs["DeltaY"];
00032   centre    = vArgs["Center"];
00033   
00034   idNameSpace = DDCurrentNamespace::ns();
00035   childName   = sArgs["ChildName"]; 
00036   DDName parentName = parent().name();
00037   LogDebug("HCalGeom") << "DDHCalLinearXY debug: Parent " << parentName
00038                        << "\tChild " << childName << " NameSpace " 
00039                        << idNameSpace << "\tNumber along X/Y " << numberX
00040                        << "/" << numberY << "\tDelta along X/Y " << deltaX
00041                        << "/" << deltaY << "\tCentre " << centre[0] << ", " 
00042                        << centre[1] << ", "     << centre[2];
00043 }
00044 
00045 void DDHCalLinearXY::execute() {
00046 
00047   DDName mother = parent().name();
00048   DDName child(DDSplit(childName).first, DDSplit(childName).second);
00049   DDRotation rot;
00050   double xoff = centre[0] - (numberX-1)*deltaX/2.;
00051   double yoff = centre[1] - (numberY-1)*deltaY/2.;
00052   int    copy = 0;
00053 
00054   for (int i=0; i<numberX; i++) {
00055     for (int j=0; j<numberY; j++) {
00056         
00057       DDTranslation tran(xoff+i*deltaX,yoff+j*deltaY,centre[2]);
00058       copy++;
00059       DDpos (child, mother, copy, tran, rot);
00060       LogDebug("HCalGeom") << "DDHCalLinearXY test: " << child 
00061                            << " number " << copy << " positioned in "
00062                            << mother << " at " << tran << " with " << rot;
00063     }
00064   }
00065 }

Generated on Tue Jun 9 17:37:30 2009 for CMSSW by  doxygen 1.5.4