CMS 3D CMS Logo

List of all members | Public Types | Public Member Functions | Protected Attributes | Private Types | Private Attributes
AlignmentParameterStore Class Reference

#include <AlignmentParameterStore.h>

Public Types

typedef std::map< std::pair< Alignable *, Alignable * >, AlgebraicMatrixCorrelations
 
typedef std::vector< unsigned int > DetIds
 
typedef std::pair< Alignable *, unsigned int > ParameterId
 a single alignable parameter of an Alignable More...
 
typedef std::vector< AlignmentParameters * > Parameters
 

Public Member Functions

void acquireRelativeParameters (void)
 
AlignablealignableFromAlignableDet (const AlignableDetOrUnitPtr &alignableDet) const
 Obsolete: Use AlignableNavigator::alignableDetFromGeomDet and alignableFromAlignableDet. More...
 
const align::Alignablesalignables (void) const
 get all alignables More...
 
 AlignmentParameterStore (const align::Alignables &alis, const edm::ParameterSet &config)
 constructor More...
 
void applyAlignableAbsolutePositions (const align::Alignables &alis, const AlignablePositions &newpos, int &ierr)
 apply absolute positions to alignables More...
 
void applyAlignableRelativePositions (const align::Alignables &alivec, const AlignableShifts &shifts, int &ierr)
 apply relative shifts to alignables More...
 
void applyParameters (void)
 Obsolete: Use AlignableNavigator::alignableDetFromDetId and alignableFromAlignableDet. More...
 
void applyParameters (Alignable *alignable)
 apply parameters of a given alignable More...
 
void attachAlignmentParameters (const align::Alignables &alivec, const Parameters &parvec, int &ierr)
 Attach alignment parameters to given alignables. More...
 
void attachAlignmentParameters (const Parameters &parvec, int &ierr)
 Attach alignment parameters to alignables. More...
 
void attachCorrelations (const align::Alignables &alivec, const Correlations &cormap, bool overwrite, int &ierr)
 Attach correlations to given alignables. More...
 
void attachCorrelations (const Correlations &cormap, bool overwrite, int &ierr)
 Attach correlations to alignables. More...
 
void attachUserVariables (const align::Alignables &alivec, const std::vector< AlignmentUserVariables * > &uvarvec, int &ierr)
 Attach User Variables to given alignables. More...
 
void cacheTransformations (void)
 cache the current position, rotation and other parameters More...
 
void cacheTransformations (const align::RunNumber &)
 cache for the given run the current position, rotation and other parameters More...
 
AlignmentCorrelationsStorecorrelationsStore (void) const
 get full correlation map More...
 
bool hierarchyConstraints (const Alignable *aliMaster, const align::Alignables &aliComps, std::vector< std::vector< ParameterId > > &paramIdsVecOut, std::vector< std::vector< double > > &factorsVecOut, bool all, double epsilon) const
 
const unsigned int numCorrelations (void) const
 get number of correlations between alignables More...
 
int numObjects (void) const
 returns number of alignables More...
 
void resetParameters (void)
 reset parameters, correlations, user variables More...
 
void resetParameters (Alignable *ali)
 reset parameters of a given alignable More...
 
void restoreCachedTransformations (void)
 restore the previously cached position, rotation and other parameters More...
 
void restoreCachedTransformations (const align::RunNumber &)
 restore for the given run the previously cached position, rotation and other parameters More...
 
CompositeAlignmentParameters selectParameters (const std::vector< AlignableDet * > &alignabledets) const
 
CompositeAlignmentParameters selectParameters (const std::vector< AlignableDetOrUnitPtr > &alignabledets) const
 select parameters More...
 
CompositeAlignmentParameters selectParameters (const std::vector< Alignable * > &alignables) const
 select parameters More...
 
void setAlignmentPositionError (const align::Alignables &alivec, double valshift, double valrot)
 Set Alignment position error. More...
 
std::pair< int, int > typeAndLayer (const Alignable *ali, const TrackerTopology *tTopo) const
 Obtain type and layer from Alignable. More...
 
void updateParameters (const CompositeAlignmentParameters &aap, bool updateCorrelations=true)
 update parameters More...
 
align::Alignables validAlignables (void) const
 get all alignables with valid parameters More...
 
virtual ~AlignmentParameterStore ()
 destructor More...
 

Protected Attributes

AlignmentCorrelationsStoretheCorrelationsStore
 

Private Types

enum  TypeOfConstraints { NONE, HIERARCHY_CONSTRAINTS, APPROX_AVERAGING_CONSTRAINTS }
 

Private Attributes

align::Alignables theAlignables
 alignables More...
 
TypeOfConstraints theTypeOfConstraints
 type of constraints More...
 

Detailed Description

Basic class for management of alignment parameters and correlations

Date
2011/05/23 20:50:31
Revision
1.19

(last update by

Author
mussgill

)

Definition at line 21 of file AlignmentParameterStore.h.

Member Typedef Documentation

Definition at line 27 of file AlignmentParameterStore.h.

typedef std::vector<unsigned int> AlignmentParameterStore::DetIds

Definition at line 28 of file AlignmentParameterStore.h.

typedef std::pair<Alignable*, unsigned int> AlignmentParameterStore::ParameterId

a single alignable parameter of an Alignable

Definition at line 134 of file AlignmentParameterStore.h.

Definition at line 26 of file AlignmentParameterStore.h.

Member Enumeration Documentation

Constructor & Destructor Documentation

AlignmentParameterStore::AlignmentParameterStore ( const align::Alignables alis,
const edm::ParameterSet config 
)

constructor

Definition at line 29 of file AlignmentParameterStore.cc.

References APPROX_AVERAGING_CONSTRAINTS, edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), HIERARCHY_CONSTRAINTS, NONE, AlCaHLTBitMon_QueryRunRegistry::string, theAlignables, theCorrelationsStore, and theTypeOfConstraints.

30  :
31  theAlignables(alis)
32 {
33  if (config.getUntrackedParameter<bool>("UseExtendedCorrelations")) {
35  (config.getParameter<edm::ParameterSet>("ExtendedCorrelationsConfig"));
36  } else {
38  }
39 
40  edm::LogInfo("Alignment") << "@SUB=AlignmentParameterStore"
41  << "Created with " << theAlignables.size() << " alignables.";
42 
43  // set hierarchy vs averaging constraints
45  const std::string cfgStrTypeOfConstraints(config.getParameter<std::string>("TypeOfConstraints"));
46  if( cfgStrTypeOfConstraints == "hierarchy" ) {
48  } else if( cfgStrTypeOfConstraints == "approximate_averaging" ) {
50  edm::LogWarning("Alignment") << "@SUB=AlignmentParameterStore"
51  << "\n\n\n******* WARNING ******************************************\n"
52  << "Using approximate implementation of averaging constraints."
53  << "This is not recommended."
54  << "Consider to use 'hierarchy' constraints:"
55  << " AlignmentProducer.ParameterStore.TypeOfConstraints = cms.string('hierarchy')\n\n\n";
56  } else {
57  edm::LogError("BadArgument") << "@SUB=AlignmentParameterStore"
58  << "Unknown type of hierarchy constraints '" << cfgStrTypeOfConstraints << "'";
59  }
60 }
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
TypeOfConstraints theTypeOfConstraints
type of constraints
align::Alignables theAlignables
alignables
AlignmentCorrelationsStore * theCorrelationsStore
AlignmentParameterStore::~AlignmentParameterStore ( )
virtual

