ConsumeIOVTestInfoAnalyzer

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 54 55 56
// -*- C++ -*-
//
// Package:    FWCore/Integration
// Class:      ConsumeIOVTestInfoAnalyzer
//
/**\class edmtest::ConsumeIOVTestInfoAnalyzer

 Description: Used in tests. Declares it consumes products
 of type IOVTestInfo. The purpose is to cause the ESProducer
 that produces that product to run.
*/
// Original Author:  W. David Dagenhart
//         Created:  2 January 2025

#include "GadgetRcd.h"

#include "FWCore/Framework/interface/global/EDAnalyzer.h"
#include "FWCore/Framework/interface/Event.h"
#include "FWCore/Framework/interface/EventSetup.h"
#include "FWCore/Framework/interface/MakerMacros.h"
#include "FWCore/Integration/interface/IOVTestInfo.h"
#include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h"
#include "FWCore/ParameterSet/interface/ParameterSet.h"
#include "FWCore/ParameterSet/interface/ParameterSetDescription.h"
#include "FWCore/Utilities/interface/ESGetToken.h"
#include "FWCore/Utilities/interface/ESInputTag.h"
#include "FWCore/Utilities/interface/StreamID.h"

namespace edmtest {

  class ConsumeIOVTestInfoAnalyzer : public edm::global::EDAnalyzer<> {
  public:
    explicit ConsumeIOVTestInfoAnalyzer(edm::ParameterSet const&);

    void analyze(edm::StreamID, edm::Event const&, edm::EventSetup const&) const override;

    static void fillDescriptions(edm::ConfigurationDescriptions&);

  private:
    edm::ESGetToken<IOVTestInfo, GadgetRcd> const esToken_;
  };

  ConsumeIOVTestInfoAnalyzer::ConsumeIOVTestInfoAnalyzer(edm::ParameterSet const& pset)
      : esToken_{esConsumes(pset.getUntrackedParameter<edm::ESInputTag>("esInputTag"))} {}

  void ConsumeIOVTestInfoAnalyzer::analyze(edm::StreamID, edm::Event const&, edm::EventSetup const&) const {}

  void ConsumeIOVTestInfoAnalyzer::fillDescriptions(edm::ConfigurationDescriptions& descriptions) {
    edm::ParameterSetDescription desc;
    desc.addUntracked<edm::ESInputTag>("esInputTag", edm::ESInputTag("", ""));
    descriptions.addDefault(desc);
  }

}  // namespace edmtest
using namespace edmtest;
DEFINE_FWK_MODULE(ConsumeIOVTestInfoAnalyzer);