CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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),
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__(), metTools.AddMETCollection::__call__(), heavyIonTools.ProductionDefaults::__call__(), editorTools.ChangeSource::__call__(), HiCoreTools.RemoveMCMatching::__call__(), cmsswVersionTools.PickRelValInputFiles::__call__(), jetTools.AddJetCollection::__call__(), coreTools.RemoveMCMatching::__call__(), trackTools.MakePATTrackCandidates::__call__(), trigTools.SwitchOnTrigger::__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.SwitchJetCollection::__call__(), jetTools.AddJetID::__call__(), jetTools.SetTagInfos::__call__(), metUncertaintyTools.RunMEtUncertainties::__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 edm::hlt::Exception, i, j, query::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 
210  // If OK, continue
211  std::vector<int> rowvec;
212  for ( int i=0; i<nRows; i++ )
213  if ( sel[i] ) rowvec.push_back(i);
214 
215  int nSelectedRows = rowvec.size();
216  AlgebraicSymMatrix result( nSelectedRows, 0 );
217  for (int i=0; i<nSelectedRows; i++)
218  for (int j=0; j<nSelectedRows; j++)
219  result[i][j] = m[ rowvec[i] ][ rowvec[j] ];
220 
221  return result;
222 
223 }
int i
Definition: DBlmapReader.cc:9
tuple result
Definition: query.py:137
int j
Definition: DBlmapReader.cc:9
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 227 of file AlignmentParameters.cc.

References edm::hlt::Exception, i, query::result, and size().

Referenced by selectedParameters().

229 {
230 
231  int nRows = m.num_row();
232  int size = sel.size();
233 
234  // Check size matching
235  if ( nRows != size )
236  throw cms::Exception("LogicError") << "Size mismatch in parameters";
237 
238  // If OK, continue
239  std::vector<int> rowvec;
240  for ( int i=0; i<nRows; i++ )
241  if ( sel[i] ) rowvec.push_back(i);
242 
243  int nSelectedRows=rowvec.size();
244  AlgebraicVector result( nSelectedRows, 0 );
245  for ( int i=0; i<nSelectedRows; i++ )
246  result[i] = m[ (int)rowvec[i] ];
247 
248  return result;
249 
250 }
int i
Definition: DBlmapReader.cc:9
tuple result
Definition: query.py:137
CLHEP::HepVector AlgebraicVector
int size(void) const
Get number of parameters.
const AlgebraicSymMatrix & AlignmentParameters::covariance ( void  ) const
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 254 of file AlignmentParameters.cc.

References edm::hlt::Exception, i, j, query::result, and size().

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

256 {
257 
258  int nRows = m.num_row();
259  int size = sel.size();
260 
261  std::vector<int> rowvec;
262  for ( int i=0; i<size; i++ )
263  if ( sel[i] ) rowvec.push_back(i);
264 
265  // Check size matching
266  if( nRows != static_cast<int>(rowvec.size()) )
267  throw cms::Exception("LogicError") << "Size mismatch in parameters";
268 
269  // If OK, continue
270  AlgebraicSymMatrix result(size,0);
271  for ( int i=0; i<nRows; i++ )
272  for (int j=0; j<nRows; j++)
273  result[ rowvec[i] ][ rowvec[j] ] = m[i][j];
274 
275  return result;
276 }
int i
Definition: DBlmapReader.cc:9
tuple result
Definition: query.py:137
int j
Definition: DBlmapReader.cc:9
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 280 of file AlignmentParameters.cc.

References edm::hlt::Exception, i, query::result, and size().

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

282 {
283 
284  int nRows = m.num_row();
285  int size = sel.size();
286 
287  std::vector<int> rowvec;
288  for ( int i=0; i<size; i++ )
289  if (sel[i]==true) rowvec.push_back(i);
290 
291  // Check size matching
292  if( nRows != static_cast<int>(rowvec.size()) )
293  throw cms::Exception("LogicError") << "Size mismatch in parameters";
294 
295  // If OK, continue
296  AlgebraicVector result(size,0);
297  for (int i=0; i<nRows; i++) result[ rowvec[i] ] = m[i];
298  return result;
299 
300 }
int i
Definition: DBlmapReader.cc:9
tuple result
Definition: query.py:137
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:50
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 KalmanAlignmentUserVariables::histogramParameters(), CurrentAlignmentKFUpdator::includeCurrentAlignmentEstimate(), AlignmentParameterStore::selectParameters(), and KalmanAlignmentUserVariables::update().

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(), numSelected(), and selector().

Referenced by CompositeAlignmentParameters::derivativesLegacy(), CurrentAlignmentKFUpdator::includeCurrentAlignmentEstimate(), 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.
virtual AlgebraicMatrix derivatives(const TrajectoryStateOnSurface &tsos, const AlignableDetOrUnitPtr &alidet) const =0
Get derivatives of selected parameters.
CLHEP::HepMatrix AlgebraicMatrix
int numSelected(void) const
Get number 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 KalmanAlignmentUserVariables::histogramParameters(), CurrentAlignmentKFUpdator::includeCurrentAlignmentEstimate(), AlignmentParameterStore::selectParameters(), and KalmanAlignmentUserVariables::update().

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