CMS 3D CMS Logo

List of all members | Public Types | Public Member Functions | Protected Attributes | Private Member Functions | Private Attributes
CompositeAlignmentParameters Class Reference

#include <CompositeAlignmentParameters.h>

Public Types

typedef std::map< AlignableDetOrUnitPtr, Alignable * > AlignableDetToAlignableMap
 
typedef std::map< Alignable *, int > Alilenmap
 
typedef std::map< Alignable *, int > Aliposmap
 
typedef align::Alignables Components
 vector of alignable components More...
 
typedef AlignmentParametersData::DataContainer DataContainer
 

Public Member Functions

AlignablealignableFromAlignableDet (const AlignableDetOrUnitPtr &adet) const
 Get relevant Alignable from AlignableDet. More...
 
CompositeAlignmentParametersclone (const AlgebraicVector &par, const AlgebraicSymMatrix &cov) const
 Clone parameters. More...
 
CompositeAlignmentParametersclone (const AlgebraicVector &par, const AlgebraicSymMatrix &cov, const AlignableDetToAlignableMap &alimap, const Aliposmap &aliposmap, const Alilenmap &alilenmap) const
 Clone parameters. More...
 
Components components () const
 Get vector of alignable components. More...
 
 CompositeAlignmentParameters (const AlgebraicVector &par, const AlgebraicSymMatrix &cov, const Components &comp)
 constructors More...
 
 CompositeAlignmentParameters (const AlgebraicVector &par, const AlgebraicSymMatrix &cov, const Components &comp, const AlignableDetToAlignableMap &alimap, const Aliposmap &aliposmap, const Alilenmap &alilenmap)
 
 CompositeAlignmentParameters (const DataContainer &data, const Components &comp, const AlignableDetToAlignableMap &alimap, const Aliposmap &aliposmap, const Alilenmap &alilenmap)
 
AlgebraicVector correctionTerm (const std::vector< TrajectoryStateOnSurface > &tsosvec, const std::vector< AlignableDet *> &alidetvec) const
 for backward compatibility, use std::vector<AlignableDetOrUnitPtr> More...
 
AlgebraicVector correctionTerm (const std::vector< TrajectoryStateOnSurface > &tsosvec, const std::vector< AlignableDetOrUnitPtr > &alidetvec) const
 
const AlgebraicSymMatrixcovariance () const
 Get parameter covariance matrix. More...
 
AlgebraicSymMatrix covarianceSubset (const align::Alignables &) const
 Extract covariance matrix for subset of alignables. More...
 
AlgebraicMatrix covarianceSubset (const align::Alignables &, const align::Alignables &) const
 Extract covariance matrix elements between two subsets of alignables. More...
 
AlgebraicMatrix derivatives (const TrajectoryStateOnSurface &tsos, const AlignableDetOrUnitPtr &alidet) const
 Get derivatives. More...
 
AlgebraicMatrix derivatives (const std::vector< TrajectoryStateOnSurface > &tsosvec, const std::vector< AlignableDet *> &alidetvec) const
 for backward compatibility, use std::vector<AlignableDetOrUnitPtr> More...
 
AlgebraicMatrix derivatives (const std::vector< TrajectoryStateOnSurface > &tsosvec, const std::vector< AlignableDetOrUnitPtr > &alidetvec) const
 
AlgebraicMatrix derivativesLegacy (const TrajectoryStateOnSurface &tsos, AlignableDet *alidet) const
 
AlgebraicMatrix derivativesLegacy (const std::vector< TrajectoryStateOnSurface > &tsosvec, const std::vector< AlignableDet *> &alidetvec) const
 
const AlgebraicVectorparameters () const
 Get alignment parameters. More...
 
AlgebraicVector parameterSubset (const align::Alignables &) const
 Extract parameters for subset of alignables. More...
 
AlgebraicMatrix selectedDerivatives (const TrajectoryStateOnSurface &tsos, const AlignableDetOrUnitPtr &alidet) const
 Get derivatives for selected alignables. More...
 
AlgebraicMatrix selectedDerivatives (const std::vector< TrajectoryStateOnSurface > &tsosvec, const std::vector< AlignableDet *> &alidetvec) const
 for backward compatibility, use std::vector<AlignableDetOrUnitPtr> More...
 
