CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_3/src/RecoVertex/GhostTrackFitter/src/AnnealingGhostTrackFitter.cc

Go to the documentation of this file.
00001 #include <vector>
00002 
00003 #include "RecoVertex/VertexTools/interface/GeometricAnnealing.h"
00004 
00005 #include "RecoVertex/GhostTrackFitter/interface/GhostTrackState.h"
00006 #include "RecoVertex/GhostTrackFitter/interface/GhostTrackPrediction.h"
00007 
00008 #include "RecoVertex/GhostTrackFitter/interface/AnnealingGhostTrackFitter.h"
00009 
00010 using namespace reco;
00011 
00012 namespace {
00013         static inline double sqr(double arg) { return arg * arg; }
00014 }
00015 
00016 AnnealingGhostTrackFitter::AnnealingGhostTrackFitter()
00017 {
00018         annealing.reset(new GeometricAnnealing(3.0, 64.0, 0.25));
00019 }
00020 
00021 void AnnealingGhostTrackFitter::postFit(
00022                         const GhostTrackFitter::PredictionUpdater &updater,
00023                         const GhostTrackPrediction &pred,
00024                         std::vector<GhostTrackState> &states)
00025 {
00026         for(std::vector<GhostTrackState>::iterator state = 
00027                 states.begin(); state != states.end(); ++state) {
00028 
00029                 if (!state->isValid())
00030                         continue;
00031 
00032                 double ndof, chi2;
00033                 updater.contribution(pred, *state, ndof, chi2);
00034                 if (ndof == 0. || firstStep)
00035                         continue;
00036 
00037                 state->setWeight(annealing->weight(chi2));
00038         }
00039 
00040         if (firstStep)
00041                 firstStep = false;
00042         else
00043                 annealing->anneal();
00044 }