destructor

Definition at line 63 of file AlignmentParameterStore.cc.

References theCorrelationsStore.

64 {
65  delete theCorrelationsStore;
66 }
AlignmentCorrelationsStore * theCorrelationsStore

Member Function Documentation

void AlignmentParameterStore::acquireRelativeParameters ( void  )

acquire shifts/rotations from alignables of the store and copy into alignment parameters (local frame)

Definition at line 381 of file AlignmentParameterStore.cc.

References Alignable::alignmentParameters(), RigidBodyAlignmentParameters::clone(), Alignable::displacement(), Exception, mps_fire::i, Alignable::rotation(), Alignable::setAlignmentParameters(), AlignmentParameters::size(), Alignable::surface(), theAlignables, align::toAngles(), AlignableSurface::toLocal(), TkRotation< T >::x(), and Basic3DVector< T >::y().

382 {
383 
384  unsigned int nAlignables = theAlignables.size();
385 
386  for (unsigned int i = 0; i < nAlignables; ++i)
387  {
388  Alignable* ali = theAlignables[i];
389 
391  dynamic_cast<RigidBodyAlignmentParameters*>( ali->alignmentParameters() );
392 
393  if ( !ap )
394  throw cms::Exception("BadAlignable")
395  << "acquireRelativeParameters: "
396  << "provided alignable does not have rigid body alignment parameters";
397 
398  AlgebraicVector par( ap->size(),0 );
399  AlgebraicSymMatrix cov( ap->size(), 0 );
400 
401  // Get displacement and transform global->local
402  align::LocalVector dloc = ali->surface().toLocal( ali->displacement() );
403  par[0]=dloc.x();
404  par[1]=dloc.y();
405  par[2]=dloc.z();
406 
407  // Transform to local euler angles
408  align::EulerAngles euloc = align::toAngles( ali->surface().toLocal( ali->rotation() ) );
409  par[3]=euloc(1);
410  par[4]=euloc(2);
411  par[5]=euloc(3);
412 
413  // Clone parameters
414  RigidBodyAlignmentParameters* apnew = ap->clone(par,cov);
415 
416  ali->setAlignmentParameters(apnew);
417  }
418 }
T y() const
Cartesian y coordinate.
const GlobalVector & displacement() const
Return change of the global position since the creation of the object.
Definition: Alignable.h:144
AlignmentParameters * alignmentParameters() const
Get the AlignmentParameters.
Definition: Alignable.h:61
Basic3DVector< T > x() const
const RotationType & rotation() const
Return change of orientation since the creation of the object.
Definition: Alignable.h:147
align::RotationType toLocal(const align::RotationType &) const
Return in local frame a rotation given in global frame.
void setAlignmentParameters(AlignmentParameters *dap)
Set the AlignmentParameters.
Definition: Alignable.cc:129
EulerAngles toAngles(const RotationType &)
Convert rotation matrix to angles about x-, y-, z-axes (frame rotation).
Definition: Utilities.cc:9
const AlignableSurface & surface() const
Return the Surface (global position and orientation) of the object.
Definition: Alignable.h:135
CLHEP::HepVector AlgebraicVector
AlgebraicVector EulerAngles
Definition: Definitions.h:36
int size(void) const
Get number of parameters.
align::Alignables theAlignables
alignables
CLHEP::HepSymMatrix AlgebraicSymMatrix
RigidBodyAlignmentParameters * clone(const AlgebraicVector &parameters, const AlgebraicSymMatrix &covMatrix) const override
Clone all parameters (for update of parameters)
Alignable * AlignmentParameterStore::alignableFromAlignableDet ( const AlignableDetOrUnitPtr alignableDet) const

Obsolete: Use AlignableNavigator::alignableDetFromGeomDet and alignableFromAlignableDet.

get Alignable corresponding to given AlignableDet (non-const ref. argument since might be returned)

Definition at line 274 of file AlignmentParameterStore.cc.

References Alignable::alignmentParameters(), and Alignable::mother().

Referenced by selectParameters().

275 {
276  AlignableDetOrUnitPtr alignableDet = _alignableDet;
277  Alignable *mother = alignableDet;
278  while (mother) {
279  if (mother->alignmentParameters()) return mother;
280  mother = mother->mother();
281  }
282 
283  return nullptr;
284 }
AlignmentParameters * alignmentParameters() const
Get the AlignmentParameters.
Definition: Alignable.h:61
Alignable * mother() const
Return pointer to container alignable (if any)
Definition: Alignable.h:94
const align::Alignables& AlignmentParameterStore::alignables ( void  ) const
inline
void AlignmentParameterStore::applyAlignableAbsolutePositions ( const align::Alignables alis,
const AlignablePositions newpos,
int &  ierr 
)

apply absolute positions to alignables

Definition at line 434 of file AlignmentParameterStore.cc.

References Alignable::addSurfaceDeformation(), Alignable::alignableObjectId(), applyAlignableRelativePositions(), SurfaceDeformationFactory::create(), runTauDisplay::dtype, runEdmFileComparison::found, Alignable::globalPosition(), Alignable::globalRotation(), mps_fire::i, Alignable::id(), SurfaceDeformationFactory::kNoDeformations, LogDebug, Alignable::move(), TkRotation< T >::multiplyInverse(), SurfaceDeformation::parameters(), align::rectify(), TkRotation< T >::rot, Alignable::rotateInGlobalFrame(), Alignable::surfaceDeformationIdPairs(), SurfaceDeformationFactory::surfaceDeformationTypeName(), and SurfaceDeformation::type().

Referenced by HIPAlignmentAlgorithm::startNewLoop(), and typeAndLayer().

