CMS 3D CMS Logo

AlignmentParameters Class Reference

Base class for alignment parameters. More...

#include <Alignment/CommonAlignment/interface/AlignmentParameters.h>

Inheritance diagram for AlignmentParameters:

CompositeAlignmentParameters RigidBodyAlignmentParameters SurveyParameters

List of all members.

Public Types

typedef
AlignmentParametersData::DataContainer 
DataContainer

Public Member Functions

Alignablealignable (void) const
 Get pointer to corresponding alignable.
 AlignmentParameters (Alignable *object, const DataContainer &data)
 Constructor.
 AlignmentParameters (Alignable *object, const AlgebraicVector &par, const AlgebraicSymMatrix &cov, const std::vector< bool > &sel)
 Constructor including selection of active parameters.
 AlignmentParameters (Alignable *object, const AlgebraicVector &par, const AlgebraicSymMatrix &cov)
 Constructor from given input.
 AlignmentParameters ()
 Default constructor.
virtual AlignmentParametersclone (const AlgebraicVector &par, const AlgebraicSymMatrix &cov) const =0
 Enforce clone methods in derived classes.
virtual AlignmentParameterscloneFromSelected (const AlgebraicVector &par, const AlgebraicSymMatrix &cov) const =0
const AlgebraicSymMatrixcovariance (void) const
 Get parameter covariance matrix.
virtual AlgebraicMatrix derivatives (const TrajectoryStateOnSurface &tsos, const AlignableDetOrUnitPtr &alidet) const =0
 Get derivatives of selected parameters.
virtual unsigned int hierarchyLevel () const
 How many levels of Alignables with parameters can be found in the substructures of the Alignable of these parameters? E.g.
const bool isValid (void) const
 Get validity flag.
const int numSelected (void) const
 Get number of selected parameters.
const AlgebraicVectorparameters (void) const
 Get alignment parameters.
AlgebraicSymMatrix selectedCovariance (void) const
 Get covariance matrix of selected parameters.
virtual AlgebraicMatrix selectedDerivatives (const TrajectoryStateOnSurface &tsos, const AlignableDetOrUnitPtr &alidet) const =0
AlgebraicVector selectedParameters (void) const
 Get selected parameters.
const std::vector< bool > & selector (void) const
 Get alignment parameter selector vector.
void setUserVariables (AlignmentUserVariables *auv)
 Set pointer to user variables.
void setValid (bool v)
 Set validity flag.
const int size (void) const
 Get number of parameters.
AlignmentUserVariablesuserVariables (void) const
 Get pointer to user variables.
virtual ~AlignmentParameters ()
 Destructor.

Protected Member Functions

AlgebraicSymMatrix collapseSymMatrix (const AlgebraicSymMatrix &m, const std::vector< bool > &sel) const
AlgebraicVector collapseVector (const AlgebraicVector &m, const std::vector< bool > &sel) const
AlgebraicSymMatrix expandSymMatrix (const AlgebraicSymMatrix &m, const std::vector< bool > &sel) const
AlgebraicVector expandVector (const AlgebraicVector &m, const std::vector< bool > &sel) const

Protected Attributes

bool bValid
 True if parameters are valid.
AlignabletheAlignable
DataContainer theData
AlignmentUserVariablestheUserVariables


Detailed Description

Base class for alignment parameters.

It contains a parameter vector of size N and a covariance matrix of size NxN. There is a pointer to the Alignable to which the parameters belong. There is also a pointer to UserVariables. Parameters can be enabled/disabled using theSelector. bValid declares if the parameters are 'valid'. The methods *selected* set/return only the active parameters/derivatives/covariance as subvector/submatrix of reduced size.

Date
2007/06/21 16:18:27
Revision
1.7
(last update by
Author
flucke
)

Definition at line 33 of file AlignmentParameters.h.


Member Typedef Documentation

typedef AlignmentParametersData::DataContainer AlignmentParameters::DataContainer

