Line Code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53
#include "FWCore/MessageLogger/interface/MessageLogger.h"

#include "CondTools/L1TriggerExt/plugins/L1TriggerKeyOnlineProdExt.h"

#include "CondTools/L1Trigger/interface/Exception.h"

#include "FWCore/Framework/interface/EventSetup.h"

L1TriggerKeyOnlineProdExt::L1TriggerKeyOnlineProdExt(const edm::ParameterSet& iConfig) {
  //the following line is needed to tell the framework what
  // data is being produced
  auto cc = setWhatProduced(this);

  for (auto const& label : iConfig.getParameter<std::vector<std::string> >("subsystemLabels")) {
    m_subsystemTokens.emplace_back(cc.consumesFrom<L1TriggerKeyExt, L1TriggerKeyExtRcd>(edm::ESInputTag{"", label}));

    //now do what ever other initialization is needed
  }

  L1TriggerKeyExt_token = cc.consumes(edm::ESInputTag{"", "SubsystemKeysOnly"});
}

L1TriggerKeyOnlineProdExt::~L1TriggerKeyOnlineProdExt() {
  // do anything here that needs to be done at desctruction time
  // (e.g. close files, deallocate resources etc.)
}

//
// member functions
//

// ------------ method called to produce the data  ------------
L1TriggerKeyOnlineProdExt::ReturnType L1TriggerKeyOnlineProdExt::produce(const L1TriggerKeyExtRcd& iRecord) {
  // Start with "SubsystemKeysOnly"
  L1TriggerKeyExt subsystemKeys;
  try {
    subsystemKeys = iRecord.get(L1TriggerKeyExt_token);
  } catch (l1t::DataAlreadyPresentException& ex) {
    throw ex;
  }

  auto pL1TriggerKey = std::make_unique<L1TriggerKeyExt>(subsystemKeys);

  // Collate object keys
  for (auto const& token : m_subsystemTokens) {
    pL1TriggerKey->add(iRecord.get(token).recordToKeyMap());
  }

  return pL1TriggerKey;
}

//define this as a plug-in
//DEFINE_FWK_EVENTSETUP_MODULE(L1TriggerKeyOnlineProdExt);