CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Member Functions | Private Attributes | Static Private Attributes
DDPixFwdBlades Class Reference

#include <DDPixFwdBlades.h>

Inheritance diagram for DDPixFwdBlades:

Public Member Functions

 DDPixFwdBlades ()
 
void execute (DDCompactView &cpv)
 
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*CLHEP::mm
 
static const double bladeAngle = 20.*CLHEP::deg
 
static const double bladeZShift = 6.*CLHEP::mm
 
static std::map< std::string, int > copyNumbers
 
static const double jX = -16.25*CLHEP::mm
 
static const double jY = 96.50*CLHEP::mm
 
static const double jZ = 1.25*CLHEP::mm
 
static const double kX = 16.25*CLHEP::mm
 
static const double kY = 96.50*CLHEP::mm
 
static const double kZ = -1.25*CLHEP::mm
 
static const int nBlades = 24
 
static CLHEP::HepRotation * nippleRotationZMinus = 0
 
static CLHEP::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 58 of file DDPixFwdBlades.cc.

58 {}
DDPixFwdBlades::~DDPixFwdBlades ( )
virtual

Definition at line 59 of file DDPixFwdBlades.cc.

59 {}

Member Function Documentation

void DDPixFwdBlades::computeNippleParameters ( double  endcap)
private

Definition at line 218 of file DDPixFwdBlades.cc.

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

Referenced by execute().

