CMS 3D CMS Logo

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

Public Member Functions

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

Private Member Functions

void computeNippleParameters (double endcap)
 
int issueCopyNumber ()
 

Private Attributes

double ancorRadius
 
double bladeAngle
 
double bladeZShift
 
string childName
 
string childRotationName
 
vector< double > childTranslationVector
 
map< string, int > copyNumbers
 
double endcap
 
string flagSelector
 
string flagString
 
string idNameSpace
 
double jX
 
double jY
 
double jZ
 
double kX
 
double kY
 
double kZ
 
int nBlades
 
CLHEP::HepRotation * nippleRotationZMinus
 
CLHEP::HepRotation * nippleRotationZPlus
 
double nippleTranslationX
 
double nippleTranslationY
 
double nippleTranslationZ
 
double zPlane
 

Detailed Description

Definition at line 83 of file DDPixFwdBlades.cc.

Constructor & Destructor Documentation

DDPixFwdBlades::DDPixFwdBlades ( )

Definition at line 134 of file DDPixFwdBlades.cc.

134 {}
DDPixFwdBlades::~DDPixFwdBlades ( )
override

Definition at line 135 of file DDPixFwdBlades.cc.

135 {}

Member Function Documentation

void DDPixFwdBlades::computeNippleParameters ( double  endcap)
private

Definition at line 320 of file DDPixFwdBlades.cc.

References funct::cos(), DDrot(), srCondWrite_cfg::deltaPhi, LogDebug, and funct::sin().