Definition at line 38 of file AlignmentParameters.h.


Constructor & Destructor Documentation

AlignmentParameters::AlignmentParameters (  ) 

Default constructor.

Definition at line 10 of file AlignmentParameters.cc.

00010                                          :
00011   theAlignable( 0),
00012   theUserVariables( 0),
00013   bValid(true)
00014 {}

AlignmentParameters::AlignmentParameters ( Alignable object,
const AlgebraicVector par,
const AlgebraicSymMatrix cov 
)

Constructor from given input.

Definition at line 18 of file AlignmentParameters.cc.

References theData.

00019                                                                         :
00020   theAlignable(object),
00021   theData( DataContainer( new AlignmentParametersData(par,cov) ) ),
00022   theUserVariables(0),
00023   bValid(true)
00024 {
00025   // is the data consistent?
00026   theData->checkConsistency();
00027 }

AlignmentParameters::AlignmentParameters ( Alignable object,
const AlgebraicVector par,
const AlgebraicSymMatrix cov,
const std::vector< bool > &  sel 
)

Constructor including selection of active parameters.

Definition at line 31 of file AlignmentParameters.cc.

References theData.

00033                                                                      :
00034   theAlignable(object),
00035   theData( DataContainer( new AlignmentParametersData(par,cov,sel) ) ),
00036   theUserVariables(0),
00037   bValid(true)
00038 {
00039   // is the data consistent?
00040   theData->checkConsistency();
00041 }

AlignmentParameters::AlignmentParameters ( Alignable object,
const DataContainer data 
)

Constructor.

Definition at line 45 of file AlignmentParameters.cc.

References theData.

00046                                                                                             :
00047   theAlignable(object),
00048   theData(data),
00049   theUserVariables(0),
00050   bValid(true)
00051 {
00052   // is the data consistent?
00053   theData->checkConsistency();
00054 }

AlignmentParameters::~AlignmentParameters (  )  [virtual]

Destructor.

Definition at line 58 of file AlignmentParameters.cc.

References theUserVariables.

00059 { 
00060   if ( theUserVariables ) delete theUserVariables;
00061 }


Member Function Documentation

Alignable * AlignmentParameters::alignable ( void   )  const

Get pointer to corresponding alignable.

Definition at line 121 of file AlignmentParameters.cc.

References theAlignable.

Referenced by AlignmentParameterStore::attachAlignmentParameters(), RigidBodyAlignmentParameters::clone(), RigidBodyAlignmentParameters::cloneFromSelected(), and RigidBodyAlignmentParameters::derivatives().

00122 { 
00123   return theAlignable;
00124 }

virtual AlignmentParameters* AlignmentParameters::clone ( const AlgebraicVector par,
const AlgebraicSymMatrix cov 
) const [pure virtual]

Enforce clone methods in derived classes.

Implemented in CompositeAlignmentParameters, RigidBodyAlignmentParameters, and SurveyParameters.

Referenced by KalmanAlignmentUserVariables::fixAlignable(), KalmanAlignmentAlgorithm::initializeAlignmentParameters(), PedeReader::setParameter(), KalmanAlignmentUserVariables::unfixAlignable(), and AlignmentParametersIO::writeOneOrigRigidBody().

virtual AlignmentParameters* AlignmentParameters::cloneFromSelected ( const AlgebraicVector par,
const AlgebraicSymMatrix cov 
) const [pure virtual]

Implemented in CompositeAlignmentParameters, RigidBodyAlignmentParameters, and SurveyParameters.

Referenced by HIPAlignmentAlgorithm::calcParameters(), AlignmentParameterStore::resetParameters(), and AlignmentParameterStore::updateParameters().

AlgebraicSymMatrix AlignmentParameters::collapseSymMatrix ( const AlgebraicSymMatrix m,
const std::vector< bool > &  sel 
) const [protected]

Definition at line 174 of file AlignmentParameters.cc.

