File indexing completed on 2024-04-06 12:29:08
0001 #include <vector>
0002
0003 #include "DataFormats/GeometryVector/interface/GlobalPoint.h"
0004 #include "DataFormats/TrackReco/interface/Track.h"
0005
0006 #include "TrackingTools/TransientTrack/interface/TransientTrack.h"
0007
0008 #include "RecoVertex/GhostTrackFitter/interface/GhostTrackPrediction.h"
0009 #include "RecoVertex/GhostTrackFitter/interface/GhostTrackState.h"
0010 #include "RecoVertex/GhostTrackFitter/interface/GhostTrack.h"
0011
0012 using namespace reco;
0013
0014 void GhostTrack::initStates(const std::vector<TransientTrack> &tracks,
0015 const std::vector<float> &weights,
0016 double offset) {
0017 std::vector<float>::const_iterator weight = weights.begin();
0018 for (std::vector<TransientTrack>::const_iterator iter = tracks.begin(); iter != tracks.end(); ++iter) {
0019 GhostTrackState state(*iter);
0020 state.linearize(prediction_, true, offset);
0021 if (weight != weights.end())
0022 state.setWeight(*weight++);
0023
0024 states_.push_back(state);
0025 }
0026 }
0027
0028 GhostTrack::GhostTrack(const GhostTrackPrediction &prior,
0029 const GhostTrackPrediction &prediction,
0030 const std::vector<TransientTrack> &tracks,
0031 double ndof,
0032 double chi2,
0033 const std::vector<float> &weights,
0034 const GlobalPoint &origin,
0035 bool withOrigin)
0036 : prediction_(prediction), prior_(prior), ndof_(ndof), chi2_(chi2) {
0037 initStates(tracks, weights, withOrigin ? prediction_.lambda(origin) : 0.);
0038 }
0039
0040 GhostTrack::GhostTrack(const Track &ghostTrack,
0041 const std::vector<TransientTrack> &tracks,
0042 const std::vector<float> &weights,
0043 const GhostTrackPrediction &prior,
0044 const GlobalPoint &origin,
0045 bool withOrigin)
0046 : prediction_(ghostTrack), prior_(prior), ndof_(ghostTrack.ndof()), chi2_(ghostTrack.chi2()) {
0047 initStates(tracks, weights, withOrigin ? prediction_.lambda(origin) : 0.);
0048 }