Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:31:32

0001 #include "FWCore/Framework/interface/ESProducer.h"
0002 #include "FWCore/Framework/interface/EventSetup.h"
0003 #include "FWCore/Framework/interface/ESHandle.h"
0004 #include "FWCore/Framework/interface/ModuleFactory.h"
0005 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0006 #include "FWCore/Utilities/interface/ESInputTag.h"
0007 #include "TrackingTools/Records/interface/TrackingComponentsRecord.h"
0008 #include "TrackingTools/KalmanUpdators/interface/TrackingRecHitPropagator.h"
0009 
0010 #include <string>
0011 #include <memory>
0012 
0013 class TrackingRecHitPropagatorESProducer : public edm::ESProducer {
0014 public:
0015   TrackingRecHitPropagatorESProducer(const edm::ParameterSet& p);
0016 
0017   std::unique_ptr<TrackingRecHitPropagator> produce(const TrackingComponentsRecord&);
0018 
0019   static void fillDescriptions(edm::ConfigurationDescriptions& descriptions);
0020 
0021 private:
0022   const edm::ESGetToken<MagneticField, IdealMagneticFieldRecord> mfToken_;
0023 };
0024 
0025 using namespace edm;
0026 
0027 TrackingRecHitPropagatorESProducer::TrackingRecHitPropagatorESProducer(const edm::ParameterSet& p)
0028     : mfToken_(setWhatProduced(this, p.getParameter<std::string>("ComponentName"))
0029                    .consumesFrom<MagneticField, IdealMagneticFieldRecord>(
0030                        edm::ESInputTag("", p.getParameter<std::string>("SimpleMagneticField")))) {}
0031 
0032 std::unique_ptr<TrackingRecHitPropagator> TrackingRecHitPropagatorESProducer::produce(
0033     const TrackingComponentsRecord& iRecord) {
0034   return std::make_unique<TrackingRecHitPropagator>(&iRecord.get(mfToken_));
0035 }
0036 
0037 void TrackingRecHitPropagatorESProducer::fillDescriptions(edm::ConfigurationDescriptions& descriptions) {
0038   edm::ParameterSetDescription desc;
0039   desc.add<std::string>("ComponentName");
0040   desc.add<std::string>("SimpleMagneticField", "");
0041   descriptions.addDefault(desc);
0042 }
0043 DEFINE_FWK_EVENTSETUP_MODULE(TrackingRecHitPropagatorESProducer);