CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_0/src/RecoVertex/GhostTrackFitter/src/GhostTrackFitter.cc

Go to the documentation of this file.
00001 #include <memory>
00002 #include <vector>
00003 
00004 #include "DataFormats/GeometryVector/interface/GlobalPoint.h"
00005 #include "DataFormats/GeometryVector/interface/GlobalVector.h" 
00006 #include "DataFormats/GeometryVector/interface/VectorUtil.h" 
00007 #include "DataFormats/GeometryCommonDetAlgo/interface/GlobalError.h"
00008 
00009 #include "TrackingTools/TransientTrack/interface/TransientTrack.h"
00010 
00011 #include "RecoVertex/GhostTrackFitter/interface/GhostTrack.h"
00012 #include "RecoVertex/GhostTrackFitter/interface/GhostTrackState.h"
00013 #include "RecoVertex/GhostTrackFitter/interface/GhostTrackPrediction.h"
00014 
00015 #include "RecoVertex/GhostTrackFitter/interface/GhostTrackFitter.h"
00016 
00017 #include "RecoVertex/GhostTrackFitter/interface/AnnealingGhostTrackFitter.h"
00018 #include "RecoVertex/GhostTrackFitter/interface/PositiveSideGhostTrackFitter.h"
00019 #include "RecoVertex/GhostTrackFitter/interface/KalmanGhostTrackUpdater.h"
00020 
00021 using namespace reco;
00022 
00023 GhostTrackFitter::GhostTrackFitter()
00024 {
00025         fitter.reset(new AnnealingGhostTrackFitter);
00026         updater.reset(new KalmanGhostTrackUpdater);
00027 }
00028 
00029 GhostTrackFitter::~GhostTrackFitter()
00030 {
00031 }
00032 
00033 GhostTrack GhostTrackFitter::fit(
00034                         const GlobalPoint &priorPosition,
00035                         const GlobalError &priorError,
00036                         const GlobalVector &direction,
00037                         double coneRadius,
00038                         const std::vector<TransientTrack> &tracks) const
00039 {
00040         GhostTrackPrediction prior(priorPosition, priorError,
00041                                    direction, coneRadius);
00042         return fit(prior, priorPosition, tracks);
00043 }
00044 
00045 GhostTrack GhostTrackFitter::fit(
00046                         const GlobalPoint &priorPosition,
00047                         const GlobalError &priorError,
00048                         const GlobalVector &direction,
00049                         const GlobalError &directionError,
00050                         const std::vector<TransientTrack> &tracks) const
00051 {
00052         GhostTrackPrediction prior(priorPosition, priorError,
00053                                    direction, directionError);
00054         return fit(prior, priorPosition, tracks);
00055 }
00056 
00057 GhostTrack GhostTrackFitter::fit(
00058                         const GhostTrackPrediction &prior,
00059                         const GlobalPoint &origin,
00060                         const std::vector<TransientTrack> &tracks) const
00061 {
00062         double offset = prior.lambda(origin);
00063 
00064         std::vector<GhostTrackState> states;
00065         for(std::vector<TransientTrack>::const_iterator iter = tracks.begin();
00066             iter != tracks.end(); ++iter) {
00067                 GhostTrackState state(*iter);
00068                 state.linearize(prior, true, offset);
00069                 states.push_back(state);
00070         }
00071 
00072         PositiveSideGhostTrackFitter actualFitter(origin, *fitter);
00073         return fit(actualFitter, prior, states);
00074 }
00075 
00076 GhostTrack GhostTrackFitter::fit(
00077                         const GhostTrackPrediction &prior,
00078                         const std::vector<TransientTrack> &tracks) const
00079 {
00080         std::vector<GhostTrackState> states;
00081         for(std::vector<TransientTrack>::const_iterator iter = tracks.begin();
00082             iter != tracks.end(); ++iter) {
00083                 GhostTrackState state(*iter);
00084                 state.linearize(prior, true);
00085                 states.push_back(state);
00086         }
00087 
00088         return fit(*fitter, prior, states);
00089 }
00090 
00091 GhostTrack GhostTrackFitter::fit(
00092                         FitterImpl &fitterImpl,
00093                         const GhostTrackPrediction &prior,
00094                         const std::vector<GhostTrackState> &states_) const
00095 {
00096         std::vector<GhostTrackState> states = states_;
00097 
00098         double ndof, chi2;
00099         GhostTrackPrediction pred =
00100                         fitterImpl.fit(*updater, prior, states, ndof, chi2);
00101 
00102         GhostTrack result(prior, pred, states, ndof, chi2);
00103 
00104         return result;
00105 }