Back to home page

Project CMSSW displayed by LXR

 
 

    


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

0001 /** \class MuonTransientTrackingRecHitBuilderESProducer
0002  *  ESProducer for the Muon Transient TrackingRecHit Builder. The Builder can be taken from the 
0003  *  EventSetup, decoupling the code in which it is used w.r.t. the RecoMuon/TransientTrackingRecHit
0004  *  lib.
0005  *
0006  *  \author R. Bellan - INFN Torino <riccardo.bellan@cern.ch>
0007  */
0008 
0009 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0010 #include "TrackingTools/Records/interface/TransientRecHitRecord.h"
0011 
0012 #include "RecoMuon/TransientTrackingRecHit/interface/MuonTransientTrackingRecHitBuilder.h"
0013 
0014 #include "FWCore/Framework/interface/EventSetup.h"
0015 #include "FWCore/Framework/interface/ESHandle.h"
0016 #include "FWCore/Framework/interface/ESProducer.h"
0017 #include "FWCore/Framework/interface/ModuleFactory.h"
0018 
0019 #include "Geometry/Records/interface/GlobalTrackingGeometryRecord.h"
0020 #include "Geometry/CommonDetUnit/interface/GlobalTrackingGeometry.h"
0021 #include "TrackingTools/Records/interface/TransientRecHitRecord.h"
0022 
0023 #include <memory>
0024 
0025 class MuonTransientTrackingRecHitBuilderESProducer : public edm::ESProducer {
0026 public:
0027   /// Constructor
0028   MuonTransientTrackingRecHitBuilderESProducer(const edm::ParameterSet&);
0029 
0030   // Operations
0031   std::unique_ptr<TransientTrackingRecHitBuilder> produce(const TransientRecHitRecord&);
0032 
0033   static void fillDescriptions(edm::ConfigurationDescriptions& descriptions);
0034 
0035 private:
0036   edm::ESGetToken<GlobalTrackingGeometry, GlobalTrackingGeometryRecord> const trackingGeometryToken_;
0037 };
0038 
0039 using namespace edm;
0040 using namespace std;
0041 
0042 MuonTransientTrackingRecHitBuilderESProducer::MuonTransientTrackingRecHitBuilderESProducer(
0043     const ParameterSet& parameterSet)
0044     : trackingGeometryToken_(setWhatProduced(this, parameterSet.getParameter<string>("ComponentName"))
0045                                  .consumesFrom<GlobalTrackingGeometry, GlobalTrackingGeometryRecord>()) {}
0046 
0047 std::unique_ptr<TransientTrackingRecHitBuilder> MuonTransientTrackingRecHitBuilderESProducer::produce(
0048     const TransientRecHitRecord& iRecord) {
0049   return std::make_unique<MuonTransientTrackingRecHitBuilder>(iRecord.getHandle(trackingGeometryToken_));
0050 }
0051 
0052 void MuonTransientTrackingRecHitBuilderESProducer::fillDescriptions(edm::ConfigurationDescriptions& descriptions) {
0053   edm::ParameterSetDescription desc;
0054   desc.add<string>("ComponentName");
0055   descriptions.addDefault(desc);
0056 }
0057 
0058 DEFINE_FWK_EVENTSETUP_MODULE(MuonTransientTrackingRecHitBuilderESProducer);