CMS 3D CMS Logo

DDPixFwdBlades Class Reference

#include <Geometry/TrackerCommonData/interface/DDPixFwdBlades.h>

List of all members.

Public Member Functions

 DDPixFwdBlades ()
void execute ()
void initialize (const DDNumericArguments &nArgs, const DDVectorArguments &vArgs, const DDMapArguments &mArgs, const DDStringArguments &sArgs, const DDStringVectorArguments &vsArgs)
virtual ~DDPixFwdBlades ()

Private Member Functions

void computeNippleParameters (double endcap)
int issueCopyNumber ()

Private Attributes

std::string childName
std::string childRotationName
std::vector< double > childTranslationVector
double endcap
std::string flagSelector
std::string flagString
std::string idNameSpace

Static Private Attributes

static const double ancorRadius = 54.631*mm
static const double bladeAngle = 20.*deg
static const double bladeZShift = 6.*mm
static std::map< std::string, intcopyNumbers
static const double jX = -16.25*mm
static const double jY = 96.50*mm
static const double jZ = 1.25*mm
static const double kX = 16.25*mm
static const double kY = 96.50*mm
static const double kZ = -1.25*mm
static const int nBlades = 24
static HepRotation * nippleRotationZMinus = 0
static HepRotation * nippleRotationZPlus = 0
static double nippleTranslationX = 0.
static double nippleTranslationY = 0.
static double nippleTranslationZ = 0.
static const double zPlane = 0.


Detailed Description

Definition at line 64 of file DDPixFwdBlades.h.


Constructor & Destructor Documentation

DDPixFwdBlades::DDPixFwdBlades (  ) 

Definition at line 59 of file DDPixFwdBlades.cc.

00059 {}

DDPixFwdBlades::~DDPixFwdBlades (  )  [virtual]

Definition at line 60 of file DDPixFwdBlades.cc.

00060 {}


Member Function Documentation

void DDPixFwdBlades::computeNippleParameters ( double  endcap  )  [private]

Definition at line 228 of file DDPixFwdBlades.cc.

References ancorRadius, bladeAngle, bladeZShift, funct::cos(), DDrot(), deltaPhi(), jX, jY, jZ, kX, kY, kZ, LogDebug, nBlades, nippleRotationZMinus, nippleRotationZPlus, nippleTranslationX, nippleTranslationY, nippleTranslationZ, and funct::sin().

Referenced by execute().