218  {
219 
220  double effBladeAngle = endcap * bladeAngle;
221 
222  CLHEP::Hep3Vector jC; // Point J in the "cover" blade frame
223  CLHEP::Hep3Vector kB; // Point K in the "body" blade frame
224  std::string rotNameNippleToCover;
225  std::string rotNameCoverToNipple;
226  std::string rotNameNippleToBody;
227 
228  if (endcap > 0.) {
229  jC = CLHEP::Hep3Vector(jX, jY + ancorRadius, jZ);
230  kB = CLHEP::Hep3Vector(kX, kY + ancorRadius, kZ);
231  rotNameNippleToCover = "NippleToCoverZPlus";
232  rotNameCoverToNipple = "CoverToNippleZPlus";
233  rotNameNippleToBody = "NippleToBodyZPlus";
234  } else {
235  jC = CLHEP::Hep3Vector(-jX, jY + ancorRadius, jZ);
236  kB = CLHEP::Hep3Vector(-kX, kY + ancorRadius, kZ);
237  rotNameNippleToCover = "NippleToCoverZMinus";
238  rotNameCoverToNipple = "CoverToNippleZMinus";
239  rotNameNippleToBody = "NippleToBodyZMinus";
240  }
241 
242  // Z-shift from "cover" to "body" blade frame:
243 
244  CLHEP::Hep3Vector tCB(bladeZShift*sin(effBladeAngle), 0., bladeZShift*cos(effBladeAngle));
245 
246  // Rotation from "cover" blade frame into "body" blade frame :
247 
248  double deltaPhi = endcap*(360./nBlades)*CLHEP::deg;
249  CLHEP::HepRotation rCB(CLHEP::Hep3Vector(1.*sin(effBladeAngle), 0., 1.*cos(effBladeAngle)), deltaPhi);
250 
251  // Transform vector k into "cover" blade frame :
252 
253  CLHEP::Hep3Vector kC = rCB * (kB + tCB);
254 
255  // Vector JK in the "cover" blade frame:
256 
257  CLHEP::Hep3Vector jkC = kC - jC;
258  double* jkLength = new double(jkC.mag());
259  DDConstant JK(DDName("JK", "pixfwdNipple"), jkLength);
260  LogDebug("PixelGeom") << "+++++++++++++++ DDPixFwdBlades: " << "JK Length " << *jkLength * CLHEP::mm;
261 
262  // Position of the center of a nipple in "cover" blade frame :
263 
264  CLHEP::Hep3Vector nippleTranslation((kC+jC)/2. - CLHEP::Hep3Vector(0., ancorRadius, 0.));
265  if (endcap > 0) {
266  nippleTranslationX = nippleTranslation.x();
267  nippleTranslationY = nippleTranslation.y();
268  nippleTranslationZ = nippleTranslation.z();
269  }
270  LogDebug("PixelGeom") << "Child translation : " << nippleTranslation;
271 
272  // Rotations from nipple frame to "cover" blade frame and back :
273 
274  CLHEP::Hep3Vector vZ(0.,0.,1.);
275  CLHEP::Hep3Vector axis = vZ.cross(jkC);
276  double angleCover = vZ.angle(jkC);
277  LogDebug("PixelGeom") << " Angle to Cover: " << angleCover;
278  CLHEP::HepRotation* rpCN = new CLHEP::HepRotation(axis, angleCover);
279  if (endcap > 0.) {
280  nippleRotationZPlus = rpCN;
281  } else {
282  nippleRotationZMinus = rpCN;
283  }
284  //( endcap > 0. ? nippleRotationZPlus : nippleRotationZMinus ) = rpCN;
285 
286  DDRotationMatrix* ddrpCN = new DDRotationMatrix(rpCN->xx(), rpCN->xy(), rpCN->xz(),
287  rpCN->yx(), rpCN->yy(), rpCN->yz(),
288  rpCN->zx(), rpCN->zy(), rpCN->zz() );
289 
290  DDrot(DDName(rotNameCoverToNipple, "pixfwdNipple"), ddrpCN);
291  CLHEP::HepRotation rpNC(axis, -angleCover);
292  DDRotationMatrix* ddrpNC = new DDRotationMatrix(rpNC.xx(), rpNC.xy(), rpNC.xz(),
293  rpNC.yx(), rpNC.yy(), rpNC.yz(),
294  rpNC.zx(), rpNC.zy(), rpNC.zz() );
295 
296  DDrot(DDName(rotNameNippleToCover, "pixfwdNipple"), ddrpNC);
297 
298  // Rotation from nipple frame to "body" blade frame :
299 
300  CLHEP::HepRotation rpNB( rpNC * rCB );
301  DDRotationMatrix* ddrpNB = new DDRotationMatrix(rpNB.xx(), rpNB.xy(), rpNB.xz(),
302  rpNB.yx(), rpNB.yy(), rpNB.yz(),
303  rpNB.zx(), rpNB.zy(), rpNB.zz() );
304 
305  DDrot(DDName(rotNameNippleToBody, "pixfwdNipple"), ddrpNB);
306  double angleBody = vZ.angle(rpNB * vZ);
307  LogDebug("PixelGeom") << " Angle to body : " << angleBody;
308 }
#define LogDebug(id)
static const double bladeZShift
static double nippleTranslationZ
double deltaPhi(float phi1, float phi2)
Definition: VectorUtil.h:30
static const double ancorRadius
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
DDName is used to identify DDD entities uniquely.
Definition: DDName.h:18
static const double jY
static const double kY
static const double kZ
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
static double nippleTranslationX
static CLHEP::HepRotation * nippleRotationZPlus
static const double bladeAngle
DDRotation DDrot(const DDName &name, DDRotationMatrix *rot)
Definition of a uniquely identifiable rotation matrix named by DDName name.
Definition: DDRotation.cc:94
static const int nBlades
static CLHEP::HepRotation * nippleRotationZMinus
static double nippleTranslationY
a named constant corresponding to the DDL-XML tag &lt;Constant&gt; and &lt;ConstantsVector&gt; ...
Definition: DDConstant.h:15
ROOT::Math::Rotation3D DDRotationMatrix
A DDRotationMatrix is currently implemented with a ROOT Rotation3D.
static const double jZ
static const double kX
static const double jX
void DDPixFwdBlades::execute ( DDCompactView cpv)

Definition at line 106 of file DDPixFwdBlades.cc.

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

