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 "SLHCUpgradeSimulations/Geometry/interface/DDPixBarStackLinearGap.h"
00013 #include "CLHEP/Units/PhysicalConstants.h"
00014 #include "CLHEP/Units/SystemOfUnits.h"
00015
00016
00017 DDPixBarStackLinearGap::DDPixBarStackLinearGap() {
00018 LogDebug("TrackerGeom") << "DDPixBarStackLinearGap info: Creating an instance";
00019 }
00020
00021 DDPixBarStackLinearGap::~DDPixBarStackLinearGap() {}
00022
00023 void DDPixBarStackLinearGap::initialize(const DDNumericArguments & nArgs,
00024 const DDVectorArguments & vArgs,
00025 const DDMapArguments & ,
00026 const DDStringArguments & sArgs,
00027 const DDStringVectorArguments &) {
00028
00029 number = int(nArgs["Number"]);
00030 ringmodules = int(nArgs["RingModules"]);
00031 theta = nArgs["Theta"];
00032 phi = nArgs["Phi"];
00033 offset = nArgs["Offset"];
00034 delta = nArgs["Delta"];
00035 centre = vArgs["Center"];
00036 rotMat = sArgs["Rotation"];
00037 stackoffset = nArgs["StackOffset"];
00038 stackoffsetT= int(nArgs["StackOffsetT"]);
00039 zoffset = nArgs["ZOffset"];
00040
00041 idNameSpace = DDCurrentNamespace::ns();
00042 childName = sArgs["ChildName"];
00043 DDName parentName = parent().name();
00044 LogDebug("TrackerGeom") << "DDPixBarStackLinearGap debug: Parent " << parentName
00045 << "\tChild " << childName << " NameSpace "
00046 << idNameSpace << "\tNumber " << number <<"\tEndRings "<<ringmodules
00047 << "\tAxis (theta/phi) " << theta/CLHEP::deg << ", "
00048 << phi/CLHEP::deg << "\t(Offset/Delta) " << offset << ", "
00049 << delta << "\tCentre " << centre[0] << ", "
00050 << centre[1] << ", " << centre[2] << "\tRotation "
00051 << rotMat;
00052 }
00053
00054 void DDPixBarStackLinearGap::execute(DDCompactView& cpv) {
00055
00056 DDName mother = parent().name();
00057 DDName child(DDSplit(childName).first, DDSplit(childName).second);
00058 DDTranslation direction(sin(theta)*cos(phi),sin(theta)*sin(phi),cos(theta));
00059 DDTranslation base(centre[0],centre[1],centre[2]);
00060 DDTranslation zbase(centre[0],zoffset,centre[2]);
00061 std::string rotstr = DDSplit(rotMat).first;
00062 DDRotation rot;
00063 if (rotstr != "NULL") {
00064 std::string rotns = DDSplit(rotMat).second;
00065 rot = DDRotation(DDName(rotstr, rotns));
00066 }
00067
00068 for (int i=(number/2)-ringmodules; i<(number/2); i++) {
00069
00070 if((stackoffset!=0.0)&&(i!=0)) {
00071 if(i%stackoffsetT==0) offset+=stackoffset;
00072 }
00073
00074 DDTranslation tran = base + (offset + double(i)*delta)*direction;
00075 cpv.position (child, mother, 2*i+1, tran, rot);
00076 LogDebug("TrackerGeom") << "DDPixBarStackLinearGap test: " << child << " number "
00077 << 2*i+1 << " positioned in " << mother << " at "
00078 << tran << " with " << rot;
00079
00080 DDTranslation tran2 = base - (offset + double(i)*delta)*direction;
00081 cpv.position (child, mother, 2*i+2, tran2, rot);
00082 LogDebug("TrackerGeom") << "DDPixBarStackLinearGap test: " << child << " number "
00083 << 2*i+2 << " positioned in " << mother << " at "
00084 << tran2 << " with " << rot;
00085
00086 if(zoffset!=0.0){
00087 if((i+1)!=number){
00088 i++;
00089 DDTranslation tran3 = zbase + (offset + double(i)*delta)*direction;
00090 cpv.position (child, mother, 2*i+1, tran3, rot);
00091 LogDebug("TrackerGeom") << "DDPixBarStackLinearGap test: " << child << " number "
00092 << 2*i+1 << " positioned in " << mother << " at "
00093 << tran3 << " with " << rot;
00094
00095 DDTranslation tran4 = zbase - (offset + double(i)*delta)*direction;
00096 cpv.position (child, mother, 2*i+2, tran4, rot);
00097 LogDebug("TrackerGeom") << "DDPixBarStackLinearGap test: " << child << " number "
00098 << 2*i+2 << " positioned in " << mother << " at "
00099 << tran4 << " with " << rot;
00100
00101 }
00102 }
00103
00104 }
00105 }