AlgebraicMatrix selectedDerivatives (const std::vector< TrajectoryStateOnSurface > &tsosvec, const std::vector< AlignableDetOrUnitPtr > &alidetvec) const
 
AlgebraicMatrix selectedDerivativesLegacy (const TrajectoryStateOnSurface &tsos, AlignableDet *alidet) const
 
AlgebraicMatrix selectedDerivativesLegacy (const std::vector< TrajectoryStateOnSurface > &tsosvec, const std::vector< AlignableDet *> &alidetvec) const
 
virtual ~CompositeAlignmentParameters ()
 destructor More...
 

Protected Attributes

DataContainer theData
 

Private Member Functions

void convert (const std::vector< AlignableDet *> &input, std::vector< AlignableDetOrUnitPtr > &output) const
 
align::Alignables extractAlignables (const align::Alignables &) const
 Return vector of alignables without multiple occurences. More...
 
bool extractPositionAndLength (const align::Alignables &alignables, std::vector< int > &posvec, std::vector< int > &lenvec, int &length) const
 Extract position and length of parameters for a subset of Alignables. More...
 

Private Attributes

AlignableDetToAlignableMap theAlignableDetToAlignableMap
 Relate Alignable's and AlignableDet's. More...
 
Alilenmap theAlilenmap
 
Aliposmap theAliposmap
 Maps to find parameters/covariance elements for given alignable. More...
 
Components theComponents
 Vector of alignable components. More...
 

Detailed Description

Class for 'concatenated' alignment parameters and associated Quantities for a set of Alignables. Provided by AlignmentParameterStore. It does not inherit from AligmentParameters since it does not need to be attached to an Alignable, so it does not need to have implementations of the apply(..) method. It neither needs AlignmentUservariables attached.

Date
2007/10/08 15:56:00
Revision
1.12

(last update by

Author
cklae

)

Definition at line 27 of file CompositeAlignmentParameters.h.

Member Typedef Documentation

◆ AlignableDetToAlignableMap

Definition at line 32 of file CompositeAlignmentParameters.h.

◆ Alilenmap

Definition at line 34 of file CompositeAlignmentParameters.h.

◆ Aliposmap

Definition at line 33 of file CompositeAlignmentParameters.h.

◆ Components

vector of alignable components

Definition at line 30 of file CompositeAlignmentParameters.h.

◆ DataContainer

Definition at line 36 of file CompositeAlignmentParameters.h.

Constructor & Destructor Documentation

◆ CompositeAlignmentParameters() [1/3]

CompositeAlignmentParameters::CompositeAlignmentParameters ( const AlgebraicVector par,
const AlgebraicSymMatrix cov,
const Components comp 
)

constructors

Date
2007/10/08 15:56:00
Revision
1.12

(last update by

Author
cklae

)

Definition at line 17 of file CompositeAlignmentParameters.cc.

Referenced by clone().

◆ CompositeAlignmentParameters() [2/3]

CompositeAlignmentParameters::CompositeAlignmentParameters ( const AlgebraicVector par,
const AlgebraicSymMatrix cov,
const Components comp,
const AlignableDetToAlignableMap alimap,
const Aliposmap aliposmap,
const Alilenmap alilenmap 
)

Definition at line 23 of file CompositeAlignmentParameters.cc.

32  theAliposmap(aliposmap),
33  theAlilenmap(alilenmap) {}
AlignmentParametersData::DataContainer DataContainer
AlignableDetToAlignableMap theAlignableDetToAlignableMap
Relate Alignable&#39;s and AlignableDet&#39;s.
Aliposmap theAliposmap
Maps to find parameters/covariance elements for given alignable.
Components theComponents
Vector of alignable components.

◆ CompositeAlignmentParameters() [3/3]

CompositeAlignmentParameters::CompositeAlignmentParameters ( const DataContainer data,
const Components comp,
const AlignableDetToAlignableMap alimap,
const Aliposmap aliposmap,
const Alilenmap alilenmap 
)

Definition at line 36 of file CompositeAlignmentParameters.cc.

