00001 // -*- C++ -*- 00002 // 00003 // Package: RPCTriggerHsbConfig 00004 // Class: RPCTriggerHsbConfig 00005 // 00013 // 00014 // Original Author: Tomasz Maciej Frueboes 00015 // Created: Wed Apr 9 13:57:29 CEST 2008 00016 // $Id: RPCTriggerHsbConfig.cc,v 1.3 2010/03/02 14:02:57 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/L1RPCHsbConfigRcd.h" 00032 #include "CondFormats/L1TObjects/interface/L1RPCHsbConfig.h" 00033 00034 00035 00036 // 00037 // class decleration 00038 // 00039 00040 class RPCTriggerHsbConfig : public edm::ESProducer { 00041 public: 00042 RPCTriggerHsbConfig(const edm::ParameterSet&); 00043 ~RPCTriggerHsbConfig(); 00044 00045 typedef std::auto_ptr<L1RPCHsbConfig> ReturnType; 00046 00047 ReturnType produce(const L1RPCHsbConfigRcd&); 00048 private: 00049 std::vector<int> m_hsb0; 00050 std::vector<int> m_hsb1; 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 RPCTriggerHsbConfig::RPCTriggerHsbConfig(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_hsb0 = iConfig.getParameter< std::vector<int > >("hsb0Mask"); 00072 m_hsb1 = iConfig.getParameter< std::vector<int > >("hsb1Mask"); 00073 00074 00075 if ( m_hsb0.size() !=8 || m_hsb1.size() != 8 ) 00076 throw cms::Exception("BadConfig") << " hsbMask needs to be 8 digits long \n"; 00077 00078 00079 // contents of the vector wont be checked here - there are also different sources of this cfg 00080 00081 } 00082 00083 00084 RPCTriggerHsbConfig::~RPCTriggerHsbConfig() 00085 { 00086 00087 00088 } 00089 00090 00091 // 00092 // member functions 00093 // 00094 00095 // ------------ method called to produce the data ------------ 00096 RPCTriggerHsbConfig::ReturnType 00097 RPCTriggerHsbConfig::produce(const L1RPCHsbConfigRcd& iRecord) 00098 { 00099 00100 using namespace edm::es; 00101 std::auto_ptr<L1RPCHsbConfig> pRPCTriggerHsbConfig = std::auto_ptr<L1RPCHsbConfig>( new L1RPCHsbConfig() ); 00102 00103 pRPCTriggerHsbConfig->setHsbMask(0, m_hsb0); 00104 pRPCTriggerHsbConfig->setHsbMask(1, m_hsb1); 00105 00106 return pRPCTriggerHsbConfig ; 00107 } 00108 00109 //define this as a plug-in 00110 DEFINE_FWK_EVENTSETUP_MODULE(RPCTriggerHsbConfig);