106  {
107 
108  // -- Compute Nipple parameters if not already computed :
109 
110  if (!nippleRotationZPlus) {
111  computeNippleParameters(1.); // Z Plus endcap
112  computeNippleParameters(-1.); // Z Minus endcap
113  }
114  if (childName == "") return;
115 
116  // -- Signed versions of blade angle and z-shift :
117 
118  double effBladeAngle = - endcap * bladeAngle;
119  double effBladeZShift = endcap * bladeZShift;
120 
121  // -- Names of mother and child volumes :
122 
123  DDName mother = parent().name();
125 
126  // -- Get translation and rotation from "blade frame" to "child frame", if any :
127 
128  CLHEP::HepRotation childRotMatrix = CLHEP::HepRotation();
129  if (childRotationName != "") {
131  // due to conversion to ROOT::Math::Rotation3D -- Michael Case
132  DD3Vector x, y, z;
133  childRotation.rotation()->GetComponents(x, y, z); // these are the orthonormal columns.
134  CLHEP::HepRep3x3 tr(x.X(), y.X(), z.X(), x.Y(), y.Y(), z.Y(), x.Z(), y.Z(), z.Z());
135  childRotMatrix = CLHEP::HepRotation(tr);
136  } else if (childName == "pixfwdNipple:PixelForwardNippleZPlus") {
137  childRotMatrix = *nippleRotationZPlus;
138  } else if (childName == "pixfwdNipple:PixelForwardNippleZMinus") {
139  childRotMatrix = *nippleRotationZMinus;
140  }
141 
142  CLHEP::Hep3Vector childTranslation;
143  if (childName == "pixfwdNipple:PixelForwardNippleZPlus") {
144  childTranslation = CLHEP::Hep3Vector(nippleTranslationX, nippleTranslationY, nippleTranslationZ);
145  } else if (childName == "pixfwdNipple:PixelForwardNippleZMinus") {
146  childTranslation = CLHEP::Hep3Vector(-nippleTranslationX, nippleTranslationY, nippleTranslationZ);
147  } else {
148  childTranslation = CLHEP::Hep3Vector(childTranslationVector[0],childTranslationVector[1],childTranslationVector[2]);
149  }
150 
151  // Create a matrix for rotation around blade axis (to "blade frame") :
152 
153  CLHEP::HepRotation bladeRotMatrix(CLHEP::Hep3Vector(0.,1.,0.),effBladeAngle);
154 
155  // Cycle over Phi positions, placing copies of the child volume :
156 
157  double deltaPhi = (360./nBlades)*CLHEP::deg;
158  int nQuarter = nBlades/4;
159  double zShiftMax = effBladeZShift*((nQuarter-1)/2.);
160 
161  for (int iBlade=0; iBlade < nBlades; iBlade++) {
162 
163  // check if this blade position should be skipped :
164 
165  if (flagString[iBlade] != flagSelector[0]) continue;
166  int copy = issueCopyNumber();
167 
168  // calculate Phi and Z shift for this blade :
169 
170  double phi = (iBlade + 0.5) * deltaPhi - 90.*CLHEP::deg;
171  int iQuarter = iBlade % nQuarter;
172  double zShift = - zShiftMax + iQuarter * effBladeZShift;
173 
174  // compute rotation matrix from mother to blade frame :
175 
176  CLHEP::HepRotation rotMatrix(CLHEP::Hep3Vector(0.,0.,1.), phi);
177  rotMatrix *= bladeRotMatrix;
178 
179  // convert translation vector from blade frame to mother frame, and add Z shift :
180 
181  CLHEP::Hep3Vector translation = rotMatrix(childTranslation + CLHEP::Hep3Vector(0., ancorRadius, 0.));
182  translation += CLHEP::Hep3Vector(0., 0., zShift + zPlane);
183 
184  // create DDRotation for placing the child if not already existent :
185 
186  DDRotation rotation;
187  std::string rotstr = DDSplit(childName).first + int_to_string(copy);
188  rotation = DDRotation(DDName(rotstr, idNameSpace));
189 
190  if (!rotation) {
191  rotMatrix *= childRotMatrix;
192  DDRotationMatrix* temp = new DDRotationMatrix(rotMatrix.xx(), rotMatrix.xy(), rotMatrix.xz(),
193  rotMatrix.yx(), rotMatrix.yy(), rotMatrix.yz(),
194  rotMatrix.zx(), rotMatrix.zy(), rotMatrix.zz() );
195  rotation = DDrot(DDName(rotstr, idNameSpace), temp);
196  }
197  // position the child :
198 
199  DDTranslation ddtran(translation.x(), translation.y(), translation.z());
200  cpv.position(child, mother, copy, ddtran, rotation);
201  // LogDebug("PixelGeom") << "DDPixFwdBlades: " << child << " Copy " << copy << " positioned in " << mother << " at " << translation << " with rotation " << rotation;
202  }
203 
204  // End of cycle over Phi positions
205 
206 }
static const double bladeZShift
const DDRotationMatrix * rotation() const
Returns the read-only rotation-matrix.
Definition: DDTransform.h:90
list parent
Definition: dbtoconf.py:74
static double nippleTranslationZ
double deltaPhi(float phi1, float phi2)
Definition: VectorUtil.h:30
std::string idNameSpace
static const double ancorRadius
void position(const DDLogicalPart &self, const DDLogicalPart &parent, std::string copyno, const DDTranslation &trans, const DDRotation &rot, const DDDivision *div=NULL)
void computeNippleParameters(double endcap)
DDName is used to identify DDD entities uniquely.
Definition: DDName.h:18
std::vector< double > childTranslationVector
double double double z
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< double > > DDTranslation
Definition: DDTranslation.h:7
Represents a uniquely identifyable rotation matrix.
Definition: DDTransform.h:66
static const double zPlane
U second(std::pair< T, U > const &p)
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< double > > DD3Vector
A DD Translation is currently implemented with Root Vector3D.
Definition: DDTranslation.h:6
std::string int_to_string(const int &in)
Definition: DDutils.cc:16
static double nippleTranslationX
static CLHEP::HepRotation * nippleRotationZPlus
bool first
Definition: L1TdeRCT.cc:79
static const double bladeAngle
DDRotation DDrot(const DDName &name, DDRotationMatrix *rot)
Definition of a uniquely identifiable rotation matrix named by DDName name.
Definition: DDRotation.cc:94
std::string childName
std::string flagString
std::pair< std::string, std::string > DDSplit(const std::string &n)
split into (name,namespace), separator = &#39;:&#39;
Definition: DDSplit.cc:4
static const int nBlades
Definition: DDAxes.h:10
static CLHEP::HepRotation * nippleRotationZMinus
static double nippleTranslationY
std::string flagSelector
ROOT::Math::Rotation3D DDRotationMatrix
A DDRotationMatrix is currently implemented with a ROOT Rotation3D.
std::string childRotationName
Definition: DDAxes.h:10
void DDPixFwdBlades::initialize ( const DDNumericArguments nArgs,
const DDVectorArguments vArgs,
const DDMapArguments mArgs,
const DDStringArguments sArgs,
const DDStringVectorArguments vsArgs 
)