41  : theData(data),
44  theAliposmap(aliposmap),
45  theAlilenmap(alilenmap) {}
AlignableDetToAlignableMap theAlignableDetToAlignableMap
Relate Alignable&#39;s and AlignableDet&#39;s.
Aliposmap theAliposmap
Maps to find parameters/covariance elements for given alignable.
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:80
Components theComponents
Vector of alignable components.

◆ ~CompositeAlignmentParameters()

CompositeAlignmentParameters::~CompositeAlignmentParameters ( )
virtual

destructor

Definition at line 48 of file CompositeAlignmentParameters.cc.

48 {}

Member Function Documentation

◆ alignableFromAlignableDet()

Alignable * CompositeAlignmentParameters::alignableFromAlignableDet ( const AlignableDetOrUnitPtr adet) const

Get relevant Alignable from AlignableDet.

Definition at line 208 of file CompositeAlignmentParameters.cc.

References theAlignableDetToAlignableMap.

Referenced by correctionTerm(), derivatives(), derivativesLegacy(), and HIPAlignmentAlgorithm::run().

208  {
209  AlignableDetToAlignableMap::const_iterator iali = theAlignableDetToAlignableMap.find(adet);
210  if (iali != theAlignableDetToAlignableMap.end())
211  return (*iali).second;
212  else
213  return nullptr;
214 }
AlignableDetToAlignableMap theAlignableDetToAlignableMap
Relate Alignable&#39;s and AlignableDet&#39;s.

◆ clone() [1/2]

CompositeAlignmentParameters * CompositeAlignmentParameters::clone ( const AlgebraicVector par,
const AlgebraicSymMatrix cov 
) const

Clone parameters.

Definition at line 51 of file CompositeAlignmentParameters.cc.

References HLT_2023v12_cff::cap, components(), and CompositeAlignmentParameters().

52  {
54 
55  return cap;
56 }
CompositeAlignmentParameters(const AlgebraicVector &par, const AlgebraicSymMatrix &cov, const Components &comp)
constructors
Components components() const
Get vector of alignable components.

◆ clone() [2/2]

CompositeAlignmentParameters * CompositeAlignmentParameters::clone ( const AlgebraicVector par,
const AlgebraicSymMatrix cov,
const AlignableDetToAlignableMap alimap,
const Aliposmap aliposmap,
const Alilenmap alilenmap 
) const

Clone parameters.

Definition at line 59 of file CompositeAlignmentParameters.cc.

References HLT_2023v12_cff::cap, components(), and CompositeAlignmentParameters().

63  {
65  new CompositeAlignmentParameters(par, cov, components(), alimap, aliposmap, alilenmap);
66 
67  return cap;
68 }
CompositeAlignmentParameters(const AlgebraicVector &par, const AlgebraicSymMatrix &cov, const Components &comp)
constructors
Components components() const
Get vector of alignable components.

◆ components()

CompositeAlignmentParameters::Components CompositeAlignmentParameters::components ( ) const

Get vector of alignable components.

Definition at line 71 of file CompositeAlignmentParameters.cc.

References theComponents.

Referenced by clone(), and AlignmentParameterStore::updateParameters().

71 { return theComponents; }
Components theComponents
Vector of alignable components.

◆ convert()

void CompositeAlignmentParameters::convert ( const std::vector< AlignableDet *> &  input,
std::vector< AlignableDetOrUnitPtr > &  output 
) const
private

backward compatibility method to convert vectors from specific AlignableDet to more general AlignableDetOrUnitPtr

Definition at line 392 of file CompositeAlignmentParameters.cc.

References input, and convertSQLitetoXML_cfg::output.

Referenced by correctionTerm(), and derivatives().

393  {
394  output.clear();
395  output.reserve(input.size());
396 
397  std::vector<AlignableDet *>::const_iterator it, itEnd;
398  for (it = input.begin(), itEnd = input.end(); it != itEnd; ++it)
399  output.push_back(AlignableDetOrUnitPtr(*it));
400 }
static std::string const input
Definition: EdmProvDump.cc:50

◆ correctionTerm() [1/2]

AlgebraicVector CompositeAlignmentParameters::correctionTerm ( const std::vector< TrajectoryStateOnSurface > &  tsosvec,
const std::vector< AlignableDet *> &  alidetvec 
) const

for backward compatibility, use std::vector<AlignableDetOrUnitPtr>

