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 #include "FWCore/MessageLogger/interface/MessageLogger.h" 00016 00017 using namespace edm; 00018 00019 TkTransientTrackingRecHitBuilderESProducer::TkTransientTrackingRecHitBuilderESProducer(const edm::ParameterSet & p) 00020 { 00021 std::string myname = p.getParameter<std::string>("ComponentName"); 00022 pset_ = p; 00023 setWhatProduced(this,myname); 00024 } 00025 00026 TkTransientTrackingRecHitBuilderESProducer::~TkTransientTrackingRecHitBuilderESProducer() {} 00027 00028 boost::shared_ptr<TransientTrackingRecHitBuilder> 00029 TkTransientTrackingRecHitBuilderESProducer::produce(const TransientRecHitRecord & iRecord){ 00030 // if (_propagator){ 00031 // delete _propagator; 00032 // _propagator = 0; 00033 // } 00034 00035 std::string sname = pset_.getParameter<std::string>("StripCPE"); 00036 std::string pname = pset_.getParameter<std::string>("PixelCPE"); 00037 std::string mname = pset_.getParameter<std::string>("Matcher"); 00038 00039 edm::ESHandle<StripClusterParameterEstimator> se; 00040 edm::ESHandle<PixelClusterParameterEstimator> pe; 00041 edm::ESHandle<SiStripRecHitMatcher> me; 00042 const StripClusterParameterEstimator * sp ; 00043 const PixelClusterParameterEstimator * pp ; 00044 const SiStripRecHitMatcher * mp ; 00045 00046 if (sname == "Fake") { 00047 sp = 0; 00048 }else{ 00049 iRecord.getRecord<TkStripCPERecord>().get( sname, se ); 00050 sp = se.product(); 00051 } 00052 00053 if (pname == "Fake") { 00054 pp = 0; 00055 }else{ 00056 iRecord.getRecord<TkPixelCPERecord>().get( pname, pe ); 00057 pp = pe.product(); 00058 } 00059 00060 if (mname == "Fake") { 00061 mp = 0; 00062 }else{ 00063 iRecord.getRecord<TkStripCPERecord>().get( mname, me ); 00064 mp = me.product(); 00065 } 00066 00067 bool computeCoarseLocalPositionFromDisk = pset_.getParameter<bool>("ComputeCoarseLocalPositionFromDisk"); 00068 if (computeCoarseLocalPositionFromDisk) 00069 edm::LogWarning("TkTransientTrackingRecHitBuilderESProducer")<<" The tracking rec hit positions and errors are not a persistent in data formats.\n" 00070 <<" They are not available from disk.\n" 00071 <<" However, TkTransientTrackingRecHitBuilderESProducer::ComputeCoarseLocalPositionFromDisk=True \n" 00072 <<" will make the coarse estimation of this position/error available without track refit.\n" 00073 <<" Position/error obtained from rechit with already defined position/error are not recomputed.\n" 00074 <<" Position/error obtained from track refit are precise."; 00075 00076 edm::ESHandle<TrackerGeometry> pDD; 00077 iRecord.getRecord<TrackerDigiGeometryRecord>().get( pDD ); 00078 00079 _builder = boost::shared_ptr<TransientTrackingRecHitBuilder>(new TkTransientTrackingRecHitBuilder(pDD.product(), pp, sp, mp, computeCoarseLocalPositionFromDisk)); 00080 return _builder; 00081 } 00082 00083