00001 // -*- C++ -*- 00002 // 00003 // Package: RPCTriggerBxOrConfig 00004 // Class: RPCTriggerBxOrConfig 00005 // 00013 // 00014 // Original Author: Tomasz Maciej Frueboes 00015 // Created: Wed Apr 9 13:57:29 CEST 2008 00016 // $Id: RPCTriggerBxOrConfig.cc,v 1.1 2010/02/26 15:50:55 fruboes Exp $ 00017 // 00018 // 00019 00020 00021 // system include files 00022 #include <memory> 00023 #include "boost/shared_ptr.hpp" 00024 00025 // user include files 00026 #include "FWCore/Framework/interface/ModuleFactory.h" 00027 #include "FWCore/Framework/interface/ESProducer.h" 00028 00029 #include "FWCore/Framework/interface/ESHandle.h" 00030 00031 #include "CondFormats/DataRecord/interface/L1RPCBxOrConfigRcd.h" 00032 #include "CondFormats/L1TObjects/interface/L1RPCBxOrConfig.h" 00033 00034 00035 00036 // 00037 // class decleration 00038 // 00039 00040 class RPCTriggerBxOrConfig : public edm::ESProducer { 00041 public: 00042 RPCTriggerBxOrConfig(const edm::ParameterSet&); 00043 ~RPCTriggerBxOrConfig(); 00044 00045 typedef std::auto_ptr<L1RPCBxOrConfig> ReturnType; 00046 00047 ReturnType produce(const L1RPCBxOrConfigRcd&); 00048 private: 00049 int m_firstBX; 00050 int m_lastBX; 00051 00052 }; 00053 00054 // 00055 // constants, enums and typedefs 00056 // 00057 00058 // 00059 // static data member definitions 00060 // 00061 00062 // 00063 // constructors and destructor 00064 // 00065 RPCTriggerBxOrConfig::RPCTriggerBxOrConfig(const edm::ParameterSet& iConfig) 00066 { 00067 //the following line is needed to tell the framework what 00068 // data is being produced 00069 setWhatProduced(this); 00070 00071 m_firstBX = iConfig.getParameter<int>("firstBX"); 00072 m_lastBX = iConfig.getParameter<int>("lastBX"); 00073 00074 00075 } 00076 00077 00078 RPCTriggerBxOrConfig::~RPCTriggerBxOrConfig() 00079 { 00080 00081 00082 } 00083 00084 00085 // 00086 // member functions 00087 // 00088 00089 // ------------ method called to produce the data ------------ 00090 RPCTriggerBxOrConfig::ReturnType 00091 RPCTriggerBxOrConfig::produce(const L1RPCBxOrConfigRcd& iRecord) 00092 { 00093 using namespace edm::es; 00094 std::auto_ptr<L1RPCBxOrConfig> pRPCTriggerBxOrConfig = std::auto_ptr<L1RPCBxOrConfig>( new L1RPCBxOrConfig() ); 00095 00096 if (m_firstBX > m_lastBX ) 00097 throw cms::Exception("BadConfig") << " firstBX < m_lastBX " << "\n"; 00098 00099 pRPCTriggerBxOrConfig->setFirstBX(m_firstBX); 00100 pRPCTriggerBxOrConfig->setLastBX(m_lastBX); 00101 00102 return pRPCTriggerBxOrConfig ; 00103 } 00104 00105 //define this as a plug-in 00106 DEFINE_FWK_EVENTSETUP_MODULE(RPCTriggerBxOrConfig);