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