Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 12:52:18

0001 #include "FWCore/MessageLogger/interface/MessageLogger.h"
0002 
0003 #include "CondTools/L1TriggerExt/plugins/L1TriggerKeyOnlineProdExt.h"
0004 
0005 #include "CondTools/L1Trigger/interface/Exception.h"
0006 
0007 #include "FWCore/Framework/interface/EventSetup.h"
0008 
0009 L1TriggerKeyOnlineProdExt::L1TriggerKeyOnlineProdExt(const edm::ParameterSet& iConfig) {
0010   //the following line is needed to tell the framework what
0011   // data is being produced
0012   auto cc = setWhatProduced(this);
0013 
0014   for (auto const& label : iConfig.getParameter<std::vector<std::string> >("subsystemLabels")) {
0015     m_subsystemTokens.emplace_back(cc.consumesFrom<L1TriggerKeyExt, L1TriggerKeyExtRcd>(edm::ESInputTag{"", label}));
0016 
0017     //now do what ever other initialization is needed
0018   }
0019 
0020   L1TriggerKeyExt_token = cc.consumes(edm::ESInputTag{"", "SubsystemKeysOnly"});
0021 }
0022 
0023 L1TriggerKeyOnlineProdExt::~L1TriggerKeyOnlineProdExt() {
0024   // do anything here that needs to be done at desctruction time
0025   // (e.g. close files, deallocate resources etc.)
0026 }
0027 
0028 //
0029 // member functions
0030 //
0031 
0032 // ------------ method called to produce the data  ------------
0033 L1TriggerKeyOnlineProdExt::ReturnType L1TriggerKeyOnlineProdExt::produce(const L1TriggerKeyExtRcd& iRecord) {
0034   // Start with "SubsystemKeysOnly"
0035   L1TriggerKeyExt subsystemKeys;
0036   try {
0037     subsystemKeys = iRecord.get(L1TriggerKeyExt_token);
0038   } catch (l1t::DataAlreadyPresentException& ex) {
0039     throw ex;
0040   }
0041 
0042   auto pL1TriggerKey = std::make_unique<L1TriggerKeyExt>(subsystemKeys);
0043 
0044   // Collate object keys
0045   for (auto const& token : m_subsystemTokens) {
0046     pL1TriggerKey->add(iRecord.get(token).recordToKeyMap());
0047   }
0048 
0049   return pL1TriggerKey;
0050 }
0051 
0052 //define this as a plug-in
0053 //DEFINE_FWK_EVENTSETUP_MODULE(L1TriggerKeyOnlineProdExt);