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 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 std::vector< Alignable * > Components
 vector of alignable components More...
 
typedef
AlignmentParametersData::DataContainer 
DataContainer
 

Public Member Functions

AlignablealignableFromAlignableDet (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 std::vector< Alignable * > &vec) const
 Extract covariance matrix for subset of alignables. More...
 
AlgebraicMatrix covarianceSubset (const std::vector< Alignable * > &veci, const std::vector< Alignable * > &vecj) 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
 deprecated due to 'AlignableDet*' interface (legacy code should not be needed anymore) More...
 
AlgebraicMatrix derivativesLegacy (const std::vector< TrajectoryStateOnSurface > &tsosvec, const std::vector< AlignableDet * > &alidetvec) const
 deprecated due to 'AlignableDet*' interface (legacy code should not be needed anymore) More...
 
const AlgebraicVectorparameters () const
 Get alignment parameters. More...
 
AlgebraicVector parameterSubset (const std::vector< Alignable * > &vec) 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
 deprecated due to 'AlignableDet*' interface (legacy code should not be needed anymore) More...
 
AlgebraicMatrix selectedDerivativesLegacy (const std::vector< TrajectoryStateOnSurface > &tsosvec, const std::vector< AlignableDet * > &alidetvec) const
 deprecated due to 'AlignableDet*' interface (legacy code should not be needed anymore) More...
 
virtual ~CompositeAlignmentParameters ()
 destructor More...
 

Protected Attributes

DataContainer theData
 

Private Member Functions

void convert (const std::vector< AlignableDet * > &input, std::vector< AlignableDetOrUnitPtr > &output) const
 
std::vector< Alignable * > extractAlignables (const std::vector< Alignable * > &alignables) const
 Return vector of alignables without multiple occurences. More...
 
