CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_4_1_8_patch9/src/RecoVertex/GhostTrackFitter/src/GhostTrack.cc

Go to the documentation of this file.
00001 #include <vector>
00002 
00003 #include "DataFormats/GeometryVector/interface/GlobalPoint.h"
00004 #include "DataFormats/TrackReco/interface/Track.h"
00005 
00006 #include "TrackingTools/TransientTrack/interface/TransientTrack.h"
00007 
00008 #include "RecoVertex/GhostTrackFitter/interface/GhostTrackPrediction.h"
00009 #include "RecoVertex/GhostTrackFitter/interface/GhostTrackState.h"
00010 #include "RecoVertex/GhostTrackFitter/interface/GhostTrack.h"
00011 
00012 using namespace reco;
00013 
00014 void GhostTrack::initStates(const std::vector<TransientTrack> &tracks,
00015                             const std::vector<float> &weights, double offset)
00016 {
00017         std::vector<float>::const_iterator weight = weights.begin();
00018         for(std::vector<TransientTrack>::const_iterator iter = tracks.begin();
00019             iter != tracks.end(); ++iter) {
00020                 GhostTrackState state(*iter);
00021                 state.linearize(prediction_, true, offset);
00022                 if (weight != weights.end())
00023                         state.setWeight(*weight++);
00024 
00025                 states_.push_back(state);
00026         }
00027 }
00028 
00029 GhostTrack::GhostTrack(const GhostTrackPrediction &prior,
00030                        const GhostTrackPrediction &prediction,
00031                        const std::vector<TransientTrack> &tracks,
00032                        double ndof, double chi2,
00033                        const std::vector<float> &weights,
00034                        const GlobalPoint &origin,
00035                        bool withOrigin) :
00036         prediction_(prediction), prior_(prior),
00037         ndof_(ndof), chi2_(chi2)
00038 {
00039         initStates(tracks, weights,
00040                    withOrigin ? prediction_.lambda(origin) : 0.);
00041 }
00042 
00043 GhostTrack::GhostTrack(const Track &ghostTrack,
00044                        const std::vector<TransientTrack> &tracks,
00045                        const std::vector<float> &weights,
00046                        const GhostTrackPrediction &prior,
00047                        const GlobalPoint &origin,
00048                        bool withOrigin) :
00049         prediction_(ghostTrack), prior_(prior),
00050         ndof_(ghostTrack.ndof()), chi2_(ghostTrack.chi2())
00051 {
00052         initStates(tracks, weights,
00053                    withOrigin ? prediction_.lambda(origin) : 0.);
00054 }