CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_4/src/RecoVertex/ConfigurableVertexReco/src/ConfigurableAdaptiveFitter.cc

Go to the documentation of this file.
00001 #include "RecoVertex/ConfigurableVertexReco/interface/ConfigurableAdaptiveFitter.h"
00002 #include "RecoVertex/ConfigurableVertexReco/interface/ReconstructorFromFitter.h"
00003 #include "RecoVertex/AdaptiveVertexFit/interface/AdaptiveVertexFitter.h"
00004 #include "RecoVertex/VertexTools/interface/GeometricAnnealing.h"
00005 #include "RecoVertex/LinearizationPointFinders/interface/DefaultLinearizationPointFinder.h"
00006 // #include "RecoVertex/LinearizationPointFinders/interface/GenericLinearizationPointFinder.h"
00007 // #include "RecoVertex/KalmanVertexFit/interface/KalmanVertexFitter.h"
00008 // #include "RecoVertex/LinearizationPointFinders/interface/ZeroLinearizationPointFinder.h"
00009 #include "RecoVertex/KalmanVertexFit/interface/KalmanVertexUpdator.h"
00010 #include "RecoVertex/KalmanVertexFit/interface/KalmanVertexTrackCompatibilityEstimator.h"
00011 #include "RecoVertex/ConfigurableVertexReco/interface/ConfigurableAnnealing.h"
00012 #include "RecoVertex/VertexTools/interface/DummyVertexSmoother.h"
00013 #include "RecoVertex/KalmanVertexFit/interface/KalmanVertexSmoother.h"
00014 #include "FWCore/MessageLogger/interface/MessageLogger.h"
00015 
00016 using namespace std;
00017 
00018 namespace {
00019   edm::ParameterSet mydefaults()
00020   {
00021     edm::ParameterSet ret;
00022     ret.addParameter<string>("annealing", "geom" );
00023     ret.addParameter<bool>("smoothing", true );
00024     ret.addParameter<double>("sigmacut",3.0);
00025     ret.addParameter<double>("Tini",256.0);
00026     ret.addParameter<double>("ratio",0.25);
00027 
00028     ret.addParameter<double>("maxshift",0.0001);
00029     ret.addParameter<double>("maxlpshift",0.1);
00030     ret.addParameter<int>("maxstep",30);
00031     ret.addParameter<double>("weightthreshold",0.001);
00032     return ret;
00033   }
00034 }
00035 
00036 ConfigurableAdaptiveFitter::ConfigurableAdaptiveFitter() :
00037     AbstractConfFitter ( AdaptiveVertexFitter() )
00038 {}
00039 
00040 void ConfigurableAdaptiveFitter::configure(
00041     const edm::ParameterSet & n )
00042 {
00043   edm::ParameterSet m=n;
00044   m.augment ( mydefaults() );
00045   ConfigurableAnnealing ann ( m );
00046   DefaultLinearizationPointFinder linpt;
00047   // ZeroLinearizationPointFinder linpt;
00048   // KalmanVertexFitter kvf;
00049   // GenericLinearizationPointFinder linpt ( kvf );
00050   KalmanVertexUpdator<5> updator;
00051   bool s=m.getParameter< bool >("smoothing");
00052   VertexSmoother<5> * smoother=0;
00053   if ( s )
00054   {
00055     smoother = new KalmanVertexSmoother ();
00056   } else {
00057     smoother = new DummyVertexSmoother<5> ();
00058   }
00059   KalmanVertexTrackCompatibilityEstimator<5> estimator;
00060 
00061   if (theFitter) delete theFitter;
00062   AdaptiveVertexFitter * fitter = new AdaptiveVertexFitter ( ann, linpt, updator, estimator, *smoother );
00063   delete smoother;
00064   fitter->setParameters ( m );
00065   theFitter=fitter;
00066 }
00067 
00068 ConfigurableAdaptiveFitter::~ConfigurableAdaptiveFitter()
00069 {
00070   /*
00071   if (theFitter) delete theFitter;
00072   theFitter=0;
00073   */
00074 }
00075 
00076 ConfigurableAdaptiveFitter::ConfigurableAdaptiveFitter 
00077     ( const ConfigurableAdaptiveFitter & o ) :
00078   AbstractConfFitter ( o )
00079 {}
00080 
00081 ConfigurableAdaptiveFitter * ConfigurableAdaptiveFitter::clone() const
00082 {
00083   return new ConfigurableAdaptiveFitter ( *this );
00084 }
00085 
00086 edm::ParameterSet ConfigurableAdaptiveFitter::defaults() const
00087 {
00088   return mydefaults();
00089 }
00090 
00091 #include "RecoVertex/ConfigurableVertexReco/interface/ConfFitterBuilder.h"
00092 
00093 namespace {
00094   ConfFitterBuilder < ConfigurableAdaptiveFitter > t ( "avf", "AdaptiveVertexFitter" );
00095 }