#include <AlignmentCorrelationsStore.h>
Public Types | |
typedef std::map< Alignable *, CorrelationsTable * > | Correlations |
typedef std::map< Alignable *, AlgebraicMatrix > | CorrelationsTable |
Public Member Functions | |
AlignmentCorrelationsStore (void) | |
virtual void | correlations (Alignable *ap1, Alignable *ap2, AlgebraicSymMatrix &cov, int row, int col) const |
virtual bool | correlationsAvailable (Alignable *ap1, Alignable *ap2) const |
Check whether correlations are stored for a given pair of alignables. | |
virtual void | resetCorrelations (void) |
Reset correlations. | |
virtual void | setCorrelations (Alignable *ap1, Alignable *ap2, AlgebraicMatrix &mat) |
Set correlations. | |
virtual void | setCorrelations (Alignable *ap1, Alignable *ap2, const AlgebraicSymMatrix &cov, int row, int col) |
virtual unsigned int | size (void) const |
Get number of stored correlations. | |
virtual | ~AlignmentCorrelationsStore (void) |
Protected Member Functions | |
virtual void | fillCorrelationsTable (Alignable *ap1, Alignable *ap2, CorrelationsTable *table, const AlgebraicSymMatrix &cov, int row, int col, bool transpose) |
virtual void | fillCovariance (Alignable *ap1, Alignable *ap2, const AlgebraicMatrix &entry, AlgebraicSymMatrix &cov, int row, int col) const |
virtual void | fillCovarianceT (Alignable *ap1, Alignable *ap2, const AlgebraicMatrix &entry, AlgebraicSymMatrix &cov, int row, int col) const |
virtual void | readFromCovariance (Alignable *ap1, Alignable *ap2, AlgebraicMatrix &entry, const AlgebraicSymMatrix &cov, int row, int col) |
virtual void | readFromCovarianceT (Alignable *ap1, Alignable *ap2, AlgebraicMatrix &entry, const AlgebraicSymMatrix &cov, int row, int col) |
Protected Attributes | |
Correlations | theCorrelations |
Definition at line 16 of file AlignmentCorrelationsStore.h.
typedef std::map< Alignable*, CorrelationsTable* > AlignmentCorrelationsStore::Correlations |
Definition at line 22 of file AlignmentCorrelationsStore.h.
typedef std::map< Alignable*, AlgebraicMatrix > AlignmentCorrelationsStore::CorrelationsTable |
Definition at line 21 of file AlignmentCorrelationsStore.h.
AlignmentCorrelationsStore::AlignmentCorrelationsStore | ( | void | ) |
Definition at line 8 of file AlignmentCorrelationsStore.cc.
{ edm::LogInfo("Alignment") << "@SUB=AlignmentCorrelationsStore::AlignmentCorrelationsStore " << "\nCreated."; }
virtual AlignmentCorrelationsStore::~AlignmentCorrelationsStore | ( | void | ) | [inline, virtual] |
Definition at line 26 of file AlignmentCorrelationsStore.h.
{}
void AlignmentCorrelationsStore::correlations | ( | Alignable * | ap1, |
Alignable * | ap2, | ||
AlgebraicSymMatrix & | cov, | ||
int | row, | ||
int | col | ||
) | const [virtual] |
Write correlations directly to the covariance matrix starting at the given position. Indices are assumed to start from 0.
Reimplemented in AlignmentExtendedCorrelationsStore.
Definition at line 15 of file AlignmentCorrelationsStore.cc.
References fillCovariance(), fillCovarianceT(), swap(), theCorrelations, and geometryDiff::transpose().
Referenced by resetCorrelations(), and AlignmentParameterStore::selectParameters().
{ static Alignable* previousAlignable = 0; static CorrelationsTable* previousCorrelations; // Needed by 'resetCorrelations()' to reset the static pointer: if ( ap1 == 0 ) { previousAlignable = 0; return; } bool transpose = ( ap2 > ap1 ); if ( transpose ) std::swap( ap1, ap2 ); if ( ap1 == previousAlignable ) { CorrelationsTable::const_iterator itC2 = previousCorrelations->find( ap2 ); if ( itC2 != previousCorrelations->end() ) { transpose ? fillCovarianceT( ap1, ap2, (*itC2).second, cov, row, col ) : fillCovariance( ap1, ap2, (*itC2).second, cov, row, col ); } } else { Correlations::const_iterator itC1 = theCorrelations.find( ap1 ); if ( itC1 != theCorrelations.end() ) { previousAlignable = ap1; previousCorrelations = (*itC1).second; CorrelationsTable::const_iterator itC2 = (*itC1).second->find( ap2 ); if ( itC2 != (*itC1).second->end() ) { transpose ? fillCovarianceT( ap1, ap2, (*itC2).second, cov, row, col ) : fillCovariance( ap1, ap2, (*itC2).second, cov, row, col ); } } } // don't fill anything into the covariance if there's no entry return; }
bool AlignmentCorrelationsStore::correlationsAvailable | ( | Alignable * | ap1, |
Alignable * | ap2 | ||
) | const [virtual] |
Check whether correlations are stored for a given pair of alignables.
Reimplemented in AlignmentExtendedCorrelationsStore.
Definition at line 117 of file AlignmentCorrelationsStore.cc.
References swap(), theCorrelations, and geometryDiff::transpose().
Referenced by AlignmentParameterStore::attachCorrelations().
{ bool transpose = ( ap2 > ap1 ); if ( transpose ) std::swap( ap1, ap2 ); Correlations::const_iterator itC1 = theCorrelations.find( ap1 ); if ( itC1 != theCorrelations.end() ) { CorrelationsTable::const_iterator itC2 = itC1->second->find( ap2 ); if ( itC2 != itC1->second->end() ) return true; } return false; }
void AlignmentCorrelationsStore::fillCorrelationsTable | ( | Alignable * | ap1, |
Alignable * | ap2, | ||
CorrelationsTable * | table, | ||
const AlgebraicSymMatrix & | cov, | ||
int | row, | ||
int | col, | ||
bool | transpose | ||
) | [protected, virtual] |
Definition at line 157 of file AlignmentCorrelationsStore.cc.
References Alignable::alignmentParameters(), AlignmentParameters::numSelected(), readFromCovariance(), and readFromCovarianceT().
Referenced by setCorrelations().
{ CorrelationsTable::iterator itC = table->find( ap2 ); if ( itC != table->end() ) { transpose ? readFromCovarianceT( ap1, ap2, itC->second, cov, row, col ) : readFromCovariance( ap1, ap2, itC->second, cov, row, col ); } else { int nRow = ap1->alignmentParameters()->numSelected(); int nCol = ap2->alignmentParameters()->numSelected(); AlgebraicMatrix newEntry( nRow, nCol ); transpose ? readFromCovarianceT( ap1, ap2, newEntry, cov, row, col ) : readFromCovariance( ap1, ap2, newEntry, cov, row, col ); (*table)[ap2] = newEntry; } }
void AlignmentCorrelationsStore::fillCovariance | ( | Alignable * | ap1, |
Alignable * | ap2, | ||
const AlgebraicMatrix & | entry, | ||
AlgebraicSymMatrix & | cov, | ||
int | row, | ||
int | col | ||
) | const [protected, virtual] |
Definition at line 184 of file AlignmentCorrelationsStore.cc.
Referenced by correlations().
void AlignmentCorrelationsStore::fillCovarianceT | ( | Alignable * | ap1, |
Alignable * | ap2, | ||
const AlgebraicMatrix & | entry, | ||
AlgebraicSymMatrix & | cov, | ||
int | row, | ||
int | col | ||
) | const [protected, virtual] |
Definition at line 197 of file AlignmentCorrelationsStore.cc.
Referenced by correlations().
void AlignmentCorrelationsStore::readFromCovariance | ( | Alignable * | ap1, |
Alignable * | ap2, | ||
AlgebraicMatrix & | entry, | ||
const AlgebraicSymMatrix & | cov, | ||
int | row, | ||
int | col | ||
) | [protected, virtual] |
Definition at line 210 of file AlignmentCorrelationsStore.cc.
Referenced by fillCorrelationsTable().
void AlignmentCorrelationsStore::readFromCovarianceT | ( | Alignable * | ap1, |
Alignable * | ap2, | ||
AlgebraicMatrix & | entry, | ||
const AlgebraicSymMatrix & | cov, | ||
int | row, | ||
int | col | ||
) | [protected, virtual] |
Definition at line 223 of file AlignmentCorrelationsStore.cc.
Referenced by fillCorrelationsTable().
void AlignmentCorrelationsStore::resetCorrelations | ( | void | ) | [virtual] |
Reset correlations.
Reimplemented in AlignmentExtendedCorrelationsStore.
Definition at line 132 of file AlignmentCorrelationsStore.cc.
References correlations(), setCorrelations(), and theCorrelations.
Referenced by AlignmentParameterStore::resetParameters().
{ Correlations::iterator itC; for ( itC = theCorrelations.begin(); itC != theCorrelations.end(); ++itC ) delete (*itC).second; theCorrelations.erase( theCorrelations.begin(), theCorrelations.end() ); // Reset the static pointers to the 'previous alignables' AlgebraicSymMatrix dummy; correlations( 0, 0, dummy, 0, 0 ); setCorrelations( 0, 0, dummy, 0, 0 ); }
void AlignmentCorrelationsStore::setCorrelations | ( | Alignable * | ap1, |
Alignable * | ap2, | ||
AlgebraicMatrix & | mat | ||
) | [virtual] |
Set correlations.
Reimplemented in AlignmentExtendedCorrelationsStore.
Definition at line 98 of file AlignmentCorrelationsStore.cc.
References swap(), theCorrelations, and geometryDiff::transpose().
{ bool transpose = ( ap2 > ap1 ); if ( transpose ) std::swap( ap1, ap2 ); Correlations::iterator itC1 = theCorrelations.find( ap1 ); if ( itC1 != theCorrelations.end() ) { (*itC1->second)[ap2] = transpose ? mat.T() : mat; } else { CorrelationsTable* newTable = new CorrelationsTable; (*newTable)[ap2] = transpose ? mat.T() : mat; theCorrelations[ap1] = newTable; } }
void AlignmentCorrelationsStore::setCorrelations | ( | Alignable * | ap1, |
Alignable * | ap2, | ||
const AlgebraicSymMatrix & | cov, | ||
int | row, | ||
int | col | ||
) | [virtual] |
Get correlations directly from the given position of the covariance matrix and store them. Indices are assumed to start from 0.
Reimplemented in AlignmentExtendedCorrelationsStore.
Definition at line 60 of file AlignmentCorrelationsStore.cc.
References fillCorrelationsTable(), swap(), theCorrelations, and geometryDiff::transpose().
Referenced by AlignmentParameterStore::attachCorrelations(), resetCorrelations(), and AlignmentParameterStore::updateParameters().
{ static Alignable* previousAlignable = 0; static CorrelationsTable* previousCorrelations; // Needed by 'resetCorrelations()' to reset the static pointer: if ( ap1 == 0 ) { previousAlignable = 0; return; } bool transpose = ( ap2 > ap1 ); if ( transpose ) std::swap( ap1, ap2 ); if ( ap1 == previousAlignable ) { fillCorrelationsTable( ap1, ap2, previousCorrelations, cov, row, col, transpose ); } else { Correlations::iterator itC = theCorrelations.find( ap1 ); if ( itC != theCorrelations.end() ) { fillCorrelationsTable( ap1, ap2, itC->second, cov, row, col, transpose ); previousAlignable = ap1; previousCorrelations = itC->second; } else { CorrelationsTable* newTable = new CorrelationsTable; fillCorrelationsTable( ap1, ap2, newTable, cov, row, col, transpose ); theCorrelations[ap1] = newTable; previousAlignable = ap1; previousCorrelations = newTable; } } }
unsigned int AlignmentCorrelationsStore::size | ( | void | ) | const [virtual] |
Get number of stored correlations.
Reimplemented in AlignmentExtendedCorrelationsStore.
Definition at line 145 of file AlignmentCorrelationsStore.cc.
References theCorrelations.
Referenced by AlignmentParameterStore::numCorrelations().
{ unsigned int size = 0; Correlations::const_iterator itC; for ( itC = theCorrelations.begin(); itC != theCorrelations.end(); ++itC ) size += itC->second->size(); return size; }
Reimplemented in AlignmentExtendedCorrelationsStore.
Definition at line 67 of file AlignmentCorrelationsStore.h.
Referenced by correlations(), correlationsAvailable(), resetCorrelations(), setCorrelations(), and size().