#include <SimpleMetricsUpdator.h>
Public Member Functions | |
virtual const std::vector < Alignable * > | additionalAlignables (const std::vector< Alignable * > &alignables) |
virtual const std::map < Alignable *, short int > | additionalAlignablesWithDistances (const std::vector< Alignable * > &alignables) |
virtual const std::vector < Alignable * > | alignables (void) const |
SimpleMetricsUpdator (const edm::ParameterSet &config) | |
virtual void | update (const std::vector< Alignable * > &alignables) |
virtual | ~SimpleMetricsUpdator (void) |
Private Member Functions | |
bool | additionalSelectionCriterion (Alignable *const &referenceAli, Alignable *const &additionalAli, short int metricalDist) const |
Private Attributes | |
bool | theASCFlag |
std::vector< unsigned int > | theExcludedSubdetIds |
double | theGeomDist |
double | theMaxDeltaPerp |
double | theMaxDeltaZ |
short int | theMetricalThreshold |
KalmanAlignmentMetricsCalculator | theMetricsCalculator |
double | theMinDeltaPerp |
double | theMinDeltaZ |
Definition at line 10 of file SimpleMetricsUpdator.h.
SimpleMetricsUpdator::SimpleMetricsUpdator | ( | const edm::ParameterSet & | config | ) |
Definition at line 11 of file SimpleMetricsUpdator.cc.
References funct::false, edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), KalmanAlignmentMetricsCalculator::setMaxDistance(), theASCFlag, theExcludedSubdetIds, theGeomDist, theMaxDeltaPerp, theMaxDeltaZ, theMetricalThreshold, theMetricsCalculator, theMinDeltaPerp, and theMinDeltaZ.
: KalmanAlignmentMetricsUpdator( config ), theMinDeltaPerp(0.), theMaxDeltaPerp(0.), theMinDeltaZ(0.), theMaxDeltaZ(0.), theGeomDist(0.), theMetricalThreshold(0) { short int maxDistance = config.getUntrackedParameter< int >( "MaxMetricsDistance", 3 ); theMetricsCalculator.setMaxDistance( maxDistance ); std::vector< unsigned int > dummy; theExcludedSubdetIds = config.getUntrackedParameter< std::vector<unsigned int> >( "ExcludedSubdetIds", dummy ); theASCFlag = config.getUntrackedParameter< bool >( "ApplyAdditionalSelectionCriterion", false ); if ( theASCFlag ) { theMinDeltaPerp = config.getParameter< double >( "MinDeltaPerp" ); theMaxDeltaPerp = config.getParameter< double >( "MaxDeltaPerp" ); theMinDeltaZ = config.getParameter< double >( "MinDeltaZ" ); theMaxDeltaZ = config.getParameter< double >( "MaxDeltaZ" ); theGeomDist = config.getParameter< double >( "GeomDist" ); theMetricalThreshold = config.getParameter< unsigned int >( "MetricalThreshold" ); } edm::LogInfo("Alignment") << "@SUB=SimpleMetricsUpdator::SimpleMetricsUpdator " << "\nInstance of MetricsCalculator created (MaxMetricsDistance = " << maxDistance << ")."; }
virtual SimpleMetricsUpdator::~SimpleMetricsUpdator | ( | void | ) | [inline, virtual] |
Definition at line 17 of file SimpleMetricsUpdator.h.
{}
const std::vector< Alignable * > SimpleMetricsUpdator::additionalAlignables | ( | const std::vector< Alignable * > & | alignables | ) | [virtual] |
Implements KalmanAlignmentMetricsUpdator.
Definition at line 58 of file SimpleMetricsUpdator.cc.
References additionalSelectionCriterion(), spr::find(), KalmanAlignmentMetricsCalculator::getDistances(), query::result, theASCFlag, and theMetricsCalculator.
{ std::vector< Alignable* > result; std::vector< Alignable* >::const_iterator itAD; std::map< Alignable*, short int > updateList; std::map< Alignable*, short int >::iterator itUL; std::set< Alignable* > alignablesFromUpdateList; std::set< Alignable* >::iterator itAUL; // make union of all lists for ( itAD = alignables.begin(); itAD != alignables.end(); itAD++ ) { updateList = theMetricsCalculator.getDistances( *itAD ); for ( itUL = updateList.begin(); itUL != updateList.end(); itUL++ ) { // extra selection criterion if ( theASCFlag && !additionalSelectionCriterion( *itAD, itUL->first, itUL->second ) ) continue; alignablesFromUpdateList.insert( itUL->first ); } updateList.clear(); } // make final list of modules for update for ( itAUL = alignablesFromUpdateList.begin(); itAUL != alignablesFromUpdateList.end(); itAUL++ ) { if ( find( alignables.begin(), alignables.end(), *itAUL ) == alignables.end() ) { result.push_back( *itAUL ); } } return result; }
const std::map< Alignable *, short int > SimpleMetricsUpdator::additionalAlignablesWithDistances | ( | const std::vector< Alignable * > & | alignables | ) | [virtual] |
Definition at line 97 of file SimpleMetricsUpdator.cc.
References KalmanAlignmentMetricsCalculator::getDistances(), query::result, and theMetricsCalculator.
{ std::map< Alignable*, short int > result; std::map< Alignable*, short int > updateList; std::map< Alignable*, short int >::iterator itUL; std::map< Alignable*, short int >::iterator itFind; std::vector< Alignable* >::const_iterator itAD; // make union of all lists for ( itAD = alignables.begin(); itAD != alignables.end(); itAD++ ) { updateList = theMetricsCalculator.getDistances( *itAD ); for ( itUL = updateList.begin(); itUL != updateList.end(); itUL++ ) { itFind = result.find( itUL->first ); if ( itFind == result.end() ) { result[itUL->first] = itUL->second; } else if ( itFind->second < itUL->second ) { itFind->second = itUL->second; } } } for ( itAD = alignables.begin(); itAD != alignables.end(); itAD++ ) { itFind = result.find( *itAD ); if ( itFind != result.end() ) result.erase( itFind ); } return result; }
bool SimpleMetricsUpdator::additionalSelectionCriterion | ( | Alignable *const & | referenceAli, |
Alignable *const & | additionalAli, | ||
short int | metricalDist | ||
) | const [private] |
Definition at line 135 of file SimpleMetricsUpdator.cc.
References Alignable::geomDetId(), Alignable::globalPosition(), PV3DBase< T, PVType, FrameType >::mag(), PV3DBase< T, PVType, FrameType >::perp(), perp2(), diffTwoXMLs::r1, diffTwoXMLs::r2, mathSSE::sqrt(), theGeomDist, theMaxDeltaPerp, theMaxDeltaZ, theMetricalThreshold, theMinDeltaPerp, theMinDeltaZ, PV3DBase< T, PVType, FrameType >::x(), PV3DBase< T, PVType, FrameType >::y(), and PV3DBase< T, PVType, FrameType >::z().
Referenced by additionalAlignables().
{ if ( metricalDist <= theMetricalThreshold ) return true; const DetId detId( referenceAli->geomDetId() ); const align::PositionType& pos1 = referenceAli->globalPosition(); const align::PositionType& pos2 = additionalAli->globalPosition(); bool barrelRegion = ( detId.subdetId()%2 != 0 ); if ( barrelRegion ) { double perp1 = pos1.perp(); double perp2 = pos2.perp(); double deltaPerp = perp2 - perp1; if ( ( deltaPerp < theMinDeltaPerp ) || ( deltaPerp > theMaxDeltaPerp ) ) return false; } else { double z1 = pos1.z(); double z2 = pos2.z(); double signZ = ( z1 > 0. ) ? 1. : -1; double deltaZ = signZ*( z2 - z1 ); if ( ( deltaZ < theMinDeltaZ ) || ( deltaZ > theMaxDeltaZ ) ) return false; } double r1 = pos1.mag(); double r2 = pos2.mag(); double sp = pos1.x()*pos2.x() + pos1.y()*pos2.y() + pos1.z()*pos2.z(); double dist = sqrt( r2*r2 - sp*sp/r1/r1 ); return ( dist < theGeomDist ); }
virtual const std::vector< Alignable* > SimpleMetricsUpdator::alignables | ( | void | ) | const [inline, virtual] |
Implements KalmanAlignmentMetricsUpdator.
Definition at line 25 of file SimpleMetricsUpdator.h.
References KalmanAlignmentMetricsCalculator::alignables(), and theMetricsCalculator.
{ return theMetricsCalculator.alignables(); }
void SimpleMetricsUpdator::update | ( | const std::vector< Alignable * > & | alignables | ) | [virtual] |
Implements KalmanAlignmentMetricsUpdator.
Definition at line 38 of file SimpleMetricsUpdator.cc.
References spr::find(), theExcludedSubdetIds, theMetricsCalculator, and KalmanAlignmentMetricsCalculator::updateDistances().
{ std::vector< Alignable* > alignablesForUpdate; std::vector< Alignable* >::const_iterator it; for ( it = alignables.begin(); it != alignables.end(); ++it ) { unsigned int subdetId = static_cast< unsigned int >( (*it)->geomDetId().subdetId() ); if ( std::find( theExcludedSubdetIds.begin(), theExcludedSubdetIds.end(), subdetId ) == theExcludedSubdetIds.end() ) { alignablesForUpdate.push_back( *it ); } } theMetricsCalculator.updateDistances( alignablesForUpdate ); }
bool SimpleMetricsUpdator::theASCFlag [private] |
Definition at line 37 of file SimpleMetricsUpdator.h.
Referenced by additionalAlignables(), and SimpleMetricsUpdator().
std::vector< unsigned int > SimpleMetricsUpdator::theExcludedSubdetIds [private] |
Definition at line 35 of file SimpleMetricsUpdator.h.
Referenced by SimpleMetricsUpdator(), and update().
double SimpleMetricsUpdator::theGeomDist [private] |
Definition at line 42 of file SimpleMetricsUpdator.h.
Referenced by additionalSelectionCriterion(), and SimpleMetricsUpdator().
double SimpleMetricsUpdator::theMaxDeltaPerp [private] |
Definition at line 39 of file SimpleMetricsUpdator.h.
Referenced by additionalSelectionCriterion(), and SimpleMetricsUpdator().
double SimpleMetricsUpdator::theMaxDeltaZ [private] |
Definition at line 41 of file SimpleMetricsUpdator.h.
Referenced by additionalSelectionCriterion(), and SimpleMetricsUpdator().
short int SimpleMetricsUpdator::theMetricalThreshold [private] |
Definition at line 43 of file SimpleMetricsUpdator.h.
Referenced by additionalSelectionCriterion(), and SimpleMetricsUpdator().
Definition at line 33 of file SimpleMetricsUpdator.h.
Referenced by additionalAlignables(), additionalAlignablesWithDistances(), alignables(), SimpleMetricsUpdator(), and update().
double SimpleMetricsUpdator::theMinDeltaPerp [private] |
Definition at line 38 of file SimpleMetricsUpdator.h.
Referenced by additionalSelectionCriterion(), and SimpleMetricsUpdator().
double SimpleMetricsUpdator::theMinDeltaZ [private] |
Definition at line 40 of file SimpleMetricsUpdator.h.
Referenced by additionalSelectionCriterion(), and SimpleMetricsUpdator().