#include <AlignableModifier.h>
Public Member Functions | |
void | addAlignmentPositionError (Alignable *alignable, float dx, float dy, float dz) |
Add the AlignmentPositionError (in global frame) to Alignable. | |
void | addAlignmentPositionErrorFromLocalRotation (Alignable *alignable, float phiX, float phiY, float phiZ) |
Add alignment position error resulting from rotation in local frame. | |
void | addAlignmentPositionErrorFromLocalRotation (Alignable *alignable, align::RotationType &) |
Add alignment position error resulting from rotation in local frame. | |
void | addAlignmentPositionErrorFromRotation (Alignable *alignable, float phiX, float phiY, float phiZ) |
Add alignment position error resulting from rotation in global frame. | |
void | addAlignmentPositionErrorFromRotation (Alignable *alignable, align::RotationType &) |
Add alignment position error resulting from rotation in global frame. | |
void | addAlignmentPositionErrorLocal (Alignable *alignable, float dx, float dy, float dz) |
Add the AlignmentPositionError (in local frame) to Alignable. | |
AlignableModifier () | |
Constructor. | |
const std::vector< float > | flatRandomVector (float sigmaX, float sigmaY, float sigmaZ) const |
Return a vector of random numbers (flat distribution) | |
const std::vector< float > | gaussianRandomVector (float sigmaX, float sigmaY, float sigmaZ) const |
Return a vector of random numbers (gaussian distribution) | |
const bool | isPropagated (const std::string ¶meterName) const |
Check if given parameter should be propagated. | |
bool | modify (Alignable *alignable, const edm::ParameterSet &pSet) |
Modify given set of alignables according to parameters. | |
void | moveAlignable (Alignable *alignable, bool random, bool gaussian, float sigmaX, float sigmaY, float sigmaZ) |
Move alignable in global space according to parameters. | |
void | moveAlignableLocal (Alignable *alignable, bool random, bool gaussian, float sigmaX, float sigmaY, float sigmaZ) |
Move alignable in local space according to parameters. | |
void | rotateAlignable (Alignable *alignable, bool random, bool gaussian, float sigmaPhiX, float sigmaPhiY, float sigmaPhiZ) |
Rotate alignable in global space according to parameters. | |
void | rotateAlignableLocal (Alignable *alignable, bool random, bool gaussian, float sigmaPhiX, float sigmaPhiY, float sigmaPhiZ) |
Rotate alignable in local space according to parameters. | |
void | setDistribution (const std::string &distr) |
Decodes string and sets distribution accordingly ('fixed', 'flat' or 'gaussian'). | |
void | setSeed (long seed) |
Resets the generator seed according to the argument. | |
~AlignableModifier () | |
Destructor. | |
Private Member Functions | |
void | init_ () |
Initialisation of all parameters. | |
Private Attributes | |
std::string | distribution_ |
double | dX_ |
double | dXlocal_ |
double | dY_ |
double | dYlocal_ |
double | dZ_ |
double | dZlocal_ |
bool | gaussian_ |
int | m_modified |
double | phiX_ |
double | phiXlocal_ |
double | phiY_ |
double | phiYlocal_ |
double | phiZ_ |
double | phiZlocal_ |
bool | random_ |
double | scale_ |
double | scaleError_ |
long | seed_ |
bool | setError_ |
bool | setRotations_ |
bool | setTranslations_ |
double | shear_ |
CLHEP::DRand48Engine * | theDRand48Engine |
Unique random number generator. | |
double | twist_ |
Definition at line 18 of file AlignableModifier.h.
AlignableModifier::AlignableModifier | ( | void | ) |
Constructor.
Definition at line 16 of file AlignableModifier.cc.
References theDRand48Engine.
{ theDRand48Engine = new CLHEP::DRand48Engine(); }
AlignableModifier::~AlignableModifier | ( | ) |
Destructor.
Definition at line 25 of file AlignableModifier.cc.
References theDRand48Engine.
{ delete theDRand48Engine; }
void AlignableModifier::addAlignmentPositionError | ( | Alignable * | alignable, |
float | dx, | ||
float | dy, | ||
float | dz | ||
) |
Add the AlignmentPositionError (in global frame) to Alignable.
Definition at line 464 of file AlignableModifier.cc.
References Alignable::addAlignmentPositionError(), and LogDebug.
Referenced by modify(), MuonScenarioBuilder::moveChamberInSector(), and MuonScenarioBuilder::moveMuon().
{ LogDebug("PrintArgs") << "Adding an AlignmentPositionError of size " << dx << " " << dy << " " << dz; AlignmentPositionError ape(dx,dy,dz); alignable->addAlignmentPositionError( ape, true ); }
void AlignableModifier::addAlignmentPositionErrorFromLocalRotation | ( | Alignable * | alignable, |
float | phiX, | ||
float | phiY, | ||
float | phiZ | ||
) |
Add alignment position error resulting from rotation in local frame.
Definition at line 520 of file AlignableModifier.cc.
Referenced by modify().
{ align::RotationType rotx( Basic3DVector<float>(1.0, 0.0, 0.0), phiX ); align::RotationType roty( Basic3DVector<float>(0.0, 1.0, 0.0), phiY ); align::RotationType rotz( Basic3DVector<float>(0.0, 0.0, 1.0), phiZ ); align::RotationType rot = rotz * roty * rotx; this->addAlignmentPositionErrorFromLocalRotation( alignable, rot ); }
void AlignableModifier::addAlignmentPositionErrorFromLocalRotation | ( | Alignable * | alignable, |
align::RotationType & | rotation | ||
) |
Add alignment position error resulting from rotation in local frame.
Definition at line 549 of file AlignableModifier.cc.
References Alignable::addAlignmentPositionErrorFromLocalRotation(), and LogDebug.
{ LogDebug("PrintArgs") << "Adding an AlignmentPositionError from Local Rotation" << std::endl << rotation; // true: propagate down to components alignable->addAlignmentPositionErrorFromLocalRotation(rotation, true); }
void AlignableModifier::addAlignmentPositionErrorFromRotation | ( | Alignable * | alignable, |
float | phiX, | ||
float | phiY, | ||
float | phiZ | ||
) |
Add alignment position error resulting from rotation in global frame.
Definition at line 504 of file AlignableModifier.cc.
Referenced by modify(), MuonScenarioBuilder::moveChamberInSector(), and MuonScenarioBuilder::moveMuon().
{ align::RotationType rotx( Basic3DVector<float>(1.0, 0.0, 0.0), phiX ); align::RotationType roty( Basic3DVector<float>(0.0, 1.0, 0.0), phiY ); align::RotationType rotz( Basic3DVector<float>(0.0, 0.0, 1.0), phiZ ); align::RotationType rot = rotz * roty * rotx; this->addAlignmentPositionErrorFromRotation( alignable, rot ); }
void AlignableModifier::addAlignmentPositionErrorFromRotation | ( | Alignable * | alignable, |
align::RotationType & | rotation | ||
) |
Add alignment position error resulting from rotation in global frame.
Definition at line 536 of file AlignableModifier.cc.
References Alignable::addAlignmentPositionErrorFromRotation(), and LogDebug.
{ LogDebug("PrintArgs") << "Adding an AlignmentPositionError from Rotation" << std::endl << rotation; alignable->addAlignmentPositionErrorFromRotation(rotation, true); // propagate down to components }
void AlignableModifier::addAlignmentPositionErrorLocal | ( | Alignable * | alignable, |
float | dx, | ||
float | dy, | ||
float | dz | ||
) |
Add the AlignmentPositionError (in local frame) to Alignable.
Definition at line 478 of file AlignableModifier.cc.
References Alignable::addAlignmentPositionError(), Alignable::globalRotation(), LogDebug, TkRotation< T >::xx(), TkRotation< T >::xy(), TkRotation< T >::xz(), TkRotation< T >::yx(), TkRotation< T >::yy(), TkRotation< T >::yz(), TkRotation< T >::zx(), TkRotation< T >::zy(), and TkRotation< T >::zz().
Referenced by SurveyDataConverter::applyAPEs(), and modify().
{ LogDebug("PrintArgs") << "Adding a local AlignmentPositionError of size " << dx << " " << dy << " " << dz; AlgebraicSymMatrix as(3,0); //3x3, zeroed as[0][0] = dx*dx; as[1][1] = dy*dy; as[2][2] = dz*dz; //diagonals align::RotationType rt = alignable->globalRotation(); //get rotation AlgebraicMatrix am(3,3); am[0][0]=rt.xx(); am[0][1]=rt.xy(); am[0][2]=rt.xz(); am[1][0]=rt.yx(); am[1][1]=rt.yy(); am[1][2]=rt.yz(); am[2][0]=rt.zx(); am[2][1]=rt.zy(); am[2][2]=rt.zz(); as=as.similarityT(am); //rotate error matrix GlobalError ge( as ); AlignmentPositionError ape( ge ); alignable->addAlignmentPositionError( ape, true ); // propagate down to components }
const std::vector< float > AlignableModifier::flatRandomVector | ( | float | sigmaX, |
float | sigmaY, | ||
float | sigmaZ | ||
) | const |
Return a vector of random numbers (flat distribution)
Definition at line 431 of file AlignableModifier.cc.
References abs, and theDRand48Engine.
Referenced by moveAlignable(), moveAlignableLocal(), MuonScenarioBuilder::moveCSCSectors(), MuonScenarioBuilder::moveDTSectors(), MuonScenarioBuilder::moveMuon(), rotateAlignable(), and rotateAlignableLocal().
{ // Get absolute value if negative arguments if ( sigmaX < 0 ) { edm::LogWarning("BadConfig") << " taking absolute value for flat sigma_x"; sigmaX = std::abs(sigmaX); } if ( sigmaY < 0 ) { edm::LogWarning("BadConfig") << " taking absolute value for flat sigma_y"; sigmaY = std::abs(sigmaY); } if ( sigmaZ < 0 ) { edm::LogWarning("BadConfig") << " taking absolute value for flat sigma_z"; sigmaZ = std::abs(sigmaZ); } CLHEP::RandFlat aFlatObjX( *theDRand48Engine, -sigmaX, sigmaX ); CLHEP::RandFlat aFlatObjY( *theDRand48Engine, -sigmaY, sigmaY ); CLHEP::RandFlat aFlatObjZ( *theDRand48Engine, -sigmaZ, sigmaZ ); std::vector<float> randomVector; randomVector.push_back( aFlatObjX.fire() ); randomVector.push_back( aFlatObjY.fire() ); randomVector.push_back( aFlatObjZ.fire() ); return randomVector; }
const std::vector< float > AlignableModifier::gaussianRandomVector | ( | float | sigmaX, |
float | sigmaY, | ||
float | sigmaZ | ||
) | const |
Return a vector of random numbers (gaussian distribution)
Definition at line 397 of file AlignableModifier.cc.
References abs, and theDRand48Engine.
Referenced by moveAlignable(), moveAlignableLocal(), MuonScenarioBuilder::moveCSCSectors(), MuonScenarioBuilder::moveDTSectors(), MuonScenarioBuilder::moveMuon(), rotateAlignable(), and rotateAlignableLocal().
{ // Get absolute value if negative arguments if ( sigmaX < 0 ) { edm::LogWarning("BadConfig") << " taking absolute value for gaussian sigma_x"; sigmaX = std::abs(sigmaX); } if ( sigmaY < 0 ) { edm::LogWarning("BadConfig") << " taking absolute value for gaussian sigma_y"; sigmaY = std::abs(sigmaY); } if ( sigmaZ < 0 ) { edm::LogWarning("BadConfig") << " taking absolute value for gaussian sigma_z"; sigmaZ = std::abs(sigmaZ); } // Pass by reference, otherwise pointer is deleted! CLHEP::RandGauss aGaussObjX( *theDRand48Engine, 0., sigmaX ); CLHEP::RandGauss aGaussObjY( *theDRand48Engine, 0., sigmaY ); CLHEP::RandGauss aGaussObjZ( *theDRand48Engine, 0., sigmaZ ); std::vector<float> randomVector; randomVector.push_back( aGaussObjX.fire() ); randomVector.push_back( aGaussObjY.fire() ); randomVector.push_back( aGaussObjZ.fire() ); return randomVector; }
void AlignableModifier::init_ | ( | void | ) | [private] |
Initialisation of all parameters.
Definition at line 33 of file AlignableModifier.cc.
References distribution_, dX_, dXlocal_, dY_, dYlocal_, dZ_, dZlocal_, gaussian_, phiX_, phiXlocal_, phiY_, phiYlocal_, phiZ_, phiZlocal_, random_, scale_, scaleError_, setError_, setRotations_, setTranslations_, shear_, and twist_.
Referenced by modify().
{ // Initialize all known parameters (according to ORCA's MisalignmentScenario.cc) distribution_ = ""; // Switch for distributions ("fixed","flat","gaussian") setError_ = false; // Apply alignment errors setRotations_ = true; // Apply rotations setTranslations_ = true; // Apply translations scale_ = 1.; // Scale to apply to all movements scaleError_ = 1.; // Scale to apply to alignment errors phiX_ = 0.; // Rotation angle around X [rad] phiY_ = 0.; // Rotation angle around Y [rad] phiZ_ = 0.; // Rotation angle around Z [rad] phiXlocal_ = 0.; // Local rotation angle around X [rad] phiYlocal_ = 0.; // Local rotation angle around Y [rad] phiZlocal_ = 0.; // Local rotation angle around Z [rad] dX_ = 0.; // X displacement [cm] dY_ = 0.; // Y displacement [cm] dZ_ = 0.; // Z displacement [cm] dXlocal_ = 0.; // Local X displacement [cm] dYlocal_ = 0.; // Local Y displacement [cm] dZlocal_ = 0.; // Local Z displacement [cm] twist_ = 0.; // Twist angle [rad] shear_ = 0.; // Shear angle [rad] // These are set through 'distribution' random_ = true; // Use random distributions gaussian_ = true; // Use gaussian distribution (otherwise flat) }
const bool AlignableModifier::isPropagated | ( | const std::string & | parameterName | ) | const |
Check if given parameter should be propagated.
Definition at line 66 of file AlignableModifier.cc.
Referenced by MisalignmentScenarioBuilder::propagateParameters_().
{ if ( parameterName == "distribution" || parameterName == "setError" || parameterName == "scaleError" || parameterName == "setRotations" || parameterName == "setTranslations" || parameterName == "scale" ) return true; return false; }
bool AlignableModifier::modify | ( | Alignable * | alignable, |
const edm::ParameterSet & | pSet | ||
) |
Modify given set of alignables according to parameters.
All known parameters and defaults are defined here! Returns true if modification actually applied.
Definition at line 84 of file AlignableModifier.cc.
References abs, addAlignmentPositionError(), addAlignmentPositionErrorFromLocalRotation(), addAlignmentPositionErrorFromRotation(), addAlignmentPositionErrorLocal(), distribution_, dX_, dXlocal_, dY_, dYlocal_, dZ_, dZlocal_, error, Exception, edm::ParameterSet::existsAs(), gaussian_, edm::ParameterSet::getParameter(), edm::ParameterSet::getParameterNames(), init_(), m_modified, moveAlignable(), moveAlignableLocal(), phiX_, phiXlocal_, phiY_, phiYlocal_, phiZ_, phiZlocal_, random_, rotateAlignable(), rotateAlignableLocal(), scale_, scaleError_, setDistribution(), setError_, setRotations_, setTranslations_, shear_, and twist_.
Referenced by MisalignmentScenarioBuilder::decodeMovements_().
{ // Initialize parameters this->init_(); int rotX_=0, rotY_=0, rotZ_=0; // To check correct backward compatibility // Reset counter m_modified = 0; // Retrieve parameters std::ostringstream error; std::vector<std::string> parameterNames = pSet.getParameterNames(); for ( std::vector<std::string>::iterator iParam = parameterNames.begin(); iParam != parameterNames.end(); iParam++ ) { if ( (*iParam) == "distribution" ) distribution_ = pSet.getParameter<std::string>( *iParam ); else if ( (*iParam) == "setError" ) setError_ = pSet.getParameter<bool>( *iParam ); else if ( (*iParam) == "setRotations") setRotations_ = pSet.getParameter<bool>( *iParam ); else if ( (*iParam) == "setTranslations") setTranslations_ = pSet.getParameter<bool>( *iParam ); else if ( (*iParam) == "scale" ) scale_ = pSet.getParameter<double>( *iParam ); else if ( (*iParam) == "scaleError" ) scaleError_ = pSet.getParameter<double>( *iParam ); else if ( (*iParam) == "phiX" ) phiX_ = pSet.getParameter<double>( *iParam ); else if ( (*iParam) == "phiY" ) phiY_ = pSet.getParameter<double>( *iParam ); else if ( (*iParam) == "phiZ" ) phiZ_ = pSet.getParameter<double>( *iParam ); else if ( (*iParam) == "dX" ) dX_ = pSet.getParameter<double>( *iParam ); else if ( (*iParam) == "dY" ) dY_ = pSet.getParameter<double>( *iParam ); else if ( (*iParam) == "dZ" ) dZ_ = pSet.getParameter<double>( *iParam ); else if ( (*iParam) == "dXlocal" ) dXlocal_ = pSet.getParameter<double>( *iParam ); else if ( (*iParam) == "dYlocal" ) dYlocal_ = pSet.getParameter<double>( *iParam ); else if ( (*iParam) == "dZlocal" ) dZlocal_ = pSet.getParameter<double>( *iParam ); else if ( (*iParam) == "twist" ) twist_ = pSet.getParameter<double>( *iParam ); else if ( (*iParam) == "shear" ) shear_ = pSet.getParameter<double>( *iParam ); else if ( (*iParam) == "localX" ) { phiXlocal_=pSet.getParameter<double>( *iParam ); rotX_++; } else if ( (*iParam) == "localY" ) { phiYlocal_=pSet.getParameter<double>( *iParam ); rotY_++; } else if ( (*iParam) == "localZ" ) { phiZlocal_=pSet.getParameter<double>( *iParam ); rotZ_++; } else if ( (*iParam) == "phiXlocal" ) { phiXlocal_=pSet.getParameter<double>( *iParam ); rotX_++; } else if ( (*iParam) == "phiYlocal" ) { phiYlocal_=pSet.getParameter<double>( *iParam ); rotY_++; } else if ( (*iParam) == "phiZlocal" ) { phiZlocal_=pSet.getParameter<double>( *iParam ); rotZ_++; } else if ( !pSet.existsAs<edm::ParameterSet>(*iParam) ) { // PSets are OK to ignore if ( !error.str().length() ) error << "Unknown parameter name(s): "; error << " " << *iParam; } } // Check if both 'localN' and 'phiNlocal' have been used if ( rotX_==2 ) throw cms::Exception("BadConfig") << "Found both localX and phiXlocal"; if ( rotY_==2 ) throw cms::Exception("BadConfig") << "Found both localY and phiYlocal"; if ( rotZ_==2 ) throw cms::Exception("BadConfig") << "Found both localZ and phiZlocal"; // Check error if ( error.str().length() ) throw cms::Exception("BadConfig") << error.str(); // Decode distribution this->setDistribution( distribution_ ); //if (scale_) { NO! Different random sequence if only parts scale to zero! // Apply displacements if ( std::abs(dX_) + std::abs(dY_) + std::abs(dZ_) > 0 && setTranslations_ ) this->moveAlignable( alignable, random_, gaussian_, scale_*dX_, scale_*dY_, scale_*dZ_ ); // Apply local displacements if ( std::abs(dXlocal_) + std::abs(dYlocal_) + std::abs(dZlocal_) > 0 && setTranslations_ ) this->moveAlignableLocal( alignable, random_, gaussian_, scale_*dXlocal_, scale_*dYlocal_, scale_*dZlocal_ ); // Apply rotations if ( std::abs(phiX_) + std::abs(phiY_) + std::abs(phiZ_) > 0 && setRotations_ ) this->rotateAlignable( alignable, random_, gaussian_, scale_*phiX_, scale_*phiY_, scale_*phiZ_ ); // Apply local rotations if ( std::abs(phiXlocal_) + std::abs(phiYlocal_) + std::abs(phiZlocal_) > 0 && setRotations_ ) this->rotateAlignableLocal( alignable, random_, gaussian_, scale_*phiXlocal_, scale_*phiYlocal_, scale_*phiZlocal_ ); // Apply twist if ( std::abs(twist_) > 0 ) edm::LogError("NotImplemented") << "Twist is not implemented yet"; // Apply shear if ( std::abs(shear_) > 0 ) edm::LogError("NotImplemented") << "Shear is not implemented yet"; // Apply error - first add scale_ to error scaleError_ *= scale_; if ( setError_ && scaleError_ ) { // Alignment Position Error for flat distribution: 1 sigma if ( !gaussian_ ) scaleError_ *= 0.68; // Error on displacement if ( std::abs(dX_) + std::abs(dY_) + std::abs(dZ_) > 0 && setTranslations_ ) this->addAlignmentPositionError( alignable, scaleError_*dX_, scaleError_*dY_, scaleError_*dZ_ ); // Error on local displacements if ( std::abs(dXlocal_) + std::abs(dYlocal_) + std::abs(dZlocal_) > 0 && setTranslations_ ) this->addAlignmentPositionErrorLocal( alignable, scaleError_*dXlocal_, scaleError_*dYlocal_, scaleError_*dZlocal_ ); // Error on rotations if ( std::abs(phiX_) + std::abs(phiY_) + std::abs(phiZ_) > 0 && setRotations_ ) this->addAlignmentPositionErrorFromRotation( alignable, scaleError_*phiX_, scaleError_*phiY_, scaleError_*phiZ_ ); // Error on local rotations if ( std::abs(phiXlocal_) + std::abs(phiYlocal_) + std::abs(phiZlocal_) > 0 && setRotations_ ) this->addAlignmentPositionErrorFromLocalRotation( alignable, scaleError_*phiXlocal_, scaleError_*phiYlocal_, scaleError_*phiZlocal_ ); } // } // end if (scale_) return ( m_modified > 0 ); }
void AlignableModifier::moveAlignable | ( | Alignable * | alignable, |
bool | random, | ||
bool | gaussian, | ||
float | sigmaX, | ||
float | sigmaY, | ||
float | sigmaZ | ||
) |
Move alignable in global space according to parameters.
If 'random' is false, the given movements are strictly applied. Otherwise, a random number is generated according to a gaussian or a flat distribution depending on 'gaussian'.
Definition at line 247 of file AlignableModifier.cc.
References flatRandomVector(), gaussianRandomVector(), LogDebug, m_modified, argparse::message, and Alignable::move().
Referenced by modify(), MuonScenarioBuilder::moveChamberInSector(), and MuonScenarioBuilder::moveMuon().
{ std::ostringstream message; // Get movement vector according to arguments GlobalVector moveV( sigmaX, sigmaY, sigmaZ ); // Default: fixed if ( random ) { std::vector<float> randomNumbers; message << "random "; if (gaussian) { randomNumbers = this->gaussianRandomVector( sigmaX, sigmaY, sigmaZ ); message << "gaussian "; } else { randomNumbers = this->flatRandomVector( sigmaX, sigmaY, sigmaZ ); message << "flat "; } moveV = GlobalVector( randomNumbers[0], randomNumbers[1], randomNumbers[2] ); } message << " move with sigma " << sigmaX << " " << sigmaY << " " << sigmaZ; LogDebug("PrintArgs") << message.str(); // Arguments LogDebug("PrintMovement") << "applied displacement: " << moveV; // Actual movements alignable->move(moveV); m_modified++; }
void AlignableModifier::moveAlignableLocal | ( | Alignable * | alignable, |
bool | random, | ||
bool | gaussian, | ||
float | sigmaX, | ||
float | sigmaY, | ||
float | sigmaZ | ||
) |
Move alignable in local space according to parameters.
If 'random' is false, the given movements are strictly applied. Otherwise, a random number is generated according to a gaussian or a flat distribution depending on 'gaussian'.
Definition at line 283 of file AlignableModifier.cc.
References flatRandomVector(), gaussianRandomVector(), LogDebug, m_modified, argparse::message, Alignable::move(), Alignable::surface(), and AlignableSurface::toGlobal().
Referenced by modify().
{ std::ostringstream message; // Get movement vector according to arguments align::LocalVector moveV( sigmaX, sigmaY, sigmaZ ); // Default: fixed if ( random ) { std::vector<float> randomNumbers; message << "random "; if (gaussian) { randomNumbers = this->gaussianRandomVector( sigmaX, sigmaY, sigmaZ ); message << "gaussian "; } else { randomNumbers = this->flatRandomVector( sigmaX, sigmaY, sigmaZ ); message << "flat "; } moveV = align::LocalVector( randomNumbers[0], randomNumbers[1], randomNumbers[2] ); } message << " move with sigma " << sigmaX << " " << sigmaY << " " << sigmaZ; LogDebug("PrintArgs") << message.str(); // Arguments LogDebug("PrintMovement") << "applied local displacement: " << moveV; // Actual movements alignable->move( alignable->surface().toGlobal(moveV) ); m_modified++; }
void AlignableModifier::rotateAlignable | ( | Alignable * | alignable, |
bool | random, | ||
bool | gaussian, | ||
float | sigmaPhiX, | ||
float | sigmaPhiY, | ||
float | sigmaPhiZ | ||
) |
Rotate alignable in global space according to parameters.
If 'random' is false, the given rotations are strictly applied. Otherwise, a random number is generated according to a gaussian or a flat distribution depending on 'gaussian'.
Definition at line 320 of file AlignableModifier.cc.
References abs, flatRandomVector(), gaussianRandomVector(), LogDebug, m_modified, argparse::message, Alignable::rotateAroundGlobalX(), Alignable::rotateAroundGlobalY(), Alignable::rotateAroundGlobalZ(), PV3DBase< T, PVType, FrameType >::x(), PV3DBase< T, PVType, FrameType >::y(), and PV3DBase< T, PVType, FrameType >::z().
Referenced by modify(), MuonScenarioBuilder::moveChamberInSector(), and MuonScenarioBuilder::moveMuon().
{ std::ostringstream message; // Get rotation vector according to arguments GlobalVector rotV( sigmaPhiX, sigmaPhiY, sigmaPhiZ ); // Default: fixed if ( random ) { std::vector<float> randomNumbers; message << "random "; if (gaussian) { randomNumbers = this->gaussianRandomVector( sigmaPhiX, sigmaPhiY, sigmaPhiZ ); message << "gaussian "; } else { randomNumbers = flatRandomVector( sigmaPhiX, sigmaPhiY, sigmaPhiZ ); message << "flat "; } rotV = GlobalVector( randomNumbers[0], randomNumbers[1], randomNumbers[2] ); } message << "global rotation by angles " << sigmaPhiX << " " << sigmaPhiY << " " << sigmaPhiZ; LogDebug("PrintArgs") << message.str(); // Arguments LogDebug("PrintMovement") << "applied rotation angles: " << rotV; // Actual movements if ( std::abs(sigmaPhiX) ) alignable->rotateAroundGlobalX( rotV.x() ); if ( std::abs(sigmaPhiY) ) alignable->rotateAroundGlobalY( rotV.y() ); if ( std::abs(sigmaPhiZ) ) alignable->rotateAroundGlobalZ( rotV.z() ); m_modified++; }
void AlignableModifier::rotateAlignableLocal | ( | Alignable * | alignable, |
bool | random, | ||
bool | gaussian, | ||
float | sigmaPhiX, | ||
float | sigmaPhiY, | ||
float | sigmaPhiZ | ||
) |
Rotate alignable in local space according to parameters.
If 'random' is false, the given rotations are strictly applied. Otherwise, a random number is generated according to a gaussian or a flat distribution depending on 'gaussian'.
Definition at line 359 of file AlignableModifier.cc.
References abs, flatRandomVector(), gaussianRandomVector(), LogDebug, m_modified, argparse::message, Alignable::rotateAroundLocalX(), Alignable::rotateAroundLocalY(), Alignable::rotateAroundLocalZ(), PV3DBase< T, PVType, FrameType >::x(), PV3DBase< T, PVType, FrameType >::y(), and PV3DBase< T, PVType, FrameType >::z().
Referenced by modify().
{ std::ostringstream message; // Get rotation vector according to arguments align::LocalVector rotV( sigmaPhiX, sigmaPhiY, sigmaPhiZ ); // Default: fixed if ( random ) { std::vector<float> randomNumbers; message << "random "; if (gaussian) { randomNumbers = this->gaussianRandomVector( sigmaPhiX, sigmaPhiY, sigmaPhiZ ); message << "gaussian "; } else { randomNumbers = flatRandomVector( sigmaPhiX, sigmaPhiY, sigmaPhiZ ); message << "flat "; } rotV = align::LocalVector( randomNumbers[0], randomNumbers[1], randomNumbers[2] ); } message << "local rotation by angles " << sigmaPhiX << " " << sigmaPhiY << " " << sigmaPhiZ; LogDebug("PrintArgs") << message.str(); // Arguments LogDebug("PrintMovement") << "applied local rotation angles: " << rotV; // Actual movements if ( std::abs(sigmaPhiX) ) alignable->rotateAroundLocalX( rotV.x() ); if ( std::abs(sigmaPhiY) ) alignable->rotateAroundLocalY( rotV.y() ); if ( std::abs(sigmaPhiZ) ) alignable->rotateAroundLocalZ( rotV.z() ); m_modified++; }
void AlignableModifier::setDistribution | ( | const std::string & | distr | ) |
Decodes string and sets distribution accordingly ('fixed', 'flat' or 'gaussian').
Definition at line 210 of file AlignableModifier.cc.
References gaussian_, and random_.
Referenced by modify().
void AlignableModifier::setSeed | ( | long | seed | ) |
Resets the generator seed according to the argument.
If 'seed' is zero, asks RandomNumberGenerator service.
Definition at line 227 of file AlignableModifier.cc.
References LogDebug, and theDRand48Engine.
Referenced by TrackerScenarioBuilder::applyScenario(), and MuonScenarioBuilder::applyScenario().
{ long m_seed; if ( seed > 0 ) m_seed = seed; else { edm::Service<edm::RandomNumberGenerator> rng; m_seed = rng->mySeed(); } LogDebug("PrintArgs") << "Setting generator seed to " << m_seed; theDRand48Engine->setSeed( m_seed ); }
std::string AlignableModifier::distribution_ [private] |
Definition at line 97 of file AlignableModifier.h.
double AlignableModifier::dX_ [private] |
Definition at line 104 of file AlignableModifier.h.
double AlignableModifier::dXlocal_ [private] |
Definition at line 105 of file AlignableModifier.h.
double AlignableModifier::dY_ [private] |
Definition at line 104 of file AlignableModifier.h.
double AlignableModifier::dYlocal_ [private] |
Definition at line 105 of file AlignableModifier.h.
double AlignableModifier::dZ_ [private] |
Definition at line 104 of file AlignableModifier.h.
double AlignableModifier::dZlocal_ [private] |
Definition at line 105 of file AlignableModifier.h.
bool AlignableModifier::gaussian_ [private] |
Definition at line 98 of file AlignableModifier.h.
Referenced by init_(), modify(), and setDistribution().
int AlignableModifier::m_modified [private] |
Definition at line 94 of file AlignableModifier.h.
Referenced by modify(), moveAlignable(), moveAlignableLocal(), rotateAlignable(), and rotateAlignableLocal().
double AlignableModifier::phiX_ [private] |
Definition at line 102 of file AlignableModifier.h.
double AlignableModifier::phiXlocal_ [private] |
Definition at line 103 of file AlignableModifier.h.
double AlignableModifier::phiY_ [private] |
Definition at line 102 of file AlignableModifier.h.
double AlignableModifier::phiYlocal_ [private] |
Definition at line 103 of file AlignableModifier.h.
double AlignableModifier::phiZ_ [private] |
Definition at line 102 of file AlignableModifier.h.
double AlignableModifier::phiZlocal_ [private] |
Definition at line 103 of file AlignableModifier.h.
bool AlignableModifier::random_ [private] |
Definition at line 98 of file AlignableModifier.h.
Referenced by init_(), modify(), and setDistribution().
double AlignableModifier::scale_ [private] |
Definition at line 101 of file AlignableModifier.h.
double AlignableModifier::scaleError_ [private] |
Definition at line 101 of file AlignableModifier.h.
long AlignableModifier::seed_ [private] |
Definition at line 100 of file AlignableModifier.h.
bool AlignableModifier::setError_ [private] |
Definition at line 98 of file AlignableModifier.h.
bool AlignableModifier::setRotations_ [private] |
Definition at line 99 of file AlignableModifier.h.
bool AlignableModifier::setTranslations_ [private] |
Definition at line 99 of file AlignableModifier.h.
double AlignableModifier::shear_ [private] |
Definition at line 106 of file AlignableModifier.h.
CLHEP::DRand48Engine* AlignableModifier::theDRand48Engine [private] |
Unique random number generator.
Definition at line 89 of file AlignableModifier.h.
Referenced by AlignableModifier(), flatRandomVector(), gaussianRandomVector(), setSeed(), and ~AlignableModifier().
double AlignableModifier::twist_ [private] |
Definition at line 106 of file AlignableModifier.h.