320  {
321  double effBladeAngle = endcap * bladeAngle;
322 
323  CLHEP::Hep3Vector jC; // Point J in the "cover" blade frame
324  CLHEP::Hep3Vector kB; // Point K in the "body" blade frame
325  string rotNameNippleToCover;
326  string rotNameCoverToNipple;
327  string rotNameNippleToBody;
328 
329  if (endcap > 0.) {
330  jC = CLHEP::Hep3Vector(jX, jY + ancorRadius, jZ);
331  kB = CLHEP::Hep3Vector(kX, kY + ancorRadius, kZ);
332  rotNameNippleToCover = "NippleToCoverZPlus";
333  rotNameCoverToNipple = "CoverToNippleZPlus";
334  rotNameNippleToBody = "NippleToBodyZPlus";
335  } else {
336  jC = CLHEP::Hep3Vector(-jX, jY + ancorRadius, jZ);
337  kB = CLHEP::Hep3Vector(-kX, kY + ancorRadius, kZ);
338  rotNameNippleToCover = "NippleToCoverZMinus";
339  rotNameCoverToNipple = "CoverToNippleZMinus";
340  rotNameNippleToBody = "NippleToBodyZMinus";
341  }
342 
343  // Z-shift from "cover" to "body" blade frame:
344 
345  CLHEP::Hep3Vector tCB(bladeZShift * sin(effBladeAngle), 0., bladeZShift * cos(effBladeAngle));
346 
347  // Rotation from "cover" blade frame into "body" blade frame :
348 
349  double deltaPhi = endcap * (360. / nBlades) * CLHEP::deg;
350  CLHEP::HepRotation rCB(CLHEP::Hep3Vector(1. * sin(effBladeAngle), 0., 1. * cos(effBladeAngle)), deltaPhi);
351 
352  // Transform vector k into "cover" blade frame :
353 
354  CLHEP::Hep3Vector kC = rCB * (kB + tCB);
355 
356  // Vector JK in the "cover" blade frame:
357 
358  CLHEP::Hep3Vector jkC = kC - jC;
359  double jkLength = jkC.mag();
360  DDConstant JK(DDName("JK", "pixfwdNipple"), make_unique<double>(jkLength));
361  LogDebug("PixelGeom") << "+++++++++++++++ DDPixFwdBlades: "
362  << "JK Length " << jkLength * CLHEP::mm;
363 
364  // Position of the center of a nipple in "cover" blade frame :
365 
366  CLHEP::Hep3Vector nippleTranslation((kC + jC) / 2. - CLHEP::Hep3Vector(0., ancorRadius, 0.));
367  if (endcap > 0) {
368  nippleTranslationX = nippleTranslation.x();
369  nippleTranslationY = nippleTranslation.y();
370  nippleTranslationZ = nippleTranslation.z();
371  }
372  LogDebug("PixelGeom") << "Child translation : " << nippleTranslation;
373 
374  // Rotations from nipple frame to "cover" blade frame and back :
375 
376  CLHEP::Hep3Vector vZ(0., 0., 1.);
377  CLHEP::Hep3Vector axis = vZ.cross(jkC);
378  double angleCover = vZ.angle(jkC);
379  LogDebug("PixelGeom") << " Angle to Cover: " << angleCover;
380  CLHEP::HepRotation* rpCN = new CLHEP::HepRotation(axis, angleCover);
381  if (endcap > 0.) {
382  nippleRotationZPlus = rpCN;
383  } else {
384  nippleRotationZMinus = rpCN;
385  }
386  //( endcap > 0. ? nippleRotationZPlus : nippleRotationZMinus ) = rpCN;
387 
388  DDrot(
389  DDName(rotNameCoverToNipple, "pixfwdNipple"),
390  make_unique<DDRotationMatrix>(
391  rpCN->xx(), rpCN->xy(), rpCN->xz(), rpCN->yx(), rpCN->yy(), rpCN->yz(), rpCN->zx(), rpCN->zy(), rpCN->zz()));
392  CLHEP::HepRotation rpNC(axis, -angleCover);
393 
394  DDrot(DDName(rotNameNippleToCover, "pixfwdNipple"),
395  make_unique<DDRotationMatrix>(
396  rpNC.xx(), rpNC.xy(), rpNC.xz(), rpNC.yx(), rpNC.yy(), rpNC.yz(), rpNC.zx(), rpNC.zy(), rpNC.zz()));
397 
398  // Rotation from nipple frame to "body" blade frame :
399 
400  CLHEP::HepRotation rpNB(rpNC * rCB);
401 
402  DDrot(DDName(rotNameNippleToBody, "pixfwdNipple"),
403  make_unique<DDRotationMatrix>(
404  rpNB.xx(), rpNB.xy(), rpNB.xz(), rpNB.yx(), rpNB.yy(), rpNB.yz(), rpNB.zx(), rpNB.zy(), rpNB.zz()));
405  double angleBody = vZ.angle(rpNB * vZ);
406  LogDebug("PixelGeom") << " Angle to body : " << angleBody;
407 }
double nippleTranslationZ
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
DDName is used to identify DDD entities uniquely.
Definition: DDName.h:17
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
double nippleTranslationX
CLHEP::HepRotation * nippleRotationZMinus
DDRotation DDrot(const DDName &name, std::unique_ptr< DDRotationMatrix > rot)
Definition of a uniquely identifiable rotation matrix named by DDName name.
Definition: DDRotation.cc:67
CLHEP::HepRotation * nippleRotationZPlus
double nippleTranslationY
a named constant corresponding to the DDL-XML tag &lt;Constant&gt; and &lt;ConstantsVector&gt; ...
Definition: DDConstant.h:18
#define LogDebug(id)
void DDPixFwdBlades::execute ( DDCompactView cpv)
override

Definition at line 205 of file DDPixFwdBlades.cc.

References submitPVValidationJobs::child, filterCSVwithJSON::copy, DDrot(), DDSplit(), srCondWrite_cfg::deltaPhi, Reference_intrackfit_cff::endcap, first, DDName::name(), SpecificationBuilder_cfi::parent(), DDCompactView::position(), idealTransformation::rotation, DDRotation::rotation(), and edm::second().

