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