Skip to content

Commit

Permalink
Merge pull request #669 from Martin-Grunewald/consumesAPI3
Browse files Browse the repository at this point in the history
Consumes api3 for HLTrigger/HLTcore and HLTrigger/HLTfilters
  • Loading branch information
davidlt committed Sep 2, 2013
2 parents 9c396fc + 92a47ab commit 37b2a0c
Show file tree
Hide file tree
Showing 29 changed files with 215 additions and 106 deletions.
10 changes: 8 additions & 2 deletions HLTrigger/HLTcore/interface/HLTEventAnalyzerAOD.h
Expand Up @@ -19,6 +19,9 @@
#include "HLTrigger/HLTcore/interface/HLTConfigProvider.h"
#include "DataFormats/Common/interface/TriggerResults.h"
#include "DataFormats/HLTReco/interface/TriggerEvent.h"
namespace edm {
class ConfigurationDescriptions;
}

//
// class declaration
Expand All @@ -28,6 +31,7 @@ class HLTEventAnalyzerAOD : public edm::EDAnalyzer {
public:
explicit HLTEventAnalyzerAOD(const edm::ParameterSet&);
~HLTEventAnalyzerAOD();
static void fillDescriptions(edm::ConfigurationDescriptions & descriptions);

virtual void beginRun(edm::Run const &, edm::EventSetup const&);
virtual void analyze(const edm::Event&, const edm::EventSetup&);
Expand All @@ -38,8 +42,10 @@ class HLTEventAnalyzerAOD : public edm::EDAnalyzer {
/// module config parameters
std::string processName_;
std::string triggerName_;
edm::InputTag triggerResultsTag_;
edm::InputTag triggerEventTag_;
edm::InputTag triggerResultsTag_;
edm::EDGetTokenT<edm::TriggerResults> triggerResultsToken_;
edm::InputTag triggerEventTag_;
edm::EDGetTokenT<trigger::TriggerEvent> triggerEventToken_;

/// additional class data memebers
edm::Handle<edm::TriggerResults> triggerResultsHandle_;
Expand Down
10 changes: 8 additions & 2 deletions HLTrigger/HLTcore/interface/HLTEventAnalyzerRAW.h
Expand Up @@ -19,6 +19,9 @@
#include "HLTrigger/HLTcore/interface/HLTConfigProvider.h"
#include "DataFormats/Common/interface/TriggerResults.h"
#include "DataFormats/HLTReco/interface/TriggerEventWithRefs.h"
namespace edm {
class ConfigurationDescriptions;
}

//
// class declaration
Expand All @@ -28,6 +31,7 @@ class HLTEventAnalyzerRAW : public edm::EDAnalyzer {
public:
explicit HLTEventAnalyzerRAW(const edm::ParameterSet&);
~HLTEventAnalyzerRAW();
static void fillDescriptions(edm::ConfigurationDescriptions & descriptions);

virtual void beginRun(edm::Run const &, edm::EventSetup const&);
virtual void analyze(const edm::Event&, const edm::EventSetup&);
Expand All @@ -38,8 +42,10 @@ class HLTEventAnalyzerRAW : public edm::EDAnalyzer {
/// module config parameters
std::string processName_;
std::string triggerName_;
edm::InputTag triggerResultsTag_;
edm::InputTag triggerEventWithRefsTag_;
edm::InputTag triggerResultsTag_;
edm::EDGetTokenT<edm::TriggerResults> triggerResultsToken_;
edm::InputTag triggerEventWithRefsTag_;
edm::EDGetTokenT<trigger::TriggerEventWithRefs> triggerEventWithRefsToken_;

/// additional class data memebers
edm::Handle<edm::TriggerResults> triggerResultsHandle_;
Expand Down
11 changes: 9 additions & 2 deletions HLTrigger/HLTcore/interface/HLTPrescaleRecorder.h
Expand Up @@ -34,6 +34,10 @@
#include<string>
#include<vector>

namespace edm {
class ConfigurationDescriptions;
}

//
// class declaration
//
Expand All @@ -46,6 +50,7 @@ class HLTPrescaleRecorder : public edm::one::EDProducer<edm::EndRunProducer,
public:
explicit HLTPrescaleRecorder(const edm::ParameterSet&);
virtual ~HLTPrescaleRecorder();
static void fillDescriptions(edm::ConfigurationDescriptions & descriptions);
virtual void beginRun(edm::Run const& iRun, const edm::EventSetup& iSetup)override final;
virtual void endRun(edm::Run const& iRun, const edm::EventSetup& iSetup)override final;
virtual void endRunProduce(edm::Run & iRun, const edm::EventSetup& iSetup)override final;
Expand All @@ -69,8 +74,10 @@ class HLTPrescaleRecorder : public edm::one::EDProducer<edm::EndRunProducer,
/// Source configs
/// name of PrescaleServicePSet (src=-1)
std::string psetName_;
/// InputTag of HLTPrescaleTable product (src=1,2,3)
edm::InputTag hltInputTag_;
/// InputTag of HLTPrescaleTable product (src=1,2,3)
edm::InputTag hltInputTag_;
/// InputToken of HLTPrescaleTable product (src=1,2,3)
edm::EDGetTokenT<trigger::HLTPrescaleTable> hltInputToken_;
/// Tag of DB entry (HLT Key Name) (src=4)
std::string hltDBTag_;

Expand Down
8 changes: 7 additions & 1 deletion HLTrigger/HLTcore/interface/HLTPrescaler.h
Expand Up @@ -19,6 +19,10 @@
#include "FWCore/Framework/interface/EDFilter.h"
#include "FWCore/ParameterSet/interface/ParameterSet.h"
#include "FWCore/PrescaleService/interface/PrescaleService.h"
#include "DataFormats/L1GlobalTrigger/interface/L1GlobalTriggerReadoutRecord.h"
namespace edm {
class ConfigurationDescriptions;
}


class HLTPrescaler : public edm::EDFilter
Expand All @@ -34,6 +38,7 @@ class HLTPrescaler : public edm::EDFilter
//
// member functions
//
static void fillDescriptions(edm::ConfigurationDescriptions & descriptions);
virtual void beginLuminosityBlock(edm::LuminosityBlock const&lb,
edm::EventSetup const& iSetup) override;
virtual bool filter(edm::Event& iEvent,edm::EventSetup const& iSetup) override;
Expand Down Expand Up @@ -68,7 +73,8 @@ class HLTPrescaler : public edm::EDFilter
bool newLumi_;

/// GT payload, to extract the prescale column index
edm::InputTag gtDigi_;
edm::InputTag gtDigiTag_;
edm::EDGetTokenT<L1GlobalTriggerReadoutRecord> gtDigiToken_;

/// "seed" used to initialize the prescale counter
static const
Expand Down
22 changes: 18 additions & 4 deletions HLTrigger/HLTcore/interface/TriggerExpressionData.h
@@ -1,19 +1,20 @@
#ifndef HLTrigger_HLTfilters_TriggerExpressionData_h
#define HLTrigger_HLTfilters_TriggerExpressionData_h

#include "FWCore/Framework/interface/ConsumesCollector.h"
#include "FWCore/Utilities/interface/InputTag.h"
#include "FWCore/ParameterSet/interface/ParameterSet.h"
#include "DataFormats/Provenance/interface/ParameterSetID.h"
#include "DataFormats/Provenance/interface/EventID.h"
#include "DataFormats/Common/interface/TriggerResults.h"
#include "DataFormats/L1GlobalTrigger/interface/L1GlobalTriggerReadoutRecord.h"

namespace edm {
class Event;
class EventSetup;
class TriggerResults;
class TriggerNames;
}

class L1GlobalTriggerReadoutRecord;
class L1GtTriggerMenu;
class L1GtTriggerMask;

Expand All @@ -25,7 +26,9 @@ class Data {
Data() :
// configuration
m_hltResultsTag(""),
m_hltResultsToken(),
m_l1tResultsTag(""),
m_l1tResultsToken(),
m_daqPartitions(0x01),
m_l1tIgnoreMask(false),
m_l1techIgnorePrescales(false),
Expand All @@ -47,10 +50,17 @@ class Data {
{ }

// explicit c'tor from a ParameterSet
explicit Data(const edm::ParameterSet & config, edm::ConsumesCollector && iC) : Data(config) {
if (not m_hltResultsTag.label().empty()) iC.consumes<edm::TriggerResults>(m_hltResultsTag);
if (not m_l1tResultsTag.label().empty()) iC.consumes<L1GlobalTriggerReadoutRecord>(m_hltResultsTag);
}

explicit Data(const edm::ParameterSet & config) :
// configuration
m_hltResultsTag(config.getParameter<edm::InputTag>("hltResults")),
m_hltResultsToken(),
m_l1tResultsTag(config.getParameter<edm::InputTag>("l1tResults")),
m_l1tResultsToken(),
m_daqPartitions(config.getParameter<unsigned int>("daqPartitions")),
m_l1tIgnoreMask(config.getParameter<bool>("l1tIgnoreMask")),
m_l1techIgnorePrescales(config.getParameter<bool>("l1techIgnorePrescales")),
Expand Down Expand Up @@ -82,7 +92,9 @@ class Data {
) :
// configuration
m_hltResultsTag(hltResultsTag),
m_hltResultsToken(),
m_l1tResultsTag(l1tResultsTag),
m_l1tResultsToken(),
m_daqPartitions(daqPartitions),
m_l1tIgnoreMask(l1tIgnoreMask),
m_l1techIgnorePrescales(l1techIgnorePrescales),
Expand Down Expand Up @@ -200,8 +212,10 @@ class Data {

private:
// configuration
edm::InputTag m_hltResultsTag;
edm::InputTag m_l1tResultsTag;
edm::InputTag m_hltResultsTag;
edm::EDGetTokenT<edm::TriggerResults> m_hltResultsToken;
edm::InputTag m_l1tResultsTag;
edm::EDGetTokenT<L1GlobalTriggerReadoutRecord> m_l1tResultsToken;
unsigned int m_daqPartitions;
bool m_l1tIgnoreMask;
bool m_l1techIgnorePrescales;
Expand Down
8 changes: 7 additions & 1 deletion HLTrigger/HLTcore/interface/TriggerSummaryAnalyzerAOD.h
Expand Up @@ -13,9 +13,13 @@
*
*/

#include "DataFormats/HLTReco/interface/TriggerEvent.h"
#include "FWCore/Framework/interface/Event.h"
#include "FWCore/Framework/interface/EDAnalyzer.h"
#include "FWCore/ParameterSet/interface/ParameterSet.h"
namespace edm {
class ConfigurationDescriptions;
}

//
// class declaration
Expand All @@ -25,11 +29,13 @@ class TriggerSummaryAnalyzerAOD : public edm::EDAnalyzer {
public:
explicit TriggerSummaryAnalyzerAOD(const edm::ParameterSet&);
~TriggerSummaryAnalyzerAOD();
static void fillDescriptions(edm::ConfigurationDescriptions & descriptions);
virtual void analyze(const edm::Event&, const edm::EventSetup&);

private:
/// InputTag of TriggerEvent to analyze
edm::InputTag inputTag_;
edm::InputTag inputTag_;
edm::EDGetTokenT<trigger::TriggerEvent> inputToken_;

};
#endif
8 changes: 7 additions & 1 deletion HLTrigger/HLTcore/interface/TriggerSummaryAnalyzerRAW.h
Expand Up @@ -13,9 +13,13 @@
*
*/

#include "DataFormats/HLTReco/interface/TriggerEventWithRefs.h"
#include "FWCore/Framework/interface/Event.h"
#include "FWCore/Framework/interface/EDAnalyzer.h"
#include "FWCore/ParameterSet/interface/ParameterSet.h"
namespace edm {
class ConfigurationDescriptions;
}

//
// class declaration
Expand All @@ -25,11 +29,13 @@ class TriggerSummaryAnalyzerRAW : public edm::EDAnalyzer {
public:
explicit TriggerSummaryAnalyzerRAW(const edm::ParameterSet&);
~TriggerSummaryAnalyzerRAW();
static void fillDescriptions(edm::ConfigurationDescriptions & descriptions);
virtual void analyze(const edm::Event&, const edm::EventSetup&);

private:
/// InputTag of TriggerEventWithRefs to analyze
edm::InputTag inputTag_;
edm::InputTag inputTag_;
edm::EDGetTokenT<trigger::TriggerEventWithRefs> inputToken_;

};
#endif
5 changes: 5 additions & 0 deletions HLTrigger/HLTcore/interface/TriggerSummaryProducerAOD.h
Expand Up @@ -55,6 +55,10 @@ namespace edm {
class EventSetup;
}

namespace edm {
class ConfigurationDescriptions;
}

//
// class declaration
//
Expand All @@ -64,6 +68,7 @@ class TriggerSummaryProducerAOD : public edm::EDProducer {
public:
explicit TriggerSummaryProducerAOD(const edm::ParameterSet&);
~TriggerSummaryProducerAOD();
static void fillDescriptions(edm::ConfigurationDescriptions & descriptions);
virtual void produce(edm::Event&, const edm::EventSetup&);
virtual void endJob();

Expand Down
5 changes: 5 additions & 0 deletions HLTrigger/HLTcore/interface/TriggerSummaryProducerRAW.h
Expand Up @@ -25,6 +25,10 @@ namespace edm {
class EventSetup;
}

namespace edm {
class ConfigurationDescriptions;
}

//
// class declaration
//
Expand All @@ -33,6 +37,7 @@ class TriggerSummaryProducerRAW : public edm::EDProducer {
public:
explicit TriggerSummaryProducerRAW(const edm::ParameterSet&);
~TriggerSummaryProducerRAW();
static void fillDescriptions(edm::ConfigurationDescriptions & descriptions);
virtual void produce(edm::Event&, const edm::EventSetup&);

private:
Expand Down
19 changes: 16 additions & 3 deletions HLTrigger/HLTcore/plugins/HLTEventAnalyzerAOD.cc
Expand Up @@ -11,6 +11,7 @@

#include "FWCore/Common/interface/TriggerNames.h"
#include "FWCore/Common/interface/TriggerResultsByName.h"
#include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h"
#include "HLTrigger/HLTcore/interface/HLTEventAnalyzerAOD.h"
#include <cassert>

Expand All @@ -21,7 +22,9 @@ HLTEventAnalyzerAOD::HLTEventAnalyzerAOD(const edm::ParameterSet& ps) :
processName_(ps.getParameter<std::string>("processName")),
triggerName_(ps.getParameter<std::string>("triggerName")),
triggerResultsTag_(ps.getParameter<edm::InputTag>("triggerResults")),
triggerEventTag_(ps.getParameter<edm::InputTag>("triggerEvent"))
triggerResultsToken_(consumes<edm::TriggerResults>(triggerResultsTag_)),
triggerEventTag_(ps.getParameter<edm::InputTag>("triggerEvent")),
triggerEventToken_(consumes<trigger::TriggerEvent>(triggerEventTag_))
{
using namespace std;
using namespace edm;
Expand All @@ -41,6 +44,16 @@ HLTEventAnalyzerAOD::~HLTEventAnalyzerAOD()
//
// member functions
//
void
HLTEventAnalyzerAOD::fillDescriptions(edm::ConfigurationDescriptions& descriptions) {
edm::ParameterSetDescription desc;
desc.add<std::string>("processName","HLT");
desc.add<std::string>("triggerName","@");
desc.add<edm::InputTag>("triggerResults",edm::InputTag("TriggerResults","","HLT"));
desc.add<edm::InputTag>("triggerEvent",edm::InputTag("hltTriggerSummaryAOD","","HLT"));
descriptions.add("hltEventAnalyzerAOD", desc);
}

void
HLTEventAnalyzerAOD::beginRun(edm::Run const & iRun, edm::EventSetup const& iSetup)
{
Expand Down Expand Up @@ -87,12 +100,12 @@ HLTEventAnalyzerAOD::analyze(const edm::Event& iEvent, const edm::EventSetup& iS
cout << endl;

// get event products
iEvent.getByLabel(triggerResultsTag_,triggerResultsHandle_);
iEvent.getByToken(triggerResultsToken_,triggerResultsHandle_);
if (!triggerResultsHandle_.isValid()) {
cout << "HLTEventAnalyzerAOD::analyze: Error in getting TriggerResults product from Event!" << endl;
return;
}
iEvent.getByLabel(triggerEventTag_,triggerEventHandle_);
iEvent.getByToken(triggerEventToken_,triggerEventHandle_);
if (!triggerEventHandle_.isValid()) {
cout << "HLTEventAnalyzerAOD::analyze: Error in getting TriggerEvent product from Event!" << endl;
return;
Expand Down
19 changes: 16 additions & 3 deletions HLTrigger/HLTcore/plugins/HLTEventAnalyzerRAW.cc
Expand Up @@ -11,6 +11,7 @@

#include "FWCore/Common/interface/TriggerNames.h"
#include "FWCore/Common/interface/TriggerResultsByName.h"
#include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h"
#include "HLTrigger/HLTcore/interface/HLTEventAnalyzerRAW.h"

// need access to class objects being referenced to get their content!
Expand Down Expand Up @@ -39,7 +40,9 @@ HLTEventAnalyzerRAW::HLTEventAnalyzerRAW(const edm::ParameterSet& ps) :
processName_(ps.getParameter<std::string>("processName")),
triggerName_(ps.getParameter<std::string>("triggerName")),
triggerResultsTag_(ps.getParameter<edm::InputTag>("triggerResults")),
triggerEventWithRefsTag_(ps.getParameter<edm::InputTag>("triggerEventWithRefs"))
triggerResultsToken_(consumes<edm::TriggerResults>(triggerResultsTag_)),
triggerEventWithRefsTag_(ps.getParameter<edm::InputTag>("triggerEventWithRefs")),
triggerEventWithRefsToken_(consumes<trigger::TriggerEventWithRefs>(triggerEventWithRefsTag_))
{
using namespace std;
using namespace edm;
Expand All @@ -59,6 +62,16 @@ HLTEventAnalyzerRAW::~HLTEventAnalyzerRAW()
//
// member functions
//
void
HLTEventAnalyzerRAW::fillDescriptions(edm::ConfigurationDescriptions& descriptions) {
edm::ParameterSetDescription desc;
desc.add<std::string>("processName","HLT");
desc.add<std::string>("triggerName","@");
desc.add<edm::InputTag>("triggerResults",edm::InputTag("TriggerResults","","HLT"));
desc.add<edm::InputTag>("triggerEventWithRefs",edm::InputTag("hltTriggerSummaryRAW","","HLT"));
descriptions.add("hltEventAnalyzerRAW", desc);
}

void
HLTEventAnalyzerRAW::beginRun(edm::Run const & iRun, edm::EventSetup const& iSetup)
{
Expand Down Expand Up @@ -99,12 +112,12 @@ HLTEventAnalyzerRAW::analyze(const edm::Event& iEvent, const edm::EventSetup& iS
cout << endl;

// get event products
iEvent.getByLabel(triggerResultsTag_,triggerResultsHandle_);
iEvent.getByToken(triggerResultsToken_,triggerResultsHandle_);
if (!triggerResultsHandle_.isValid()) {
cout << "HLTEventAnalyzerRAW::analyze: Error in getting TriggerResults product from Event!" << endl;
return;
}
iEvent.getByLabel(triggerEventWithRefsTag_,triggerEventWithRefsHandle_);
iEvent.getByToken(triggerEventWithRefsToken_,triggerEventWithRefsHandle_);
if (!triggerEventWithRefsHandle_.isValid()) {
cout << "HLTEventAnalyzerRAW::analyze: Error in getting TriggerEventWithRefs product from Event!" << endl;
return;
Expand Down

0 comments on commit 37b2a0c

Please sign in to comment.