References Exception, i, j, HLT_VtxMuL3::result, and size().

Referenced by selectedCovariance().

00176 {
00177 
00178   int nRows = m.num_row();
00179   int size  = sel.size();
00180 
00181   // Check size matching
00182   if ( nRows != size ) 
00183     throw cms::Exception("LogicError") << "Size mismatch in parameters";
00184 
00185   // If OK, continue
00186   std::vector<int> rowvec;
00187   for ( int i=0; i<nRows; i++ ) 
00188     if ( sel[i] ) rowvec.push_back(i);
00189  
00190   int nSelectedRows = rowvec.size();
00191   AlgebraicSymMatrix result( nSelectedRows, 0 );
00192   for (int i=0; i<nSelectedRows; i++) 
00193     for (int j=0; j<nSelectedRows; j++)
00194       result[i][j] = m[ rowvec[i] ][ rowvec[j] ];
00195 
00196   return result;
00197 
00198 }

AlgebraicVector AlignmentParameters::collapseVector ( const AlgebraicVector m,
const std::vector< bool > &  sel 
) const [protected]

Definition at line 202 of file AlignmentParameters.cc.

References Exception, i, HLT_VtxMuL3::result, and size().

Referenced by selectedParameters().

00204 {
00205 
00206   int nRows = m.num_row();
00207   int size  = sel.size();
00208 
00209   // Check size matching
00210   if ( nRows != size ) 
00211     throw cms::Exception("LogicError") << "Size mismatch in parameters";
00212 
00213   // If OK, continue
00214   std::vector<int> rowvec;
00215   for ( int i=0; i<nRows; i++ ) 
00216     if ( sel[i] ) rowvec.push_back(i);
00217 
00218   int nSelectedRows=rowvec.size();
00219   AlgebraicVector result( nSelectedRows, 0 );
00220   for ( int i=0; i<nSelectedRows; i++ )
00221     result[i] = m[ (int)rowvec[i] ];
00222 
00223   return result;
00224 
00225 }

const AlgebraicSymMatrix & AlignmentParameters::covariance ( void   )  const

Get parameter covariance matrix.

Definition at line 99 of file AlignmentParameters.cc.

References theData.

Referenced by MillePedeAlignmentAlgorithm::areEmptyParams(), KalmanAlignmentUserVariables::fixAlignable(), KalmanAlignmentAlgorithm::initializeAlignmentParameters(), SurveyAlignment::iterate(), PedeReader::setParameter(), KalmanAlignmentUserVariables::unfixAlignable(), AlignmentParameterStore::updateParameters(), AlignmentParametersIORoot::writeOne(), and AlignmentParametersIO::writeOneOrigRigidBody().

00100 { 
00101   return theData->covariance();
00102 }

virtual AlgebraicMatrix AlignmentParameters::derivatives ( const TrajectoryStateOnSurface tsos,
const AlignableDetOrUnitPtr alidet 
) const [pure virtual]

Get derivatives of selected parameters.

Implemented in CompositeAlignmentParameters, RigidBodyAlignmentParameters, and SurveyParameters.

Referenced by MillePedeAlignmentAlgorithm::globalDerivativesHierarchy().

AlgebraicSymMatrix AlignmentParameters::expandSymMatrix ( const AlgebraicSymMatrix m,
const std::vector< bool > &  sel 
) const [protected]

Definition at line 229 of file AlignmentParameters.cc.

References Exception, i, j, HLT_VtxMuL3::result, and size().

Referenced by RigidBodyAlignmentParameters::cloneFromSelected().

00231 {
00232 
00233   int nRows = m.num_row();
00234   int size  = sel.size();
00235 
00236   std::vector<int> rowvec;
00237   for ( int i=0; i<size; i++ ) 
00238     if ( sel[i] ) rowvec.push_back(i);
00239 
00240   // Check size matching
00241   if( nRows != static_cast<int>(rowvec.size()) ) 
00242     throw cms::Exception("LogicError") << "Size mismatch in parameters";
00243 
00244   // If OK, continue
00245   AlgebraicSymMatrix result(size,0);
00246   for ( int i=0; i<nRows; i++ )
00247     for (int j=0; j<nRows; j++)
00248       result[ rowvec[i] ][ rowvec[j] ] = m[i][j];
00249 
00250   return result;
00251 }

