CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Member Functions | Private Attributes
SimpleMetricsUpdator Class Reference

#include <SimpleMetricsUpdator.h>

Inheritance diagram for SimpleMetricsUpdator:
KalmanAlignmentMetricsUpdator

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)
 
- Public Member Functions inherited from KalmanAlignmentMetricsUpdator
 KalmanAlignmentMetricsUpdator (const edm::ParameterSet &config)
 
virtual ~KalmanAlignmentMetricsUpdator (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
 

Detailed Description

Definition at line 10 of file SimpleMetricsUpdator.h.

Constructor & Destructor Documentation

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.

11  :
15 {
16  short int maxDistance = config.getUntrackedParameter< int >( "MaxMetricsDistance", 3 );
17  theMetricsCalculator.setMaxDistance( maxDistance );
18 
19  std::vector< unsigned int > dummy;
20  theExcludedSubdetIds = config.getUntrackedParameter< std::vector<unsigned int> >( "ExcludedSubdetIds", dummy );
21 
22  theASCFlag = config.getUntrackedParameter< bool >( "ApplyAdditionalSelectionCriterion", false );
23  if ( theASCFlag )
24  {
25  theMinDeltaPerp = config.getParameter< double >( "MinDeltaPerp" );
26  theMaxDeltaPerp = config.getParameter< double >( "MaxDeltaPerp" );
27  theMinDeltaZ = config.getParameter< double >( "MinDeltaZ" );
28  theMaxDeltaZ = config.getParameter< double >( "MaxDeltaZ" );
29  theGeomDist = config.getParameter< double >( "GeomDist" );
30  theMetricalThreshold = config.getParameter< unsigned int >( "MetricalThreshold" );
31  }
32 
33  edm::LogInfo("Alignment") << "@SUB=SimpleMetricsUpdator::SimpleMetricsUpdator "
34  << "\nInstance of MetricsCalculator created (MaxMetricsDistance = " << maxDistance << ").";
35 }
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
void setMaxDistance(short int maxDistance)
Set maximum distance to be stored.
KalmanAlignmentMetricsUpdator(const edm::ParameterSet &config)
std::vector< unsigned int > theExcludedSubdetIds
KalmanAlignmentMetricsCalculator theMetricsCalculator
virtual SimpleMetricsUpdator::~SimpleMetricsUpdator ( void  )
inlinevirtual

Definition at line 17 of file SimpleMetricsUpdator.h.

17 {}

Member Function Documentation

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.

59 {
60  std::vector< Alignable* > result;
61  std::vector< Alignable* >::const_iterator itAD;
62 
63  std::map< Alignable*, short int > updateList;
64  std::map< Alignable*, short int >::iterator itUL;
65 
66  std::set< Alignable* > alignablesFromUpdateList;
67  std::set< Alignable* >::iterator itAUL;
68 
69  // make union of all lists
70  for ( itAD = alignables.begin(); itAD != alignables.end(); itAD++ )
71  {
72  updateList = theMetricsCalculator.getDistances( *itAD );
73  for ( itUL = updateList.begin(); itUL != updateList.end(); itUL++ )
74  {
75  // extra selection criterion
76  if ( theASCFlag && !additionalSelectionCriterion( *itAD, itUL->first, itUL->second ) ) continue;
77 
78  alignablesFromUpdateList.insert( itUL->first );
79  }
80  updateList.clear();
81  }
82 
83  // make final list of modules for update
84  for ( itAUL = alignablesFromUpdateList.begin(); itAUL != alignablesFromUpdateList.end(); itAUL++ )
85  {
86  if ( find( alignables.begin(), alignables.end(), *itAUL ) == alignables.end() )
87  {
88  result.push_back( *itAUL );
89  }
90  }
91 
92  return result;
93 }
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:7
virtual const std::vector< Alignable * > alignables(void) const
tuple result
Definition: query.py:137
bool additionalSelectionCriterion(Alignable *const &referenceAli, Alignable *const &additionalAli, short int metricalDist) const
KalmanAlignmentMetricsCalculator theMetricsCalculator
const SingleDistancesList & getDistances(Alignable *i) const
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.

98 {
99  std::map< Alignable*, short int > result;
100  std::map< Alignable*, short int > updateList;
101  std::map< Alignable*, short int >::iterator itUL;
102  std::map< Alignable*, short int >::iterator itFind;
103 
104  std::vector< Alignable* >::const_iterator itAD;
105 
106  // make union of all lists
107  for ( itAD = alignables.begin(); itAD != alignables.end(); itAD++ )
108  {
109  updateList = theMetricsCalculator.getDistances( *itAD );
110  for ( itUL = updateList.begin(); itUL != updateList.end(); itUL++ )
111  {
112  itFind = result.find( itUL->first );
113  if ( itFind == result.end() )
114  {
115  result[itUL->first] = itUL->second;
116  }
117  else if ( itFind->second < itUL->second )
118  {
119  itFind->second = itUL->second;
120  }
121  }
122  }
123 
124  for ( itAD = alignables.begin(); itAD != alignables.end(); itAD++ )
125  {
126  itFind = result.find( *itAD );
127  if ( itFind != result.end() ) result.erase( itFind );
128  }
129 
130  return result;
131 }
virtual const std::vector< Alignable * > alignables(void) const
tuple result
Definition: query.py:137
KalmanAlignmentMetricsCalculator theMetricsCalculator
const SingleDistancesList & getDistances(Alignable *i) const
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().

138 {
139  if ( metricalDist <= theMetricalThreshold ) return true;
140 
141  const DetId detId( referenceAli->geomDetId() );
142 
143  const align::PositionType& pos1 = referenceAli->globalPosition();
144  const align::PositionType& pos2 = additionalAli->globalPosition();
145 
146  bool barrelRegion = ( detId.subdetId()%2 != 0 );
147 
148  if ( barrelRegion )
149  {
150  double perp1 = pos1.perp();
151  double perp2 = pos2.perp();
152  double deltaPerp = perp2 - perp1;
153 
154  if ( ( deltaPerp < theMinDeltaPerp ) || ( deltaPerp > theMaxDeltaPerp ) ) return false;
155  }
156  else
157  {
158  double z1 = pos1.z();
159  double z2 = pos2.z();
160  double signZ = ( z1 > 0. ) ? 1. : -1;
161  double deltaZ = signZ*( z2 - z1 );
162 
163  if ( ( deltaZ < theMinDeltaZ ) || ( deltaZ > theMaxDeltaZ ) ) return false;
164  }
165 
166  double r1 = pos1.mag();
167  double r2 = pos2.mag();
168  double sp = pos1.x()*pos2.x() + pos1.y()*pos2.y() + pos1.z()*pos2.z();
169 
170  double dist = sqrt( r2*r2 - sp*sp/r1/r1 );
171  return ( dist < theGeomDist );
172 }
T perp() const
Definition: PV3DBase.h:71
T y() const
Definition: PV3DBase.h:62
T mag() const
Definition: PV3DBase.h:66
T sqrt(T t)
Definition: SSEVec.h:46
T z() const
Definition: PV3DBase.h:63
Definition: DetId.h:20
T perp2() const
Squared magnitude of transverse component.
const PositionType & globalPosition() const
Return the global position of the object.
Definition: Alignable.h:129
T x() const
Definition: PV3DBase.h:61
const DetId & geomDetId() const
Definition: Alignable.h:177
virtual const std::vector< Alignable* > SimpleMetricsUpdator::alignables ( void  ) const
inlinevirtual

Implements KalmanAlignmentMetricsUpdator.

Definition at line 25 of file SimpleMetricsUpdator.h.

References KalmanAlignmentMetricsCalculator::alignables(), and theMetricsCalculator.

25 { return theMetricsCalculator.alignables(); }
const std::vector< Alignable * > alignables(void) const
Return all known alignables.
KalmanAlignmentMetricsCalculator theMetricsCalculator
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().

Referenced by progressbar.ProgressBar::__next__(), relval_steps.Matrix::__setitem__(), relval_steps.Steps::__setitem__(), python.seqvaluedict.seqdict::__setslice__(), Vispa.Gui.VispaWidget.VispaWidget::autosize(), Vispa.Views.LineDecayView.LineDecayContainer::createObject(), Vispa.Views.LineDecayView.LineDecayContainer::deselectAllObjects(), Vispa.Gui.VispaWidgetOwner.VispaWidgetOwner::deselectAllWidgets(), Vispa.Gui.VispaWidget.VispaWidget::enableAutosizing(), python.seqvaluedict.seqdict::extend(), progressbar.ProgressBar::finish(), Vispa.Gui.MenuWidget.MenuWidget::leaveEvent(), Vispa.Gui.VispaWidgetOwner.VispaWidgetOwner::mouseMoveEvent(), Vispa.Gui.MenuWidget.MenuWidget::mouseMoveEvent(), Vispa.Views.LineDecayView.LineDecayContainer::mouseMoveEvent(), Vispa.Gui.VispaWidgetOwner.VispaWidgetOwner::mouseReleaseEvent(), Vispa.Views.LineDecayView.LineDecayContainer::objectMoved(), relval_steps.Steps::overwrite(), Vispa.Views.LineDecayView.LineDecayContainer::removeObject(), Vispa.Gui.ConnectableWidget.ConnectableWidget::removePorts(), Vispa.Gui.FindDialog.FindDialog::reset(), Vispa.Gui.PortConnection.PointToPointConnection::select(), Vispa.Gui.VispaWidget.VispaWidget::select(), Vispa.Views.LineDecayView.LineDecayContainer::select(), Vispa.Gui.VispaWidget.VispaWidget::setText(), Vispa.Gui.VispaWidget.VispaWidget::setTitle(), Vispa.Gui.ZoomableWidget.ZoomableWidget::setZoom(), Vispa.Views.LineDecayView.LineDecayContainer::setZoom(), and Vispa.Gui.PortConnection.PointToPointConnection::updateConnection().

39 {
40  std::vector< Alignable* > alignablesForUpdate;
41  std::vector< Alignable* >::const_iterator it;
42 
43  for ( it = alignables.begin(); it != alignables.end(); ++it )
44  {
45  unsigned int subdetId = static_cast< unsigned int >( (*it)->geomDetId().subdetId() );
46 
47  if ( std::find( theExcludedSubdetIds.begin(), theExcludedSubdetIds.end(), subdetId ) == theExcludedSubdetIds.end() )
48  {
49  alignablesForUpdate.push_back( *it );
50  }
51  }
52 
53  theMetricsCalculator.updateDistances( alignablesForUpdate );
54 }
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:7
virtual const std::vector< Alignable * > alignables(void) const
std::vector< unsigned int > theExcludedSubdetIds
void updateDistances(const std::vector< Alignable * > &alignables)
Update list of distances with a set Alignables.
KalmanAlignmentMetricsCalculator theMetricsCalculator

Member Data Documentation

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().

KalmanAlignmentMetricsCalculator SimpleMetricsUpdator::theMetricsCalculator
private
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().