CMS 3D CMS Logo

List of all members | Public Types | Public Member Functions | Protected Member Functions | Protected Attributes
AlignmentParameters Class Referenceabstract

#include <AlignmentParameters.h>

Inheritance diagram for AlignmentParameters:
BeamSpotAlignmentParameters BowedSurfaceAlignmentParameters RigidBodyAlignmentParameters SurveyParameters TwoBowedSurfacesAlignmentParameters RigidBodyAlignmentParameters4D

Public Types

typedef AlignmentParametersData::DataContainer DataContainer
 

Public Member Functions

Alignablealignable (void) const
 Get pointer to corresponding alignable. More...
 
 AlignmentParameters ()
 Default constructor. More...
 
 AlignmentParameters (Alignable *object, const AlgebraicVector &par, const AlgebraicSymMatrix &cov)
 Constructor from given input. More...
 
 AlignmentParameters (Alignable *object, const AlgebraicVector &par, const AlgebraicSymMatrix &cov, const std::vector< bool > &sel)
 Constructor including selection of active parameters. More...
 
 AlignmentParameters (Alignable *object, const DataContainer &data)
 Constructor. More...
 
virtual void apply ()=0
 apply parameters to alignable More...
 
virtual AlignmentParametersclone (const AlgebraicVector &par, const AlgebraicSymMatrix &cov) const =0
 Enforce clone methods in derived classes. More...
 
virtual AlignmentParameterscloneFromSelected (const AlgebraicVector &par, const AlgebraicSymMatrix &cov) const =0
 
const AlgebraicSymMatrixcovariance (void) const
 Get parameter covariance matrix. More...
 
virtual AlgebraicMatrix derivatives (const TrajectoryStateOnSurface &tsos, const AlignableDetOrUnitPtr &alidet) const =0
 Get derivatives of selected parameters. More...
 
virtual unsigned int hierarchyLevel () const
 
bool isValid (void) const
 Get validity flag. More...
 
int numSelected (void) const
 Get number of selected parameters. More...
 
const AlgebraicVectorparameters (void) const
 Get alignment parameters. More...
 
AlgebraicSymMatrix selectedCovariance (void) const
 Get covariance matrix of selected parameters. More...
 
virtual AlgebraicMatrix selectedDerivatives (const TrajectoryStateOnSurface &tsos, const AlignableDetOrUnitPtr &alidet) const
 
AlgebraicVector selectedParameters (void) const
 Get selected parameters. More...
 
const std::vector< bool > & selector (void) const
 Get alignment parameter selector vector. More...
 
void setUserVariables (AlignmentUserVariables *auv)
 Set pointer to user variables. More...
 
void setValid (bool v)
 Set validity flag. More...
 
int size (void) const
 Get number of parameters. More...
 
virtual int type () const =0
 tell type (AlignmentParametersFactory::ParametersType - but no circular dependency) More...
 
AlignmentUserVariablesuserVariables (void) const
 Get pointer to user variables. More...
 
virtual ~AlignmentParameters ()
 Destructor. More...
 

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. More...
 
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
2010/10/26 19:50:21
Revision
1.9

(last update by

Author
flucke

)

Definition at line 35 of file AlignmentParameters.h.

Member Typedef Documentation

Definition at line 40 of file AlignmentParameters.h.

Constructor & Destructor Documentation

AlignmentParameters::AlignmentParameters ( )

Default constructor.

Definition at line 10 of file AlignmentParameters.cc.

10  :
11  theAlignable( 0),
12  theUserVariables( 0),
13  bValid(true)
14 {}
bool bValid
True if parameters are valid.
AlignmentUserVariables * theUserVariables
AlignmentParameters::AlignmentParameters ( Alignable object,
const AlgebraicVector par,
const AlgebraicSymMatrix cov 
)

Constructor from given input.

Definition at line 18 of file AlignmentParameters.cc.

References theData.

19  :
20  theAlignable(object),
23  bValid(true)
24 {
25  // is the data consistent?
26  theData->checkConsistency();
27 }
AlignmentParametersData::DataContainer DataContainer
bool bValid
True if parameters are valid.
AlignmentUserVariables * theUserVariables
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.

33  :
34  theAlignable(object),
35  theData( DataContainer( new AlignmentParametersData(par,cov,sel) ) ),
37  bValid(true)
38 {
39  // is the data consistent?
40  theData->checkConsistency();
41 }
AlignmentParametersData::DataContainer DataContainer
bool bValid
True if parameters are valid.
AlignmentUserVariables * theUserVariables
AlignmentParameters::AlignmentParameters ( Alignable object,
const DataContainer data 
)

