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