CMS 3D CMS Logo

DDTrackerXYZPosAlgo.cc

Go to the documentation of this file.
00001 
00002 // File: DDTrackerXYZPosAlgo.cc
00003 // Description: Position n copies at given x-values, y-values and z-values
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/DDTrackerXYZPosAlgo.h"
00014 #include "CLHEP/Units/PhysicalConstants.h"
00015 #include "CLHEP/Units/SystemOfUnits.h"
00016 
00017 
00018 DDTrackerXYZPosAlgo::DDTrackerXYZPosAlgo() {
00019   LogDebug("TrackerGeom") <<"DDTrackerXYZPosAlgo info: Creating an instance";
00020 }
00021 
00022 DDTrackerXYZPosAlgo::~DDTrackerXYZPosAlgo() {}
00023 
00024 void DDTrackerXYZPosAlgo::initialize(const DDNumericArguments & nArgs,
00025                                    const DDVectorArguments & vArgs,
00026                                    const DDMapArguments & ,
00027                                    const DDStringArguments & sArgs,
00028                                    const DDStringVectorArguments & vsArgs) {
00029 
00030   startCopyNo = int(nArgs["StartCopyNo"]);
00031   incrCopyNo  = int(nArgs["IncrCopyNo"]);
00032   xvec        = vArgs["XPositions"];
00033   yvec        = vArgs["YPositions"];
00034   zvec        = vArgs["ZPositions"];
00035   rotMat      = vsArgs["Rotations"];
00036   
00037   idNameSpace = DDCurrentNamespace::ns();
00038   childName   = sArgs["ChildName"]; 
00039   DDName parentName = parent().name();
00040   LogDebug("TrackerGeom") << "DDTrackerXYZPosAlgo debug: Parent " << parentName 
00041                           << "\tChild " << childName << " NameSpace " 
00042                           << idNameSpace << "\tCopyNo (Start/Increment) " 
00043                           << startCopyNo << ", " << incrCopyNo << "\tNumber " 
00044                           << xvec.size() << ", " << yvec.size() << ", " << zvec.size();
00045   for (int i = 0; i < (int)(zvec.size()); i++) {
00046     LogDebug("TrackerGeom") << "\t[" << i << "]\tX = " << xvec[i]
00047                             << "\t[" << i << "]\tY = " << yvec[i] 
00048                             << "\t[" << i << "]\tZ = " << zvec[i] 
00049                             << ", Rot.Matrix = " << rotMat[i];
00050   }
00051 }
00052 
00053 void DDTrackerXYZPosAlgo::execute() {
00054 
00055   int    copy   = startCopyNo;
00056   DDName mother = parent().name();
00057   DDName child(DDSplit(childName).first, DDSplit(childName).second);
00058 
00059   for (int i=0; i<(int)(zvec.size()); i++) {
00060         
00061     DDTranslation tran(xvec[i], yvec[i], zvec[i]);
00062     std::string rotstr = DDSplit(rotMat[i]).first;
00063     DDRotation rot;
00064     if (rotstr != "NULL") {
00065       std::string rotns  = DDSplit(rotMat[i]).second;
00066       rot = DDRotation(DDName(rotstr, rotns));
00067     }
00068     DDpos (child, mother, copy, tran, rot);
00069     LogDebug("TrackerGeom") << "DDTrackerXYZPosAlgo test: " << child <<" number "
00070                             << copy << " positioned in " << mother << " at "
00071                             << tran << " with " << rot;
00072     copy += incrCopyNo;
00073   }
00074 }

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