Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:22:25

0001 // -*- C++ -*-
0002 //
0003 // Package:    RPCTriggerBxOrConfig
0004 // Class:      RPCTriggerBxOrConfig
0005 //
0006 /**\class RPCTriggerBxOrConfig RPCTriggerBxOrConfig.h L1TriggerConfig/RPCTriggerBxOrConfig/src/RPCTriggerBxOrConfig.cc
0007 
0008  Description: <one line class summary>
0009 
0010  Implementation:
0011      <Notes on implementation>
0012 */
0013 //
0014 // Original Author:  Tomasz Maciej Frueboes
0015 //         Created:  Wed Apr  9 13:57:29 CEST 2008
0016 //
0017 //
0018 
0019 // system include files
0020 #include <memory>
0021 
0022 // user include files
0023 #include "FWCore/Framework/interface/ModuleFactory.h"
0024 #include "FWCore/Framework/interface/ESProducer.h"
0025 
0026 #include "FWCore/Framework/interface/ESHandle.h"
0027 
0028 #include "CondFormats/DataRecord/interface/L1RPCBxOrConfigRcd.h"
0029 #include "CondFormats/L1TObjects/interface/L1RPCBxOrConfig.h"
0030 
0031 //
0032 // class decleration
0033 //
0034 
0035 class RPCTriggerBxOrConfig : public edm::ESProducer {
0036 public:
0037   RPCTriggerBxOrConfig(const edm::ParameterSet&);
0038   ~RPCTriggerBxOrConfig() override;
0039 
0040   typedef std::unique_ptr<L1RPCBxOrConfig> ReturnType;
0041 
0042   ReturnType produce(const L1RPCBxOrConfigRcd&);
0043 
0044 private:
0045   int m_firstBX;
0046   int m_lastBX;
0047 };
0048 
0049 //
0050 // constants, enums and typedefs
0051 //
0052 
0053 //
0054 // static data member definitions
0055 //
0056 
0057 //
0058 // constructors and destructor
0059 //
0060 RPCTriggerBxOrConfig::RPCTriggerBxOrConfig(const edm::ParameterSet& iConfig) {
0061   //the following line is needed to tell the framework what
0062   // data is being produced
0063   setWhatProduced(this);
0064 
0065   m_firstBX = iConfig.getParameter<int>("firstBX");
0066   m_lastBX = iConfig.getParameter<int>("lastBX");
0067 }
0068 
0069 RPCTriggerBxOrConfig::~RPCTriggerBxOrConfig() {}
0070 
0071 //
0072 // member functions
0073 //
0074 
0075 // ------------ method called to produce the data  ------------
0076 RPCTriggerBxOrConfig::ReturnType RPCTriggerBxOrConfig::produce(const L1RPCBxOrConfigRcd& iRecord) {
0077   auto pRPCTriggerBxOrConfig = std::make_unique<L1RPCBxOrConfig>();
0078 
0079   if (m_firstBX > m_lastBX)
0080     throw cms::Exception("BadConfig") << " firstBX < m_lastBX  "
0081                                       << "\n";
0082 
0083   pRPCTriggerBxOrConfig->setFirstBX(m_firstBX);
0084   pRPCTriggerBxOrConfig->setLastBX(m_lastBX);
0085 
0086   return pRPCTriggerBxOrConfig;
0087 }
0088 
0089 //define this as a plug-in
0090 DEFINE_FWK_EVENTSETUP_MODULE(RPCTriggerBxOrConfig);