PhysicsTools
PatAlgos
plugins
PATTriggerObjectStandAloneSlimmer.cc
Go to the documentation of this file.
1
// -*- C++ -*-
2
//
3
// Package: PatAlgos
4
// Class: pat::PATTriggerObjectStandAloneSlimmer
5
//
6
//
14
#include "
FWCore/Framework/interface/global/EDProducer.h
"
15
#include "
FWCore/Framework/interface/Event.h
"
16
#include "
FWCore/Framework/interface/EventSetup.h
"
17
#include "
FWCore/ParameterSet/interface/ParameterSet.h
"
18
#include "
FWCore/Utilities/interface/InputTag.h
"
19
20
#include "
DataFormats/PatCandidates/interface/TriggerObjectStandAlone.h
"
21
#include <set>
22
23
namespace
pat
{
24
25
class
PATTriggerObjectStandAloneSlimmer
:
public
edm::global::EDProducer
<> {
26
public
:
27
explicit
PATTriggerObjectStandAloneSlimmer
(
const
edm::ParameterSet
& iConfig);
28
~PATTriggerObjectStandAloneSlimmer
()
override
{};
29
30
private
:
31
void
produce
(
edm::StreamID
,
edm::Event
&
iEvent
,
const
edm::EventSetup
& iSetup)
const override
;
32
33
const
edm::EDGetTokenT<TriggerObjectStandAloneCollection>
srcToken_
;
34
const
edm::EDGetTokenT<edm::TriggerResults>
triggerResultsToken_
;
35
36
bool
packFilterLabels_
,
packP4_
;
37
};
38
39
}
// namespace pat
40
41
using namespace
pat
;
42
43
PATTriggerObjectStandAloneSlimmer::PATTriggerObjectStandAloneSlimmer
(
const
edm::ParameterSet
& iConfig)
44
: srcToken_(consumes<
TriggerObjectStandAloneCollection
>(iConfig.getParameter<
edm
::
InputTag
>(
"src"
))),
45
triggerResultsToken_(consumes<
edm
::
TriggerResults
>(iConfig.getParameter<
edm
::
InputTag
>(
"triggerResults"
))),
46
packFilterLabels_(iConfig.getParameter<
bool
>(
"packFilterLabels"
)),
47
packP4_(iConfig.getParameter<
bool
>(
"packP4"
)) {
48
produces<TriggerObjectStandAloneCollection>();
49
if
(
packFilterLabels_
) {
50
produces<std::vector<std::string>>(
"filterLabels"
);
51
}
52
}
53
54
void
PATTriggerObjectStandAloneSlimmer::produce
(
edm::StreamID
,
55
edm::Event
&
iEvent
,
56
const
edm::EventSetup
& iSetup)
const
{
57
edm::Handle<TriggerObjectStandAloneCollection>
src
;
58
iEvent
.getByToken(
srcToken_
,
src
);
59
edm::Handle<edm::TriggerResults>
triggerResults
;
60
iEvent
.getByToken(
triggerResultsToken_
,
triggerResults
);
61
62
auto
slimmed = std::make_unique<TriggerObjectStandAloneCollection>(*
src
);
63
64
if
(
packFilterLabels_
) {
65
std::set<std::string> allLabels;
66
for
(
auto
&
obj
: *slimmed) {
67
obj
.packFilterLabels(
iEvent
, *
triggerResults
);
68
}
69
}
70
if
(
packP4_
) {
71
for
(
TriggerObjectStandAlone
&
obj
: *slimmed) {
72
obj
.packP4();
73
}
74
}
75
iEvent
.put(
std::move
(slimmed));
76
}
77
78
#include "
FWCore/Framework/interface/MakerMacros.h
"
79
DEFINE_FWK_MODULE
(
PATTriggerObjectStandAloneSlimmer
);
edm::StreamID
Definition:
StreamID.h:30
electrons_cff.bool
bool
Definition:
electrons_cff.py:366
pat::TriggerObjectStandAlone
Analysis-level trigger object class (stand-alone)
Definition:
TriggerObjectStandAlone.h:32
edm::EDGetTokenT< TriggerObjectStandAloneCollection >
edm
HLT enums.
Definition:
AlignableModifier.h:19
pat::PATTriggerObjectStandAloneSlimmer::packP4_
bool packP4_
Definition:
PATTriggerObjectStandAloneSlimmer.cc:36
HLT_FULL_cff.InputTag
InputTag
Definition:
HLT_FULL_cff.py:89285
triggerResults
static const std::string triggerResults
Definition:
EdmProvDump.cc:45
edm::Handle
Definition:
AssociativeIterator.h:50
MakerMacros.h
DEFINE_FWK_MODULE
#define DEFINE_FWK_MODULE(type)
Definition:
MakerMacros.h:16
pat::PATTriggerObjectStandAloneSlimmer::srcToken_
const edm::EDGetTokenT< TriggerObjectStandAloneCollection > srcToken_
Definition:
PATTriggerObjectStandAloneSlimmer.cc:33
getGTfromDQMFile.obj
obj
Definition:
getGTfromDQMFile.py:32
edm::global::EDProducer
Definition:
EDProducer.h:32
edm::ParameterSet
Definition:
ParameterSet.h:47
TrackRefitter_38T_cff.src
src
Definition:
TrackRefitter_38T_cff.py:24
Event.h
pat::PATTriggerObjectStandAloneSlimmer::produce
void produce(edm::StreamID, edm::Event &iEvent, const edm::EventSetup &iSetup) const override
Definition:
PATTriggerObjectStandAloneSlimmer.cc:54
iEvent
int iEvent
Definition:
GenABIO.cc:224
pat::TriggerObjectStandAloneCollection
std::vector< TriggerObjectStandAlone > TriggerObjectStandAloneCollection
Collection of TriggerObjectStandAlone.
Definition:
TriggerObjectStandAlone.h:219
edm::EventSetup
Definition:
EventSetup.h:58
pat
Definition:
HeavyIon.h:7
pat::PATTriggerObjectStandAloneSlimmer::~PATTriggerObjectStandAloneSlimmer
~PATTriggerObjectStandAloneSlimmer() override
Definition:
PATTriggerObjectStandAloneSlimmer.cc:28
InputTag.h
eostools.move
def move(src, dest)
Definition:
eostools.py:511
pat::PATTriggerObjectStandAloneSlimmer::PATTriggerObjectStandAloneSlimmer
PATTriggerObjectStandAloneSlimmer(const edm::ParameterSet &iConfig)
Definition:
PATTriggerObjectStandAloneSlimmer.cc:43
pat::PATTriggerObjectStandAloneSlimmer
Packs filter labels and/or 4-vectors of a pat::TriggerObjectStandAloneCollection.
Definition:
PATTriggerObjectStandAloneSlimmer.cc:25
pat::PATTriggerObjectStandAloneSlimmer::triggerResultsToken_
const edm::EDGetTokenT< edm::TriggerResults > triggerResultsToken_
Definition:
PATTriggerObjectStandAloneSlimmer.cc:34
EventSetup.h
ParameterSet.h
EDProducer.h
pat::PATTriggerObjectStandAloneSlimmer::packFilterLabels_
bool packFilterLabels_
Definition:
PATTriggerObjectStandAloneSlimmer.cc:36
HLTObjectsMonitor_cfi.TriggerResults
TriggerResults
Definition:
HLTObjectsMonitor_cfi.py:9
edm::Event
Definition:
Event.h:73
TriggerObjectStandAlone.h
Generated for CMSSW Reference Manual by
1.8.16