Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:03:13

0001 // -*- C++ -*-
0002 //
0003 // Package:    L1ObjectKeysOnlineProdBase
0004 // Class:      L1ObjectKeysOnlineProdBase
0005 //
0006 /**\class L1ObjectKeysOnlineProdBase L1ObjectKeysOnlineProdBase.h CondTools/L1ObjectKeysOnlineProdBase/src/L1ObjectKeysOnlineProdBase.cc
0007 
0008  Description: <one line class summary>
0009 
0010  Implementation:
0011      <Notes on implementation>
0012 */
0013 //
0014 // Original Author:  Werner Man-Li Sun
0015 //         Created:  Fri Aug 22 19:51:36 CEST 2008
0016 // $Id: L1ObjectKeysOnlineProdBase.cc,v 1.1 2008/09/19 19:22:59 wsun Exp $
0017 //
0018 //
0019 
0020 // system include files
0021 
0022 // user include files
0023 #include "CondTools/L1Trigger/interface/L1ObjectKeysOnlineProdBase.h"
0024 
0025 #include "CondTools/L1Trigger/interface/Exception.h"
0026 
0027 #include "CondFormats/L1TObjects/interface/L1TriggerKeyList.h"
0028 #include "CondFormats/DataRecord/interface/L1TriggerKeyListRcd.h"
0029 
0030 #include "FWCore/Framework/interface/EventSetup.h"
0031 
0032 //
0033 // class declaration
0034 //
0035 
0036 //
0037 // constants, enums and typedefs
0038 //
0039 
0040 //
0041 // static data member definitions
0042 //
0043 
0044 //
0045 // constructors and destructor
0046 //
0047 L1ObjectKeysOnlineProdBase::L1ObjectKeysOnlineProdBase(const edm::ParameterSet& iConfig)
0048     : m_omdsReader(iConfig.getParameter<std::string>("onlineDB"),
0049                    iConfig.getParameter<std::string>("onlineAuthentication")) {
0050   //the following line is needed to tell the framework what
0051   // data is being produced
0052 
0053   // The subsystemLabel is used by L1TriggerKeyOnlineProd to identify the
0054   // L1TriggerKeys to concatenate.
0055   auto cc = setWhatProduced(this, iConfig.getParameter<std::string>("subsystemLabel"));
0056 
0057   //now do what ever other initialization is needed
0058   l1TriggerKeyToken_ = cc.consumes(edm::ESInputTag("", "SubsystemKeysOnly"));
0059 }
0060 
0061 L1ObjectKeysOnlineProdBase::~L1ObjectKeysOnlineProdBase() {
0062   // do anything here that needs to be done at desctruction time
0063   // (e.g. close files, deallocate resources etc.)
0064 }
0065 
0066 //
0067 // member functions
0068 //
0069 
0070 // ------------ method called to produce the data  ------------
0071 L1ObjectKeysOnlineProdBase::ReturnType L1ObjectKeysOnlineProdBase::produce(const L1TriggerKeyRcd& iRecord) {
0072   // Get L1TriggerKey with label "SubsystemKeysOnly".  Re-throw exception if
0073   // not present.
0074   edm::ESHandle<L1TriggerKey> subsystemKeys;
0075   try {
0076     subsystemKeys = iRecord.getHandle(l1TriggerKeyToken_);
0077   } catch (l1t::DataAlreadyPresentException& ex) {
0078     throw ex;
0079   }
0080 
0081   // Copy L1TriggerKey to new object.
0082   std::unique_ptr<L1TriggerKey> pL1TriggerKey = std::make_unique<L1TriggerKey>(*subsystemKeys);
0083 
0084   // Get object keys.
0085   fillObjectKeys(pL1TriggerKey.get());
0086 
0087   return pL1TriggerKey;
0088 }
0089 
0090 //define this as a plug-in
0091 //DEFINE_FWK_EVENTSETUP_MODULE(L1ObjectKeysOnlineProdBase);