CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_2_9/src/Alignment/KalmanAlignmentAlgorithm/plugins/KalmanAlignmentAlgorithm.h

Go to the documentation of this file.
00001 #ifndef Alignment_KalmanAlignmentAlgorithm_KalmanAlignmentAlgorithm_h
00002 #define Alignment_KalmanAlignmentAlgorithm_KalmanAlignmentAlgorithm_h
00003 
00004 #include "Alignment/CommonAlignment/interface/Alignable.h"
00005 #include "Alignment/CommonAlignmentAlgorithm/interface/AlignmentAlgorithmBase.h"
00006 #include "Alignment/ReferenceTrajectories/interface/TrajectoryFactoryBase.h"
00007 
00008 #include "Alignment/KalmanAlignmentAlgorithm/interface/KalmanAlignmentSetup.h"
00009 #include "Alignment/KalmanAlignmentAlgorithm/interface/KalmanAlignmentTrackRefitter.h"
00010 
00011 #include <set>
00012 
00017 
00018 class AlignableNavigator;
00019 class AlignmentParameterSelector;
00020 class TrajectoryFitter;
00021 
00022 namespace reco { class BeamSpot; }
00023 
00024 class KalmanAlignmentAlgorithm : public AlignmentAlgorithmBase
00025 {
00026 
00027 public:
00028 
00029   typedef TrajectoryFactoryBase::ReferenceTrajectoryPtr ReferenceTrajectoryPtr;
00030   typedef TrajectoryFactoryBase::ReferenceTrajectoryCollection ReferenceTrajectoryCollection;
00031   typedef TrajectoryFactoryBase::ExternalPredictionCollection ExternalPredictionCollection;
00032 
00033   typedef KalmanAlignmentTracklet::TrackletPtr TrackletPtr;
00034   typedef std::vector< TrackletPtr > TrackletCollection;
00035 
00036   typedef KalmanAlignmentSetup AlignmentSetup;
00037   typedef std::vector< AlignmentSetup* > AlignmentSetupCollection;
00038 
00039 
00040   KalmanAlignmentAlgorithm( const edm::ParameterSet& config );
00041   virtual ~KalmanAlignmentAlgorithm( void );
00042 
00045   virtual void produce( edm::Event&, const edm::EventSetup& ) {}
00046 
00047   virtual void initialize( const edm::EventSetup& setup, 
00048                            AlignableTracker* tracker,
00049                            AlignableMuon* muon,
00050                            AlignableExtras* extras,
00051                            AlignmentParameterStore* store );
00052 
00053   virtual void terminate( void );
00054 
00055   virtual void run( const edm::EventSetup& setup, const EventInfo &eventInfo );
00056 
00057   inline bool operator()( const Alignable* a1, const Alignable* a2 ) const { return ( a1->id() < a2->id() ); }
00058 
00059 private:
00060 
00061   void initializeAlignmentParameters( const edm::EventSetup& setup );
00062 
00063   void initializeAlignmentSetups( const edm::EventSetup& setup );
00064 
00065   void applyAlignmentParameters( Alignable* ali, AlignmentParameters* par, bool applyPar, bool applyCov ) const;
00066 
00067   void getComponents( Alignable* ali, std::vector<Alignable*>& comps ) const;
00068 
00069   void mergeResults( void ) const;
00070 
00071   void setAPEToZero( void );
00072 
00073   inline const PropagationDirection getDirection( const std::string& dir ) const
00074     { return ( dir == "alongMomentum" ) ? alongMomentum : oppositeToMomentum; }
00075 
00076   inline const PropagationDirection oppositeDirection( const PropagationDirection dir ) const
00077     { return ( dir == alongMomentum ) ? oppositeToMomentum : alongMomentum; }
00078 
00079   const KalmanAlignmentSetup::SortingDirection getSortingDirection( const std::string& sortDir ) const;
00080 
00081   edm::ParameterSet theConfiguration;
00082 
00083   AlignmentSetupCollection theAlignmentSetups;
00084 
00085   KalmanAlignmentTrackRefitter* theRefitter;
00086 
00087   AlignmentParameterStore* theParameterStore;
00088   AlignableNavigator* theNavigator;
00089   AlignmentParameterSelector* theSelector;
00090 
00091   AlignableTracker* theTracker;
00092 
00093   bool theMergerFlag;
00094 };
00095 
00096 #endif