00228                                                           {
00229         
00230   double effBladeAngle = endcap * bladeAngle;
00231   
00232   Hep3Vector jC; // Point J in the "cover" blade frame
00233   Hep3Vector kB; // Point K in the "body" blade frame
00234   std::string rotNameNippleToCover;
00235   std::string rotNameCoverToNipple;
00236   std::string rotNameNippleToBody;
00237 
00238   if (endcap > 0.) {
00239         jC = Hep3Vector(jX, jY + ancorRadius, jZ);
00240         kB = Hep3Vector(kX, kY + ancorRadius, kZ);
00241         rotNameNippleToCover = "NippleToCoverZPlus";
00242         rotNameCoverToNipple = "CoverToNippleZPlus";
00243         rotNameNippleToBody = "NippleToBodyZPlus";
00244   } else {
00245         jC = Hep3Vector(-jX, jY + ancorRadius, jZ);
00246         kB = Hep3Vector(-kX, kY + ancorRadius, kZ);
00247         rotNameNippleToCover = "NippleToCoverZMinus";
00248         rotNameCoverToNipple = "CoverToNippleZMinus";
00249         rotNameNippleToBody = "NippleToBodyZMinus";
00250   }
00251                 
00252   // Z-shift from "cover" to "body" blade frame:
00253   
00254   Hep3Vector tCB(bladeZShift*sin(effBladeAngle), 0., bladeZShift*cos(effBladeAngle));
00255   
00256   // Rotation from "cover" blade frame into "body" blade frame :
00257   
00258   double deltaPhi = endcap*(360./nBlades)*deg;
00259   HepRotation rCB(Hep3Vector(1.*sin(effBladeAngle), 0., 1.*cos(effBladeAngle)), deltaPhi);
00260   
00261   // Transform vector k into "cover" blade frame :
00262   
00263   Hep3Vector kC = rCB * (kB + tCB);
00264   
00265   // Vector JK in the "cover" blade frame:
00266   
00267   Hep3Vector jkC = kC - jC;
00268   double* jkLength = new double(jkC.mag());
00269   DDConstant JK(DDName("JK", "pixfwdNipple"), jkLength);
00270   LogDebug("PixelGeom") << "+++++++++++++++ DDPixFwdBlades: " << "JK Length " <<  *jkLength * mm;
00271   
00272   // Position of the center of a nipple in "cover" blade frame :
00273   
00274   Hep3Vector nippleTranslation((kC+jC)/2. - Hep3Vector(0., ancorRadius, 0.));
00275   if (endcap > 0) {
00276         nippleTranslationX = nippleTranslation.x();
00277         nippleTranslationY = nippleTranslation.y();
00278         nippleTranslationZ = nippleTranslation.z();
00279   }
00280   LogDebug("PixelGeom") << "Child translation : " << nippleTranslation;
00281   
00282   // Rotations from nipple frame to "cover" blade frame and back :
00283   
00284   Hep3Vector vZ(0.,0.,1.);
00285   Hep3Vector axis = vZ.cross(jkC);
00286   double angleCover = vZ.angle(jkC);
00287   LogDebug("PixelGeom") << " Angle to Cover: " << angleCover;
00288   HepRotation* rpCN = new HepRotation(axis, angleCover);
00289   if (endcap > 0.) {
00290         nippleRotationZPlus = rpCN;
00291   } else {
00292         nippleRotationZMinus = rpCN;
00293   }
00294   //( endcap > 0. ? nippleRotationZPlus : nippleRotationZMinus ) = rpCN;
00295 
00296   // due to conversion to ROOT::Math::Rotation3D;
00297   // also, maybe I'm dumb, but the ownership of these pointers is very confusing,
00298   // so it seemed safer to make DD stuff "as needed" -- Michael Case
00299   DDRotationMatrix* ddrpCN = new DDRotationMatrix(rpCN->xx(), rpCN->xy(), rpCN->xz(),
00300                                                   rpCN->yx(), rpCN->yy(), rpCN->yz(),
00301                                                   rpCN->zx(), rpCN->zy(), rpCN->zz() );
00302 
00303   DDrot(DDName(rotNameCoverToNipple, "pixfwdNipple"), ddrpCN);
00304   HepRotation* rpNC = new HepRotation(axis, -angleCover);
00305   DDRotationMatrix* ddrpNC = new DDRotationMatrix(rpNC->xx(), rpNC->xy(), rpNC->xz(),
00306                                                   rpNC->yx(), rpNC->yy(), rpNC->yz(),
00307                                                   rpNC->zx(), rpNC->zy(), rpNC->zz() );
00308 
00309   DDrot(DDName(rotNameNippleToCover, "pixfwdNipple"), ddrpNC);
00310   
00311   // Rotation from nipple frame to "body" blade frame :
00312   
00313   HepRotation* rpNB = new HepRotation( (*rpNC) * rCB );
00314   DDRotationMatrix* ddrpNB = new DDRotationMatrix(rpNB->xx(), rpNB->xy(), rpNB->xz(),
00315                                                   rpNB->yx(), rpNB->yy(), rpNB->yz(),
00316                                                   rpNB->zx(), rpNB->zy(), rpNB->zz() );
00317 
00318   DDrot(DDName(rotNameNippleToBody, "pixfwdNipple"), ddrpNB);
00319   double angleBody = vZ.angle(*rpNB * vZ);
00320   LogDebug("PixelGeom") << " Angle to body : " << angleBody;
00321   
00322 }

void DDPixFwdBlades::execute (  ) 

Definition at line 107 of file DDPixFwdBlades.cc.

References ancorRadius, bladeAngle, bladeZShift, childName, childRotationName, childTranslationVector, computeNippleParameters(), edmNew::copy(), DDpos(), DDrot(), DDSplit(), deltaPhi(), endcap, first, flagSelector, flagString, idNameSpace, int_to_string(), issueCopyNumber(), nBlades, nippleRotationZMinus, nippleRotationZPlus, nippleTranslationX, nippleTranslationY, nippleTranslationZ, dbtoconf::parent, phi, DDRotation::rotation(), edm::second(), pyDBSRunClass::temp, x, y, z, and zPlane.

