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

◆ DataContainer

Definition at line 37 of file AlignmentParameters.h.

Constructor & Destructor Documentation

◆ AlignmentParameters() [1/4]

AlignmentParameters::AlignmentParameters ( )

Default constructor.

Definition at line 9 of file AlignmentParameters.cc.

9 : theAlignable(nullptr), theUserVariables(nullptr), bValid(true) {}

◆ AlignmentParameters() [2/4]

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

Constructor from given input.

Definition at line 12 of file AlignmentParameters.cc.

13  : theAlignable(object),
15  theUserVariables(nullptr),
16  bValid(true) {
17  // is the data consistent?
18  theData->checkConsistency();
19 }

References theData.

◆ AlignmentParameters() [3/4]

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

Constructor including selection of active parameters.

Definition at line 22 of file AlignmentParameters.cc.

26  : theAlignable(object),
28  theUserVariables(nullptr),
29  bValid(true) {
30  // is the data consistent?
31  theData->checkConsistency();
32 }

References theData.

◆ AlignmentParameters() [4/4]

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

Constructor.

Definition at line 35 of file AlignmentParameters.cc.

36  : theAlignable(object), theData(data), theUserVariables(nullptr), bValid(true) {
37  // is the data consistent?
38  theData->checkConsistency();
39 }

References theData.

◆ ~AlignmentParameters()

AlignmentParameters::~AlignmentParameters ( )
virtual

Destructor.

Definition at line 42 of file AlignmentParameters.cc.

42  {
43  if (theUserVariables)
44  delete theUserVariables;
45 }

References theUserVariables.

Member Function Documentation

◆ alignable()

Alignable * AlignmentParameters::alignable ( void  ) const

◆ apply()

virtual void AlignmentParameters::apply ( )
pure virtual

◆ clone()

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

◆ cloneFromSelected()

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

◆ collapseSymMatrix()

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

Definition at line 140 of file AlignmentParameters.cc.

141  {
142  int nRows = m.num_row();
143  int size = sel.size();
144 
145  // Check size matching
146  if (nRows != size)
147  throw cms::Exception("LogicError") << "Size mismatch in parameters"
148  << " (input symmatrix = " << nRows << ", selection: " << size << ")";
149 
150  // If OK, continue
151  std::vector<int> rowvec;
152  for (int i = 0; i < nRows; i++)
153  if (sel[i])
154  rowvec.push_back(i);
155 
156  int nSelectedRows = rowvec.size();
157  AlgebraicSymMatrix result(nSelectedRows, 0);
158  for (int i = 0; i < nSelectedRows; i++)
159  for (int j = 0; j < nSelectedRows; j++)
160  result[i][j] = m[rowvec[i]][rowvec[j]];
161 
162  return result;
163 }

References Exception, mps_fire::i, dqmiolumiharvest::j, visualization-live-secondInstance_cfg::m, mps_fire::result, EgammaValidation_Wenu_cff::sel, and size().

Referenced by selectedCovariance().

◆ collapseVector()

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

Definition at line 166 of file AlignmentParameters.cc.

166  {
167  int nRows = m.num_row();
168  int size = sel.size();
169 
170  // Check size matching
171  if (nRows != size)
172  throw cms::Exception("LogicError") << "Size mismatch in parameters"
173  << " (input vector = " << nRows << ", selection: " << size << ")";
174 
175  // If OK, continue
176  std::vector<int> rowvec;
177  for (int i = 0; i < nRows; i++)
178  if (sel[i])
179  rowvec.push_back(i);
180 
181  int nSelectedRows = rowvec.size();
182  AlgebraicVector result(nSelectedRows, 0);
183  for (int i = 0; i < nSelectedRows; i++)
184  result[i] = m[(int)rowvec[i]];
185 
186  return result;
187 }

References Exception, mps_fire::i, visualization-live-secondInstance_cfg::m, mps_fire::result, EgammaValidation_Wenu_cff::sel, and size().

Referenced by selectedParameters().

◆ covariance()

const AlgebraicSymMatrix & AlignmentParameters::covariance ( void  ) const

Get parameter covariance matrix.

Definition at line 67 of file AlignmentParameters.cc.

67 { return theData->covariance(); }

References theData.

Referenced by SurveyAlignment::iterate(), AlignmentParametersIORoot::writeOne(), and AlignmentParametersIO::writeOneOrigRigidBody().

◆ derivatives()

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

