CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_4_1_8_patch9/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 
00087   void acquireRelativeParameters(void);
00088 
00090   void applyAlignableAbsolutePositions( const align::Alignables& alis, 
00091                                         const AlignablePositions& newpos, int& ierr );
00092 
00094   void applyAlignableRelativePositions( const align::Alignables& alivec, 
00095                                         const AlignableShifts& shifts, int& ierr );
00096 
00098   void attachAlignmentParameters( const align::Alignables& alivec, const Parameters& parvec, int& ierr );
00099 
00101   void attachAlignmentParameters(const Parameters& parvec, int& ierr);
00102 
00104   void attachCorrelations( const align::Alignables& alivec, const Correlations& cormap, 
00105                            bool overwrite, int& ierr );
00106 
00108   void attachCorrelations( const Correlations& cormap, bool overwrite, int& ierr );
00109 
00111   void attachUserVariables( const align::Alignables& alivec,
00112                             const std::vector<AlignmentUserVariables*>& uvarvec, int& ierr);
00113 
00115   void setAlignmentPositionError( const align::Alignables& alivec, double valshift, double valrot );
00116 
00118   std::pair<int,int> typeAndLayer( const Alignable* ali ) const;
00119 
00121   typedef std::pair<Alignable*, unsigned int> ParameterId;
00137   bool hierarchyConstraints(const Alignable *aliMaster, const align::Alignables &aliComps,
00138                             std::vector<std::vector<ParameterId> > &paramIdsVecOut,
00139                             std::vector<std::vector<double> > &factorsVecOut,
00140                             bool all, double epsilon) const;
00141 
00142 protected:
00143 
00144   // storage for correlations
00145   AlignmentCorrelationsStore* theCorrelationsStore;
00146 
00147 private:
00148   // data members
00149 
00151   align::Alignables theAlignables;
00152 
00153 };
00154 
00155 #endif