Constructor.

Definition at line 45 of file AlignmentParameters.cc.

References theData.

46  :
47  theAlignable(object),
48  theData(data),
50  bValid(true)
51 {
52  // is the data consistent?
53  theData->checkConsistency();
54 }
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:82
bool bValid
True if parameters are valid.
AlignmentUserVariables * theUserVariables
AlignmentParameters::~AlignmentParameters ( )
virtual

Destructor.

Definition at line 58 of file AlignmentParameters.cc.

References theUserVariables.

59 {
60  if ( theUserVariables ) delete theUserVariables;
61 }
AlignmentUserVariables * theUserVariables

Member Function Documentation

Alignable * AlignmentParameters::alignable ( void  ) const
virtual void AlignmentParameters::apply ( )
pure virtual

apply parameters to alignable

Implemented in TwoBowedSurfacesAlignmentParameters, BowedSurfaceAlignmentParameters, BeamSpotAlignmentParameters, RigidBodyAlignmentParameters, and SurveyParameters.

Referenced by heavyIonTools.ConfigureHeavyIons::__call__(), editorTools.UserCodeTool::__call__(), HiCoreTools.RestrictInputToAOD::__call__(), coreTools.RunOnData::__call__(), trackTools.MakeAODTrackCandidates::__call__(), runJetUncertainties.RunJetUncertainties::__call__(), metTools.AddMETCollection::__call__(), heavyIonTools.ProductionDefaults::__call__(), editorTools.ChangeSource::__call__(), HiCoreTools.RemoveMCMatching::__call__(), cmsswVersionTools.PickRelValInputFiles::__call__(), coreTools.RemoveMCMatching::__call__(), trackTools.MakePATTrackCandidates::__call__(), trigTools.SwitchOnTrigger::__call__(), runMETCorrectionsAndUncertainties.RunMETCorrectionsAndUncertainties::__call__(), heavyIonTools.SelectionDefaults::__call__(), HiCoreTools.RemoveAllPATObjectsBut::__call__(), heavyIonTools.DisbaleMonteCarloDeps::__call__(), HiCoreTools.RemoveSpecificPATObjects::__call__(), trigTools.SwitchOnTriggerStandAlone::__call__(), trackTools.MakeTrackCandidates::__call__(), tauTools.AddTauCollection::__call__(), trigTools.SwitchOnTriggerMatching::__call__(), HiCoreTools.RemoveCleaning::__call__(), HiCoreTools.AddCleaning::__call__(), trigTools.SwitchOnTriggerMatchingStandAlone::__call__(), trigTools.SwitchOnTriggerMatchEmbedding::__call__(), jetTools.AddJetCollection::__call__(), jetTools.SwitchJetCollection::__call__(), jetTools.UpdateJetCollection::__call__(), jetTools.AddJetID::__call__(), jetTools.SetTagInfos::__call__(), and AlignmentParameterStore::applyParameters().

virtual AlignmentParameters* AlignmentParameters::clone ( const AlgebraicVector par,
const AlgebraicSymMatrix cov 
) const
pure virtual
virtual AlignmentParameters* AlignmentParameters::cloneFromSelected ( const AlgebraicVector par,
const AlgebraicSymMatrix cov 
) const
pure virtual
AlgebraicSymMatrix AlignmentParameters::collapseSymMatrix ( const AlgebraicSymMatrix m,
const std::vector< bool > &  sel 
) const
protected

Definition at line 199 of file AlignmentParameters.cc.

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

Referenced by selectedCovariance().

201 {
202 
203  int nRows = m.num_row();
204  int size = sel.size();
205 
206  // Check size matching
207  if ( nRows != size )
208  throw cms::Exception("LogicError") << "Size mismatch in parameters"
209  << " (input symmatrix = " << nRows << ", selection: " << size << ")";
210 
211  // If OK, continue
212  std::vector<int> rowvec;
213  for ( int i=0; i<nRows; i++ )
214  if ( sel[i] ) rowvec.push_back(i);
215 
216  int nSelectedRows = rowvec.size();
217  AlgebraicSymMatrix result( nSelectedRows, 0 );
218  for (int i=0; i<nSelectedRows; i++)
219  for (int j=0; j<nSelectedRows; j++)
220  result[i][j] = m[ rowvec[i] ][ rowvec[j] ];
221 
222  return result;
223 
224 }
int size(void) const
Get number of parameters.
CLHEP::HepSymMatrix AlgebraicSymMatrix
AlgebraicVector AlignmentParameters::collapseVector ( const AlgebraicVector m,
const std::vector< bool > &  sel 
) const
protected

