Back to home page

Project CMSSW displayed by LXR

 
 

    


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

0001 // -*- C++ -*-
0002 //
0003 // Package:    RPCTriggerHsbConfig
0004 // Class:      RPCTriggerHsbConfig
0005 //
0006 /**\class RPCTriggerHsbConfig RPCTriggerHsbConfig.h L1TriggerConfig/RPCTriggerHsbConfig/src/RPCTriggerHsbConfig.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/L1RPCHsbConfigRcd.h"
0029 #include "CondFormats/L1TObjects/interface/L1RPCHsbConfig.h"
0030 
0031 //
0032 // class decleration
0033 //
0034 
0035 class RPCTriggerHsbConfig : public edm::ESProducer {
0036 public:
0037   RPCTriggerHsbConfig(const edm::ParameterSet&);
0038   ~RPCTriggerHsbConfig() override;
0039 
0040   typedef std::unique_ptr<L1RPCHsbConfig> ReturnType;
0041 
0042   ReturnType produce(const L1RPCHsbConfigRcd&);
0043 
0044 private:
0045   std::vector<int> m_hsb0;
0046   std::vector<int> m_hsb1;
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 RPCTriggerHsbConfig::RPCTriggerHsbConfig(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_hsb0 = iConfig.getParameter<std::vector<int> >("hsb0Mask");
0066   m_hsb1 = iConfig.getParameter<std::vector<int> >("hsb1Mask");
0067 
0068   if (m_hsb0.size() != 8 || m_hsb1.size() != 8)
0069     throw cms::Exception("BadConfig") << " hsbMask needs to be 8 digits long \n";
0070 
0071   // contents of the vector wont be checked here - there are also different sources of this cfg
0072 }
0073 
0074 RPCTriggerHsbConfig::~RPCTriggerHsbConfig() {}
0075 
0076 //
0077 // member functions
0078 //
0079 
0080 // ------------ method called to produce the data  ------------
0081 RPCTriggerHsbConfig::ReturnType RPCTriggerHsbConfig::produce(const L1RPCHsbConfigRcd& iRecord) {
0082   auto pRPCTriggerHsbConfig = std::make_unique<L1RPCHsbConfig>();
0083 
0084   pRPCTriggerHsbConfig->setHsbMask(0, m_hsb0);
0085   pRPCTriggerHsbConfig->setHsbMask(1, m_hsb1);
0086 
0087   return pRPCTriggerHsbConfig;
0088 }
0089 
0090 //define this as a plug-in
0091 DEFINE_FWK_EVENTSETUP_MODULE(RPCTriggerHsbConfig);