435 {
436  unsigned int nappl=0;
437  ierr=0;
438 
439  // Iterate over list of alignables
440  for (align::Alignables::const_iterator iali = alivec.begin(); iali != alivec.end(); ++iali) {
441  Alignable* ali = *iali;
442  align::ID id = ali->id();
443  align::StructureType typeId = ali->alignableObjectId();
444 
445  // Find corresponding entry in AlignablePositions
446  bool found=false;
447  for (AlignablePositions::const_iterator ipos = newpos.begin(); ipos != newpos.end(); ++ipos) {
448  if (id == ipos->id() && typeId == ipos->objId()) {
449  if (found) {
450  edm::LogError("DuplicatePosition")
451  << "New positions for alignable found more than once!";
452  }
453  else {
454  // New position/rotation
455  const align::PositionType& pnew = ipos->pos();
456  const align::RotationType& rnew = ipos->rot();
457  const std::vector<double>& dnew = ipos->deformationParameters();
458  // Current position / rotation
459  const align::PositionType& pold = ali->globalPosition();
460  const align::RotationType& rold = ali->globalRotation();
461  // Current surf. deformation
462  std::vector<std::pair<int, SurfaceDeformation*> > dold_id_pairs;
463  SurfaceDeformation* dold_obj=nullptr;
465  std::vector<double> dold;
466  if (1 == ali->surfaceDeformationIdPairs(dold_id_pairs)){ // might not have any...
467  dold_obj = dold_id_pairs[0].second;
468  dold = dold_obj->parameters();
469  dtype = (SurfaceDeformationFactory::Type)dold_obj->type();
470  }
471 
472  // shift needed to move from current to new position
473  align::GlobalVector posDiff = pnew - pold;
474  align::RotationType rotDiff = rold.multiplyInverse(rnew);
475  align::rectify(rotDiff); // correct for rounding errors
476  ali->move(posDiff);
477  ali->rotateInGlobalFrame(rotDiff);
478  LogDebug("NewPosition") << "moving by:" << posDiff;
479  LogDebug("NewRotation") << "rotating by:\n" << rotDiff;
480 
481  // add the surface deformations
482  // If an old surface deformation record exists, ensure that the added deformation has the same type and size.
483  if (!dold.empty() && dtype != SurfaceDeformationFactory::kNoDeformations && dnew.size()==dold.size()){
484  std::vector<double> defDiff; defDiff.reserve(dold.size());
485  for (unsigned int i = 0; i < dold.size(); i++) defDiff.push_back(dnew[i] - dold[i]);
486  auto deform = SurfaceDeformationFactory::create(dtype, defDiff);
487  edm::LogInfo("Alignment") << "@SUB=AlignmentParameterStore::applyAlignableAbsolutePositions"
488  << "Adding surface deformation of type " << SurfaceDeformationFactory::surfaceDeformationTypeName((SurfaceDeformationFactory::Type)deform->type())
489  << ", size " << defDiff.size() << " and first element " << defDiff.at(0)
490  << " to alignable with id / type: " << id << " / " << typeId;
491  ali->addSurfaceDeformation(deform, true);
492  delete deform;
493  }
494  // In case no old surface deformation record exists, only ensure that the new surface deformation record has size>0. Size check is done elsewhere.
495  else if (!dnew.empty()){
496  auto deform = SurfaceDeformationFactory::create(dnew);
497  edm::LogInfo("Alignment") << "@SUB=AlignmentParameterStore::applyAlignableAbsolutePositions"
498  << "Setting surface deformation of type " << SurfaceDeformationFactory::surfaceDeformationTypeName((SurfaceDeformationFactory::Type)deform->type())
499  << ", size " << dnew.size() << " and first element " << dnew.at(0)
500  << " to alignable with id / type: " << id << " / " << typeId;
501  ali->addSurfaceDeformation(deform, true); // Equivalent to setSurfaceDeformation in this case
502  delete deform;
503  }
504  // If there is no new surface deformation record, do nothing.
505 
506  // add position error
507  // AlignmentPositionError ape(shift.x(),shift.y(),shift.z());
508  // (*iali)->addAlignmentPositionError(ape);
509  // (*iali)->addAlignmentPositionErrorFromRotation(rot);
510 
511  found=true;
512  ++nappl;
513  }
514  }
515  }
516  }
517 
518  if (nappl< newpos.size())
519  edm::LogError("Mismatch") << "Applied only " << nappl << " new positions"
520  << " out of " << newpos.size();
521 
522  LogDebug("NewPositions") << "Applied new positions for " << nappl
523  << " out of " << alivec.size() <<" alignables.";
524 
525 }
#define LogDebug(id)
align::ID id() const
Return the ID of Alignable, i.e. DetId of &#39;first&#39; component GeomDet(Unit).
Definition: Alignable.h:189
virtual int surfaceDeformationIdPairs(std::vector< std::pair< int, SurfaceDeformation * > > &) const =0
virtual std::vector< double > parameters() const =0
parameters - interpretation left to the concrete implementation
uint32_t ID
Definition: Definitions.h:26
virtual int type() const =0
specific type, i.e. SurfaceDeformationFactory::Type
const RotationType & globalRotation() const
Return the global orientation of the object.
Definition: Alignable.h:141
virtual void move(const GlobalVector &displacement)=0
Movement with respect to the global reference frame.
virtual StructureType alignableObjectId() const =0
Return the alignable type identifier.
void rectify(RotationType &)
Correct a rotation matrix for rounding errors.
Definition: Utilities.cc:198
virtual void addSurfaceDeformation(const SurfaceDeformation *deformation, bool propagateDown)=0
Rot3< T > rot
virtual void rotateInGlobalFrame(const RotationType &rotation)=0
std::string surfaceDeformationTypeName(const Type &type)
const PositionType & globalPosition() const
Return the global position of the object.
Definition: Alignable.h:138
Basic3DVector< T > multiplyInverse(const Basic3DVector< T > &v) const
SurfaceDeformation * create(int type, const std::vector< double > &params)
void AlignmentParameterStore::applyAlignableRelativePositions ( const align::Alignables alivec,
const AlignableShifts shifts,
int &  ierr 
)

apply relative shifts to alignables

Definition at line 530 of file AlignmentParameterStore.cc.

References Alignable::addSurfaceDeformation(), Alignable::alignableObjectId(), SurfaceDeformationFactory::create(), runTauDisplay::dtype, runEdmFileComparison::found, mps_fire::i, Alignable::id(), SurfaceDeformationFactory::kNoDeformations, LogDebug, Alignable::move(), SurfaceDeformation::parameters(), Alignable::rotateInGlobalFrame(), Alignable::surfaceDeformationIdPairs(), SurfaceDeformationFactory::surfaceDeformationTypeName(), and SurfaceDeformation::type().

Referenced by applyAlignableAbsolutePositions().

