CMS 3D CMS Logo

/afs/cern.ch/work/a/aaltunda/public/www/CMSSW_6_2_5/src/TrackingTools/GsfTracking/plugins/GsfTrajectoryFitterESProducer.cc

Go to the documentation of this file.
00001 #include "TrackingTools/GsfTracking/plugins/GsfTrajectoryFitterESProducer.h"
00002 
00003 #include "FWCore/Framework/interface/EventSetup.h"
00004 #include "FWCore/Framework/interface/ESHandle.h"
00005 #include "FWCore/Framework/interface/ModuleFactory.h"
00006 #include "FWCore/Framework/interface/ESProducer.h"
00007 
00008 #include "TrackingTools/GeomPropagators/interface/AnalyticalPropagator.h"
00009 #include "TrackingTools/GsfTracking/interface/GsfMaterialEffectsUpdator.h"
00010 #include "TrackingTools/GsfTracking/interface/GsfPropagatorWithMaterial.h"
00011 #include "TrackingTools/GsfTracking/interface/GsfMultiStateUpdator.h"
00012 #include "TrackingTools/GsfTools/interface/MultiGaussianStateMerger.h"
00013 #include "TrackingTools/GsfTools/interface/CloseComponentsMerger.h"
00014 #include "TrackingTools/GsfTracking/interface/MultiTrajectoryStateMerger.h"
00015 #include "TrackingTools/GsfTracking/interface/GsfChi2MeasurementEstimator.h"
00016 #include "TrackingTools/GsfTracking/interface/GsfTrajectoryFitter.h"
00017 
00018 #include <string>
00019 #include <memory>
00020 
00021 #include <iostream>
00022 
00023 GsfTrajectoryFitterESProducer::GsfTrajectoryFitterESProducer(const edm::ParameterSet & p) 
00024 {
00025   std::string myname = p.getParameter<std::string>("ComponentName");
00026   pset_ = p;
00027   setWhatProduced(this,myname);
00028 }
00029 
00030 GsfTrajectoryFitterESProducer::~GsfTrajectoryFitterESProducer() {}
00031 
00032 boost::shared_ptr<TrajectoryFitter> 
00033 GsfTrajectoryFitterESProducer::produce(const TrajectoryFitterRecord & iRecord){ 
00034   //
00035   // material effects
00036   //
00037   std::string matName = pset_.getParameter<std::string>("MaterialEffectsUpdator");
00038   edm::ESHandle<GsfMaterialEffectsUpdator> matProducer;
00039   iRecord.getRecord<TrackingComponentsRecord>().get(matName,matProducer);
00040   //
00041   // propagator
00042   //
00043   std::string geomName = pset_.getParameter<std::string>("GeometricalPropagator");
00044   edm::ESHandle<Propagator> geomProducer;
00045   iRecord.getRecord<TrackingComponentsRecord>().get(geomName,geomProducer);
00046   GsfPropagatorWithMaterial propagator(*geomProducer.product(),*matProducer.product());
00047   //
00048   // merger
00049   //
00050   std::string mergerName = pset_.getParameter<std::string>("Merger");
00051 //   edm::ESHandle<MultiTrajectoryStateMerger> mergerProducer;
00052 //   iRecord.get(mergerName,mergerProducer);
00053   edm::ESHandle< MultiGaussianStateMerger<5> > mergerProducer;
00054   iRecord.getRecord<TrackingComponentsRecord>().get(mergerName,mergerProducer);
00055   MultiTrajectoryStateMerger merger(*mergerProducer.product());
00056   //
00057   // estimator
00058   //
00059   //   double chi2Cut = pset_.getParameter<double>("ChiSquarCut");
00060   double chi2Cut(100.);
00061   GsfChi2MeasurementEstimator estimator(chi2Cut);
00062 
00063   // geometry
00064   std::string gname = pset_.getParameter<std::string>("RecoGeometry");
00065   edm::ESHandle<DetLayerGeometry> geo;
00066   iRecord.getRecord<RecoGeometryRecord>().get(gname,geo);
00067   //
00068   // create algorithm
00069   //
00070   return boost::shared_ptr<TrajectoryFitter>(new GsfTrajectoryFitter(propagator,
00071                                                                      GsfMultiStateUpdator(), 
00072                                                                      estimator,merger,
00073                                                                      geo.product()));
00074 }