Definition at line 94 of file CompositeAlignmentParameters.cc.

References convert().

95  {
96  std::vector<AlignableDetOrUnitPtr> detOrUnits;
97  this->convert(alidetvec, detOrUnits);
98 
99  return this->correctionTerm(tsosvec, detOrUnits);
100 }
void convert(const std::vector< AlignableDet *> &input, std::vector< AlignableDetOrUnitPtr > &output) const
AlgebraicVector correctionTerm(const std::vector< TrajectoryStateOnSurface > &tsosvec, const std::vector< AlignableDet *> &alidetvec) const
for backward compatibility, use std::vector<AlignableDetOrUnitPtr>

◆ correctionTerm() [2/2]

AlgebraicVector CompositeAlignmentParameters::correctionTerm ( const std::vector< TrajectoryStateOnSurface > &  tsosvec,
const std::vector< AlignableDetOrUnitPtr > &  alidetvec 
) const

Definition at line 103 of file CompositeAlignmentParameters.cc.

References alignableFromAlignableDet(), and CompositeAlignmentDerivativesExtractor::correctionTerm().

104  {
105  align::Alignables alivec;
106  for (std::vector<AlignableDetOrUnitPtr>::const_iterator it = alidetvec.begin(); it != alidetvec.end(); ++it)
107  alivec.push_back(alignableFromAlignableDet(*it));
108 
109  CompositeAlignmentDerivativesExtractor extractor(alivec, alidetvec, tsosvec);
110  return extractor.correctionTerm();
111 }
std::vector< Alignable * > Alignables
Definition: Utilities.h:31
Alignable * alignableFromAlignableDet(const AlignableDetOrUnitPtr &adet) const
Get relevant Alignable from AlignableDet.

◆ covariance()

const AlgebraicSymMatrix& CompositeAlignmentParameters::covariance ( void  ) const
inline

Get parameter covariance matrix.

Definition at line 62 of file CompositeAlignmentParameters.h.

References theData.

Referenced by AlignmentParameterStore::updateParameters().

62 { return theData->covariance(); }

◆ covarianceSubset() [1/2]

AlgebraicSymMatrix CompositeAlignmentParameters::covarianceSubset ( const align::Alignables vec) const

Extract covariance matrix for subset of alignables.

Definition at line 252 of file CompositeAlignmentParameters.cc.

References extractAlignables(), extractPositionAndLength(), mps_fire::result, EgammaValidation_Wenu_cff::sel, and theData.

252  {
253  const auto &sel = extractAlignables(vec);
254 
255  const unsigned int nali = sel.size();
256  int ndim = 0;
257 
258  std::vector<int> posvec;
259  std::vector<int> lenvec;
260 
261  posvec.reserve(nali);
262  lenvec.reserve(nali);
263 
264  // iterate over input vectors of alignables
265  // to determine dimensions of result matrix
266  if (!extractPositionAndLength(sel, posvec, lenvec, ndim))
267  return AlgebraicSymMatrix();
268 
269  // OK, let's do the real work now
271 
272  int resi = 0;
273  for (unsigned int iali = 0; iali < nali; ++iali) {
274  int posi = posvec[iali];
275  int leni = lenvec[iali];
276 
277  int resj = 0;
278  for (unsigned int jali = 0; jali <= iali; ++jali) {
279  int posj = posvec[jali];
280  int lenj = lenvec[jali];
281 
282  for (int ir = 0; ir < leni; ++ir)
283  for (int ic = 0; ic < lenj; ++ic)
284  result[resi + ir][resj + ic] = theData->covariance()[posi - 1 + ir][posj - 1 + ic];
285 
286  resj += lenj;
287  }
288  resi += leni;
289  }
290 
291  return result;
292 }
bool extractPositionAndLength(const align::Alignables &alignables, std::vector< int > &posvec, std::vector< int > &lenvec, int &length) const
Extract position and length of parameters for a subset of Alignables.
CLHEP::HepSymMatrix AlgebraicSymMatrix
align::Alignables extractAlignables(const align::Alignables &) const
Return vector of alignables without multiple occurences.

◆ covarianceSubset() [2/2]

AlgebraicMatrix CompositeAlignmentParameters::covarianceSubset ( const align::Alignables veci,
const align::Alignables vecj 
) const