◆ expandSymMatrix()

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

Definition at line 190 of file AlignmentParameters.cc.

191  {
192  int nRows = m.num_row();
193  int size = sel.size();
194 
195  std::vector<int> rowvec;
196  for (int i = 0; i < size; i++)
197  if (sel[i])
198  rowvec.push_back(i);
199 
200  // Check size matching
201  if (nRows != static_cast<int>(rowvec.size()))
202  throw cms::Exception("LogicError") << "Size mismatch in parameters"
203  << " (input symmatrix = " << nRows << ", selection: " << size << ")";
204 
205  // If OK, continue
207  for (int i = 0; i < nRows; i++)
208  for (int j = 0; j < nRows; j++)
209  result[rowvec[i]][rowvec[j]] = m[i][j];
210 
211  return result;
212 }

References Exception, mps_fire::i, dqmiolumiharvest::j, visualization-live-secondInstance_cfg::m, mps_fire::result, EgammaValidation_Wenu_cff::sel, and size().

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

◆ expandVector()

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

Definition at line 215 of file AlignmentParameters.cc.

215  {
216  int nRows = m.num_row();
217  int size = sel.size();
218 
219  std::vector<int> rowvec;
220  for (int i = 0; i < size; i++)
221  if (sel[i] == true)
222  rowvec.push_back(i);
223 
224  // Check size matching
225  if (nRows != static_cast<int>(rowvec.size()))
226  throw cms::Exception("LogicError") << "Size mismatch in parameters"
227  << " (input vector = " << nRows << ", selection: " << size << ")";
228 
229  // If OK, continue
231  for (int i = 0; i < nRows; i++)
232  result[rowvec[i]] = m[i];
233  return result;
234 }

References Exception, mps_fire::i, visualization-live-secondInstance_cfg::m, mps_fire::result, EgammaValidation_Wenu_cff::sel, and size().

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

◆ hierarchyLevel()

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 107 of file AlignmentParameters.cc.

107  {
108  if (!theAlignable) {
109  edm::LogError("Alignment") << "@SUB=AlignmentParameters::hierarchyLevel"
110  << "Called for AlignmentParameters without pointer to Alignable";
111  return 0;
112  }
113 
114  align::Alignables comps;
116  if (comps.empty())
117  return 0;
118 
119  unsigned int maxLevelOfComp = 0;
120  for (const auto& iAli : comps) { // firstCompsWithParams guaranties that alignmentParameters() != 0:
121  const unsigned int compResult = iAli->alignmentParameters()->hierarchyLevel();
122  // levels might be different for components, get largest:
123  if (maxLevelOfComp < compResult)
124  maxLevelOfComp = compResult;
125  }
126 
127  return maxLevelOfComp + 1;
128 }

References Alignable::firstCompsWithParams(), and theAlignable.

Referenced by AlignmentParametersIORoot::writeOne().

◆ isValid()

bool AlignmentParameters::isValid ( void  ) const

◆ numSelected()

int AlignmentParameters::numSelected ( void  ) const

◆ parameters()

const AlgebraicVector & AlignmentParameters::parameters ( void  ) const

◆ selectedCovariance()

AlgebraicSymMatrix AlignmentParameters::selectedCovariance ( void  ) const

Get covariance matrix of selected parameters.

Definition at line 59 of file AlignmentParameters.cc.

59  {
60  return collapseSymMatrix(theData->covariance(), theData->selector());
61 }

References collapseSymMatrix(), and theData.

Referenced by AlignmentParameterStore::selectParameters().

◆ selectedDerivatives()

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

Reimplemented in BeamSpotAlignmentParameters, RigidBodyAlignmentParameters, and SurveyParameters.

Definition at line 70 of file AlignmentParameters.cc.

71  {
72  const AlgebraicMatrix dev(this->derivatives(tsos, alignableDet));
73 
74  const int ncols = dev.num_col();
75  const int nrows = dev.num_row();
76  const int nsel = numSelected();
77 
78  AlgebraicMatrix seldev(nsel, ncols);
79 
80  int ir2 = 0;
81  for (int irow = 0; irow < nrows; ++irow) {
82  if (this->selector()[irow]) {
83  for (int icol = 0; icol < ncols; ++icol) {
84  seldev[ir2][icol] = dev[irow][icol];
85  }
86  ++ir2;
87  }
88  }
89 
90  return seldev;
91 }

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