AlgebraicVector AlignmentParameters::expandVector ( const AlgebraicVector m,
const std::vector< bool > &  sel 
) const [protected]

Definition at line 255 of file AlignmentParameters.cc.

References Exception, i, HLT_VtxMuL3::result, and size().

Referenced by RigidBodyAlignmentParameters::cloneFromSelected().

00257 {
00258 
00259   int nRows = m.num_row();
00260   int size  = sel.size();
00261 
00262   std::vector<int> rowvec;
00263   for ( int i=0; i<size; i++ ) 
00264     if (sel[i]==true) rowvec.push_back(i);
00265 
00266   // Check size matching
00267   if( nRows != static_cast<int>(rowvec.size()) ) 
00268     throw cms::Exception("LogicError") << "Size mismatch in parameters";
00269 
00270   // If OK, continue
00271   AlgebraicVector result(size,0);
00272   for (int i=0; i<nRows; i++) result[ rowvec[i] ] = m[i];
00273   return result;
00274 
00275 }

unsigned int AlignmentParameters::hierarchyLevel (  )  const [virtual]

How many levels of Alignables with parameters can be found in the substructures of the Alignable of these parameters? E.g.

0: lowest level, i.e. no components of hte Alignable have parameters, n: up to n generations of components have parameters (some 'branches' may have less)

Definition at line 127 of file AlignmentParameters.cc.

References Alignable::firstCompsWithParams(), and theAlignable.

Referenced by AlignmentParametersIORoot::writeOne().

00128 {
00129   if (!theAlignable) {
00130     edm::LogError("Alignment") << "@SUB=AlignmentParameters::hierarchyLevel"
00131                                << "Called for AlignmentParameters without pointer to Alignable";
00132     return 0;
00133   }
00134 
00135   std::vector<Alignable*> comps;
00136   theAlignable->firstCompsWithParams(comps);
00137   if (comps.empty()) return 0;
00138 
00139   unsigned int maxLevelOfComp = 0;
00140   for (std::vector<Alignable*>::const_iterator iAli = comps.begin(), iAliEnd = comps.end();
00141        iAli != iAliEnd; ++iAli) {// firstCompsWithParams guaranties that alignmentParameters() != 0:
00142     const unsigned int compResult = (*iAli)->alignmentParameters()->hierarchyLevel();
00143     // levels might be different for components, get largest:
00144     if (maxLevelOfComp < compResult) maxLevelOfComp = compResult;
00145   }
00146 
00147   return maxLevelOfComp + 1;
00148 }

const bool AlignmentParameters::isValid ( void   )  const

Get validity flag.

Definition at line 159 of file AlignmentParameters.cc.

References bValid.

Referenced by RigidBodyAlignmentParameters::clone(), RigidBodyAlignmentParameters::cloneFromSelected(), HIPAlignmentAlgorithm::fillRoot(), AlignmentCorrelationsIORoot::write(), AlignableDataIO::writeAbsPos(), AlignableDataIO::writeOrgPos(), and AlignableDataIO::writeRelPos().

00160 { 
00161   return bValid;
00162 }

const int AlignmentParameters::numSelected ( void   )  const

Get number of selected parameters.

Definition at line 71 of file AlignmentParameters.cc.

References theData.

Referenced by AlignmentCorrelationsStore::fillCorrelationsTable(), AlignmentExtendedCorrelationsStore::fillCorrelationsTable(), AlignmentParameterStore::resetParameters(), RigidBodyAlignmentParameters::selectedDerivatives(), AlignmentParameterStore::selectParameters(), HIPAlignmentAlgorithm::startNewLoop(), and AlignmentParameterStore::updateParameters().