205  {
206  // -- Compute Nipple parameters if not already computed :
207 
208  if (!nippleRotationZPlus) {
209  computeNippleParameters(1.); // Z Plus endcap
210  computeNippleParameters(-1.); // Z Minus endcap
211  }
212  if (childName.empty())
213  return;
214 
215  // -- Signed versions of blade angle and z-shift :
216 
217  double effBladeAngle = -endcap * bladeAngle;
218  double effBladeZShift = endcap * bladeZShift;
219 
220  // -- Names of mother and child volumes :
221 
222  DDName mother = parent().name();
224 
225  // -- Get translation and rotation from "blade frame" to "child frame", if any :
226 
227  CLHEP::HepRotation childRotMatrix = CLHEP::HepRotation();
228  if (!childRotationName.empty()) {
230  // due to conversion to ROOT::Math::Rotation3D -- Michael Case
231  DD3Vector x, y, z;
232  childRotation.rotation().GetComponents(x, y, z); // these are the orthonormal columns.
233  CLHEP::HepRep3x3 tr(x.X(), y.X(), z.X(), x.Y(), y.Y(), z.Y(), x.Z(), y.Z(), z.Z());
234  childRotMatrix = CLHEP::HepRotation(tr);
235  } else if (childName == "pixfwdNipple:PixelForwardNippleZPlus") {
236  childRotMatrix = *nippleRotationZPlus;
237  } else if (childName == "pixfwdNipple:PixelForwardNippleZMinus") {
238  childRotMatrix = *nippleRotationZMinus;
239  }
240 
241  CLHEP::Hep3Vector childTranslation;
242  if (childName == "pixfwdNipple:PixelForwardNippleZPlus") {
243  childTranslation = CLHEP::Hep3Vector(nippleTranslationX, nippleTranslationY, nippleTranslationZ);
244  } else if (childName == "pixfwdNipple:PixelForwardNippleZMinus") {
245  childTranslation = CLHEP::Hep3Vector(-nippleTranslationX, nippleTranslationY, nippleTranslationZ);
246  } else {
247  childTranslation =
249  }
250 
251  // Create a matrix for rotation around blade axis (to "blade frame") :
252 
253  CLHEP::HepRotation bladeRotMatrix(CLHEP::Hep3Vector(0., 1., 0.), effBladeAngle);
254 
255  // Cycle over Phi positions, placing copies of the child volume :
256 
257  double deltaPhi = (360. / nBlades) * CLHEP::deg;
258  int nQuarter = nBlades / 4;
259  double zShiftMax = effBladeZShift * ((nQuarter - 1) / 2.);
260 
261  for (int iBlade = 0; iBlade < nBlades; iBlade++) {
262  // check if this blade position should be skipped :
263 
264  if (flagString[iBlade] != flagSelector[0])
265  continue;
266  int copy = issueCopyNumber();
267 
268  // calculate Phi and Z shift for this blade :
269 
270  double phi = (iBlade + 0.5) * deltaPhi - 90. * CLHEP::deg;
271  int iQuarter = iBlade % nQuarter;
272  double zShift = -zShiftMax + iQuarter * effBladeZShift;
273 
274  // compute rotation matrix from mother to blade frame :
275 
276  CLHEP::HepRotation rotMatrix(CLHEP::Hep3Vector(0., 0., 1.), phi);
277  rotMatrix *= bladeRotMatrix;
278 
279  // convert translation vector from blade frame to mother frame, and add Z shift :
280 
281  CLHEP::Hep3Vector translation = rotMatrix(childTranslation + CLHEP::Hep3Vector(0., ancorRadius, 0.));
282  translation += CLHEP::Hep3Vector(0., 0., zShift + zPlane);
283 
284  // create DDRotation for placing the child if not already existent :
285 
287  string rotstr = mother.name() + DDSplit(childName).first + to_string(copy);
288  rotation = DDRotation(DDName(rotstr, idNameSpace));
289 
290  if (!rotation) {
291  rotMatrix *= childRotMatrix;
292  rotation = DDrot(DDName(rotstr, idNameSpace),
293  make_unique<DDRotationMatrix>(rotMatrix.xx(),
294  rotMatrix.xy(),
295  rotMatrix.xz(),
296  rotMatrix.yx(),
297  rotMatrix.yy(),
298  rotMatrix.yz(),
299  rotMatrix.zx(),
300  rotMatrix.zy(),
301  rotMatrix.zz()));
302  }
303  // position the child :
304 
305  DDTranslation ddtran(translation.x(), translation.y(), translation.z());
306  cpv.position(child, mother, copy, ddtran, rotation);
307  }
308 
309  // End of cycle over Phi positions
310 }
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< double >> DD3Vector
double nippleTranslationZ
void position(const DDLogicalPart &self, const DDLogicalPart &parent, const std::string &copyno, const DDTranslation &trans, const DDRotation &rot, const DDDivision *div=nullptr)
void computeNippleParameters(double endcap)
DDName is used to identify DDD entities uniquely.
Definition: DDName.h:17
Represents a uniquely identifyable rotation matrix.
Definition: DDTransform.h:57
U second(std::pair< T, U > const &p)
string childRotationName
double nippleTranslationX
CLHEP::HepRotation * nippleRotationZMinus
DDRotation DDrot(const DDName &name, std::unique_ptr< DDRotationMatrix > rot)
Definition of a uniquely identifiable rotation matrix named by DDName name.
Definition: DDRotation.cc:67
CLHEP::HepRotation * nippleRotationZPlus
const DDRotationMatrix & rotation() const
Returns the read-only rotation-matrix.
Definition: DDTransform.h:81
vector< double > childTranslationVector
double nippleTranslationY
std::pair< std::string, std::string > DDSplit(const std::string &n)
split into (name,namespace), separator = &#39;:&#39;
Definition: DDSplit.cc:3
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< double > > DDTranslation
Definition: DDTranslation.h:7
const std::string & name() const
Returns the name.
Definition: DDName.cc:41
void DDPixFwdBlades::initialize ( const DDNumericArguments nArgs,
const DDVectorArguments vArgs,
const DDMapArguments mArgs,
const DDStringArguments sArgs,
const DDStringVectorArguments vsArgs 
)
override