Extract covariance matrix elements between two subsets of alignables.

Definition at line 296 of file CompositeAlignmentParameters.cc.

References extractAlignables(), extractPositionAndLength(), mps_fire::result, and theData.

297  {
298  const auto &seli = extractAlignables(veci);
299  const auto &selj = extractAlignables(vecj);
300 
301  int ndimi = 0;
302  int ndimj = 0;
303 
304  std::vector<int> posveci;
305  std::vector<int> lenveci;
306  std::vector<int> posvecj;
307  std::vector<int> lenvecj;
308 
309  posveci.reserve(seli.size());
310  lenveci.reserve(seli.size());
311  posvecj.reserve(selj.size());
312  lenvecj.reserve(selj.size());
313 
314  // iterate over input vectors of alignables
315  // to determine dimensions of result matrix
316  if (!extractPositionAndLength(seli, posveci, lenveci, ndimi))
317  return AlgebraicSymMatrix();
318  // vector vecj
319  if (!extractPositionAndLength(selj, posvecj, lenvecj, ndimj))
320  return AlgebraicSymMatrix();
321 
322  // OK, let's do the real work now
323  AlgebraicMatrix result(ndimi, ndimj);
324 
325  int resi = 0;
326  for (unsigned int iali = 0; iali < seli.size(); ++iali) {
327  int posi = posveci[iali];
328  int leni = lenveci[iali];
329 
330  int resj = 0;
331  for (unsigned int jali = 0; jali < selj.size(); ++jali) {
332  int posj = posvecj[jali];
333  int lenj = lenvecj[jali];
334 
335  for (int ir = 0; ir < leni; ++ir)
336  for (int ic = 0; ic < lenj; ++ic)
337  result[resi + ir][resj + ic] = theData->covariance()[posi - 1 + ir][posj - 1 + ic];
338 
339  resj += lenj;
340  }
341  resi += leni;
342  }
343 
344  return result;
345 }
bool extractPositionAndLength(const align::Alignables &alignables, std::vector< int > &posvec, std::vector< int > &lenvec, int &length) const
Extract position and length of parameters for a subset of Alignables.
CLHEP::HepMatrix AlgebraicMatrix
CLHEP::HepSymMatrix AlgebraicSymMatrix
align::Alignables extractAlignables(const align::Alignables &) const
Return vector of alignables without multiple occurences.

◆ derivatives() [1/3]

AlgebraicMatrix CompositeAlignmentParameters::derivatives ( const TrajectoryStateOnSurface tsos,
const AlignableDetOrUnitPtr alidet 
) const

Get derivatives.

Definition at line 128 of file CompositeAlignmentParameters.cc.

Referenced by derivatives(), and selectedDerivatives().

129  {
130  std::vector<TrajectoryStateOnSurface> tsosvec;
131  std::vector<AlignableDetOrUnitPtr> alidetvec;
132  tsosvec.push_back(tsos);
133  alidetvec.push_back(alidet);
134  return derivatives(tsosvec, alidetvec);
135 }
AlgebraicMatrix derivatives(const TrajectoryStateOnSurface &tsos, const AlignableDetOrUnitPtr &alidet) const
Get derivatives.

◆ derivatives() [2/3]

AlgebraicMatrix CompositeAlignmentParameters::derivatives ( const std::vector< TrajectoryStateOnSurface > &  tsosvec,
const std::vector< AlignableDet *> &  alidetvec 
) const

for backward compatibility, use std::vector<AlignableDetOrUnitPtr>

Definition at line 75 of file CompositeAlignmentParameters.cc.

References convert(), and derivatives().

76  {
77  std::vector<AlignableDetOrUnitPtr> detOrUnits;
78  this->convert(alidetvec, detOrUnits);
79 
80  return this->derivatives(tsosvec, detOrUnits);
81 }
void convert(const std::vector< AlignableDet *> &input, std::vector< AlignableDetOrUnitPtr > &output) const
AlgebraicMatrix derivatives(const TrajectoryStateOnSurface &tsos, const AlignableDetOrUnitPtr &alidet) const
Get derivatives.

◆ derivatives() [3/3]