Referenced by CompositeAlignmentParameters::derivativesLegacy().

◆ selectedParameters()

AlgebraicVector AlignmentParameters::selectedParameters ( void  ) const

Get selected parameters.

Definition at line 54 of file AlignmentParameters.cc.

54  {
55  return collapseVector(theData->parameters(), theData->selector());
56 }

References collapseVector(), and theData.

Referenced by AlignmentParameterStore::selectParameters().

◆ selector()

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

◆ setUserVariables()

void AlignmentParameters::setUserVariables ( AlignmentUserVariables auv)

◆ setValid()

void AlignmentParameters::setValid ( bool  v)

◆ size()

int AlignmentParameters::size ( void  ) const

◆ type()

virtual int AlignmentParameters::type ( ) const
pure virtual

◆ userVariables()

AlignmentUserVariables * AlignmentParameters::userVariables ( void  ) const

Member Data Documentation

◆ bValid

bool AlignmentParameters::bValid
protected

True if parameters are valid.

Definition at line 127 of file AlignmentParameters.h.

Referenced by isValid(), and setValid().

◆ theAlignable

Alignable* AlignmentParameters::theAlignable
protected

◆ theData

DataContainer AlignmentParameters::theData
protected

◆ theUserVariables

AlignmentUserVariables* AlignmentParameters::theUserVariables
protected

Definition at line 125 of file AlignmentParameters.h.

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

AlignmentParameters::theAlignable
Alignable * theAlignable
Definition: AlignmentParameters.h:121
hgcalPlots.ncols
ncols
Definition: hgcalPlots.py:105
Alignable::firstCompsWithParams
bool firstCompsWithParams(Alignables &paramComps) const
Definition: Alignable.cc:62
mps_fire.i
i
Definition: mps_fire.py:428
AlignmentParameters::theData
DataContainer theData
Definition: AlignmentParameters.h:123
AlignmentParameters::collapseVector
AlgebraicVector collapseVector(const AlgebraicVector &m, const std::vector< bool > &sel) const
Definition: AlignmentParameters.cc:166
findQualityFiles.v
v
Definition: findQualityFiles.py:179
AlgebraicVector
CLHEP::HepVector AlgebraicVector
Definition: AlgebraicObjects.h:13
visualization-live-secondInstance_cfg.m
m
Definition: visualization-live-secondInstance_cfg.py:72
AlignmentParameters::theUserVariables
AlignmentUserVariables * theUserVariables
Definition: AlignmentParameters.h:125
AlgebraicSymMatrix
CLHEP::HepSymMatrix AlgebraicSymMatrix
Definition: AlgebraicObjects.h:15
AlignmentParameters::collapseSymMatrix
AlgebraicSymMatrix collapseSymMatrix(const AlgebraicSymMatrix &m, const std::vector< bool > &sel) const
Definition: AlignmentParameters.cc:140
edm::LogError
Log< level::Error, false > LogError
Definition: MessageLogger.h:123
AlignmentParametersData
Definition: AlignmentParametersData.h:7
AlignmentParameters::DataContainer
AlignmentParametersData::DataContainer DataContainer
Definition: AlignmentParameters.h:37
align::Alignables
std::vector< Alignable * > Alignables
Definition: Utilities.h:31
AlignmentParameters::derivatives
virtual AlgebraicMatrix derivatives(const TrajectoryStateOnSurface &tsos, const AlignableDetOrUnitPtr &alidet) const =0
Get derivatives of selected parameters.
AlgebraicMatrix
CLHEP::HepMatrix AlgebraicMatrix
Definition: AlgebraicObjects.h:14
Exception
Definition: hltDiff.cc:245
AlignmentParameters::numSelected
int numSelected(void) const
Get number of selected parameters.
Definition: AlignmentParameters.cc:51
AlignmentParameters::size
int size(void) const
Get number of parameters.
Definition: AlignmentParameters.cc:131
AlignmentParameters::selector
const std::vector< bool > & selector(void) const
Get alignment parameter selector vector.
Definition: AlignmentParameters.cc:48
data
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:79
mps_fire.result
result
Definition: mps_fire.py:311
EgammaValidation_Wenu_cff.sel
sel
Definition: EgammaValidation_Wenu_cff.py:33
dqmiolumiharvest.j
j
Definition: dqmiolumiharvest.py:66
AlignmentParameters::bValid
bool bValid
True if parameters are valid.
Definition: AlignmentParameters.h:127