Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-09-28 23:48:17

0001 // -*- C++ -*-
0002 //
0003 // Package:    L1TriggerKeyOnlineProd
0004 // Class:      L1TriggerKeyOnlineProd
0005 //
0006 /**\class L1TriggerKeyOnlineProd L1TriggerKeyOnlineProd.h CondTools/L1TriggerKeyOnlineProd/src/L1TriggerKeyOnlineProd.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:  Sun Mar  2 03:03:32 CET 2008
0016 // $Id: L1TriggerKeyOnlineProd.cc,v 1.10 2008/10/13 01:49:48 wsun Exp $
0017 //
0018 //
0019 
0020 // system include files
0021 
0022 // user include files
0023 #include "FWCore/MessageLogger/interface/MessageLogger.h"
0024 
0025 #include "CondTools/L1Trigger/plugins/L1TriggerKeyOnlineProd.h"
0026 
0027 #include "CondTools/L1Trigger/interface/Exception.h"
0028 
0029 #include "FWCore/Framework/interface/EventSetup.h"
0030 
0031 //
0032 // class declaration
0033 //
0034 
0035 //
0036 // constants, enums and typedefs
0037 //
0038 
0039 //
0040 // static data member definitions
0041 //
0042 
0043 //
0044 // constructors and destructor
0045 //
0046 L1TriggerKeyOnlineProd::L1TriggerKeyOnlineProd(const edm::ParameterSet& iConfig)
0047     : m_subsystemLabels(iConfig.getParameter<std::vector<std::string> >("subsystemLabels")) {
0048   //the following line is needed to tell the framework what
0049   // data is being produced
0050   auto cc = setWhatProduced(this);
0051 
0052   //now do what ever other initialization is needed
0053   l1TriggerKeyToken_ = cc.consumes(edm::ESInputTag("", "SubsystemKeysOnly"));
0054   for (const auto& mlabel : m_subsystemLabels) {
0055     l1TriggerKeyTokenVec_.emplace_back(cc.consumes(edm::ESInputTag("", mlabel)));
0056   }
0057 }
0058 
0059 L1TriggerKeyOnlineProd::~L1TriggerKeyOnlineProd() {
0060   // do anything here that needs to be done at desctruction time
0061   // (e.g. close files, deallocate resources etc.)
0062 }
0063 
0064 //
0065 // member functions
0066 //
0067 
0068 // ------------ method called to produce the data  ------------
0069 L1TriggerKeyOnlineProd::ReturnType L1TriggerKeyOnlineProd::produce(const L1TriggerKeyRcd& iRecord) {
0070   // Start with "SubsystemKeysOnly"
0071   edm::ESHandle<L1TriggerKey> subsystemKeys;
0072   try {
0073     subsystemKeys = iRecord.getHandle(l1TriggerKeyToken_);
0074   } catch (l1t::DataAlreadyPresentException& ex) {
0075     throw ex;
0076   }
0077 
0078   std::unique_ptr<L1TriggerKey> pL1TriggerKey = std::make_unique<L1TriggerKey>(*subsystemKeys);
0079 
0080   // Collate object keys
0081   for (const auto& l1token : l1TriggerKeyTokenVec_) {
0082     edm::ESHandle<L1TriggerKey> objectKeys;
0083     try {
0084       objectKeys = iRecord.getHandle(l1token);
0085     } catch (l1t::DataAlreadyPresentException& ex) {
0086       throw ex;
0087     }
0088 
0089     pL1TriggerKey->add(objectKeys->recordToKeyMap());
0090   }
0091 
0092   return pL1TriggerKey;
0093 }
0094 
0095 //define this as a plug-in
0096 //DEFINE_FWK_EVENTSETUP_MODULE(L1TriggerKeyOnlineProd);