AlgebraicMatrix CompositeAlignmentParameters::derivatives ( const std::vector< TrajectoryStateOnSurface > &  tsosvec,
const std::vector< AlignableDetOrUnitPtr > &  alidetvec 
) const

Definition at line 83 of file CompositeAlignmentParameters.cc.

References alignableFromAlignableDet(), and CompositeAlignmentDerivativesExtractor::derivatives().

84  {
85  align::Alignables alivec;
86  for (std::vector<AlignableDetOrUnitPtr>::const_iterator it = alidetvec.begin(); it != alidetvec.end(); ++it)
87  alivec.push_back(alignableFromAlignableDet(*it));
88 
89  CompositeAlignmentDerivativesExtractor extractor(alivec, alidetvec, tsosvec);
90  return extractor.derivatives();
91 }
std::vector< Alignable * > Alignables
Definition: Utilities.h:31
Alignable * alignableFromAlignableDet(const AlignableDetOrUnitPtr &adet) const
Get relevant Alignable from AlignableDet.

◆ derivativesLegacy() [1/2]

AlgebraicMatrix CompositeAlignmentParameters::derivativesLegacy ( const TrajectoryStateOnSurface tsos,
AlignableDet alidet 
) const

deprecated due to 'AlignableDet*' interface (legacy code should not be needed anymore)

Definition at line 190 of file CompositeAlignmentParameters.cc.

Referenced by selectedDerivativesLegacy().

191  {
192  std::vector<TrajectoryStateOnSurface> tsosvec;
193  std::vector<AlignableDet *> alidetvec;
194  tsosvec.push_back(tsos);
195  alidetvec.push_back(alidet);
196  return derivativesLegacy(tsosvec, alidetvec);
197 }
AlgebraicMatrix derivativesLegacy(const TrajectoryStateOnSurface &tsos, AlignableDet *alidet) const

◆ derivativesLegacy() [2/2]

AlgebraicMatrix CompositeAlignmentParameters::derivativesLegacy ( const std::vector< TrajectoryStateOnSurface > &  tsosvec,
const std::vector< AlignableDet *> &  alidetvec 
) const

deprecated due to 'AlignableDet*' interface (legacy code should not be needed anymore)

Definition at line 147 of file CompositeAlignmentParameters.cc.

References alignableFromAlignableDet(), Alignable::alignmentParameters(), and AlignmentParameters::selectedDerivatives().

148  {
149  // sanity check: length of parameter argument vectors must be equal
150  if (alidetvec.size() != tsosvec.size()) {
151  edm::LogError("BadArgument") << " Inconsistent length of argument vectors! ";
152  AlgebraicMatrix selderiv(1, 0);
153  return selderiv;
154  }
155 
156  std::vector<AlgebraicMatrix> vecderiv;
157  int nparam = 0;
158 
159  std::vector<TrajectoryStateOnSurface>::const_iterator itsos = tsosvec.begin();
160  for (std::vector<AlignableDet *>::const_iterator it = alidetvec.begin(); it != alidetvec.end(); ++it, ++itsos) {
161  AlignableDet *ad = (*it);
164  AlgebraicMatrix thisselderiv = ap->selectedDerivatives(*itsos, ad);
165  vecderiv.push_back(thisselderiv);
166  nparam += thisselderiv.num_row();
167  }
168 
169  int ipos = 1;
170  AlgebraicMatrix selderiv(nparam, 2);
171  for (std::vector<AlgebraicMatrix>::const_iterator imat = vecderiv.begin(); imat != vecderiv.end(); ++imat) {
172  const AlgebraicMatrix &thisselderiv = (*imat);
173  int npar = thisselderiv.num_row();
174  selderiv.sub(ipos, 1, thisselderiv);
175  ipos += npar;
176  }
177 
178  return selderiv;
179 }
AlignmentParameters * alignmentParameters() const
Get the AlignmentParameters.
Definition: Alignable.h:58
Log< level::Error, false > LogError
CLHEP::HepMatrix AlgebraicMatrix
virtual AlgebraicMatrix selectedDerivatives(const TrajectoryStateOnSurface &tsos, const AlignableDetOrUnitPtr &alidet) const
Alignable * alignableFromAlignableDet(const AlignableDetOrUnitPtr &adet) const
Get relevant Alignable from AlignableDet.

◆ extractAlignables()