531 {
532  ierr=0;
533  unsigned int nappl=0;
534  unsigned int nAlignables = alivec.size();
535 
536  for (unsigned int i = 0; i < nAlignables; ++i) {
537  Alignable* ali = alivec[i];
538 
539  align::ID id = ali->id();
540  align::StructureType typeId = ali->alignableObjectId();
541 
542  // Find corresponding entry in AlignableShifts
543  bool found = false;
544  for (AlignableShifts::const_iterator ipos = shifts.begin(); ipos != shifts.end(); ++ipos) {
545  if (id == ipos->id() && typeId == ipos->objId()) {
546  if (found) {
547  edm::LogError("DuplicatePosition")
548  << "New positions for alignable found more than once!";
549  }
550  else {
551  // Current surf. deformation
552  std::vector<std::pair<int, SurfaceDeformation*> > dold_id_pairs;
553  SurfaceDeformation* dold_obj=nullptr;
555  std::vector<double> dold;
556  if (1 == ali->surfaceDeformationIdPairs(dold_id_pairs)){ // might not have any...
557  dold_obj = dold_id_pairs[0].second;
558  dold = dold_obj->parameters();
559  dtype = (SurfaceDeformationFactory::Type)dold_obj->type();
560  }
561 
562  ali->move(ipos->pos());
563  ali->rotateInGlobalFrame(ipos->rot());
564 
565  const std::vector<double>& defDiff = ipos->deformationParameters();
566  // If an old surface deformation record exists, ensure that the added deformation has the same type and size.
567  if (!dold.empty() && dtype != SurfaceDeformationFactory::kNoDeformations && defDiff.size()==dold.size()){
568  auto deform = SurfaceDeformationFactory::create(dtype, defDiff);
569  edm::LogInfo("Alignment") << "@SUB=AlignmentParameterStore::applyAlignableRelativePositions"
570  << "Adding surface deformation of type " << SurfaceDeformationFactory::surfaceDeformationTypeName((SurfaceDeformationFactory::Type)deform->type())
571  << ", size " << defDiff.size() << " and first element " << defDiff.at(0)
572  << " to alignable with id / type: " << id << " / " << typeId;
573  ali->addSurfaceDeformation(deform, true);
574  delete deform;
575  }
576  // In case no old surface deformation record exists, only ensure that the new surface deformation record has size>0. Size check is done elsewhere.
577  else if (!defDiff.empty()){
578  auto deform = SurfaceDeformationFactory::create(defDiff);
579  edm::LogInfo("Alignment") << "@SUB=AlignmentParameterStore::applyAlignableRelativePositions"
580  << "Setting surface deformation of type " << SurfaceDeformationFactory::surfaceDeformationTypeName((SurfaceDeformationFactory::Type)deform->type())
581  << ", size " << defDiff.size() << " and first element " << defDiff.at(0)
582  << " to alignable with id / type: " << id << " / " << typeId;
583  ali->addSurfaceDeformation(deform, true); // Equivalent to setSurfaceDeformation in this case
584  delete deform;
585  }
586  // If there is no new surface deformation record, do nothing.
587 
588  // Add position error
589  //AlignmentPositionError ape(pnew.x(),pnew.y(),pnew.z());
590  //ali->addAlignmentPositionError(ape);
591  //ali->addAlignmentPositionErrorFromRotation(rnew);
592 
593  found=true;
594  ++nappl;
595  }
596  }
597  }
598  }
599 
600  if (nappl < shifts.size())
601  edm::LogError("Mismatch") << "Applied only " << nappl << " new positions"
602  << " out of " << shifts.size();
603 
604  LogDebug("NewPositions") << "Applied new positions for " << nappl << " alignables.";
605 }
#define LogDebug(id)
align::ID id() const
Return the ID of Alignable, i.e. DetId of &#39;first&#39; component GeomDet(Unit).
Definition: Alignable.h:189
virtual int surfaceDeformationIdPairs(std::vector< std::pair< int, SurfaceDeformation * > > &) const =0
virtual std::vector< double > parameters() const =0
parameters - interpretation left to the concrete implementation
uint32_t ID
Definition: Definitions.h:26
virtual int type() const =0
specific type, i.e. SurfaceDeformationFactory::Type
virtual void move(const GlobalVector &displacement)=0
Movement with respect to the global reference frame.
virtual StructureType alignableObjectId() const =0
Return the alignable type identifier.
virtual void addSurfaceDeformation(const SurfaceDeformation *deformation, bool propagateDown)=0
virtual void rotateInGlobalFrame(const RotationType &rotation)=0
std::string surfaceDeformationTypeName(const Type &type)
SurfaceDeformation * create(int type, const std::vector< double > &params)
void AlignmentParameterStore::applyParameters ( void  )

Obsolete: Use AlignableNavigator::alignableDetFromDetId and alignableFromAlignableDet.

apply all valid parameters to their alignables

Definition at line 287 of file AlignmentParameterStore.cc.

References theAlignables.

Referenced by CSCAlignmentCorrections::applyAlignment(), MuonAlignmentFromReference::fitAndAlign(), CSCChamberFitter::radiusCorrection(), MillePedeAlignmentAlgorithm::setParametersForRunRange(), MuonMillepedeAlgorithm::terminate(), and HIPAlignmentAlgorithm::terminate().

288 {
289  align::Alignables::const_iterator iali;
290  for ( iali = theAlignables.begin(); iali != theAlignables.end(); ++iali)
291  applyParameters( *iali );
292 }
void applyParameters(void)
Obsolete: Use AlignableNavigator::alignableDetFromDetId and alignableFromAlignableDet.
align::Alignables theAlignables
alignables
void AlignmentParameterStore::applyParameters ( Alignable alignable)

apply parameters of a given alignable

Definition at line 296 of file AlignmentParameterStore.cc.

References Alignable::alignmentParameters(), AlignmentParameters::apply(), and Exception.

297 {
298 
299  AlignmentParameters *pars = (alignable ? alignable->alignmentParameters() : nullptr);
300  if (!pars) {
301  throw cms::Exception("BadAlignable")
302  << "applyParameters: provided alignable does not have alignment parameters";
303  }
304  pars->apply();
305 }
AlignmentParameters * alignmentParameters() const
Get the AlignmentParameters.
Definition: Alignable.h:61
virtual void apply()=0
apply parameters to alignable
void AlignmentParameterStore::attachAlignmentParameters ( const align::Alignables alivec,
const Parameters parvec,
int &  ierr 
)

Attach alignment parameters to given alignables.

Definition at line 618 of file AlignmentParameterStore.cc.

References AlignmentParameters::alignable(), runEdmFileComparison::found, and LogDebug.

Referenced by attachAlignmentParameters().