00072 {
00073   return theData->numSelected();
00074 }

const AlgebraicVector & AlignmentParameters::parameters ( void   )  const

Get alignment parameters.

Definition at line 92 of file AlignmentParameters.cc.

References theData.

Referenced by MillePedeAlignmentAlgorithm::areEmptyParams(), HIPAlignmentAlgorithm::fillRoot(), KalmanAlignmentUserVariables::fixAlignable(), KalmanAlignmentAlgorithm::initializeAlignmentParameters(), SurveyAlignment::iterate(), SingleTrajectoryUpdator::process(), PedeReader::setParameter(), SurveyAlignment::shiftSensors(), KalmanAlignmentUserVariables::unfixAlignable(), AlignmentParameterStore::updateParameters(), AlignmentParametersIORoot::writeOne(), and AlignmentParametersIO::writeOneOrigRigidBody().

00093 { 
00094   return theData->parameters();
00095 }

AlgebraicSymMatrix AlignmentParameters::selectedCovariance ( void   )  const

Get covariance matrix of selected parameters.

Definition at line 85 of file AlignmentParameters.cc.

References collapseSymMatrix(), and theData.

Referenced by CurrentAlignmentKFUpdator::includeCurrentAlignmentEstimate(), AlignmentParameterStore::selectParameters(), and KalmanAlignmentUserVariables::update().

00086 { 
00087   return collapseSymMatrix( theData->covariance(), theData->selector() );
00088 }

virtual AlgebraicMatrix AlignmentParameters::selectedDerivatives ( const TrajectoryStateOnSurface tsos,
const AlignableDetOrUnitPtr alidet 
) const [pure virtual]

Implemented in CompositeAlignmentParameters, RigidBodyAlignmentParameters, and SurveyParameters.

Referenced by CompositeAlignmentParameters::derivativesLegacy(), CurrentAlignmentKFUpdator::includeCurrentAlignmentEstimate(), and HIPAlignmentAlgorithm::run().

AlgebraicVector AlignmentParameters::selectedParameters ( void   )  const

Get selected parameters.

Definition at line 78 of file AlignmentParameters.cc.

References collapseVector(), and theData.

Referenced by CurrentAlignmentKFUpdator::includeCurrentAlignmentEstimate(), AlignmentParameterStore::selectParameters(), and KalmanAlignmentUserVariables::update().

00079 { 
00080   return collapseVector( theData->parameters(), theData->selector() );
00081 }

const std::vector< bool > & AlignmentParameters::selector ( void   )  const

Get alignment parameter selector vector.

Definition at line 65 of file AlignmentParameters.cc.

References theData.

Referenced by AlignmentMonitorMuonHIP::afterAlignment(), RigidBodyAlignmentParameters::clone(), RigidBodyAlignmentParameters::cloneFromSelected(), MillePedeAlignmentAlgorithm::globalDerivativesHierarchy(), AlignmentParameterStore::hierarchyConstraints(), AlignmentParametersIORoot::readOne(), RigidBodyAlignmentParameters::selectedDerivatives(), AlignmentProducer::simpleMisalignment_(), and KalmanAlignmentUserVariables::update().

00066 { 
00067   return theData->selector();
00068 }

void AlignmentParameters::setUserVariables ( AlignmentUserVariables auv  ) 

Set pointer to user variables.

Definition at line 106 of file AlignmentParameters.cc.

References theUserVariables.

Referenced by AlignmentParameterBuilder::addFullParamSel(), AlignmentParameterStore::attachUserVariables(), MillePedeAlignmentAlgorithm::buildUserVariables(), PedeReader::checkAliParams(), CompositeAlignmentParameters::clone(), RigidBodyAlignmentParameters::clone(), RigidBodyAlignmentParameters::cloneFromSelected(), KalmanAlignmentAlgorithm::initializeAlignmentParameters(), and HIPAlignmentAlgorithm::startNewLoop().