align::Alignables CompositeAlignmentParameters::extractAlignables ( const align::Alignables alignables) const
private

Return vector of alignables without multiple occurences.

Definition at line 380 of file CompositeAlignmentParameters.cc.

References spr::find(), and mps_fire::result.

Referenced by covarianceSubset(), and parameterSubset().

380  {
382 
383  for (const auto &itA : alignables) {
384  if (std::find(result.begin(), result.end(), itA) == result.end())
385  result.push_back(itA);
386  }
387 
388  return result;
389 }
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:19
std::vector< Alignable * > Alignables
Definition: Utilities.h:31

◆ extractPositionAndLength()

bool CompositeAlignmentParameters::extractPositionAndLength ( const align::Alignables alignables,
std::vector< int > &  posvec,
std::vector< int > &  lenvec,
int &  length 
) const
private

Extract position and length of parameters for a subset of Alignables.

Definition at line 349 of file CompositeAlignmentParameters.cc.

References spr::find(), theAlilenmap, theAliposmap, and theComponents.

Referenced by covarianceSubset(), and parameterSubset().

352  {
353  length = 0;
354 
355  for (const auto &it : alignables) {
356  // check if in components
357  if (std::find(theComponents.begin(), theComponents.end(), it) == theComponents.end()) {
358  edm::LogError("NotFound") << "@SUB=CompositeAlignmentParameters::extractPositionAndLength"
359  << "Alignable not found in components!";
360  return false;
361  }
362 
363  // get pos/length
364  Aliposmap::const_iterator iposmap = theAliposmap.find(it);
365  Alilenmap::const_iterator ilenmap = theAlilenmap.find(it);
366  if (iposmap == theAliposmap.end() || ilenmap == theAlilenmap.end()) {
367  edm::LogError("NotFound") << "@SUB=CompositeAlignmentParameters::extractPositionAndLength"
368  << "position/length not found for Alignable in maps!";
369  return false;
370  }
371  posvec.push_back(iposmap->second);
372  lenvec.push_back(ilenmap->second);
373  length += ilenmap->second;
374  }
375 
376  return true;
377 }
Log< level::Error, false > LogError
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:19
Aliposmap theAliposmap
Maps to find parameters/covariance elements for given alignable.
Components theComponents
Vector of alignable components.

◆ parameters()

const AlgebraicVector& CompositeAlignmentParameters::parameters ( void  ) const
inline

Get alignment parameters.

Definition at line 59 of file CompositeAlignmentParameters.h.

References theData.

Referenced by AlignmentParameterStore::updateParameters().

59 { return theData->parameters(); }

◆ parameterSubset()

AlgebraicVector CompositeAlignmentParameters::parameterSubset ( const align::Alignables vec) const

Extract parameters for subset of alignables.

Definition at line 217 of file CompositeAlignmentParameters.cc.

References extractAlignables(), extractPositionAndLength(), mps_fire::result, EgammaValidation_Wenu_cff::sel, and theData.

217  {
218  const auto &sel = extractAlignables(vec);
219 
220  const unsigned int nali = sel.size();
221  int ndim = 0;
222 
223  std::vector<int> posvec;
224  std::vector<int> lenvec;
225 
226  posvec.reserve(nali);
227  lenvec.reserve(nali);
228 
229  // iterate over input vector of alignables to determine size of result vector
230  if (!extractPositionAndLength(sel, posvec, lenvec, ndim))
231  return AlgebraicVector();
232 
233  // OK, let's do the real work now
234  AlgebraicVector result(ndim);
235 
236  int resi = 0;
237  for (unsigned int iali = 0; iali < nali; ++iali) {
238  int posi = posvec[iali];
239  int leni = lenvec[iali];
240 
241  for (int ir = 0; ir < leni; ++ir)
242  result[resi + ir] = theData->parameters()[posi - 1 + ir];
243 
244  resi += leni;
245  }
246 
247  return result;
248 }
bool extractPositionAndLength(const align::Alignables &alignables, std::vector< int > &posvec, std::vector< int > &lenvec, int &length) const
Extract position and length of parameters for a subset of Alignables.
CLHEP::HepVector AlgebraicVector
align::Alignables extractAlignables(const align::Alignables &) const
Return vector of alignables without multiple occurences.