Definition at line 137 of file DDPixFwdBlades.cc.

References Reference_intrackfit_cff::endcap, and DDCurrentNamespace::ns().

141  {
142  if (nArgs.find("Endcap") != nArgs.end()) {
143  endcap = nArgs["Endcap"];
144  } else {
145  endcap = 1.;
146  }
147 
148  if (sArgs.find("FlagString") != sArgs.end()) {
149  flagString = sArgs["FlagString"];
150  flagSelector = sArgs["FlagSelector"];
151  } else {
152  flagString = "YYYYYYYYYYYYYYYYYYYYYYYY";
153  flagSelector = "Y";
154  }
155 
156  if (sArgs.find("Child") != sArgs.end()) {
157  childName = sArgs["Child"];
158  } else {
159  childName = "";
160  }
161 
162  if (vArgs.find("ChildTranslation") != vArgs.end()) {
163  childTranslationVector = vArgs["ChildTranslation"];
164  } else {
165  childTranslationVector = vector<double>(3, 0.);
166  }
167 
168  if (sArgs.find("ChildRotation") != sArgs.end()) {
169  childRotationName = sArgs["ChildRotation"];
170  } else {
171  childRotationName = "";
172  }
173 
175 
176  // -- Input geometry parameters : -----------------------------------------------------
177 
178  nBlades = 24; // Number of blades
179  bladeAngle = 20. * CLHEP::deg; // Angle of blade rotation around its axis
180  zPlane = 0.; // Common shift in Z for all blades (with respect to disk center plane)
181  bladeZShift = 6. * CLHEP::mm; // Shift in Z between the axes of two adjacent blades
182 
183  ancorRadius = 54.631 * CLHEP::mm; // Distance from beam line to ancor point defining center of "blade frame"
184 
185  // Coordinates of Nipple ancor points J and K in "blade frame" :
186 
187  jX = -16.25 * CLHEP::mm;
188  jY = 96.50 * CLHEP::mm;
189  jZ = 1.25 * CLHEP::mm;
190  kX = 16.25 * CLHEP::mm;
191  kY = 96.50 * CLHEP::mm;
192  kZ = -1.25 * CLHEP::mm;
193 
194  // -- Static initialization : -----------------------------------------------------------
195 
196  nippleRotationZPlus = nullptr;
197  nippleRotationZMinus = nullptr;
198  nippleTranslationX = 0.;
199  nippleTranslationY = 0.;
200  nippleTranslationZ = 0.;
201 
202  copyNumbers.clear();
203 }
double nippleTranslationZ
static std::string & ns()
map< string, int > copyNumbers
string childRotationName
double nippleTranslationX
CLHEP::HepRotation * nippleRotationZMinus
CLHEP::HepRotation * nippleRotationZPlus
vector< double > childTranslationVector
double nippleTranslationY
int DDPixFwdBlades::issueCopyNumber ( )
private