620 {
621  int ipass = 0;
622  int ifail = 0;
623  ierr = 0;
624 
625  // Iterate over alignables
626  for ( align::Alignables::const_iterator iali = alivec.begin(); iali != alivec.end(); ++iali )
627  {
628  // Iterate over Parameters
629  bool found=false;
630  for ( Parameters::const_iterator ipar = parvec.begin(); ipar != parvec.end(); ++ipar)
631  {
632  // Get new alignment parameters
633  AlignmentParameters* ap = *ipar;
634 
635  // Check if parameters belong to alignable
636  if ( ap->alignable() == (*iali) )
637  {
638  if (!found)
639  {
640  (*iali)->setAlignmentParameters(ap);
641  ++ipass;
642  found=true;
643  }
644  else edm::LogError("Alignment") << "@SUB=AlignmentParameterStore::attachAlignmentParameters"
645  << "More than one parameters for Alignable.";
646  }
647  }
648  if (!found) ++ifail;
649  }
650  if (ifail>0) ierr=-1;
651 
652  LogDebug("attachAlignmentParameters") << " Parameters, Alignables: " << parvec.size() << ","
653  << alivec.size() << "\n pass,fail: " << ipass << ","<< ifail;
654 }
#define LogDebug(id)
Alignable * alignable(void) const
Get pointer to corresponding alignable.
void AlignmentParameterStore::attachAlignmentParameters ( const Parameters parvec,
int &  ierr 
)

Attach alignment parameters to alignables.

Definition at line 610 of file AlignmentParameterStore.cc.

References attachAlignmentParameters(), and theAlignables.

611 {
613 }
align::Alignables theAlignables
alignables
void attachAlignmentParameters(const align::Alignables &alivec, const Parameters &parvec, int &ierr)
Attach alignment parameters to given alignables.
void AlignmentParameterStore::attachCorrelations ( const align::Alignables alivec,
const Correlations cormap,
bool  overwrite,
int &  ierr 
)

Attach correlations to given alignables.

Definition at line 666 of file AlignmentParameterStore.cc.

References attachUserVariables(), AlignmentCorrelationsStore::correlationsAvailable(), spr::find(), LogDebug, AlignmentCorrelationsStore::setCorrelations(), and theCorrelationsStore.

Referenced by attachCorrelations().

669 {
670  ierr=0;
671  int icount=0;
672 
673  // Iterate over correlations
674  for ( Correlations::const_iterator icor = cormap.begin(); icor!=cormap.end(); ++icor )
675  {
676  AlgebraicMatrix mat=(*icor).second;
677  Alignable* ali1 = (*icor).first.first;
678  Alignable* ali2 = (*icor).first.second;
679 
680  // Check if alignables exist
681  if ( find( alivec.begin(), alivec.end(), ali1 ) != alivec.end() &&
682  find( alivec.begin(), alivec.end(), ali2 ) != alivec.end() )
683  {
684  // Check if correlations already existing between these alignables
685  if ( !theCorrelationsStore->correlationsAvailable(ali1,ali2) || (overwrite) )
686  {
687  theCorrelationsStore->setCorrelations(ali1,ali2,mat);
688  ++icount;
689  }
690  else edm::LogInfo("AlreadyExists") << "Correlation existing and not overwritten";
691  }
692  else edm::LogInfo("IgnoreCorrelation") << "Ignoring correlation with no alignables!";
693  }
694 
695  LogDebug( "attachCorrelations" ) << " Alignables,Correlations: " << alivec.size() <<","<< cormap.size()
696  << "\n applied: " << icount ;
697 
698 }
#define LogDebug(id)
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:20
virtual bool correlationsAvailable(Alignable *ap1, Alignable *ap2) const
Check whether correlations are stored for a given pair of alignables.
virtual void setCorrelations(Alignable *ap1, Alignable *ap2, const AlgebraicSymMatrix &cov, int row, int col)
CLHEP::HepMatrix AlgebraicMatrix
AlignmentCorrelationsStore * theCorrelationsStore
void AlignmentParameterStore::attachCorrelations ( const Correlations cormap,
bool  overwrite,
int &  ierr 
)

Attach correlations to alignables.

Definition at line 658 of file AlignmentParameterStore.cc.

References attachCorrelations(), and theAlignables.

660 {
661  attachCorrelations( theAlignables, cormap, overwrite, ierr );
662 }
void attachCorrelations(const align::Alignables &alivec, const Correlations &cormap, bool overwrite, int &ierr)
Attach correlations to given alignables.
align::Alignables theAlignables
alignables
void AlignmentParameterStore::attachUserVariables ( const align::Alignables alivec,
const std::vector< AlignmentUserVariables * > &  uvarvec,
int &  ierr 
)

Attach User Variables to given alignables.

Definition at line 703 of file AlignmentParameterStore.cc.

References LogDebug, and AlignmentParameters::setUserVariables().

Referenced by attachCorrelations(), and HIPAlignmentAlgorithm::collector().

705 {
706  ierr=0;
707 
708  LogDebug("DumpArguments") << "size of alivec: " << alivec.size()
709  << "\nsize of uvarvec: " << uvarvec.size();
710 
711  std::vector<AlignmentUserVariables*>::const_iterator iuvar=uvarvec.begin();
712 
713  for ( align::Alignables::const_iterator iali=alivec.begin(); iali!=alivec.end(); ++iali, ++iuvar )
714  {
715  AlignmentParameters* ap = (*iali)->alignmentParameters();
716  AlignmentUserVariables* uvarnew = (*iuvar);
717  ap->setUserVariables(uvarnew);
718  }
719 }
#define LogDebug(id)
(Abstract) Base class for alignment algorithm user variables
void setUserVariables(AlignmentUserVariables *auv)
Set pointer to user variables.
void AlignmentParameterStore::cacheTransformations ( void  )

cache the current position, rotation and other parameters

Definition at line 349 of file AlignmentParameterStore.cc.

References theAlignables.

Referenced by MillePedeAlignmentAlgorithm::beginRun(), and MillePedeAlignmentAlgorithm::terminate().

350 {
351  align::Alignables::const_iterator iali;
352  for ( iali = theAlignables.begin(); iali != theAlignables.end(); ++iali)
353  (*iali)->cacheTransformation();
354 }
align::Alignables theAlignables
alignables
void AlignmentParameterStore::cacheTransformations ( const align::RunNumber run)

cache for the given run the current position, rotation and other parameters

Definition at line 358 of file AlignmentParameterStore.cc.

References theAlignables.

359 {
360  for (const auto& iali: theAlignables) iali->cacheTransformation(run);
361 }
align::Alignables theAlignables
alignables
AlignmentCorrelationsStore* AlignmentParameterStore::correlationsStore ( void  ) const
inline

get full correlation map

Definition at line 60 of file AlignmentParameterStore.h.

60 { return theCorrelationsStore; }
AlignmentCorrelationsStore * theCorrelationsStore
bool AlignmentParameterStore::hierarchyConstraints ( const Alignable aliMaster,
const align::Alignables aliComps,
std::vector< std::vector< ParameterId > > &  paramIdsVecOut,
std::vector< std::vector< double > > &  factorsVecOut,
bool  all,
double  epsilon 
) const

