Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:21:57

0001 //  This ESproducer produces configuration needed by HitPatternHelper
0002 //
0003 //  Created by J.Li on 1/23/21.
0004 //
0005 
0006 #include "FWCore/Framework/interface/ModuleFactory.h"
0007 #include "FWCore/Framework/interface/ESProducer.h"
0008 #include "FWCore/Framework/interface/ESHandle.h"
0009 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0010 #include "FWCore/Utilities/interface/ESGetToken.h"
0011 #include "FWCore/Utilities/interface/ESInputTag.h"
0012 #include "DataFormats/Provenance/interface/ParameterSetID.h"
0013 #include "L1Trigger/TrackFindingTracklet/interface/HitPatternHelper.h"
0014 #include "L1Trigger/TrackTrigger/interface/Setup.h"
0015 #include "L1Trigger/TrackerTFP/interface/DataFormats.h"
0016 #include "L1Trigger/TrackerTFP/interface/LayerEncoding.h"
0017 
0018 #include <memory>
0019 
0020 using namespace std;
0021 using namespace edm;
0022 
0023 namespace hph {
0024 
0025   class ProducerHPH : public ESProducer {
0026   public:
0027     ProducerHPH(const ParameterSet& iConfig);
0028     ~ProducerHPH() override {}
0029     unique_ptr<Setup> produce(const SetupRcd& Rcd);
0030 
0031   private:
0032     const ParameterSet iConfig_;
0033     ESGetToken<tt::Setup, tt::SetupRcd> esGetTokenSetup_;
0034     ESGetToken<trackerTFP::DataFormats, trackerTFP::DataFormatsRcd> esGetTokenDataFormats_;
0035     ESGetToken<trackerTFP::LayerEncoding, trackerTFP::LayerEncodingRcd> esGetTokenLayerEncoding_;
0036   };
0037 
0038   ProducerHPH::ProducerHPH(const ParameterSet& iConfig) : iConfig_(iConfig) {
0039     auto cc = setWhatProduced(this);
0040     esGetTokenSetup_ = cc.consumes();
0041     esGetTokenDataFormats_ = cc.consumes();
0042     esGetTokenLayerEncoding_ = cc.consumes();
0043   }
0044 
0045   unique_ptr<Setup> ProducerHPH::produce(const SetupRcd& Rcd) {
0046     const tt::Setup& setupTT = Rcd.get(esGetTokenSetup_);
0047     const trackerTFP::DataFormats& dataFormats = Rcd.get(esGetTokenDataFormats_);
0048     const trackerTFP::LayerEncoding& layerEncoding = Rcd.get(esGetTokenLayerEncoding_);
0049     return make_unique<Setup>(iConfig_, setupTT, dataFormats, layerEncoding);
0050   }
0051 
0052 }  // namespace hph
0053 
0054 DEFINE_FWK_EVENTSETUP_MODULE(hph::ProducerHPH);