◆ selectedDerivatives() [1/3]

AlgebraicMatrix CompositeAlignmentParameters::selectedDerivatives ( const TrajectoryStateOnSurface tsos,
const AlignableDetOrUnitPtr alidet 
) const

Get derivatives for selected alignables.

Definition at line 139 of file CompositeAlignmentParameters.cc.

References derivatives().

140  {
141  return derivatives(tsos, alidet);
142 }
AlgebraicMatrix derivatives(const TrajectoryStateOnSurface &tsos, const AlignableDetOrUnitPtr &alidet) const
Get derivatives.

◆ selectedDerivatives() [2/3]

AlgebraicMatrix CompositeAlignmentParameters::selectedDerivatives ( const std::vector< TrajectoryStateOnSurface > &  tsosvec,
const std::vector< AlignableDet *> &  alidetvec 
) const

for backward compatibility, use std::vector<AlignableDetOrUnitPtr>

Definition at line 115 of file CompositeAlignmentParameters.cc.

References derivatives().

116  {
117  return derivatives(tsosvec, alidetvec);
118 }
AlgebraicMatrix derivatives(const TrajectoryStateOnSurface &tsos, const AlignableDetOrUnitPtr &alidet) const
Get derivatives.

◆ selectedDerivatives() [3/3]

AlgebraicMatrix CompositeAlignmentParameters::selectedDerivatives ( const std::vector< TrajectoryStateOnSurface > &  tsosvec,
const std::vector< AlignableDetOrUnitPtr > &  alidetvec 
) const

Definition at line 121 of file CompositeAlignmentParameters.cc.

References derivatives().

122  {
123  return derivatives(tsosvec, alidetvec);
124 }
AlgebraicMatrix derivatives(const TrajectoryStateOnSurface &tsos, const AlignableDetOrUnitPtr &alidet) const
Get derivatives.

◆ selectedDerivativesLegacy() [1/2]

AlgebraicMatrix CompositeAlignmentParameters::selectedDerivativesLegacy ( const TrajectoryStateOnSurface tsos,
AlignableDet alidet 
) const

deprecated due to 'AlignableDet*' interface (legacy code should not be needed anymore)

Definition at line 201 of file CompositeAlignmentParameters.cc.

References derivativesLegacy().

202  {
203  return derivativesLegacy(tsos, alidet);
204 }
AlgebraicMatrix derivativesLegacy(const TrajectoryStateOnSurface &tsos, AlignableDet *alidet) const

◆ selectedDerivativesLegacy() [2/2]

AlgebraicMatrix CompositeAlignmentParameters::selectedDerivativesLegacy ( const std::vector< TrajectoryStateOnSurface > &  tsosvec,
const std::vector< AlignableDet *> &  alidetvec 
) const

deprecated due to 'AlignableDet*' interface (legacy code should not be needed anymore)

Definition at line 183 of file CompositeAlignmentParameters.cc.

References derivativesLegacy().

184  {
185  return derivativesLegacy(tsosvec, alidetvec);
186 }
AlgebraicMatrix derivativesLegacy(const TrajectoryStateOnSurface &tsos, AlignableDet *alidet) const

Member Data Documentation

◆ theAlignableDetToAlignableMap

AlignableDetToAlignableMap CompositeAlignmentParameters::theAlignableDetToAlignableMap
private

Relate Alignable's and AlignableDet's.

Definition at line 145 of file CompositeAlignmentParameters.h.

Referenced by alignableFromAlignableDet().

◆ theAlilenmap

Alilenmap CompositeAlignmentParameters::theAlilenmap
private

Definition at line 149 of file CompositeAlignmentParameters.h.

Referenced by extractPositionAndLength().

◆ theAliposmap

Aliposmap CompositeAlignmentParameters::theAliposmap
private

Maps to find parameters/covariance elements for given alignable.

Definition at line 148 of file CompositeAlignmentParameters.h.

Referenced by extractPositionAndLength().

◆ theComponents

Components CompositeAlignmentParameters::theComponents
private

Vector of alignable components.

Definition at line 142 of file CompositeAlignmentParameters.h.

Referenced by components(), and extractPositionAndLength().

◆ theData

DataContainer CompositeAlignmentParameters::theData
protected