Assuming aliMaster has (sub-)components aliComps with alignment parameters (cf. Alignable::firstParamComponents), paramIdsVecOut and factorsVecOut will be filled (in parallel) with constraints on the selected alignment parameters of aliMaster to get rid of the additionally introduced degrees of freedom: The 'vector product' of the parameters identified by ParameterId in std::vector<ParameterId> and the factors in std::vector<double> has to vanish (i.e. == 0.), |factor| < epsilon will be treated as 0. If all == false, skip constraint on aliMaster's degree of freedom 'i' if 'i'th alignment parameter of aliMaster is not selected, i.e. constrain only for otherwise doubled d.o.f. If all == true, produce one constraint for each of the aliMaster's parameters irrespective of whether they are selecte dor not. paramIdsVecOut and factorsVecOut contain exactly one std::vector per selected alignment parameter of aliMaster, but in principle these can be empty... Note that not all combinations of AlignmentParameters classes ar supported. If not there will be an exception (and false returned...)

Definition at line 756 of file AlignmentParameterStore.cc.

References Alignable::alignmentParameters(), APPROX_AVERAGING_CONSTRAINTS, Exception, HIERARCHY_CONSTRAINTS, ParametersToParametersDerivatives::isOK(), AlignmentParameters::selector(), and theTypeOfConstraints.

Referenced by PedeSteerer::hierarchyConstraint(), and setAlignmentPositionError().

760 {
761  // Weak point if all = false:
762  // Ignores constraints between non-subsequent levels in case the parameter is not considered in
763  // the intermediate level, e.g. global z for dets and layers is aligned, but not for rods!
764  if (!ali || !ali->alignmentParameters()) return false;
765 
766  const std::vector<bool> &aliSel= ali->alignmentParameters()->selector();
767  paramIdsVecOut.clear();
768  factorsVecOut.clear();
769 
770  bool firstComp = true;
771  for (align::Alignables::const_iterator iComp = aliComps.begin(), iCompE = aliComps.end();
772  iComp != iCompE; ++iComp) {
773 
774  const ParametersToParametersDerivatives p2pDerivs(**iComp, *ali);
775  if (!p2pDerivs.isOK()) {
776  // std::cerr << (*iComp)->alignmentParameters()->type() << " "
777  // << ali->alignmentParameters()->type() << std::endl;
778  throw cms::Exception("BadConfig")
779  << "AlignmentParameterStore::hierarchyConstraints"
780  << " Bad match of types of AlignmentParameters classes.\n";
781  return false;
782  }
783  const std::vector<bool> &aliCompSel = (*iComp)->alignmentParameters()->selector();
784  for (unsigned int iParMast = 0, iParMastUsed = 0; iParMast < aliSel.size(); ++iParMast) {
785  if (!all && !aliSel[iParMast]) continue;// no higher level parameter & constraint deselected
786  if (firstComp) { // fill output with empty arrays
787  paramIdsVecOut.push_back(std::vector<ParameterId>());
788  factorsVecOut.push_back(std::vector<double>());
789  }
790  for (unsigned int iParComp = 0; iParComp < aliCompSel.size(); ++iParComp) {
791  if (aliCompSel[iParComp]) {
792  double factor = 0.;
794  // hierachy constraints
795  factor = p2pDerivs(iParMast, iParComp);
797  // CHK poor mans averaging constraints
798  factor = p2pDerivs(iParMast, iParComp);
799  if (iParMast < 3 && (iParComp % 9) >= 3) factor = 0.;
800  }
801  if (fabs(factor) > epsilon) {
802  paramIdsVecOut[iParMastUsed].push_back(ParameterId(*iComp, iParComp));
803  factorsVecOut[iParMastUsed].push_back(factor);
804  }
805  }
806  }
807  ++iParMastUsed;
808  }
809  firstComp = false;
810  } // end loop on components
811 
812  return true;
813 }
std::pair< Alignable *, unsigned int > ParameterId
a single alignable parameter of an Alignable
TypeOfConstraints theTypeOfConstraints
type of constraints
const unsigned int AlignmentParameterStore::numCorrelations ( void  ) const
inline

get number of correlations between alignables

Definition at line 63 of file AlignmentParameterStore.h.

63 { return theCorrelationsStore->size(); }
virtual unsigned int size(void) const
Get number of stored correlations.
AlignmentCorrelationsStore * theCorrelationsStore
int AlignmentParameterStore::numObjects ( void  ) const
inline

returns number of alignables

Definition at line 57 of file AlignmentParameterStore.h.

57 { return theAlignables.size(); }
align::Alignables theAlignables
alignables
void AlignmentParameterStore::resetParameters ( void  )

reset parameters, correlations, user variables

Definition at line 309 of file AlignmentParameterStore.cc.

References AlignmentCorrelationsStore::resetCorrelations(), theAlignables, and theCorrelationsStore.

Referenced by MillePedeAlignmentAlgorithm::setParametersForRunRange().

310 {
311  // Erase contents of correlation map
313 
314  // Iterate over alignables in the store and reset parameters
315  align::Alignables::const_iterator iali;
316  for ( iali = theAlignables.begin(); iali != theAlignables.end(); ++iali )
317  resetParameters( *iali );
318 }
void resetParameters(void)
reset parameters, correlations, user variables
virtual void resetCorrelations(void)
Reset correlations.
align::Alignables theAlignables
alignables
AlignmentCorrelationsStore * theCorrelationsStore
void AlignmentParameterStore::resetParameters ( Alignable ali)

reset parameters of a given alignable

Definition at line 322 of file AlignmentParameterStore.cc.

References Alignable::alignmentParameters(), AlignmentParameters::cloneFromSelected(), AlignmentParameters::numSelected(), Alignable::setAlignmentParameters(), and AlignmentParameters::setValid().

323 {
324  if ( ali )
325  {
326  // Get alignment parameters for this alignable
328  if ( ap )
329  {
330  int npar=ap->numSelected();
331 
332  AlgebraicVector par(npar,0);
333  AlgebraicSymMatrix cov(npar,0);
334  AlignmentParameters* apnew = ap->cloneFromSelected(par,cov);
335  ali->setAlignmentParameters(apnew);
336  apnew->setValid(false);
337  }
338  else
339  edm::LogError("BadArgument") << "@SUB=AlignmentParameterStore::resetParameters"
340  << "alignable has no alignment parameter";
341  }
342  else
343  edm::LogError("BadArgument") << "@SUB=AlignmentParameterStore::resetParameters"
344  << "argument is NULL";
345 }
virtual AlignmentParameters * cloneFromSelected(const AlgebraicVector &par, const AlgebraicSymMatrix &cov) const =0
AlignmentParameters * alignmentParameters() const
Get the AlignmentParameters.
Definition: Alignable.h:61
void setAlignmentParameters(AlignmentParameters *dap)
Set the AlignmentParameters.
Definition: Alignable.cc:129
void setValid(bool v)
Set validity flag.
int numSelected(void) const
Get number of selected parameters.
CLHEP::HepVector AlgebraicVector
CLHEP::HepSymMatrix AlgebraicSymMatrix
void AlignmentParameterStore::restoreCachedTransformations ( void  )

