CMS 3D CMS Logo

/data/git/CMSSW_5_3_11_patch5/src/Alignment/CommonAlignmentAlgorithm/interface/AlignmentParameterStore.h

Go to the documentation of this file.
00001 #ifndef Alignment_CommonAlignmentAlgorithm_AlignmentParameterStore_h
00002 #define Alignment_CommonAlignmentAlgorithm_AlignmentParameterStore_h
00003 
00004 #include "Alignment/CommonAlignment/interface/Utilities.h"
00005 #include "Alignment/CommonAlignmentAlgorithm/interface/AlignableData.h"
00006 #include "Alignment/CommonAlignmentAlgorithm/interface/AlignmentCorrelationsStore.h"
00007 #include "Alignment/CommonAlignmentParametrization/interface/CompositeAlignmentParameters.h"
00008 
00016 
00017 namespace edm { class ParameterSet; }
00018 class AlignmentUserVariables;
00019 
00020 class AlignmentParameterStore 
00021 {
00022 
00023 public:
00024 
00025   typedef std::vector<AlignmentParameters*> Parameters;
00026   typedef std::map< std::pair<Alignable*,Alignable*>,AlgebraicMatrix > Correlations;
00027   typedef std::vector<unsigned int> DetIds;
00028 
00030   AlignmentParameterStore( const align::Alignables &alis, const edm::ParameterSet& config );
00031 
00033   virtual ~AlignmentParameterStore();
00034 
00037   CompositeAlignmentParameters
00038     selectParameters( const std::vector <AlignableDet*>& alignabledets ) const;
00040   CompositeAlignmentParameters
00041     selectParameters( const std::vector <AlignableDetOrUnitPtr>& alignabledets ) const;
00043   CompositeAlignmentParameters
00044     selectParameters( const std::vector <Alignable*>& alignables ) const;
00045 
00047   void updateParameters(const CompositeAlignmentParameters& aap, bool updateCorrelations = true);
00048 
00050   const align::Alignables& alignables(void) const { return theAlignables; }
00051 
00053   align::Alignables validAlignables(void) const;
00054 
00056   int numObjects(void) const { return theAlignables.size(); }
00057 
00059   AlignmentCorrelationsStore* correlationsStore( void ) const { return theCorrelationsStore; }
00060 
00062   const unsigned int numCorrelations( void ) const { return theCorrelationsStore->size(); }
00063 
00065 /*   Alignable* alignableFromGeomDet( const GeomDet* geomDet ) const; */
00066 
00068   Alignable* alignableFromAlignableDet( AlignableDetOrUnitPtr alignableDet ) const;
00069 
00071 /*   Alignable* alignableFromDetId(const unsigned int& detId) const; */
00072 
00074   void applyParameters(void);
00075 
00077   void applyParameters(Alignable* alignable);
00078 
00080   void resetParameters(void);
00081 
00083   void resetParameters(Alignable* ali);
00084 
00086   void cacheTransformations(void);
00087 
00089   void restoreCachedTransformations(void);
00090 
00093   void acquireRelativeParameters(void);
00094 
00096   void applyAlignableAbsolutePositions( const align::Alignables& alis, 
00097                                         const AlignablePositions& newpos, int& ierr );
00098 
00100   void applyAlignableRelativePositions( const align::Alignables& alivec, 
00101                                         const AlignableShifts& shifts, int& ierr );
00102 
00104   void attachAlignmentParameters( const align::Alignables& alivec, const Parameters& parvec, int& ierr );
00105 
00107   void attachAlignmentParameters(const Parameters& parvec, int& ierr);
00108 
00110   void attachCorrelations( const align::Alignables& alivec, const Correlations& cormap, 
00111                            bool overwrite, int& ierr );
00112 
00114   void attachCorrelations( const Correlations& cormap, bool overwrite, int& ierr );
00115 
00117   void attachUserVariables( const align::Alignables& alivec,
00118                             const std::vector<AlignmentUserVariables*>& uvarvec, int& ierr);
00119 
00121   void setAlignmentPositionError( const align::Alignables& alivec, double valshift, double valrot );
00122 
00124   std::pair<int,int> typeAndLayer( const Alignable* ali ) const;
00125 
00127   typedef std::pair<Alignable*, unsigned int> ParameterId;
00143   bool hierarchyConstraints(const Alignable *aliMaster, const align::Alignables &aliComps,
00144                             std::vector<std::vector<ParameterId> > &paramIdsVecOut,
00145                             std::vector<std::vector<double> > &factorsVecOut,
00146                             bool all, double epsilon) const;
00147 
00148 protected:
00149 
00150   // storage for correlations
00151   AlignmentCorrelationsStore* theCorrelationsStore;
00152 
00153 private:
00154   // data members
00155 
00157   align::Alignables theAlignables;
00158 
00159 };
00160 
00161 #endif