Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 14:26:44

0001 // user include files
0002 #include "FWCore/Framework/interface/ModuleFactory.h"
0003 #include "FWCore/Framework/interface/ESProducer.h"
0004 #include "FWCore/Framework/interface/ESHandle.h"
0005 
0006 #include "Geometry/Records/interface/TrackerTopologyRcd.h"
0007 
0008 #include "RecoPixelVertexing/PixelLowPtUtilities/interface/TrackCleaner.h"
0009 
0010 class TrackCleanerESProducer : public edm::ESProducer {
0011 public:
0012   TrackCleanerESProducer(const edm::ParameterSet& iConfig);
0013   ~TrackCleanerESProducer() override = default;
0014 
0015   static void fillDescriptions(edm::ConfigurationDescriptions& descriptions);
0016 
0017   std::unique_ptr<PixelTrackCleaner> produce(const PixelTrackCleaner::Record& iRecord);
0018 
0019 private:
0020   const edm::ESGetToken<TrackerTopology, TrackerTopologyRcd> trackerToken_;
0021 };
0022 
0023 TrackCleanerESProducer::TrackCleanerESProducer(const edm::ParameterSet& iConfig)
0024     : trackerToken_(setWhatProduced(this, iConfig.getParameter<std::string>("ComponentName"))
0025                         .consumesFrom<TrackerTopology, TrackerTopologyRcd>()) {}
0026 
0027 void TrackCleanerESProducer::fillDescriptions(edm::ConfigurationDescriptions& descriptions) {
0028   edm::ParameterSetDescription desc;
0029   desc.add<std::string>("ComponentName", "trackCleaner");
0030   descriptions.add("trackCleaner", desc);
0031 }
0032 
0033 std::unique_ptr<PixelTrackCleaner> TrackCleanerESProducer::produce(const PixelTrackCleaner::Record& iRecord) {
0034   return std::make_unique<TrackCleaner>(&iRecord.get(trackerToken_));
0035 }
0036 
0037 #include "FWCore/PluginManager/interface/ModuleDef.h"
0038 #include "FWCore/Framework/interface/MakerMacros.h"
0039 DEFINE_FWK_EVENTSETUP_MODULE(TrackCleanerESProducer);