restore the previously cached position, rotation and other parameters

Definition at line 365 of file AlignmentParameterStore.cc.

References theAlignables.

Referenced by MillePedeAlignmentAlgorithm::setParametersForRunRange(), and MillePedeAlignmentAlgorithm::terminate().

366 {
367  align::Alignables::const_iterator iali;
368  for ( iali = theAlignables.begin(); iali != theAlignables.end(); ++iali)
369  (*iali)->restoreCachedTransformation();
370 }
align::Alignables theAlignables
alignables
void AlignmentParameterStore::restoreCachedTransformations ( const align::RunNumber run)

restore for the given run the previously cached position, rotation and other parameters

Definition at line 374 of file AlignmentParameterStore.cc.

References theAlignables.

375 {
376  for (const auto& iali: theAlignables) iali->restoreCachedTransformation(run);
377 }
align::Alignables theAlignables
alignables
CompositeAlignmentParameters AlignmentParameterStore::selectParameters ( const std::vector< AlignableDet * > &  alignabledets) const

select parameters (for backward compatibility, use with vector<AlignableDetOrUnitPtr> as argument instead)

Definition at line 70 of file AlignmentParameterStore.cc.

Referenced by MuonMillepedeAlgorithm::run(), HIPAlignmentAlgorithm::run(), and selectParameters().

71 {
72  std::vector<AlignableDetOrUnitPtr> detOrUnits;
73  detOrUnits.reserve(alignabledets.size());
74 
75  std::vector<AlignableDet*>::const_iterator it, iEnd;
76  for ( it = alignabledets.begin(), iEnd = alignabledets.end(); it != iEnd; ++it)
77  detOrUnits.push_back(AlignableDetOrUnitPtr(*it));
78 
79  return this->selectParameters(detOrUnits);
80 }
CompositeAlignmentParameters selectParameters(const std::vector< AlignableDet * > &alignabledets) const
CompositeAlignmentParameters AlignmentParameterStore::selectParameters ( const std::vector< AlignableDetOrUnitPtr > &  alignabledets) const

select parameters

Definition at line 84 of file AlignmentParameterStore.cc.

References alignableFromAlignableDet(), alignables(), Alignable::alignmentParameters(), AlignmentCorrelationsStore::correlations(), data, spr::find(), AlignmentParameters::numSelected(), AlignmentParameters::selectedCovariance(), AlignmentParameters::selectedParameters(), selectParameters(), and theCorrelationsStore.

85 {
86 
88  std::map <AlignableDetOrUnitPtr,Alignable*> alidettoalimap;
89  std::map <Alignable*,int> aliposmap;
90  std::map <Alignable*,int> alilenmap;
91  int nparam=0;
92 
93  // iterate over AlignableDet's
94  for( std::vector<AlignableDetOrUnitPtr>::const_iterator iad = alignabledets.begin();
95  iad != alignabledets.end(); ++iad )
96  {
97  Alignable* ali = alignableFromAlignableDet( *iad );
98  if ( ali )
99  {
100  alidettoalimap[ *iad ] = ali; // Add to map
101  // Check if Alignable already there, insert into vector if not
102  if ( find(alignables.begin(),alignables.end(),ali) == alignables.end() )
103  {
104  alignables.push_back(ali);
106  nparam += ap->numSelected();
107  }
108  }
109  }
110 
111  AlgebraicVector* selpar = new AlgebraicVector( nparam, 0 );
112  AlgebraicSymMatrix* selcov = new AlgebraicSymMatrix( nparam, 0 );
113 
114  // Fill in parameters and corresponding covariance matricess
115  int ipos = 1; // NOTE: .sub indices start from 1
116  align::Alignables::const_iterator it1;
117  for( it1 = alignables.begin(); it1 != alignables.end(); ++it1 )
118  {
119  AlignmentParameters* ap = (*it1)->alignmentParameters();
120  selpar->sub( ipos, ap->selectedParameters() );
121  selcov->sub( ipos, ap->selectedCovariance() );
122  int npar = ap->numSelected();
123  aliposmap[*it1]=ipos;
124  alilenmap[*it1]=npar;
125  ipos +=npar;
126  }
127 
128  // Fill in the correlations. Has to be an extra loop, because the
129  // AlignmentExtendedCorrelationsStore (if used) needs the
130  // alignables' covariance matrices already present.
131  ipos = 1;
132  for( it1 = alignables.begin(); it1 != alignables.end(); ++it1 )
133  {
134  int jpos=1;
135 
136  // Look for correlations between alignables
137  align::Alignables::const_iterator it2;
138  for( it2 = alignables.begin(); it2 != it1; ++it2 )
139  {
140  theCorrelationsStore->correlations( *it1, *it2, *selcov, ipos-1, jpos-1 );
141  jpos += (*it2)->alignmentParameters()->numSelected();
142  }
143 
144  ipos += (*it1)->alignmentParameters()->numSelected();
145  }
146 
148  CompositeAlignmentParameters aap( data, alignables, alidettoalimap, aliposmap, alilenmap );
149 
150  return aap;
151 }
AlgebraicVector selectedParameters(void) const
Get selected parameters.
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:20
AlignmentParameters * alignmentParameters() const
Get the AlignmentParameters.
Definition: Alignable.h:61
AlgebraicSymMatrix selectedCovariance(void) const
Get covariance matrix of selected parameters.
Alignable * alignableFromAlignableDet(const AlignableDetOrUnitPtr &alignableDet) const
Obsolete: Use AlignableNavigator::alignableDetFromGeomDet and alignableFromAlignableDet.
int numSelected(void) const
Get number of selected parameters.
CLHEP::HepVector AlgebraicVector
virtual void correlations(Alignable *ap1, Alignable *ap2, AlgebraicSymMatrix &cov, int row, int col) const
std::vector< Alignable * > Alignables
Definition: Utilities.h:31
AlignmentCorrelationsStore * theCorrelationsStore
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:82
CLHEP::HepSymMatrix AlgebraicSymMatrix
const align::Alignables & alignables(void) const
get all alignables
CompositeAlignmentParameters AlignmentParameterStore::selectParameters ( const std::vector< Alignable * > &  alignables) const

select parameters

void AlignmentParameterStore::setAlignmentPositionError ( const align::Alignables alivec,
double  valshift,
double  valrot 
)

Set Alignment position error.

Definition at line 723 of file AlignmentParameterStore.cc.

References Alignable::addAlignmentPositionError(), Alignable::addAlignmentPositionErrorFromRotation(), hierarchyConstraints(), mps_fire::i, LogDebug, alignCSCRings::r, Alignable::setAlignmentPositionError(), and align::toMatrix().

