CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_4_1_8_patch13/src/CondTools/L1Trigger/src/L1ObjectKeysOnlineProdBase.cc

Go to the documentation of this file.
00001 // -*- C++ -*-
00002 //
00003 // Package:    L1ObjectKeysOnlineProdBase
00004 // Class:      L1ObjectKeysOnlineProdBase
00005 // 
00013 //
00014 // Original Author:  Werner Man-Li Sun
00015 //         Created:  Fri Aug 22 19:51:36 CEST 2008
00016 // $Id: L1ObjectKeysOnlineProdBase.cc,v 1.2 2010/02/01 22:00:05 wsun Exp $
00017 //
00018 //
00019 
00020 
00021 // system include files
00022 
00023 // user include files
00024 #include "CondTools/L1Trigger/interface/L1ObjectKeysOnlineProdBase.h"
00025 
00026 #include "CondTools/L1Trigger/interface/Exception.h"
00027 
00028 #include "CondFormats/L1TObjects/interface/L1TriggerKeyList.h"
00029 #include "CondFormats/DataRecord/interface/L1TriggerKeyListRcd.h"
00030 
00031 #include "FWCore/Framework/interface/EventSetup.h"
00032 
00033 //
00034 // class declaration
00035 //
00036 
00037 //
00038 // constants, enums and typedefs
00039 //
00040 
00041 //
00042 // static data member definitions
00043 //
00044 
00045 //
00046 // constructors and destructor
00047 //
00048 L1ObjectKeysOnlineProdBase::L1ObjectKeysOnlineProdBase(const edm::ParameterSet& iConfig)
00049    : m_omdsReader(
00050         iConfig.getParameter< std::string >( "onlineDB" ),
00051         iConfig.getParameter< std::string >( "onlineAuthentication" ) )
00052 {
00053    //the following line is needed to tell the framework what
00054    // data is being produced
00055 
00056   // The subsystemLabel is used by L1TriggerKeyOnlineProd to identify the
00057   // L1TriggerKeys to concatenate.
00058   setWhatProduced(this,
00059                   iConfig.getParameter< std::string >( "subsystemLabel" )
00060                   );
00061 
00062    //now do what ever other initialization is needed
00063 }
00064 
00065 
00066 L1ObjectKeysOnlineProdBase::~L1ObjectKeysOnlineProdBase()
00067 {
00068  
00069    // do anything here that needs to be done at desctruction time
00070    // (e.g. close files, deallocate resources etc.)
00071 
00072 }
00073 
00074 
00075 //
00076 // member functions
00077 //
00078 
00079 // ------------ method called to produce the data  ------------
00080 L1ObjectKeysOnlineProdBase::ReturnType
00081 L1ObjectKeysOnlineProdBase::produce(const L1TriggerKeyRcd& iRecord)
00082 {
00083    using namespace edm::es;
00084 
00085   // Get L1TriggerKey with label "SubsystemKeysOnly".  Re-throw exception if
00086   // not present.
00087   edm::ESHandle< L1TriggerKey > subsystemKeys ;
00088   try
00089     {
00090       iRecord.get( "SubsystemKeysOnly", subsystemKeys ) ;
00091     }
00092   catch( l1t::DataAlreadyPresentException& ex )
00093     {
00094       throw ex ;
00095     }
00096 
00097   // Copy L1TriggerKey to new object.
00098   boost::shared_ptr<L1TriggerKey> pL1TriggerKey ;
00099   pL1TriggerKey = boost::shared_ptr< L1TriggerKey >(
00100     new L1TriggerKey( *subsystemKeys ) ) ;
00101 
00102   // Get object keys.
00103   fillObjectKeys( pL1TriggerKey ) ;
00104 
00105   return pL1TriggerKey ;
00106 }
00107 
00108 //define this as a plug-in
00109 //DEFINE_FWK_EVENTSETUP_MODULE(L1ObjectKeysOnlineProdBase);