CMS 3D CMS Logo

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