Referenced by MuonAlignmentFromReference::fitAndAlign(), MuonAlignmentFromReference::initialize(), and HIPAlignmentAlgorithm::setAlignmentPositionError().

725 {
726  unsigned int nAlignables = alivec.size();
727 
728  for (unsigned int i = 0; i < nAlignables; ++i)
729  {
730  Alignable* ali = alivec[i];
731 
732  // First reset APE
733  AlignmentPositionError nulApe(0,0,0);
734  ali->setAlignmentPositionError(nulApe, true);
735 
736  // Set APE from displacement
737  AlignmentPositionError ape(valshift,valshift,valshift);
738  if ( valshift > 0. ) ali->addAlignmentPositionError(ape, true);
739  else ali->setAlignmentPositionError(ape, true);
740  // GF: Resetting and setting as above does not really make sense to me,
741  // and adding to zero or setting is the same! I'd just do
742  //ali->setAlignmentPositionError(AlignmentPositionError ape(valshift,valshift,valshift),true);
743 
744  // Set APE from rotation
746  r(1)=valrot; r(2)=valrot; r(3)=valrot;
748  }
749 
750  LogDebug("StoreAPE") << "Store APE from shift: " << valshift
751  << "\nStore APE from rotation: " << valrot;
752 }
#define LogDebug(id)
virtual void addAlignmentPositionErrorFromRotation(const RotationType &rotation, bool propagateDown)=0
virtual void addAlignmentPositionError(const AlignmentPositionError &ape, bool propagateDown)=0
virtual void setAlignmentPositionError(const AlignmentPositionError &ape, bool propagateDown)=0
Set the alignment position error - if (!propagateDown) do not affect daughters.
AlgebraicVector EulerAngles
Definition: Definitions.h:36
RotationType toMatrix(const EulerAngles &)
Convert rotation angles about x-, y-, z-axes to matrix.
Definition: Utilities.cc:42
std::pair< int, int > AlignmentParameterStore::typeAndLayer ( const Alignable ali,
const TrackerTopology tTopo 
) const

Obtain type and layer from Alignable.

Definition at line 426 of file AlignmentParameterStore.cc.

References applyAlignableAbsolutePositions(), Alignable::id(), and TrackerAlignableId::typeAndLayerFromDetId().

Referenced by HIPAlignmentAlgorithm::fillAlignablesMonitor(), and HIPAlignmentAlgorithm::terminate().

427 {
428  return TrackerAlignableId().typeAndLayerFromDetId( ali->id(), tTopo );
429 }
align::ID id() const
Return the ID of Alignable, i.e. DetId of &#39;first&#39; component GeomDet(Unit).
Definition: Alignable.h:189
std::pair< int, int > typeAndLayerFromDetId(const DetId &detId, const TrackerTopology *tTopo) const
void AlignmentParameterStore::updateParameters ( const CompositeAlignmentParameters aap,
bool  updateCorrelations = true 
)

update parameters

Definition at line 222 of file AlignmentParameterStore.cc.

References alignables(), AlignmentParameters::cloneFromSelected(), CompositeAlignmentParameters::components(), CompositeAlignmentParameters::covariance(), AlignmentParameters::numSelected(), CompositeAlignmentParameters::parameters(), metProducer_cfi::parameters, AlignmentCorrelationsStore::setCorrelations(), and theCorrelationsStore.

223 {
224 
226  const AlgebraicVector& parameters = aap.parameters();
227  const AlgebraicSymMatrix& covariance = aap.covariance();
228 
229  int ipos = 1; // NOTE: .sub indices start from 1
230 
231  // Loop over alignables
232  for( align::Alignables::const_iterator it=alignables.begin(); it != alignables.end(); ++it )
233  {
234  // Update parameters and local covariance
235  AlignmentParameters* ap = (*it)->alignmentParameters();
236  int nsel = ap->numSelected();
237  AlgebraicVector subvec = parameters.sub( ipos, ipos+nsel-1 );
238  AlgebraicSymMatrix subcov = covariance.sub( ipos, ipos+nsel-1 );
239  AlignmentParameters* apnew = ap->cloneFromSelected( subvec, subcov );
240  (*it)->setAlignmentParameters( apnew );
241 
242  // Now update correlations between detectors
243  if ( updateCorrelations )
244  {
245  int jpos = 1;
246  for( align::Alignables::const_iterator it2 = alignables.begin(); it2 != it; ++it2 )
247  {
248  theCorrelationsStore->setCorrelations( *it, *it2, covariance, ipos-1, jpos-1 );
249  jpos += (*it2)->alignmentParameters()->numSelected();
250  }
251  }
252 
253  ipos+=nsel;
254  }
255 
256 }
virtual AlignmentParameters * cloneFromSelected(const AlgebraicVector &par, const AlgebraicSymMatrix &cov) const =0
const AlgebraicVector & parameters() const
Get alignment parameters.
virtual void setCorrelations(Alignable *ap1, Alignable *ap2, const AlgebraicSymMatrix &cov, int row, int col)
Components components() const
Get vector of alignable components.
const AlgebraicSymMatrix & covariance() const
Get parameter covariance matrix.
int numSelected(void) const
Get number of selected parameters.
CLHEP::HepVector AlgebraicVector
std::vector< Alignable * > Alignables
Definition: Utilities.h:31
AlignmentCorrelationsStore * theCorrelationsStore
CLHEP::HepSymMatrix AlgebraicSymMatrix
const align::Alignables & alignables(void) const
get all alignables
align::Alignables AlignmentParameterStore::validAlignables ( void  ) const

get all alignables with valid parameters

Definition at line 260 of file AlignmentParameterStore.cc.

References LogDebug, mps_fire::result, and theAlignables.

261 {
263  for (align::Alignables::const_iterator iali = theAlignables.begin();
264  iali != theAlignables.end(); ++iali)
265  if ( (*iali)->alignmentParameters()->isValid() ) result.push_back(*iali);
266 
267  LogDebug("Alignment") << "@SUB=AlignmentParameterStore::validAlignables"
268  << "Valid alignables: " << result.size()
269  << "out of " << theAlignables.size();
270  return result;
271 }
#define LogDebug(id)
align::Alignables theAlignables
alignables
std::vector< Alignable * > Alignables
Definition: Utilities.h:31

Member Data Documentation

align::Alignables AlignmentParameterStore::theAlignables
private
AlignmentCorrelationsStore* AlignmentParameterStore::theCorrelationsStore
protected
TypeOfConstraints AlignmentParameterStore::theTypeOfConstraints
private

type of constraints

Definition at line 169 of file AlignmentParameterStore.h.

Referenced by AlignmentParameterStore(), and hierarchyConstraints().