00107                              {
00108 
00109   // -- Compute Nipple parameters if not already computed :
00110   
00111   if (!nippleRotationZPlus) {
00112         computeNippleParameters(1.);   // Z Plus endcap
00113         computeNippleParameters(-1.);  // Z Minus endcap
00114   }
00115   if (childName == "") return;
00116   
00117   // -- Signed versions of blade angle and z-shift :
00118   
00119   double effBladeAngle = - endcap * bladeAngle;
00120   double effBladeZShift = endcap * bladeZShift;
00121   
00122   // -- Names of mother and child volumes :
00123 
00124   DDName mother = parent().name();
00125   DDName child(DDSplit(childName).first, DDSplit(childName).second);
00126   
00127   // -- Get translation and rotation from "blade frame" to "child frame", if any :
00128   
00129   HepRotation childRotMatrix = HepRotation();
00130   if (childRotationName != "") {
00131     DDRotation childRotation = DDRotation(DDName(DDSplit(childRotationName).first, DDSplit(childRotationName).second));
00132     // due to conversion to ROOT::Math::Rotation3D -- Michael Case
00133     DD3Vector x, y, z;
00134     childRotation.rotation()->GetComponents(x, y, z); // these are the orthonormal columns.
00135     HepRep3x3 tr(x.X(), y.X(), z.X(), x.Y(), y.Y(), z.Y(), x.Z(), y.Z(), z.Z());
00136     childRotMatrix = HepRotation(tr);
00137   } else if (childName == "pixfwdNipple:PixelForwardNippleZPlus") {
00138     childRotMatrix = *nippleRotationZPlus;
00139   } else if (childName == "pixfwdNipple:PixelForwardNippleZMinus") {
00140     childRotMatrix = *nippleRotationZMinus;
00141   }
00142   
00143   Hep3Vector childTranslation;
00144   if (childName == "pixfwdNipple:PixelForwardNippleZPlus") {
00145         childTranslation = Hep3Vector(nippleTranslationX, nippleTranslationY, nippleTranslationZ);
00146   } else if (childName == "pixfwdNipple:PixelForwardNippleZMinus") {
00147         childTranslation = Hep3Vector(-nippleTranslationX, nippleTranslationY, nippleTranslationZ);
00148   } else {
00149         childTranslation = Hep3Vector(childTranslationVector[0],childTranslationVector[1],childTranslationVector[2]);
00150   }
00151   
00152   // Create a matrix for rotation around blade axis (to "blade frame") :
00153   
00154   HepRotation bladeRotMatrix(Hep3Vector(0.,1.,0.), effBladeAngle);
00155   
00156   // Cycle over Phi positions, placing copies of the child volume :
00157 
00158   double deltaPhi = (360./nBlades)*deg;
00159   int nQuarter = nBlades/4;
00160   double zShiftMax = effBladeZShift*((nQuarter-1)/2.);
00161 
00162   for (int iBlade=0; iBlade < nBlades; iBlade++) {
00163     
00164     // check if this blade position should be skipped :
00165         
00166         if (flagString[iBlade] != flagSelector[0]) continue;
00167     int copy = issueCopyNumber();
00168     
00169     // calculate Phi and Z shift for this blade :
00170 
00171     double phi = (iBlade + 0.5) * deltaPhi - 90.*deg;
00172     int iQuarter = iBlade % nQuarter;
00173     double zShift = - zShiftMax + iQuarter * effBladeZShift;
00174     
00175     // compute rotation matrix from mother to blade frame :
00176     
00177     HepRotation* rotMatrix = new HepRotation(Hep3Vector(0.,0.,1.), phi);
00178     (*rotMatrix) *= bladeRotMatrix;
00179     
00180     // convert translation vector from blade frame to mother frame, and add Z shift :
00181     
00182     Hep3Vector translation = (*rotMatrix)(childTranslation + Hep3Vector(0., ancorRadius, 0.));
00183     translation += Hep3Vector(0., 0., zShift + zPlane);
00184     
00185     // create DDRotation for placing the child if not already existent :
00186 
00187     DDRotation rotation;   
00188     std::string rotstr = DDSplit(childName).first + int_to_string(copy);
00189     rotation = DDRotation(DDName(rotstr, idNameSpace));
00190 
00191     if (!rotation) {
00192       (*rotMatrix) *= childRotMatrix;
00193       // due to conversion to ROOT::Math::Rotation3D; 
00194       // also, maybe I'm dumb, but the ownership of these pointers is very confusing,
00195       // so it seemed safer to make DD stuff "as needed" -- Michael Case
00196       DDRotationMatrix* temp = new DDRotationMatrix(rotMatrix->xx(), rotMatrix->xy(), rotMatrix->xz(),
00197                                                     rotMatrix->yx(), rotMatrix->yy(), rotMatrix->yz(),
00198                                                     rotMatrix->zx(), rotMatrix->zy(), rotMatrix->zz() );
00199       rotation = DDrot(DDName(rotstr, idNameSpace), temp);
00200     } else {
00201       delete rotMatrix;
00202     }
00203 
00204     // position the child :
00205 
00206     // due to conversion to ROOT::Math::Rotation3D; 
00207     // also, maybe I'm dumb, but the ownership of these pointers is very confusing,
00208     // so it seemed safer to make DD stuff "as needed" -- Michael Case
00209     DDTranslation ddtran(translation.x(), translation.y(), translation.z());
00210     DDpos(child, mother, copy, ddtran, rotation);
00211     // LogDebug("PixelGeom") << "DDPixFwdBlades: " << child << " Copy " << copy << " positioned in " << mother << " at " << translation << " with rotation " << rotation;
00212   }
00213 
00214   // End of cycle over Phi positions
00215 
00216 }