Definition at line 312 of file DDPixFwdBlades.cc.

312  {
313  if (copyNumbers.count(childName) == 0)
314  copyNumbers[childName] = 0;
315  return ++copyNumbers[childName];
316 }
map< string, int > copyNumbers

Member Data Documentation

double DDPixFwdBlades::ancorRadius
private

Definition at line 102 of file DDPixFwdBlades.cc.

double DDPixFwdBlades::bladeAngle
private

Definition at line 98 of file DDPixFwdBlades.cc.

double DDPixFwdBlades::bladeZShift
private

Definition at line 100 of file DDPixFwdBlades.cc.

string DDPixFwdBlades::childName
private

Definition at line 118 of file DDPixFwdBlades.cc.

string DDPixFwdBlades::childRotationName
private

Definition at line 121 of file DDPixFwdBlades.cc.

vector<double> DDPixFwdBlades::childTranslationVector
private

Definition at line 120 of file DDPixFwdBlades.cc.

map<string, int> DDPixFwdBlades::copyNumbers
private

Definition at line 124 of file DDPixFwdBlades.cc.

double DDPixFwdBlades::endcap
private

Definition at line 113 of file DDPixFwdBlades.cc.

Referenced by geometryXMLparser.CSCAlignable::index().

string DDPixFwdBlades::flagSelector
private

Definition at line 116 of file DDPixFwdBlades.cc.

string DDPixFwdBlades::flagString
private

Definition at line 115 of file DDPixFwdBlades.cc.

string DDPixFwdBlades::idNameSpace
private

Definition at line 122 of file DDPixFwdBlades.cc.

double DDPixFwdBlades::jX
private

Definition at line 106 of file DDPixFwdBlades.cc.

double DDPixFwdBlades::jY
private

Definition at line 107 of file DDPixFwdBlades.cc.

double DDPixFwdBlades::jZ
private

Definition at line 108 of file DDPixFwdBlades.cc.

double DDPixFwdBlades::kX
private

Definition at line 109 of file DDPixFwdBlades.cc.

double DDPixFwdBlades::kY
private

Definition at line 110 of file DDPixFwdBlades.cc.

double DDPixFwdBlades::kZ
private

Definition at line 111 of file DDPixFwdBlades.cc.

int DDPixFwdBlades::nBlades
private

Definition at line 97 of file DDPixFwdBlades.cc.

CLHEP::HepRotation* DDPixFwdBlades::nippleRotationZMinus
private

Definition at line 127 of file DDPixFwdBlades.cc.

CLHEP::HepRotation* DDPixFwdBlades::nippleRotationZPlus
private

Definition at line 126 of file DDPixFwdBlades.cc.

double DDPixFwdBlades::nippleTranslationX
private

Definition at line 128 of file DDPixFwdBlades.cc.

double DDPixFwdBlades::nippleTranslationY
private

Definition at line 128 of file DDPixFwdBlades.cc.

double DDPixFwdBlades::nippleTranslationZ
private

Definition at line 128 of file DDPixFwdBlades.cc.

double DDPixFwdBlades::zPlane
private

Definition at line 99 of file DDPixFwdBlades.cc.