Definition at line 228 of file AlignmentParameters.cc.

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

Referenced by selectedParameters().

230 {
231 
232  int nRows = m.num_row();
233  int size = sel.size();
234 
235  // Check size matching
236  if ( nRows != size )
237  throw cms::Exception("LogicError") << "Size mismatch in parameters"
238  << " (input vector = " << nRows << ", selection: " << size << ")";
239 
240  // If OK, continue
241  std::vector<int> rowvec;
242  for ( int i=0; i<nRows; i++ )
243  if ( sel[i] ) rowvec.push_back(i);
244 
245  int nSelectedRows=rowvec.size();
246  AlgebraicVector result( nSelectedRows, 0 );
247  for ( int i=0; i<nSelectedRows; i++ )
248  result[i] = m[ (int)rowvec[i] ];
249 
250  return result;
251 
252 }
CLHEP::HepVector AlgebraicVector
int size(void) const
Get number of parameters.
const AlgebraicSymMatrix & AlignmentParameters::covariance ( void  ) const

Get parameter covariance matrix.

Definition at line 99 of file AlignmentParameters.cc.

References theData.

Referenced by MillePedeAlignmentAlgorithm::areEmptyParams(), SurveyAlignment::iterate(), PedeReader::setParameter(), AlignmentParametersIORoot::writeOne(), and AlignmentParametersIO::writeOneOrigRigidBody().

100 {
101  return theData->covariance();
102 }
virtual AlgebraicMatrix AlignmentParameters::derivatives ( const TrajectoryStateOnSurface tsos,
const AlignableDetOrUnitPtr alidet 
) const
pure virtual
AlgebraicSymMatrix AlignmentParameters::expandSymMatrix ( const AlgebraicSymMatrix m,
const std::vector< bool > &  sel 
) const
protected

Definition at line 256 of file AlignmentParameters.cc.

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

Referenced by BeamSpotAlignmentParameters::cloneFromSelected(), RigidBodyAlignmentParameters::cloneFromSelected(), RigidBodyAlignmentParameters4D::cloneFromSelected(), BowedSurfaceAlignmentParameters::cloneFromSelected(), and TwoBowedSurfacesAlignmentParameters::cloneFromSelected().

258 {
259 
260  int nRows = m.num_row();
261  int size = sel.size();
262 
263  std::vector<int> rowvec;
264  for ( int i=0; i<size; i++ )
265  if ( sel[i] ) rowvec.push_back(i);
266 
267  // Check size matching
268  if( nRows != static_cast<int>(rowvec.size()) )
269  throw cms::Exception("LogicError") << "Size mismatch in parameters"
270  << " (input symmatrix = " << nRows << ", selection: " << size << ")";
271 
272  // If OK, continue
273  AlgebraicSymMatrix result(size,0);
274  for ( int i=0; i<nRows; i++ )
275  for (int j=0; j<nRows; j++)
276  result[ rowvec[i] ][ rowvec[j] ] = m[i][j];
277 
278  return result;
279 }
int size(void) const
Get number of parameters.
CLHEP::HepSymMatrix AlgebraicSymMatrix
AlgebraicVector AlignmentParameters::expandVector ( const AlgebraicVector m,
const std::vector< bool > &  sel 
) const
protected

Definition at line 283 of file AlignmentParameters.cc.

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

Referenced by BeamSpotAlignmentParameters::cloneFromSelected(), RigidBodyAlignmentParameters::cloneFromSelected(), RigidBodyAlignmentParameters4D::cloneFromSelected(), BowedSurfaceAlignmentParameters::cloneFromSelected(), and TwoBowedSurfacesAlignmentParameters::cloneFromSelected().

285 {
286 
287  int nRows = m.num_row();
288  int size = sel.size();
289 
290  std::vector<int> rowvec;
291  for ( int i=0; i<size; i++ )
292  if (sel[i]==true) rowvec.push_back(i);
293 
294  // Check size matching
295  if( nRows != static_cast<int>(rowvec.size()) )
296  throw cms::Exception("LogicError") << "Size mismatch in parameters"
297  << " (input vector = " << nRows << ", selection: " << size << ")";
298 
299  // If OK, continue
300  AlgebraicVector result(size,0);
301  for (int i=0; i<nRows; i++) result[ rowvec[i] ] = m[i];
302  return result;
303 
304 }
CLHEP::HepVector AlgebraicVector
int size(void) const
Get number of parameters.
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 152 of file AlignmentParameters.cc.

