00001 #ifndef RecoAlgos_CandKalmanVertexFitter_h 00002 #define RecoAlgos_CandKalmanVertexFitter_h 00003 #include "CommonTools/UtilAlgos/interface/EventSetupInitTrait.h" 00004 #include "PhysicsTools/RecoUtils/interface/CandCommonVertexFitter.h" 00005 #include "MagneticField/Records/interface/IdealMagneticFieldRecord.h" 00006 #include "FWCore/Framework/interface/ESHandle.h" 00007 #include "FWCore/Framework/interface/EventSetup.h" 00008 00009 namespace reco { 00010 namespace modules { 00011 template<typename Fitter> 00012 struct CandVertexFitterEventSetupInit { 00013 static void init(CandCommonVertexFitter<Fitter> & fitter, 00014 const edm::Event & evt, 00015 const edm::EventSetup& es) { 00016 edm::ESHandle<MagneticField> h; 00017 es.get<IdealMagneticFieldRecord>().get(h); 00018 fitter.set(h.product()); 00019 } 00020 }; 00021 00022 template<typename Fitter> 00023 struct EventSetupInit<CandCommonVertexFitter<Fitter> > { 00024 typedef CandVertexFitterEventSetupInit<Fitter> type; 00025 }; 00026 } 00027 } 00028 00029 #endif