void DDPixFwdBlades::initialize ( const DDNumericArguments nArgs,
const DDVectorArguments vArgs,
const DDMapArguments mArgs,
const DDStringArguments sArgs,
const DDStringVectorArguments vsArgs 
)

Definition at line 64 of file DDPixFwdBlades.cc.

References childName, childRotationName, childTranslationVector, endcap, flagSelector, flagString, idNameSpace, and DDCurrentNamespace::ns().

00068                                                                   {
00069                                         
00070   if ( nArgs.find("Endcap") != nArgs.end() ) {
00071     endcap = nArgs["Endcap"];
00072   } else {
00073     endcap = 1.;
00074   }
00075 
00076   if ( sArgs.find("FlagString") != sArgs.end() ) {
00077     flagString = sArgs["FlagString"];
00078     flagSelector = sArgs["FlagSelector"];
00079   } else {
00080     flagString = "YYYYYYYYYYYYYYYYYYYYYYYY";
00081     flagSelector = "Y";
00082   }
00083 
00084   if ( sArgs.find("Child") != sArgs.end() ) {
00085     childName   = sArgs["Child"];
00086   } else {
00087     childName   = "";
00088   }
00089 
00090   if ( vArgs.find("ChildTranslation") != vArgs.end() ) {
00091     childTranslationVector = vArgs["ChildTranslation"];
00092   } else {
00093     childTranslationVector = std::vector<double>(3, 0.);
00094   }
00095 
00096   if ( sArgs.find("ChildRotation") != sArgs.end() ) {
00097     childRotationName = sArgs["ChildRotation"];
00098   } else {
00099     childRotationName = "";
00100   }
00101 
00102   idNameSpace = DDCurrentNamespace::ns();
00103 }

int DDPixFwdBlades::issueCopyNumber (  )  [private]

Definition at line 220 of file DDPixFwdBlades.cc.

References childName, and copyNumbers.

Referenced by execute().

00220                                     {
00221   if (copyNumbers.count(childName) == 0) copyNumbers[childName] = 0;
00222   return ++copyNumbers[childName];
00223 }


Member Data Documentation

const double DDPixFwdBlades::ancorRadius = 54.631*mm [static, private]

Definition at line 94 of file DDPixFwdBlades.h.

Referenced by computeNippleParameters(), and execute().