bool extractPositionAndLength (const std::vector< Alignable * > &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

Definition at line 35 of file CompositeAlignmentParameters.h.

Definition at line 37 of file CompositeAlignmentParameters.h.

Definition at line 36 of file CompositeAlignmentParameters.h.

vector of alignable components

Definition at line 33 of file CompositeAlignmentParameters.h.

Definition at line 39 of file CompositeAlignmentParameters.h.

Constructor & Destructor Documentation

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 19 of file CompositeAlignmentParameters.cc.

Referenced by clone().

20  :
22  theComponents(comp)
23 {}
AlignmentParametersData::DataContainer DataContainer
Components theComponents
Vector of alignable components.
const double par[8 *NPar][4]
CompositeAlignmentParameters::CompositeAlignmentParameters ( const AlgebraicVector par,
const AlgebraicSymMatrix cov,
const Components comp,
const AlignableDetToAlignableMap alimap,
const Aliposmap aliposmap,
const Alilenmap alilenmap 
)

Definition at line 28 of file CompositeAlignmentParameters.cc.

30  :
32  theComponents(comp) ,
34  theAliposmap(aliposmap),
35  theAlilenmap(alilenmap)
36 {}
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.
const double par[8 *NPar][4]
CompositeAlignmentParameters::CompositeAlignmentParameters ( const DataContainer data,
const Components comp,
const AlignableDetToAlignableMap alimap,
const Aliposmap aliposmap,
const Alilenmap alilenmap 
)

Definition at line 41 of file CompositeAlignmentParameters.cc.

43  :
44  theData(data),
45  theComponents(comp) ,
47  theAliposmap(aliposmap),
48  theAlilenmap(alilenmap)
49 {}
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::~CompositeAlignmentParameters ( )
virtual

destructor

Definition at line 53 of file CompositeAlignmentParameters.cc.

54 {}

Member Function Documentation

Alignable * CompositeAlignmentParameters::alignableFromAlignableDet ( AlignableDetOrUnitPtr  adet) const

Get relevant Alignable from AlignableDet.

Definition at line 261 of file CompositeAlignmentParameters.cc.

References theAlignableDetToAlignableMap.

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

262 {
263 
264  AlignableDetToAlignableMap::const_iterator iali =
266  if ( iali!=theAlignableDetToAlignableMap.end() ) return (*iali).second;
267  else return 0;
268 
269 }
AlignableDetToAlignableMap theAlignableDetToAlignableMap
Relate Alignable&#39;s and AlignableDet&#39;s.
CompositeAlignmentParameters * CompositeAlignmentParameters::clone ( const AlgebraicVector par,
const AlgebraicSymMatrix cov 
) const

Clone parameters.

Definition at line 59 of file CompositeAlignmentParameters.cc.

References components(), and CompositeAlignmentParameters().

Referenced by SingleTrajectoryUpdator::process().

61 {
64 
65  return cap;
66 }
Components components() const
Get vector of alignable components.
CompositeAlignmentParameters(const AlgebraicVector &par, const AlgebraicSymMatrix &cov, const Components &comp)
constructors
const double par[8 *NPar][4]
CompositeAlignmentParameters * CompositeAlignmentParameters::clone ( const AlgebraicVector par,
const AlgebraicSymMatrix cov,
const AlignableDetToAlignableMap alimap,
const Aliposmap aliposmap,
const Alilenmap alilenmap 
) const

Clone parameters.

Definition at line 70 of file CompositeAlignmentParameters.cc.

References components(), and CompositeAlignmentParameters().

75 {
77  new CompositeAlignmentParameters(par,cov,components(),alimap,aliposmap,alilenmap);
78 
79  return cap;
80 }
Components components() const
Get vector of alignable components.
CompositeAlignmentParameters(const AlgebraicVector &par, const AlgebraicSymMatrix &cov, const Components &comp)
constructors
const double par[8 *NPar][4]
CompositeAlignmentParameters::Components CompositeAlignmentParameters::components ( ) const

Get vector of alignable components.

Definition at line 84 of file CompositeAlignmentParameters.cc.

References theComponents.

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

85 {
86  return theComponents;
87 }
Components theComponents
Vector of alignable components.
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 468 of file CompositeAlignmentParameters.cc.

Referenced by correctionTerm(), and derivatives().

470 {
471  output.clear();
472  output.reserve(input.size());
473 
474  std::vector<AlignableDet*>::const_iterator it, itEnd;
475  for (it = input.begin(), itEnd = input.end(); it != itEnd; ++it)
476  output.push_back(AlignableDetOrUnitPtr(*it));
477 }
tuple input
Definition: collect_tpl.py:10
AlgebraicVector CompositeAlignmentParameters::correctionTerm ( const std::vector< TrajectoryStateOnSurface > &  tsosvec,
const std::vector< AlignableDet * > &  alidetvec 
) const

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

Definition at line 116 of file CompositeAlignmentParameters.cc.

References convert().

118 {
119  std::vector<AlignableDetOrUnitPtr> detOrUnits;
120  this->convert(alidetvec, detOrUnits);
121 
122  return this->correctionTerm(tsosvec, detOrUnits);
123 }
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&lt;AlignableDetOrUnitPtr&gt;
AlgebraicVector CompositeAlignmentParameters::correctionTerm ( const std::vector< TrajectoryStateOnSurface > &  tsosvec,
const std::vector< AlignableDetOrUnitPtr > &  alidetvec 
) const

Definition at line 127 of file CompositeAlignmentParameters.cc.

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

129 {
130  std::vector<Alignable*> alivec;
131  for (std::vector<AlignableDetOrUnitPtr>::const_iterator it=alidetvec.begin(); it!=alidetvec.end(); ++it )
132  alivec.push_back(alignableFromAlignableDet(*it));
133 
134  CompositeAlignmentDerivativesExtractor extractor(alivec,alidetvec,tsosvec);
135  return extractor.correctionTerm();
136 }
Alignable * alignableFromAlignableDet(AlignableDetOrUnitPtr adet) const
Get relevant Alignable from AlignableDet.
const AlgebraicSymMatrix& CompositeAlignmentParameters::covariance ( void  ) const
inline

Get parameter covariance matrix.

Definition at line 61 of file CompositeAlignmentParameters.h.

References theData.

Referenced by AlignmentParameterStore::updateParameters().

61 { return theData->covariance();}
AlgebraicSymMatrix CompositeAlignmentParameters::covarianceSubset ( const std::vector< Alignable * > &  vec) const

Extract covariance matrix for subset of alignables.

Definition at line 312 of file CompositeAlignmentParameters.cc.

References extractAlignables(), extractPositionAndLength(), query::result, runTheMatrix::sel, and theData.

Referenced by SingleTrajectoryUpdator::process().

313 {
314  const std::vector< Alignable* > sel = extractAlignables( vec );
315 
316  const unsigned int nali = sel.size();
317  int ndim = 0;
318 
319  std::vector<int> posvec;
320  std::vector<int> lenvec;
321 
322  posvec.reserve( nali );
323  lenvec.reserve( nali );
324 
325  // iterate over input vectors of alignables
326  // to determine dimensions of result matrix
327  if ( !extractPositionAndLength( sel, posvec, lenvec, ndim ) ) return AlgebraicSymMatrix();
328 
329  // OK, let's do the real work now
330  AlgebraicSymMatrix result( ndim );
331 
332  int resi = 0;
333  for ( unsigned int iali = 0; iali < nali; ++iali )
334  {
335  int posi = posvec[iali];
336  int leni = lenvec[iali];
337 
338  int resj = 0;
339  for ( unsigned int jali = 0; jali <= iali; ++jali )
340  {
341  int posj = posvec[jali];
342  int lenj = lenvec[jali];
343 
344  for ( int ir = 0; ir < leni; ++ir )
345  for ( int ic = 0; ic < lenj; ++ic )
346  result[resi+ir][resj+ic] = theData->covariance()[posi-1+ir][posj-1+ic];
347 
348  resj += lenj;
349  }
350  resi += leni;
351  }
352 
353  return result;
354 }
bool extractPositionAndLength(const std::vector< Alignable * > &alignables, std::vector< int > &posvec, std::vector< int > &lenvec, int &length) const
Extract position and length of parameters for a subset of Alignables.
std::vector< Alignable * > extractAlignables(const std::vector< Alignable * > &alignables) const
Return vector of alignables without multiple occurences.
tuple result
Definition: query.py:137
CLHEP::HepSymMatrix AlgebraicSymMatrix
AlgebraicMatrix CompositeAlignmentParameters::covarianceSubset ( const std::vector< Alignable * > &  veci,
const std::vector< Alignable * > &  vecj 
) const

Extract covariance matrix elements between two subsets of alignables.

Definition at line 360 of file CompositeAlignmentParameters.cc.

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

362 {
363  const std::vector< Alignable* > seli = extractAlignables( veci );
364  const std::vector< Alignable* > selj = extractAlignables( vecj );
365 
366  int ndimi=0;
367  int ndimj=0;
368 
369  std::vector<int> posveci;
370  std::vector<int> lenveci;
371  std::vector<int> posvecj;
372  std::vector<int> lenvecj;
373 
374  posveci.reserve( seli.size() );
375  lenveci.reserve( seli.size() );
376  posvecj.reserve( selj.size() );
377  lenvecj.reserve( selj.size() );
378 
379  // iterate over input vectors of alignables
380  // to determine dimensions of result matrix
381  if ( !extractPositionAndLength( seli, posveci, lenveci, ndimi ) ) return AlgebraicSymMatrix();
382  // vector vecj
383  if ( !extractPositionAndLength( selj, posvecj, lenvecj, ndimj ) ) return AlgebraicSymMatrix();
384 
385  // OK, let's do the real work now
386  AlgebraicMatrix result( ndimi, ndimj );
387 
388  int resi = 0;
389  for ( unsigned int iali = 0; iali < seli.size(); ++iali )
390  {
391  int posi = posveci[iali];
392  int leni = lenveci[iali];
393 
394  int resj = 0;
395  for ( unsigned int jali = 0; jali < selj.size(); ++jali )
396  {
397  int posj = posvecj[jali];
398  int lenj = lenvecj[jali];
399 
400  for ( int ir = 0; ir < leni; ++ir )
401  for ( int ic = 0; ic < lenj; ++ic )
402  result[resi+ir][resj+ic] = theData->covariance()[posi-1+ir][posj-1+ic];
403 
404  resj += lenj;
405  }
406  resi += leni;
407  }
408 
409  return result;
410 }
bool extractPositionAndLength(const std::vector< Alignable * > &alignables, std::vector< int > &posvec, std::vector< int > &lenvec, int &length) const
Extract position and length of parameters for a subset of Alignables.
std::vector< Alignable * > extractAlignables(const std::vector< Alignable * > &alignables) const
Return vector of alignables without multiple occurences.
CLHEP::HepMatrix AlgebraicMatrix
tuple result
Definition: query.py:137
CLHEP::HepSymMatrix AlgebraicSymMatrix
AlgebraicMatrix CompositeAlignmentParameters::derivatives ( const TrajectoryStateOnSurface tsos,
const AlignableDetOrUnitPtr alidet 
) const

Get derivatives.

Definition at line 158 of file CompositeAlignmentParameters.cc.

Referenced by derivatives(), and selectedDerivatives().

160 {
161  std::vector<TrajectoryStateOnSurface> tsosvec;
162  std::vector<AlignableDetOrUnitPtr> alidetvec;
163  tsosvec.push_back(tsos);
164  alidetvec.push_back(alidet);
165  return derivatives(tsosvec,alidetvec);
166 }
AlgebraicMatrix derivatives(const TrajectoryStateOnSurface &tsos, const AlignableDetOrUnitPtr &alidet) const
Get derivatives.
AlgebraicMatrix CompositeAlignmentParameters::derivatives ( const std::vector< TrajectoryStateOnSurface > &  tsosvec,
const std::vector< AlignableDet * > &  alidetvec 
) const

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

Definition at line 93 of file CompositeAlignmentParameters.cc.

References convert(), and derivatives().

95 {
96  std::vector<AlignableDetOrUnitPtr> detOrUnits;
97  this->convert(alidetvec, detOrUnits);
98 
99  return this->derivatives(tsosvec, detOrUnits);
100 }
void convert(const std::vector< AlignableDet * > &input, std::vector< AlignableDetOrUnitPtr > &output) const
AlgebraicMatrix derivatives(const TrajectoryStateOnSurface &tsos, const AlignableDetOrUnitPtr &alidet) const
Get derivatives.
AlgebraicMatrix CompositeAlignmentParameters::derivatives ( const std::vector< TrajectoryStateOnSurface > &  tsosvec,
const std::vector< AlignableDetOrUnitPtr > &  alidetvec 
) const

Definition at line 103 of file CompositeAlignmentParameters.cc.

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

105 {
106  std::vector<Alignable*> alivec;
107  for (std::vector<AlignableDetOrUnitPtr>::const_iterator it=alidetvec.begin(); it!=alidetvec.end(); ++it)
108  alivec.push_back(alignableFromAlignableDet(*it));
109 
110  CompositeAlignmentDerivativesExtractor extractor(alivec,alidetvec,tsosvec);
111  return extractor.derivatives();
112 }
Alignable * alignableFromAlignableDet(AlignableDetOrUnitPtr adet) const
Get relevant Alignable from AlignableDet.
AlgebraicMatrix CompositeAlignmentParameters::derivativesLegacy ( const TrajectoryStateOnSurface tsos,
AlignableDet alidet 
) const

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

Definition at line 236 of file CompositeAlignmentParameters.cc.

Referenced by selectedDerivativesLegacy().

238 {
239  std::vector<TrajectoryStateOnSurface> tsosvec;
240  std::vector<AlignableDet*> alidetvec;
241  tsosvec.push_back(tsos);
242  alidetvec.push_back(alidet);
243  return derivativesLegacy(tsosvec,alidetvec);
244 
245 }
AlgebraicMatrix derivativesLegacy(const TrajectoryStateOnSurface &tsos, AlignableDet *alidet) const
deprecated due to &#39;AlignableDet*&#39; interface (legacy code should not be needed anymore) ...
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 182 of file CompositeAlignmentParameters.cc.

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

184 {
185  // sanity check: length of parameter argument vectors must be equal
186  if (alidetvec.size() != tsosvec.size())
187  {
188  edm::LogError("BadArgument") << " Inconsistent length of argument vectors! ";
189  AlgebraicMatrix selderiv(1,0);
190  return selderiv;
191  }
192 
193  std::vector<AlgebraicMatrix> vecderiv;
194  int nparam=0;
195 
196  std::vector<TrajectoryStateOnSurface>::const_iterator itsos=tsosvec.begin();
197  for( std::vector<AlignableDet*>::const_iterator it=alidetvec.begin();
198  it!=alidetvec.end(); ++it, ++itsos )
199  {
200  AlignableDet* ad = (*it);
203  AlgebraicMatrix thisselderiv = ap->selectedDerivatives(*itsos,ad);
204  vecderiv.push_back(thisselderiv);
205  nparam += thisselderiv.num_row();
206  }
207 
208  int ipos=1;
209  AlgebraicMatrix selderiv(nparam,2);
210  for ( std::vector<AlgebraicMatrix>::const_iterator imat=vecderiv.begin();
211  imat!=vecderiv.end(); ++imat )
212  {
213  AlgebraicMatrix thisselderiv=(*imat);
214  int npar=thisselderiv.num_row();
215  selderiv.sub(ipos,1,thisselderiv);
216  ipos += npar;
217  }
218 
219  return selderiv;
220 }
Alignable * alignableFromAlignableDet(AlignableDetOrUnitPtr adet) const
Get relevant Alignable from AlignableDet.
AlignmentParameters * alignmentParameters() const
Get the AlignmentParameters.
Definition: Alignable.h:57
CLHEP::HepMatrix AlgebraicMatrix
virtual AlgebraicMatrix selectedDerivatives(const TrajectoryStateOnSurface &tsos, const AlignableDetOrUnitPtr &alidet) const
std::vector< Alignable * > CompositeAlignmentParameters::extractAlignables ( const std::vector< Alignable * > &  alignables) const
private

Return vector of alignables without multiple occurences.

Definition at line 453 of file CompositeAlignmentParameters.cc.

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

Referenced by covarianceSubset(), and parameterSubset().

454 {
455  std::vector< Alignable* > result;
456 
457  std::vector< Alignable* >::const_iterator itA, itEnd;
458  for ( itA = alignables.begin(), itEnd = alignables.end(); itA != itEnd; ++itA )
459  {
460  if ( std::find( result.begin(), result.end(), *itA ) == result.end() ) result.push_back( *itA );
461  }
462 
463  return result;
464 }
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:7
tuple result
Definition: query.py:137
bool CompositeAlignmentParameters::extractPositionAndLength ( const std::vector< Alignable * > &  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 416 of file CompositeAlignmentParameters.cc.

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

Referenced by covarianceSubset(), and parameterSubset().

420 {
421  length = 0;
422 
423  for ( std::vector<Alignable*>::const_iterator it = alignables.begin(); it != alignables.end(); ++it )
424  {
425  // check if in components
426  if ( std::find( theComponents.begin(), theComponents.end(), *it ) == theComponents.end() )
427  {
428  edm::LogError( "NotFound" ) << "@SUB=CompositeAlignmentParameters::extractPositionAndLength"
429  << "Alignable not found in components!";
430  return false;
431  }
432 
433  // get pos/length
434  Aliposmap::const_iterator iposmap = theAliposmap.find( *it );
435  Alilenmap::const_iterator ilenmap = theAlilenmap.find( *it );
436  if ( iposmap == theAliposmap.end() || ilenmap == theAlilenmap.end() )
437  {
438  edm::LogError( "NotFound" ) << "@SUB=CompositeAlignmentParameters::extractPositionAndLength"
439  << "position/length not found for Alignable in maps!";
440  return false;
441  }
442  posvec.push_back( iposmap->second );
443  lenvec.push_back( ilenmap->second );
444  length += ilenmap->second;
445  }
446 
447  return true;
448 }
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:7
Aliposmap theAliposmap
Maps to find parameters/covariance elements for given alignable.
Components theComponents
Vector of alignable components.
const AlgebraicVector& CompositeAlignmentParameters::parameters ( void  ) const
inline
AlgebraicVector CompositeAlignmentParameters::parameterSubset ( const std::vector< Alignable * > &  vec) const

Extract parameters for subset of alignables.

Definition at line 274 of file CompositeAlignmentParameters.cc.

References extractAlignables(), extractPositionAndLength(), query::result, runTheMatrix::sel, and theData.

275 {
276  const std::vector< Alignable* > sel = extractAlignables( vec );
277 
278  const unsigned int nali = sel.size();
279  int ndim = 0;
280 
281  std::vector<int> posvec;
282  std::vector<int> lenvec;
283 
284  posvec.reserve( nali );
285  lenvec.reserve( nali );
286 
287  // iterate over input vector of alignables to determine size of result vector
288  if ( !extractPositionAndLength( sel, posvec, lenvec, ndim ) ) return AlgebraicVector();
289 
290  // OK, let's do the real work now
291  AlgebraicVector result( ndim );
292 
293  int resi = 0;
294  for ( unsigned int iali = 0; iali < nali; ++iali )
295  {
296  int posi = posvec[iali];
297  int leni = lenvec[iali];
298 
299  for ( int ir = 0; ir < leni; ++ir )
300  result[resi+ir] = theData->parameters()[posi-1+ir];
301 
302  resi += leni;
303  }
304 
305  return result;
306 }
bool extractPositionAndLength(const std::vector< Alignable * > &alignables, std::vector< int > &posvec, std::vector< int > &lenvec, int &length) const
Extract position and length of parameters for a subset of Alignables.
std::vector< Alignable * > extractAlignables(const std::vector< Alignable * > &alignables) const
Return vector of alignables without multiple occurences.
tuple result
Definition: query.py:137
CLHEP::HepVector AlgebraicVector
AlgebraicMatrix CompositeAlignmentParameters::selectedDerivatives ( const TrajectoryStateOnSurface tsos,
const AlignableDetOrUnitPtr alidet 
) const

Get derivatives for selected alignables.

Definition at line 171 of file CompositeAlignmentParameters.cc.

References derivatives().

173 {
174  return derivatives(tsos,alidet);
175 }
AlgebraicMatrix derivatives(const TrajectoryStateOnSurface &tsos, const AlignableDetOrUnitPtr &alidet) const
Get derivatives.
AlgebraicMatrix CompositeAlignmentParameters::selectedDerivatives ( const std::vector< TrajectoryStateOnSurface > &  tsosvec,
const std::vector< AlignableDet * > &  alidetvec 
) const

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

Definition at line 141 of file CompositeAlignmentParameters.cc.

References derivatives().

143 {
144  return derivatives(tsosvec,alidetvec);
145 }
AlgebraicMatrix derivatives(const TrajectoryStateOnSurface &tsos, const AlignableDetOrUnitPtr &alidet) const
Get derivatives.
AlgebraicMatrix CompositeAlignmentParameters::selectedDerivatives ( const std::vector< TrajectoryStateOnSurface > &  tsosvec,
const std::vector< AlignableDetOrUnitPtr > &  alidetvec 
) const

Definition at line 149 of file CompositeAlignmentParameters.cc.

References derivatives().

151 {
152  return derivatives(tsosvec,alidetvec);
153 }
AlgebraicMatrix derivatives(const TrajectoryStateOnSurface &tsos, const AlignableDetOrUnitPtr &alidet) const
Get derivatives.
AlgebraicMatrix CompositeAlignmentParameters::selectedDerivativesLegacy ( const TrajectoryStateOnSurface tsos,
AlignableDet alidet 
) const

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

Definition at line 251 of file CompositeAlignmentParameters.cc.

References derivativesLegacy().

253 {
254  return derivativesLegacy(tsos,alidet);
255 }
AlgebraicMatrix derivativesLegacy(const TrajectoryStateOnSurface &tsos, AlignableDet *alidet) const
deprecated due to &#39;AlignableDet*&#39; interface (legacy code should not be needed anymore) ...
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 226 of file CompositeAlignmentParameters.cc.

References derivativesLegacy().

228 {
229  return derivativesLegacy(tsosvec,alidetvec);
230 }
AlgebraicMatrix derivativesLegacy(const TrajectoryStateOnSurface &tsos, AlignableDet *alidet) const
deprecated due to &#39;AlignableDet*&#39; interface (legacy code should not be needed anymore) ...

Member Data Documentation

AlignableDetToAlignableMap CompositeAlignmentParameters::theAlignableDetToAlignableMap
private

Relate Alignable's and AlignableDet's.

Definition at line 147 of file CompositeAlignmentParameters.h.

Referenced by alignableFromAlignableDet().

Alilenmap CompositeAlignmentParameters::theAlilenmap
private

Definition at line 151 of file CompositeAlignmentParameters.h.

Referenced by extractPositionAndLength().

Aliposmap CompositeAlignmentParameters::theAliposmap
private

Maps to find parameters/covariance elements for given alignable.

Definition at line 150 of file CompositeAlignmentParameters.h.

Referenced by extractPositionAndLength().

Components CompositeAlignmentParameters::theComponents
private

Vector of alignable components.

Definition at line 144 of file CompositeAlignmentParameters.h.

Referenced by components(), and extractPositionAndLength().

DataContainer CompositeAlignmentParameters::theData
protected