CMS 3D CMS Logo

/afs/cern.ch/work/a/aaltunda/public/www/CMSSW_6_2_5/src/TrackingTools/TrackFitters/plugins/KFTrajectoryFitterESProducer.cc

Go to the documentation of this file.
00001 #include "TrackingTools/TrackFitters/plugins/KFTrajectoryFitterESProducer.h"
00002 #include "MagneticField/Engine/interface/MagneticField.h"
00003 #include "MagneticField/Records/interface/IdealMagneticFieldRecord.h"
00004 
00005 #include "FWCore/Framework/interface/EventSetup.h"
00006 #include "FWCore/Framework/interface/ESHandle.h"
00007 #include "FWCore/Framework/interface/ModuleFactory.h"
00008 #include "FWCore/Framework/interface/ESProducer.h"
00009 
00010 #include "TrackingTools/PatternTools/interface/TrajectoryStateUpdator.h"
00011 #include "TrackingTools/GeomPropagators/interface/Propagator.h"
00012 #include "TrackingTools/PatternTools/interface/TrajectoryStateUpdator.h"
00013 #include "TrackingTools/KalmanUpdators/interface/Chi2MeasurementEstimatorBase.h"
00014 
00015 #include <string>
00016 #include <memory>
00017 
00018 using namespace edm;
00019 
00020 KFTrajectoryFitterESProducer::KFTrajectoryFitterESProducer(const edm::ParameterSet & p) 
00021 {
00022   std::string myname = p.getParameter<std::string>("ComponentName");
00023   pset_ = p;
00024   setWhatProduced(this,myname);
00025 }
00026 
00027 KFTrajectoryFitterESProducer::~KFTrajectoryFitterESProducer() {}
00028 
00029 boost::shared_ptr<TrajectoryFitter> 
00030 KFTrajectoryFitterESProducer::produce(const TrajectoryFitterRecord & iRecord){ 
00031 
00032   std::string pname = pset_.getParameter<std::string>("Propagator");
00033   std::string uname = pset_.getParameter<std::string>("Updator");
00034   std::string ename = pset_.getParameter<std::string>("Estimator");
00035   std::string gname = pset_.getParameter<std::string>("RecoGeometry");
00036   int minHits = pset_.getParameter<int>("minHits");
00037 
00038   edm::ESHandle<Propagator> prop;
00039   edm::ESHandle<TrajectoryStateUpdator> upd;
00040   edm::ESHandle<Chi2MeasurementEstimatorBase> est;
00041   edm::ESHandle<DetLayerGeometry> geo;
00042 
00043   iRecord.getRecord<TrackingComponentsRecord>().get(pname, prop);
00044   iRecord.getRecord<TrackingComponentsRecord>().get(uname, upd);
00045   iRecord.getRecord<TrackingComponentsRecord>().get(ename, est);
00046   iRecord.getRecord<RecoGeometryRecord>().get(gname,geo);
00047 
00048   _fitter  = boost::shared_ptr<TrajectoryFitter>(new KFTrajectoryFitter(prop.product(),
00049                                                                         upd.product(),
00050                                                                         est.product(),
00051                                                                         minHits,
00052                                                                         geo.product() ));
00053   return _fitter;
00054 }
00055 
00056