Definition at line 63 of file DDPixFwdBlades.cc.

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

67  {
68 
69  if ( nArgs.find("Endcap") != nArgs.end() ) {
70  endcap = nArgs["Endcap"];
71  } else {
72  endcap = 1.;
73  }
74 
75  if ( sArgs.find("FlagString") != sArgs.end() ) {
76  flagString = sArgs["FlagString"];
77  flagSelector = sArgs["FlagSelector"];
78  } else {
79  flagString = "YYYYYYYYYYYYYYYYYYYYYYYY";
80  flagSelector = "Y";
81  }
82 
83  if ( sArgs.find("Child") != sArgs.end() ) {
84  childName = sArgs["Child"];
85  } else {
86  childName = "";
87  }
88 
89  if ( vArgs.find("ChildTranslation") != vArgs.end() ) {
90  childTranslationVector = vArgs["ChildTranslation"];
91  } else {
92  childTranslationVector = std::vector<double>(3, 0.);
93  }
94 
95  if ( sArgs.find("ChildRotation") != sArgs.end() ) {
96  childRotationName = sArgs["ChildRotation"];
97  } else {
98  childRotationName = "";
99  }
100 
102 }
std::string idNameSpace
static std::string & ns()
std::vector< double > childTranslationVector
std::string childName
std::string flagString
std::string flagSelector
std::string childRotationName
int DDPixFwdBlades::issueCopyNumber ( )
private