00107 { 
00108   if ( theUserVariables ) delete theUserVariables;
00109   theUserVariables = auv;
00110 }

void AlignmentParameters::setValid ( bool  v  ) 

Set validity flag.

Definition at line 166 of file AlignmentParameters.cc.

References bValid.

Referenced by HIPAlignmentAlgorithm::calcParameters(), RigidBodyAlignmentParameters::clone(), RigidBodyAlignmentParameters::cloneFromSelected(), AlignmentParametersIORoot::readOne(), AlignmentParameterStore::resetParameters(), and HIPAlignmentAlgorithm::terminate().

00167 { 
00168   bValid=v;
00169 }

const int AlignmentParameters::size ( void   )  const

Get number of parameters.

Definition at line 152 of file AlignmentParameters.cc.

References theData.

Referenced by AlignmentParameterStore::acquireRelativeParameters(), PedeSteerer::buildNoHierarchyCollection(), MillePedeAlignmentAlgorithm::buildUserVariables(), PedeReader::checkAliParams(), PedeSteerer::checkParameterChoices(), collapseSymMatrix(), collapseVector(), expandSymMatrix(), expandVector(), PedeSteerer::fixParameters(), and PedeSteerer::selectCoordinateAlis().

00153 { 
00154   return theData->parameters().num_row();
00155 }

AlignmentUserVariables * AlignmentParameters::userVariables ( void   )  const

Get pointer to user variables.

Definition at line 114 of file AlignmentParameters.cc.

References theUserVariables.

Referenced by MillePedeAlignmentAlgorithm::addHits(), AlignmentMonitorMuonHIP::afterAlignment(), PedeSteerer::buildNoHierarchyCollection(), HIPAlignmentAlgorithm::calcParameters(), PedeReader::checkAliParams(), PedeSteerer::checkParameterChoices(), CompositeAlignmentParameters::clone(), RigidBodyAlignmentParameters::clone(), RigidBodyAlignmentParameters::cloneFromSelected(), HIPAlignmentAlgorithm::collector(), HIPAlignmentAlgorithm::fillRoot(), PedeSteerer::fixParameters(), HIPAlignmentAlgorithm::run(), PedeSteerer::selectCoordinateAlis(), PedeReader::setParameter(), HIPAlignmentAlgorithm::startNewLoop(), KalmanAlignmentAlgorithm::terminate(), KalmanAlignmentUpdator::updateUserVariables(), HIPUserVariablesIORoot::writeOne(), and MillePedeVariablesIORoot::writeOne().

00115 { 
00116   return theUserVariables;
00117 }


Member Data Documentation

bool AlignmentParameters::bValid [protected]

True if parameters are valid.

Definition at line 129 of file AlignmentParameters.h.

Referenced by isValid(), and setValid().

Alignable* AlignmentParameters::theAlignable [protected]

Definition at line 123 of file AlignmentParameters.h.

Referenced by alignable(), RigidBodyAlignmentParameters::globalParameters(), and hierarchyLevel().

DataContainer AlignmentParameters::theData [protected]

Definition at line 125 of file AlignmentParameters.h.

Referenced by AlignmentParameters(), covariance(), CompositeAlignmentParameters::covarianceSubset(), numSelected(), parameters(), CompositeAlignmentParameters::parameterSubset(), RigidBodyAlignmentParameters::print(), RigidBodyAlignmentParameters::rotation(), selectedCovariance(), selectedParameters(), selector(), size(), and RigidBodyAlignmentParameters::translation().

AlignmentUserVariables* AlignmentParameters::theUserVariables [protected]

Definition at line 127 of file AlignmentParameters.h.

Referenced by setUserVariables(), userVariables(), and ~AlignmentParameters().


The documentation for this class was generated from the following files:
Generated on Tue Jun 9 18:14:35 2009 for CMSSW by  doxygen 1.5.4