CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_4_2_9_HLT1_bphpatch4/src/RecoVertex/GhostTrackFitter/src/PositiveSideGhostTrackFitter.cc

Go to the documentation of this file.
00001 #include <cmath>
00002 #include <vector>
00003 
00004 #include "DataFormats/GeometryVector/interface/GlobalVector.h" 
00005 #include "DataFormats/GeometryVector/interface/GlobalPoint.h" 
00006 
00007 #include "RecoVertex/GhostTrackFitter/interface/GhostTrackState.h"
00008 #include "RecoVertex/GhostTrackFitter/interface/GhostTrackPrediction.h"
00009 
00010 #include "RecoVertex/GhostTrackFitter/interface/PositiveSideGhostTrackFitter.h"
00011 
00012 using namespace reco;
00013 
00014 GhostTrackPrediction PositiveSideGhostTrackFitter::fit(
00015                         const GhostTrackFitter::PredictionUpdater &updater,
00016                         const GhostTrackPrediction &prior,
00017                         std::vector<GhostTrackState> &states,
00018                         double &ndof, double &chi2)
00019 {
00020         double rho = prior.rho();
00021         for(unsigned int i = 0; i < states.size(); i++) {
00022                 GhostTrackState &state = states[i];
00023                 state.linearize(prior, true, .5 / rho);
00024         }
00025 
00026         GhostTrackPrediction pred =
00027                         actualFitter_->fit(updater, prior, states, ndof, chi2);
00028 
00029         double origin = pred.lambda(origin_);
00030         bool done = true;
00031         for(unsigned int i = 0; i < states.size(); i++) {
00032                 GhostTrackState &state = states[i];
00033                 double lambda = state.lambda();
00034                 if (lambda < origin && (origin - lambda) < 3.5) {
00035                         GhostTrackState testState = state;
00036                         testState.linearize(pred, 2. * origin - lambda);
00037                         double ndof, chi2;
00038 
00039                         updater.contribution(prior, testState, ndof, chi2, true);
00040                         if (ndof > 0. && chi2 < 10.) {
00041                                 state = testState;
00042                                 if (state.weight() != 1.)
00043                                         state.setWeight(3.);
00044                                 done = false;
00045                         }
00046                 }
00047         }
00048 
00049         if (!done) {
00050                 for(unsigned int i = 0; i < states.size(); i++) {
00051                         GhostTrackState &state = states[i];
00052                         double lambda = state.lambda();
00053                         if (state.weight() != 1. && lambda < origin) {
00054                                 double weight =
00055                                         std::exp(10. * (origin - lambda) - .1);
00056                                 state.setWeight(
00057                                         std::min(state.weight(), weight));
00058                         }
00059                 }
00060 
00061                 pred = actualFitter_->fit(updater, prior, states, ndof, chi2);
00062         }
00063 
00064         return pred;
00065 }