CMS 3D CMS Logo

AlignableModifier.cc
Go to the documentation of this file.
1 #include <memory>
2 #include <cctype>
3 
4 #include "CLHEP/Random/DRand48Engine.h"
5 #include "CLHEP/Random/RandGauss.h"
6 #include "CLHEP/Random/Randomize.h"
7 
13 
16 
19 
20 //__________________________________________________________________________________________________
22  : distribution_(""),
23  random_(false),
24  gaussian_(false),
25  setError_(false),
26  setRotations_(false),
27  setTranslations_(false),
28  seed_(0),
29  scaleError_(0.),
30  scale_(0.),
31  phiX_(0.),
32  phiY_(0.),
33  phiZ_(0.),
34  phiXlocal_(0.),
35  phiYlocal_(0.),
36  phiZlocal_(0.),
37  dX_(0.),
38  dY_(0.),
39  dZ_(0.),
40  dXlocal_(0.),
41  dYlocal_(0.),
42  dZlocal_(0.),
43  twist_(0.),
44  shear_(0.) {
45  theDRand48Engine = new CLHEP::DRand48Engine();
46 }
47 
48 //__________________________________________________________________________________________________
50 
51 //__________________________________________________________________________________________________
53  // Initialize all known parameters (according to ORCA's MisalignmentScenario.cc)
54  distribution_ = ""; // Switch for distributions ("fixed","flat","gaussian")
55  setError_ = false; // Apply alignment errors
56  setRotations_ = true; // Apply rotations
57  setTranslations_ = true; // Apply translations
58  scale_ = 1.; // Scale to apply to all movements
59  scaleError_ = 1.; // Scale to apply to alignment errors
60  phiX_ = 0.; // Rotation angle around X [rad]
61  phiY_ = 0.; // Rotation angle around Y [rad]
62  phiZ_ = 0.; // Rotation angle around Z [rad]
63  phiXlocal_ = 0.; // Local rotation angle around X [rad]
64  phiYlocal_ = 0.; // Local rotation angle around Y [rad]
65  phiZlocal_ = 0.; // Local rotation angle around Z [rad]
66  dX_ = 0.; // X displacement [cm]
67  dY_ = 0.; // Y displacement [cm]
68  dZ_ = 0.; // Z displacement [cm]
69  dXlocal_ = 0.; // Local X displacement [cm]
70  dYlocal_ = 0.; // Local Y displacement [cm]
71  dZlocal_ = 0.; // Local Z displacement [cm]
72  deformation_.first.clear(); // SurfaceDeformation: type
73  deformation_.second.clear(); //SurfaceDeformation: parameter vector
74  twist_ = 0.; // Twist angle [rad]
75  shear_ = 0.; // Shear angle [rad]
76 
77  // These are set through 'distribution'
78  random_ = true; // Use random distributions
79  gaussian_ = true; // Use gaussian distribution (otherwise flat)
80 }
81 
82 //__________________________________________________________________________________________________
83 // Return true if given parameter name should be propagated down
84 bool AlignableModifier::isPropagated(const std::string& parameterName) const {
85  if (parameterName == "distribution" || parameterName == "setError" || parameterName == "scaleError" ||
86  parameterName == "setRotations" || parameterName == "setTranslations" || parameterName == "scale")
87  return true;
88 
89  return false;
90 }
91 
92 //__________________________________________________________________________________________________
94 bool AlignableModifier::modify(Alignable* alignable, const edm::ParameterSet& pSet) {
95  // Initialize parameters
96  this->init_();
97  int rotX_ = 0, rotY_ = 0, rotZ_ = 0; // To check correct backward compatibility
98 
99  // Reset counter
100  m_modified = 0;
101 
102  // Retrieve parameters
103  std::ostringstream error;
104  std::vector<std::string> parameterNames = pSet.getParameterNames();
105  for (std::vector<std::string>::iterator iParam = parameterNames.begin(); iParam != parameterNames.end(); ++iParam) {
106  if ((*iParam) == "distribution")
107  distribution_ = pSet.getParameter<std::string>(*iParam);
108  else if ((*iParam) == "setError")
109  setError_ = pSet.getParameter<bool>(*iParam);
110  else if ((*iParam) == "setRotations")
111  setRotations_ = pSet.getParameter<bool>(*iParam);
112  else if ((*iParam) == "setTranslations")
113  setTranslations_ = pSet.getParameter<bool>(*iParam);
114  else if ((*iParam) == "scale")
115  scale_ = pSet.getParameter<double>(*iParam);
116  else if ((*iParam) == "scaleError")
117  scaleError_ = pSet.getParameter<double>(*iParam);
118  else if ((*iParam) == "phiX")
119  phiX_ = pSet.getParameter<double>(*iParam);
120  else if ((*iParam) == "phiY")
121  phiY_ = pSet.getParameter<double>(*iParam);
122  else if ((*iParam) == "phiZ")
123  phiZ_ = pSet.getParameter<double>(*iParam);
124  else if ((*iParam) == "dX")
125  dX_ = pSet.getParameter<double>(*iParam);
126  else if ((*iParam) == "dY")
127  dY_ = pSet.getParameter<double>(*iParam);
128  else if ((*iParam) == "dZ")
129  dZ_ = pSet.getParameter<double>(*iParam);
130  else if ((*iParam) == "dXlocal")
131  dXlocal_ = pSet.getParameter<double>(*iParam);
132  else if ((*iParam) == "dYlocal")
133  dYlocal_ = pSet.getParameter<double>(*iParam);
134  else if ((*iParam) == "dZlocal")
135  dZlocal_ = pSet.getParameter<double>(*iParam);
136  else if ((*iParam) == "twist")
137  twist_ = pSet.getParameter<double>(*iParam);
138  else if ((*iParam) == "shear")
139  shear_ = pSet.getParameter<double>(*iParam);
140  else if ((*iParam) == "localX") {
141  phiXlocal_ = pSet.getParameter<double>(*iParam);
142  rotX_++;
143  } else if ((*iParam) == "localY") {
144  phiYlocal_ = pSet.getParameter<double>(*iParam);
145  rotY_++;
146  } else if ((*iParam) == "localZ") {
147  phiZlocal_ = pSet.getParameter<double>(*iParam);
148  rotZ_++;
149  } else if ((*iParam) == "phiXlocal") {
150  phiXlocal_ = pSet.getParameter<double>(*iParam);
151  rotX_++;
152  } else if ((*iParam) == "phiYlocal") {
153  phiYlocal_ = pSet.getParameter<double>(*iParam);
154  rotY_++;
155  } else if ((*iParam) == "phiZlocal") {
156  phiZlocal_ = pSet.getParameter<double>(*iParam);
157  rotZ_++;
158  } else if ((*iParam) == "deformation") {
159  const edm::ParameterSet deform(pSet.getParameter<edm::ParameterSet>(*iParam));
160  deformation_.first = deform.getParameter<std::string>("type");
161  deformation_.second = deform.getParameter<std::vector<double> >("parameters");
162  } else if (pSet.existsAs<edm::ParameterSet>(*iParam)) {
163  // Other PSets than 'deformation' must refer to hierarchy structures, i.e. their name
164  // is a level name followed by 's' or ending with a digit (see
165  // MisalignmentScenarioBuilder::getParameterSet_). Pitfall is to forget the trailing 's'!
166  // 'Muon' is an especially allowed case used in MuonScenarioBuilder::moveMuon(..),
167  // also check that we do not have any mistyping like 'deformations' or 'deformation2'
168  const auto lastCharacter = (iParam->empty() ? '_' : (*iParam)[iParam->size() - 1]);
169  if ((lastCharacter != 's' && !isdigit(lastCharacter) && (*iParam) != "Muon") ||
170  iParam->find("deformation") != std::string::npos) {
171  throw cms::Exception("BadConfig") << "@SUB=AlignableModifier::modify(..):\n"
172  << "I see parameter '" << *iParam << "' of type PSet, "
173  << "but expect either 'deformation' or a level name "
174  << "with 's' or a digit at the end.\n";
175  } // other PSets should now be hierarchy levels and thus be OK to ignore here
176  } else {
177  if (!error.str().length())
178  error << "Unknown parameter name(s): ";
179  error << " " << *iParam;
180  }
181  }
182 
183  // Check if both 'localN' and 'phiNlocal' have been used
184  if (rotX_ == 2)
185  throw cms::Exception("BadConfig") << "Found both localX and phiXlocal";
186  if (rotY_ == 2)
187  throw cms::Exception("BadConfig") << "Found both localY and phiYlocal";
188  if (rotZ_ == 2)
189  throw cms::Exception("BadConfig") << "Found both localZ and phiZlocal";
190 
191  // Check error
192  if (error.str().length())
193  throw cms::Exception("BadConfig") << error.str();
194 
195  // Decode distribution
197 
198  //if (scale_) { NO! Different random sequence if only parts scale to zero!
199 
200  // Apply displacements
202  this->moveAlignable(alignable, random_, gaussian_, scale_ * dX_, scale_ * dY_, scale_ * dZ_);
203 
204  // Apply local displacements
207 
208  // Apply rotations
210  this->rotateAlignable(alignable, random_, gaussian_, scale_ * phiX_, scale_ * phiY_, scale_ * phiZ_);
211 
212  // Apply local rotations
214  this->rotateAlignableLocal(
216 
217  // Apply twist
218  if (std::abs(twist_) > 0)
219  edm::LogError("NotImplemented") << "Twist is not implemented yet";
220 
221  // Apply shear
222  if (std::abs(shear_) > 0)
223  edm::LogError("NotImplemented") << "Shear is not implemented yet";
224 
225  if (!deformation_.first.empty()) {
226  this->addDeformation(alignable, deformation_, random_, gaussian_, scale_);
227  }
228 
229  // Apply error - first add scale_ to error
230  scaleError_ *= scale_;
231  if (setError_ && scaleError_) {
232  // Alignment Position Error for flat distribution: 1 sigma
233  if (!gaussian_)
234  scaleError_ *= 0.68;
235 
236  // Error on displacement
239 
240  // Error on local displacements
244 
245  // Error on rotations
248  alignable, scaleError_ * phiX_, scaleError_ * phiY_, scaleError_ * phiZ_);
249 
250  // Error on local rotations
254  // Do we need to add any APE for deformations?
255  // Probably we would do so if there wouldn't be data, but only MC to play with... ;-)
256  }
257  // } // end if (scale_)
258 
259  return (m_modified > 0);
260 }
261 
262 //__________________________________________________________________________________________________
264  if (distr == "fixed")
265  random_ = false;
266  else if (distr == "flat") {
267  random_ = true;
268  gaussian_ = false;
269  } else if (distr == "gaussian") {
270  random_ = true;
271  gaussian_ = true;
272  }
273 }
274 
275 //__________________________________________________________________________________________________
278  long m_seed;
279 
280  if (seed > 0)
281  m_seed = seed;
282  else {
284  m_seed = rng->mySeed();
285  }
286 
287  LogDebug("PrintArgs") << "Setting generator seed to " << m_seed;
288 
289  theDRand48Engine->setSeed(m_seed);
290 }
291 
292 //__________________________________________________________________________________________________
296  Alignable* alignable, bool random, bool gaussian, float sigmaX, float sigmaY, float sigmaZ) {
297  std::ostringstream message;
298 
299  // Get movement vector according to arguments
300  GlobalVector moveV(sigmaX, sigmaY, sigmaZ); // Default: fixed
301  if (random) {
302  std::vector<float> randomNumbers;
303  message << "random ";
304  if (gaussian) {
305  randomNumbers = this->gaussianRandomVector(sigmaX, sigmaY, sigmaZ);
306  message << "gaussian ";
307  } else {
308  randomNumbers = this->flatRandomVector(sigmaX, sigmaY, sigmaZ);
309  message << "flat ";
310  }
311  moveV = GlobalVector(randomNumbers[0], randomNumbers[1], randomNumbers[2]);
312  }
313 
314  message << " move with sigma " << sigmaX << " " << sigmaY << " " << sigmaZ;
315 
316  LogDebug("PrintArgs") << message.str(); // Arguments
317 
318  LogDebug("PrintMovement") << "applied displacement: " << moveV; // Actual movements
319  alignable->move(moveV);
320  m_modified++;
321 }
322 
323 //__________________________________________________________________________________________________
327  Alignable* alignable, bool random, bool gaussian, float sigmaX, float sigmaY, float sigmaZ) {
328  std::ostringstream message;
329 
330  // Get movement vector according to arguments
331  align::LocalVector moveV(sigmaX, sigmaY, sigmaZ); // Default: fixed
332  if (random) {
333  std::vector<float> randomNumbers;
334  message << "random ";
335  if (gaussian) {
336  randomNumbers = this->gaussianRandomVector(sigmaX, sigmaY, sigmaZ);
337  message << "gaussian ";
338  } else {
339  randomNumbers = this->flatRandomVector(sigmaX, sigmaY, sigmaZ);
340  message << "flat ";
341  }
342  moveV = align::LocalVector(randomNumbers[0], randomNumbers[1], randomNumbers[2]);
343  }
344 
345  message << " move with sigma " << sigmaX << " " << sigmaY << " " << sigmaZ;
346 
347  LogDebug("PrintArgs") << message.str(); // Arguments
348 
349  LogDebug("PrintMovement") << "applied local displacement: " << moveV; // Actual movements
350  alignable->move(alignable->surface().toGlobal(moveV));
351  m_modified++;
352 }
353 
354 //__________________________________________________________________________________________________
356  const AlignableModifier::DeformationMemberType& deformation,
357  bool random,
358  bool gaussian,
359  double scale) {
360  const SurfaceDeformationFactory::Type deformType =
362 
363  // Scale and randomize
364  // (need a little hack since ySplit must not be treated)!
365  const bool rndNotLast = (deformType == SurfaceDeformationFactory::kTwoBowedSurfaces);
366  std::vector<double> rndDeformation(deformation.second.begin(), deformation.second.end() - (rndNotLast ? 1 : 0));
367  for (unsigned int i = 0; i < rndDeformation.size(); ++i) {
368  rndDeformation[i] *= scale;
369  }
370  if (random) {
371  this->randomise(rndDeformation, gaussian);
372  }
373  if (rndNotLast) { // put back ySplit at the end
374  rndDeformation.push_back(deformation.second.back());
375  }
376 
377  // auto_ptr has exception safe delete (in contrast to bare pointer)
378  const std::unique_ptr<SurfaceDeformation> surfDef(SurfaceDeformationFactory::create(deformType, rndDeformation));
379 
380  alignable->addSurfaceDeformation(surfDef.get(), true); // true to propagate down
381  ++m_modified;
382 }
383 
384 //__________________________________________________________________________________________________
388  Alignable* alignable, bool random, bool gaussian, float sigmaPhiX, float sigmaPhiY, float sigmaPhiZ) {
389  std::ostringstream message;
390 
391  // Get rotation vector according to arguments
392  GlobalVector rotV(sigmaPhiX, sigmaPhiY, sigmaPhiZ); // Default: fixed
393  if (random) {
394  std::vector<float> randomNumbers;
395  message << "random ";
396  if (gaussian) {
397  randomNumbers = this->gaussianRandomVector(sigmaPhiX, sigmaPhiY, sigmaPhiZ);
398  message << "gaussian ";
399  } else {
400  randomNumbers = flatRandomVector(sigmaPhiX, sigmaPhiY, sigmaPhiZ);
401  message << "flat ";
402  }
403  rotV = GlobalVector(randomNumbers[0], randomNumbers[1], randomNumbers[2]);
404  }
405 
406  message << "global rotation by angles " << sigmaPhiX << " " << sigmaPhiY << " " << sigmaPhiZ;
407 
408  LogDebug("PrintArgs") << message.str(); // Arguments
409 
410  LogDebug("PrintMovement") << "applied rotation angles: " << rotV; // Actual movements
411  if (std::abs(sigmaPhiX))
412  alignable->rotateAroundGlobalX(rotV.x());
413  if (std::abs(sigmaPhiY))
414  alignable->rotateAroundGlobalY(rotV.y());
415  if (std::abs(sigmaPhiZ))
416  alignable->rotateAroundGlobalZ(rotV.z());
417  m_modified++;
418 }
419 
420 //__________________________________________________________________________________________________
424  Alignable* alignable, bool random, bool gaussian, float sigmaPhiX, float sigmaPhiY, float sigmaPhiZ) {
425  std::ostringstream message;
426 
427  // Get rotation vector according to arguments
428  align::LocalVector rotV(sigmaPhiX, sigmaPhiY, sigmaPhiZ); // Default: fixed
429  if (random) {
430  std::vector<float> randomNumbers;
431  message << "random ";
432  if (gaussian) {
433  randomNumbers = this->gaussianRandomVector(sigmaPhiX, sigmaPhiY, sigmaPhiZ);
434  message << "gaussian ";
435  } else {
436  randomNumbers = flatRandomVector(sigmaPhiX, sigmaPhiY, sigmaPhiZ);
437  message << "flat ";
438  }
439  rotV = align::LocalVector(randomNumbers[0], randomNumbers[1], randomNumbers[2]);
440  }
441 
442  message << "local rotation by angles " << sigmaPhiX << " " << sigmaPhiY << " " << sigmaPhiZ;
443 
444  LogDebug("PrintArgs") << message.str(); // Arguments
445 
446  LogDebug("PrintMovement") << "applied local rotation angles: " << rotV; // Actual movements
447  if (std::abs(sigmaPhiX))
448  alignable->rotateAroundLocalX(rotV.x());
449  if (std::abs(sigmaPhiY))
450  alignable->rotateAroundLocalY(rotV.y());
451  if (std::abs(sigmaPhiZ))
452  alignable->rotateAroundLocalZ(rotV.z());
453  m_modified++;
454 }
455 
456 //__________________________________________________________________________________________________
457 const std::vector<float> AlignableModifier::gaussianRandomVector(float sigmaX, float sigmaY, float sigmaZ) const {
458  // Get absolute value if negative arguments
459  if (sigmaX < 0) {
460  edm::LogWarning("BadConfig") << " taking absolute value for gaussian sigma_x";
462  }
463  if (sigmaY < 0) {
464  edm::LogWarning("BadConfig") << " taking absolute value for gaussian sigma_y";
466  }
467  if (sigmaZ < 0) {
468  edm::LogWarning("BadConfig") << " taking absolute value for gaussian sigma_z";
470  }
471 
472  // Pass by reference, otherwise pointer is deleted!
473  CLHEP::RandGauss aGaussObjX(*theDRand48Engine, 0., sigmaX);
474  CLHEP::RandGauss aGaussObjY(*theDRand48Engine, 0., sigmaY);
475  CLHEP::RandGauss aGaussObjZ(*theDRand48Engine, 0., sigmaZ);
476 
477  std::vector<float> randomVector;
478  randomVector.push_back(aGaussObjX.fire());
479  randomVector.push_back(aGaussObjY.fire());
480  randomVector.push_back(aGaussObjZ.fire());
481 
482  return randomVector;
483 }
484 
485 //__________________________________________________________________________________________________
486 const std::vector<float> AlignableModifier::flatRandomVector(float sigmaX, float sigmaY, float sigmaZ) const {
487  // Get absolute value if negative arguments
488  if (sigmaX < 0) {
489  edm::LogWarning("BadConfig") << " taking absolute value for flat sigma_x";
491  }
492  if (sigmaY < 0) {
493  edm::LogWarning("BadConfig") << " taking absolute value for flat sigma_y";
495  }
496  if (sigmaZ < 0) {
497  edm::LogWarning("BadConfig") << " taking absolute value for flat sigma_z";
499  }
500 
501  CLHEP::RandFlat aFlatObjX(*theDRand48Engine, -sigmaX, sigmaX);
502  CLHEP::RandFlat aFlatObjY(*theDRand48Engine, -sigmaY, sigmaY);
503  CLHEP::RandFlat aFlatObjZ(*theDRand48Engine, -sigmaZ, sigmaZ);
504 
505  std::vector<float> randomVector;
506  randomVector.push_back(aFlatObjX.fire());
507  randomVector.push_back(aFlatObjY.fire());
508  randomVector.push_back(aFlatObjZ.fire());
509 
510  return randomVector;
511 }
512 
513 //__________________________________________________________________________________________________
514 void AlignableModifier::randomise(std::vector<double>& rnd, bool gaussian) const {
515  for (unsigned int i = 0; i < rnd.size(); ++i) {
516  if (rnd[i] < 0.) {
517  edm::LogWarning("BadConfig") << " taking absolute value to randomise " << i;
518  rnd[i] = std::abs(rnd[i]);
519  }
520 
521  if (gaussian) {
522  CLHEP::RandGauss aGaussObj(*theDRand48Engine, 0., rnd[i]);
523  rnd[i] = aGaussObj.fire();
524  } else {
525  CLHEP::RandFlat aFlatObj(*theDRand48Engine, -rnd[i], rnd[i]);
526  rnd[i] = aFlatObj.fire();
527  }
528  }
529 }
530 
531 //__________________________________________________________________________________________________
532 void AlignableModifier::addAlignmentPositionError(Alignable* alignable, float dx, float dy, float dz) {
533  LogDebug("PrintArgs") << "Adding an AlignmentPositionError of size " << dx << " " << dy << " " << dz;
534 
536  alignable->addAlignmentPositionError(ape, true);
537 }
538 
539 //__________________________________________________________________________________________________
540 void AlignableModifier::addAlignmentPositionErrorLocal(Alignable* alignable, float dx, float dy, float dz) {
541  LogDebug("PrintArgs") << "Adding a local AlignmentPositionError of size " << dx << " " << dy << " " << dz;
542 
543  AlgebraicSymMatrix as(3, 0); //3x3, zeroed
544  as[0][0] = dx * dx;
545  as[1][1] = dy * dy;
546  as[2][2] = dz * dz; //diagonals
547  align::RotationType rt = alignable->globalRotation(); //get rotation
548  AlgebraicMatrix am(3, 3);
549  am[0][0] = rt.xx();
550  am[0][1] = rt.xy();
551  am[0][2] = rt.xz();
552  am[1][0] = rt.yx();
553  am[1][1] = rt.yy();
554  am[1][2] = rt.yz();
555  am[2][0] = rt.zx();
556  am[2][1] = rt.zy();
557  am[2][2] = rt.zz();
558  as = as.similarityT(am); //rotate error matrix
559 
560  GlobalError ge(asSMatrix<3>(as));
561  GlobalErrorExtended gee(ge.cxx(),
562  ge.cyx(),
563  ge.czx(),
564  0.,
565  0.,
566  0.,
567  ge.cyy(),
568  ge.czy(),
569  0.,
570  0.,
571  0.,
572  ge.czz(),
573  0.,
574  0.,
575  0.,
576  0.,
577  0.,
578  0.,
579  0.,
580  0.,
581  0.);
582  AlignmentPositionError ape(gee);
583 
584  alignable->addAlignmentPositionError(ape, true); // propagate down to components
585 }
586 
587 //__________________________________________________________________________________________________
588 void AlignableModifier::addAlignmentPositionErrorFromRotation(Alignable* alignable, float phiX, float phiY, float phiZ) {
589  align::RotationType rotx(Basic3DVector<float>(1.0, 0.0, 0.0), phiX);
590  align::RotationType roty(Basic3DVector<float>(0.0, 1.0, 0.0), phiY);
591  align::RotationType rotz(Basic3DVector<float>(0.0, 0.0, 1.0), phiZ);
592  align::RotationType rot = rotz * roty * rotx;
593 
594  this->addAlignmentPositionErrorFromRotation(alignable, rot);
595 }
596 
597 //__________________________________________________________________________________________________
599  float phiX,
600  float phiY,
601  float phiZ) {
602  align::RotationType rotx(Basic3DVector<float>(1.0, 0.0, 0.0), phiX);
603  align::RotationType roty(Basic3DVector<float>(0.0, 1.0, 0.0), phiY);
604  align::RotationType rotz(Basic3DVector<float>(0.0, 0.0, 1.0), phiZ);
605  align::RotationType rot = rotz * roty * rotx;
606 
608 }
609 
610 //__________________________________________________________________________________________________
612  LogDebug("PrintArgs") << "Adding an AlignmentPositionError from Rotation" << std::endl << rotation;
613 
614  alignable->addAlignmentPositionErrorFromRotation(rotation, true); // propagate down to components
615 }
616 
617 //__________________________________________________________________________________________________
620  LogDebug("PrintArgs") << "Adding an AlignmentPositionError from Local Rotation" << std::endl << rotation;
621 
622  // true: propagate down to components
624 }
align::GlobalPoints toGlobal(const align::LocalPoints &) const
Return in global coord given a set of local points.
void addAlignmentPositionErrorFromLocalRotation(Alignable *alignable, float phiX, float phiY, float phiZ)
Add alignment position error resulting from rotation in local frame.
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
void rotateAlignableLocal(Alignable *alignable, bool random, bool gaussian, float sigmaPhiX, float sigmaPhiY, float sigmaPhiZ)
Rotate alignable in local space according to parameters.
const AlignableSurface & surface() const
Return the Surface (global position and orientation) of the object.
Definition: Alignable.h:132
virtual void rotateAroundLocalZ(Scalar radians)
Rotation around local z-axis.
Definition: Alignable.cc:183
void setSeed(long seed)
Resets the generator seed according to the argument.
T z() const
Definition: PV3DBase.h:61
virtual void addAlignmentPositionErrorFromRotation(const RotationType &rotation, bool propagateDown)=0
void addAlignmentPositionError(Alignable *alignable, float dx, float dy, float dz)
Add the AlignmentPositionError (in global frame) to Alignable.
~AlignableModifier()
Destructor.
void init_()
Initialisation of all parameters.
virtual void move(const GlobalVector &displacement)=0
Movement with respect to the global reference frame.
bool existsAs(std::string const &parameterName, bool trackiness=true) const
checks if a parameter exists as a given type
Definition: ParameterSet.h:171
Log< level::Error, false > LogError
virtual void addAlignmentPositionError(const AlignmentPositionError &ape, bool propagateDown)=0
void addAlignmentPositionErrorLocal(Alignable *alignable, float dx, float dy, float dz)
Add the AlignmentPositionError (in local frame) to Alignable.
bool isPropagated(const std::string &parameterName) const
Check if given parameter should be propagated.
std::string distribution_
void addDeformation(Alignable *alignable, const DeformationMemberType &deformation, bool random, bool gaussian, double scale)
virtual void rotateAroundGlobalZ(Scalar radians)
Rotation around global z-axis.
Definition: Alignable.cc:176
const std::vector< float > flatRandomVector(float sigmaX, float sigmaY, float sigmaZ) const
Return a vector of random numbers (flat distribution)
virtual void addAlignmentPositionErrorFromLocalRotation(const RotationType &rotation, bool propagateDown)=0
void moveAlignable(Alignable *alignable, bool random, bool gaussian, float sigmaX, float sigmaY, float sigmaZ)
Move alignable in global space according to parameters.
AlignableModifier()
Constructor.
T x() const
Definition: PV3DBase.h:59
T y() const
Definition: PV3DBase.h:60
virtual std::uint32_t mySeed() const =0
CLHEP::HepMatrix AlgebraicMatrix
virtual void addSurfaceDeformation(const SurfaceDeformation *deformation, bool propagateDown)=0
void setDistribution(const std::string &distr)
Decodes string and sets distribution accordingly (&#39;fixed&#39;, &#39;flat&#39; or &#39;gaussian&#39;). ...
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
CLHEP::DRand48Engine * theDRand48Engine
Unique random number generator.
void randomise(std::vector< double > &rnd, bool gaussian) const
Vector3DBase< Scalar, LocalTag > LocalVector
Definition: Definitions.h:32
const std::vector< float > gaussianRandomVector(float sigmaX, float sigmaY, float sigmaZ) const
Return a vector of random numbers (gaussian distribution)
DeformationMemberType deformation_
void rotateAlignable(Alignable *alignable, bool random, bool gaussian, float sigmaPhiX, float sigmaPhiY, float sigmaPhiZ)
Rotate alignable in global space according to parameters.
virtual void rotateAroundGlobalX(Scalar radians)
Rotation around global x-axis.
Definition: Alignable.cc:148
bool modify(Alignable *alignable, const edm::ParameterSet &pSet)
Modify given set of alignables according to parameters.
void addAlignmentPositionErrorFromRotation(Alignable *alignable, float phiX, float phiY, float phiZ)
Add alignment position error resulting from rotation in global frame.
virtual void rotateAroundLocalY(Scalar radians)
Rotation around local y-axis.
Definition: Alignable.cc:169
virtual void rotateAroundGlobalY(Scalar radians)
Rotation around global y-axis.
Definition: Alignable.cc:162
virtual void rotateAroundLocalX(Scalar radians)
Rotation around local x-axis.
Definition: Alignable.cc:155
CLHEP::HepSymMatrix AlgebraicSymMatrix
void moveAlignableLocal(Alignable *alignable, bool random, bool gaussian, float sigmaX, float sigmaY, float sigmaZ)
Move alignable in local space according to parameters.
const RotationType & globalRotation() const
Return the global orientation of the object.
Definition: Alignable.h:138
Log< level::Warning, false > LogWarning
std::pair< std::string, std::vector< double > > DeformationMemberType
Type surfaceDeformationType(const std::string &typeString)
convert string to &#39;Type&#39; - exception if string is not known
std::vector< std::string > getParameterNames() const
SurfaceDeformation * create(int type, const std::vector< double > &params)
Global3DVector GlobalVector
Definition: GlobalVector.h:10
#define LogDebug(id)