const double DDPixFwdBlades::bladeAngle = 20.*deg [static, private]

Definition at line 90 of file DDPixFwdBlades.h.

Referenced by computeNippleParameters(), and execute().

const double DDPixFwdBlades::bladeZShift = 6.*mm [static, private]

Definition at line 92 of file DDPixFwdBlades.h.

Referenced by computeNippleParameters(), and execute().

std::string DDPixFwdBlades::childName [private]

Definition at line 112 of file DDPixFwdBlades.h.

Referenced by execute(), initialize(), and issueCopyNumber().

std::string DDPixFwdBlades::childRotationName [private]

Definition at line 115 of file DDPixFwdBlades.h.

Referenced by execute(), and initialize().

std::vector<double> DDPixFwdBlades::childTranslationVector [private]

Definition at line 114 of file DDPixFwdBlades.h.

Referenced by execute(), and initialize().

std::map< std::string, int > DDPixFwdBlades::copyNumbers [static, private]

Definition at line 121 of file DDPixFwdBlades.h.

Referenced by issueCopyNumber().

double DDPixFwdBlades::endcap [private]

Definition at line 107 of file DDPixFwdBlades.h.

Referenced by execute(), and initialize().

std::string DDPixFwdBlades::flagSelector [private]

Definition at line 110 of file DDPixFwdBlades.h.

Referenced by execute(), and initialize().

std::string DDPixFwdBlades::flagString [private]

Definition at line 109 of file DDPixFwdBlades.h.

Referenced by execute(), and initialize().

std::string DDPixFwdBlades::idNameSpace [private]

Definition at line 119 of file DDPixFwdBlades.h.

Referenced by execute(), and initialize().

const double DDPixFwdBlades::jX = -16.25*mm [static, private]

Definition at line 98 of file DDPixFwdBlades.h.

Referenced by computeNippleParameters().

const double DDPixFwdBlades::jY = 96.50*mm [static, private]

Definition at line 99 of file DDPixFwdBlades.h.

Referenced by computeNippleParameters().

const double DDPixFwdBlades::jZ = 1.25*mm [static, private]

Definition at line 100 of file DDPixFwdBlades.h.

Referenced by computeNippleParameters().

const double DDPixFwdBlades::kX = 16.25*mm [static, private]

Definition at line 101 of file DDPixFwdBlades.h.

Referenced by computeNippleParameters().

const double DDPixFwdBlades::kY = 96.50*mm [static, private]

Definition at line 102 of file DDPixFwdBlades.h.

Referenced by computeNippleParameters().

const double DDPixFwdBlades::kZ = -1.25*mm [static, private]

Definition at line 103 of file DDPixFwdBlades.h.

Referenced by computeNippleParameters().

const int DDPixFwdBlades::nBlades = 24 [static, private]

Definition at line 89 of file DDPixFwdBlades.h.

Referenced by computeNippleParameters(), and execute().

HepRotation * DDPixFwdBlades::nippleRotationZMinus = 0 [static, private]

Definition at line 124 of file DDPixFwdBlades.h.

Referenced by computeNippleParameters(), and execute().

HepRotation * DDPixFwdBlades::nippleRotationZPlus = 0 [static, private]

Definition at line 123 of file DDPixFwdBlades.h.

Referenced by computeNippleParameters(), and execute().

double DDPixFwdBlades::nippleTranslationX = 0. [static, private]

Definition at line 125 of file DDPixFwdBlades.h.

Referenced by computeNippleParameters(), and execute().

double DDPixFwdBlades::nippleTranslationY = 0. [static, private]

Definition at line 125 of file DDPixFwdBlades.h.

Referenced by computeNippleParameters(), and execute().

double DDPixFwdBlades::nippleTranslationZ = 0. [static, private]

Definition at line 125 of file DDPixFwdBlades.h.

Referenced by computeNippleParameters(), and execute().

const double DDPixFwdBlades::zPlane = 0. [static, private]

Definition at line 91 of file DDPixFwdBlades.h.

Referenced by execute().


The documentation for this class was generated from the following files:
Generated on Tue Jun 9 18:18:12 2009 for CMSSW by  doxygen 1.5.4