References Alignable::firstCompsWithParams(), and theAlignable.

Referenced by AlignmentParametersIORoot::writeOne().

153 {
154  if (!theAlignable) {
155  edm::LogError("Alignment") << "@SUB=AlignmentParameters::hierarchyLevel"
156  << "Called for AlignmentParameters without pointer to Alignable";
157  return 0;
158  }
159 
160  std::vector<Alignable*> comps;
162  if (comps.empty()) return 0;
163 
164  unsigned int maxLevelOfComp = 0;
165  for (std::vector<Alignable*>::const_iterator iAli = comps.begin(), iAliEnd = comps.end();
166  iAli != iAliEnd; ++iAli) {// firstCompsWithParams guaranties that alignmentParameters() != 0:
167  const unsigned int compResult = (*iAli)->alignmentParameters()->hierarchyLevel();
168  // levels might be different for components, get largest:
169  if (maxLevelOfComp < compResult) maxLevelOfComp = compResult;
170  }
171 
172  return maxLevelOfComp + 1;
173 }
bool firstCompsWithParams(Alignables &paramComps) const
Definition: Alignable.cc:69
bool AlignmentParameters::isValid ( void  ) const
int AlignmentParameters::numSelected ( void  ) const
const AlgebraicVector & AlignmentParameters::parameters ( void  ) const
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 AlignmentParameterStore::selectParameters().

86 {
87  return collapseSymMatrix( theData->covariance(), theData->selector() );
88 }
AlgebraicSymMatrix collapseSymMatrix(const AlgebraicSymMatrix &m, const std::vector< bool > &sel) const
AlgebraicMatrix AlignmentParameters::selectedDerivatives ( const TrajectoryStateOnSurface tsos,
const AlignableDetOrUnitPtr alidet 
) const
virtual

Reimplemented in BeamSpotAlignmentParameters, RigidBodyAlignmentParameters, and SurveyParameters.

Definition at line 106 of file AlignmentParameters.cc.

References derivatives(), trackingPlots::ncols, numSelected(), and selector().

Referenced by CompositeAlignmentParameters::derivativesLegacy(), HIPAlignmentAlgorithm::processHit1D(), HIPAlignmentAlgorithm::processHit2D(), and MuonMillepedeAlgorithm::run().

108 {
109  const AlgebraicMatrix dev(this->derivatives(tsos, alignableDet));
110 
111  const int ncols = dev.num_col();
112  const int nrows = dev.num_row();
113  const int nsel = numSelected();
114 
115  AlgebraicMatrix seldev(nsel, ncols);
116 
117  int ir2 = 0;
118  for (int irow = 0; irow < nrows; ++irow) {
119  if (this->selector()[irow]) {
120  for (int icol = 0; icol < ncols; ++icol) {
121  seldev[ir2][icol] = dev[irow][icol];
122  }
123  ++ir2;
124  }
125  }
126 
127  return seldev;
128 }
const std::vector< bool > & selector(void) const
Get alignment parameter selector vector.
CLHEP::HepMatrix AlgebraicMatrix
int numSelected(void) const
Get number of selected parameters.
virtual AlgebraicMatrix derivatives(const TrajectoryStateOnSurface &tsos, const AlignableDetOrUnitPtr &alidet) const =0
Get derivatives of selected parameters.
AlgebraicVector AlignmentParameters::selectedParameters ( void  ) const

Get selected parameters.

Definition at line 78 of file AlignmentParameters.cc.

References collapseVector(), and theData.

Referenced by AlignmentParameterStore::selectParameters().

79 {
80  return collapseVector( theData->parameters(), theData->selector() );
81 }
AlgebraicVector collapseVector(const AlgebraicVector &m, const std::vector< bool > &sel) const
const std::vector< bool > & AlignmentParameters::selector ( void  ) const
void AlignmentParameters::setUserVariables ( AlignmentUserVariables auv)
void AlignmentParameters::setValid ( bool  v)
int AlignmentParameters::size ( void  ) const
virtual int AlignmentParameters::type ( ) const
pure virtual
AlignmentUserVariables * AlignmentParameters::userVariables ( void  ) const

Member Data Documentation

bool AlignmentParameters::bValid
protected

True if parameters are valid.

Definition at line 136 of file AlignmentParameters.h.

Referenced by isValid(), and setValid().

Alignable* AlignmentParameters::theAlignable
protected
DataContainer AlignmentParameters::theData
protected
AlignmentUserVariables* AlignmentParameters::theUserVariables
protected

Definition at line 134 of file AlignmentParameters.h.

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