00001 #include "RecoTracker/TransientTrackingRecHit/plugins/TkTransientTrackingRecHitBuilderESProducer.h" 00002 #include "RecoTracker/TransientTrackingRecHit/interface/TkTransientTrackingRecHitBuilder.h" 00003 #include "MagneticField/Engine/interface/MagneticField.h" 00004 #include "Geometry/Records/interface/TrackerDigiGeometryRecord.h" 00005 00006 00007 #include "FWCore/Framework/interface/EventSetup.h" 00008 #include "FWCore/Framework/interface/ESHandle.h" 00009 #include "FWCore/Framework/interface/ModuleFactory.h" 00010 #include "FWCore/Framework/interface/ESProducer.h" 00011 00012 #include <string> 00013 #include <memory> 00014 00015 using namespace edm; 00016 00017 TkTransientTrackingRecHitBuilderESProducer::TkTransientTrackingRecHitBuilderESProducer(const edm::ParameterSet & p) 00018 { 00019 std::string myname = p.getParameter<std::string>("ComponentName"); 00020 pset_ = p; 00021 setWhatProduced(this,myname); 00022 } 00023 00024 TkTransientTrackingRecHitBuilderESProducer::~TkTransientTrackingRecHitBuilderESProducer() {} 00025 00026 boost::shared_ptr<TransientTrackingRecHitBuilder> 00027 TkTransientTrackingRecHitBuilderESProducer::produce(const TransientRecHitRecord & iRecord){ 00028 // if (_propagator){ 00029 // delete _propagator; 00030 // _propagator = 0; 00031 // } 00032 00033 std::string sname = pset_.getParameter<std::string>("StripCPE"); 00034 std::string pname = pset_.getParameter<std::string>("PixelCPE"); 00035 std::string mname = pset_.getParameter<std::string>("Matcher"); 00036 00037 edm::ESHandle<StripClusterParameterEstimator> se; 00038 edm::ESHandle<PixelClusterParameterEstimator> pe; 00039 edm::ESHandle<SiStripRecHitMatcher> me; 00040 const StripClusterParameterEstimator * sp ; 00041 const PixelClusterParameterEstimator * pp ; 00042 const SiStripRecHitMatcher * mp ; 00043 00044 if (sname == "Fake") { 00045 sp = 0; 00046 }else{ 00047 iRecord.getRecord<TkStripCPERecord>().get( sname, se ); 00048 sp = se.product(); 00049 } 00050 00051 if (pname == "Fake") { 00052 pp = 0; 00053 }else{ 00054 iRecord.getRecord<TkPixelCPERecord>().get( pname, pe ); 00055 pp = pe.product(); 00056 } 00057 00058 if (mname == "Fake") { 00059 mp = 0; 00060 }else{ 00061 iRecord.getRecord<TkStripCPERecord>().get( mname, me ); 00062 mp = me.product(); 00063 } 00064 00065 00066 edm::ESHandle<TrackerGeometry> pDD; 00067 iRecord.getRecord<TrackerDigiGeometryRecord>().get( pDD ); 00068 00069 _builder = boost::shared_ptr<TransientTrackingRecHitBuilder>(new TkTransientTrackingRecHitBuilder(pDD.product(), pp, sp, mp)); 00070 return _builder; 00071 } 00072 00073