Definition at line 210 of file DDPixFwdBlades.cc.

References childName, and copyNumbers.

Referenced by execute().

210  {
211  if (copyNumbers.count(childName) == 0) copyNumbers[childName] = 0;
212  return ++copyNumbers[childName];
213 }
static std::map< std::string, int > copyNumbers
std::string childName

Member Data Documentation

const double DDPixFwdBlades::ancorRadius = 54.631*CLHEP::mm
staticprivate

Definition at line 94 of file DDPixFwdBlades.h.

Referenced by computeNippleParameters(), and execute().

const double DDPixFwdBlades::bladeAngle = 20.*CLHEP::deg
staticprivate

Definition at line 90 of file DDPixFwdBlades.h.

Referenced by computeNippleParameters(), and execute().

const double DDPixFwdBlades::bladeZShift = 6.*CLHEP::mm
staticprivate

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
staticprivate

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(), geometryXMLparser.CSCAlignable::index(), 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*CLHEP::mm
staticprivate

Definition at line 98 of file DDPixFwdBlades.h.

Referenced by computeNippleParameters().

const double DDPixFwdBlades::jY = 96.50*CLHEP::mm
staticprivate

Definition at line 99 of file DDPixFwdBlades.h.

Referenced by computeNippleParameters().

const double DDPixFwdBlades::jZ = 1.25*CLHEP::mm
staticprivate

Definition at line 100 of file DDPixFwdBlades.h.

Referenced by computeNippleParameters().

const double DDPixFwdBlades::kX = 16.25*CLHEP::mm
staticprivate

Definition at line 101 of file DDPixFwdBlades.h.

Referenced by computeNippleParameters().

const double DDPixFwdBlades::kY = 96.50*CLHEP::mm
staticprivate

Definition at line 102 of file DDPixFwdBlades.h.

Referenced by computeNippleParameters().

const double DDPixFwdBlades::kZ = -1.25*CLHEP::mm
staticprivate

Definition at line 103 of file DDPixFwdBlades.h.

Referenced by computeNippleParameters().

const int DDPixFwdBlades::nBlades = 24
staticprivate

Definition at line 89 of file DDPixFwdBlades.h.

Referenced by computeNippleParameters(), and execute().

CLHEP::HepRotation * DDPixFwdBlades::nippleRotationZMinus = 0
staticprivate

Definition at line 124 of file DDPixFwdBlades.h.

Referenced by computeNippleParameters(), and execute().

CLHEP::HepRotation * DDPixFwdBlades::nippleRotationZPlus = 0
staticprivate

Definition at line 123 of file DDPixFwdBlades.h.

Referenced by computeNippleParameters(), and execute().

double DDPixFwdBlades::nippleTranslationX = 0.
staticprivate

Definition at line 125 of file DDPixFwdBlades.h.

Referenced by computeNippleParameters(), and execute().

double DDPixFwdBlades::nippleTranslationY = 0.
staticprivate

Definition at line 125 of file DDPixFwdBlades.h.

Referenced by computeNippleParameters(), and execute().

double DDPixFwdBlades::nippleTranslationZ = 0.
staticprivate

Definition at line 125 of file DDPixFwdBlades.h.

Referenced by computeNippleParameters(), and execute().

const double DDPixFwdBlades::zPlane = 0.
staticprivate

Definition at line 91 of file DDPixFwdBlades.h.

Referenced by execute().