00001
00002
00003
00004
00005
00006
00008
00009 #include <cmath>
00010 #include <algorithm>
00011
00012 #include "FWCore/MessageLogger/interface/MessageLogger.h"
00013 #include "DetectorDescription/Base/interface/DDutils.h"
00014 #include "DetectorDescription/Core/interface/DDPosPart.h"
00015 #include "DetectorDescription/Core/interface/DDCurrentNamespace.h"
00016 #include "DetectorDescription/Core/interface/DDSplit.h"
00017 #include "Geometry/TrackerCommonData/interface/DDTECCoolAlgo.h"
00018 #include "CLHEP/Units/PhysicalConstants.h"
00019 #include "CLHEP/Units/SystemOfUnits.h"
00020
00021
00022 DDTECCoolAlgo::DDTECCoolAlgo(): phiPosition(0),coolInsert(0) {
00023 LogDebug("TECGeom") << "DDTECCoolAlgo info: Creating an instance";
00024 }
00025
00026 DDTECCoolAlgo::~DDTECCoolAlgo() {}
00027
00028 void DDTECCoolAlgo::initialize(const DDNumericArguments & nArgs,
00029 const DDVectorArguments & vArgs,
00030 const DDMapArguments & ,
00031 const DDStringArguments & sArgs,
00032 const DDStringVectorArguments & vsArgs) {
00033
00034 idNameSpace = DDCurrentNamespace::ns();
00035 startCopyNo = int(nArgs["StartCopyNo"]);
00036
00037 DDName parentName = parent().name();
00038 rPosition = nArgs["RPosition"];
00039 LogDebug("TECGeom") << "DDTECCoolAlgo debug: Parent " << parentName
00040 <<" NameSpace " << idNameSpace << " at radial Position "
00041 << rPosition ;
00042 phiPosition = vArgs["PhiPosition"];
00043 coolInsert = vsArgs["CoolInsert"];
00044 if(phiPosition.size() == coolInsert.size()){
00045 for (int i=0; i<(int)(phiPosition.size()); i++) LogDebug("TECGeom") << "DDTECCoolAlgo debug: Insert[" << i << "]: "
00046 << coolInsert.at(i) << " at Phi " << phiPosition.at(i)/deg;
00047 }else{
00048 LogDebug("TECGeom") << "ERROR: Number of inserts does not match the numer of PhiPositions!";
00049 }
00050 LogDebug("TECGeom") << " Done creating instance of DDTECCoolAlgo ";
00051 }
00052
00053 void DDTECCoolAlgo::execute() {
00054 LogDebug("TECGeom") << "==>> Constructing DDTECCoolAlgo...";
00055 int copyNo = startCopyNo;
00056
00057 for (int i = 0; i < (int)(coolInsert.size()); i++) {
00058
00059 DDName child = DDName(DDSplit(coolInsert.at(i)).first,
00060 DDSplit(coolInsert.at(i)).second);
00061 DDName mother = parent().name();
00062
00063 double xpos = rPosition*cos(phiPosition.at(i));
00064 double ypos = -rPosition*sin(phiPosition.at(i));
00065
00066 DDTranslation tran(xpos, ypos, 0.0);
00067 DDRotation rotation;
00068 DDpos (child, mother, copyNo, tran, rotation);
00069 LogDebug("TECGeom") << "DDTECCoolAlgo test " << child << "["
00070 << copyNo << "] positioned in " << mother
00071 << " at " << tran << " with " << rotation
00072 << " phi " << phiPosition.at(i)/deg <<" r " << rPosition;
00073 copyNo++;
00074 }
00075 LogDebug("TECGeom") << "<<== End of DDTECCoolAlgo construction ...";
00076 }