CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_2_7_hltpatch1/src/Alignment/CommonAlignmentParametrization/interface/CompositeAlignmentParameters.h

Go to the documentation of this file.
00001 #ifndef Alignment_CommonAlignmentParametrization_CompositeAlignmentParameters_h
00002 #define Alignment_CommonAlignmentParametrization_CompositeAlignmentParameters_h
00003 
00004 
00005 #include "Alignment/CommonAlignment/interface/AlignmentParametersData.h"
00006 #include "Alignment/CommonAlignment/interface/AlignableDetOrUnitPtr.h"
00007 #include "TrackingTools/TrajectoryState/interface/TrajectoryStateOnSurface.h"
00008 
00009 #include <map>
00010 #include <vector>
00011 
00023 
00024 class AlignableDet;
00025 class Alignable;
00026 
00027 class CompositeAlignmentParameters
00028 {
00029 
00030 public:
00031 
00033   typedef std::vector<Alignable*> Components;
00034 
00035   typedef std::map<AlignableDetOrUnitPtr,Alignable*> AlignableDetToAlignableMap;
00036   typedef std::map<Alignable*,int> Aliposmap;
00037   typedef std::map<Alignable*,int> Alilenmap;
00038 
00039   typedef AlignmentParametersData::DataContainer DataContainer;
00040 
00042 
00043   CompositeAlignmentParameters(const AlgebraicVector& par, const AlgebraicSymMatrix& cov,
00044                                const Components& comp);
00045 
00046   CompositeAlignmentParameters(const AlgebraicVector& par, const AlgebraicSymMatrix& cov,
00047                                const Components& comp, const AlignableDetToAlignableMap& alimap,
00048                                const Aliposmap& aliposmap, const Alilenmap& alilenmap);
00049 
00050   CompositeAlignmentParameters( const DataContainer& data,
00051                                 const Components& comp, const AlignableDetToAlignableMap& alimap,
00052                                 const Aliposmap& aliposmap, const Alilenmap& alilenmap);
00053 
00055   virtual ~CompositeAlignmentParameters();
00056 
00058   const AlgebraicVector& parameters() const { return theData->parameters();}
00059 
00061   const AlgebraicSymMatrix& covariance() const { return theData->covariance();}
00062 
00064   CompositeAlignmentParameters* clone( const AlgebraicVector& par,
00065                                        const AlgebraicSymMatrix& cov) const;
00066 
00068   CompositeAlignmentParameters* clone( const AlgebraicVector& par, const AlgebraicSymMatrix& cov,
00069                                        const AlignableDetToAlignableMap& alimap,
00070                                        const Aliposmap& aliposmap,
00071                                        const Alilenmap& alilenmap) const;
00072 
00074   Components components() const;
00075 
00077   AlgebraicMatrix derivatives( const TrajectoryStateOnSurface& tsos, const AlignableDetOrUnitPtr &alidet ) const;
00079   AlgebraicMatrix selectedDerivatives( const TrajectoryStateOnSurface& tsos, 
00080                                        const AlignableDetOrUnitPtr &alidet ) const;
00082   AlgebraicMatrix derivatives( const std::vector<TrajectoryStateOnSurface>& tsosvec, 
00083                                const std::vector<AlignableDet*>& alidetvec ) const;
00084   AlgebraicMatrix derivatives( const std::vector<TrajectoryStateOnSurface>& tsosvec,
00085                                const std::vector<AlignableDetOrUnitPtr>& alidetvec ) const;
00087   AlgebraicMatrix selectedDerivatives( const std::vector<TrajectoryStateOnSurface> &tsosvec,
00088                                        const std::vector<AlignableDet*> &alidetvec ) const;
00089   AlgebraicMatrix selectedDerivatives( const std::vector<TrajectoryStateOnSurface> &tsosvec,
00090                                        const std::vector<AlignableDetOrUnitPtr> &alidetvec ) const;
00091 
00093   AlgebraicVector correctionTerm( const std::vector<TrajectoryStateOnSurface>& tsosvec,
00094                                   const std::vector<AlignableDet*>& alidetvec ) const;
00095   AlgebraicVector correctionTerm( const std::vector<TrajectoryStateOnSurface>& tsosvec,
00096                                   const std::vector<AlignableDetOrUnitPtr>& alidetvec ) const;
00098   AlgebraicMatrix derivativesLegacy ( const TrajectoryStateOnSurface& tsos, 
00099                                       AlignableDet* alidet ) const;
00101   AlgebraicMatrix selectedDerivativesLegacy( const TrajectoryStateOnSurface& tsos, 
00102                                              AlignableDet* alidet ) const;
00104   AlgebraicMatrix derivativesLegacy( const std::vector<TrajectoryStateOnSurface>& tsosvec,
00105                                      const std::vector<AlignableDet*>& alidetvec ) const;
00107   AlgebraicMatrix selectedDerivativesLegacy( const std::vector<TrajectoryStateOnSurface>& tsosvec, 
00108                                              const std::vector<AlignableDet*>& alidetvec ) const;
00109 
00111   Alignable* alignableFromAlignableDet( AlignableDetOrUnitPtr adet ) const;
00112 
00113 
00115   AlgebraicVector parameterSubset ( const std::vector<Alignable*>& vec ) const;
00116 
00118   AlgebraicSymMatrix covarianceSubset( const std::vector<Alignable*>& vec ) const;
00119 
00121   AlgebraicMatrix covarianceSubset ( const std::vector<Alignable*>& veci,
00122                                      const std::vector<Alignable*>& vecj ) const;
00123 
00124 protected:
00125   DataContainer theData;
00126 
00127 private:
00128 
00130   bool extractPositionAndLength( const std::vector<Alignable*>& alignables,
00131                                  std::vector<int>& posvec,
00132                                  std::vector<int>& lenvec,
00133                                  int& length ) const;
00134 
00136   std::vector< Alignable* > extractAlignables( const std::vector< Alignable* >& alignables ) const;
00137 
00140   void convert(const std::vector<AlignableDet*> &input,
00141                std::vector<AlignableDetOrUnitPtr> &output) const;
00142 
00144   Components theComponents;
00145 
00147   AlignableDetToAlignableMap theAlignableDetToAlignableMap;
00148 
00150   Aliposmap theAliposmap;
00151   Alilenmap theAlilenmap;
00152 
00153 };
00154 
00155 #endif