HLTrigger
btau
plugins
HLTCollectionProducer.h
Go to the documentation of this file.
1
#ifndef HLTCollectionProducer_h
2
#define HLTCollectionProducer_h
3
4
//
5
// Package: HLTCollectionProducer
6
// Class: HLTCollectionProducer
7
//
14
//
15
// Original Author: Ian Tomalin
16
//
17
18
#include <string>
19
#include <vector>
20
21
// user include files
22
#include "
FWCore/Framework/interface/global/EDProducer.h
"
23
#include "
FWCore/Framework/interface/Event.h
"
24
#include "
FWCore/ParameterSet/interface/ParameterSet.h
"
25
#include "
FWCore/ParameterSet/interface/ConfigurationDescriptions.h
"
26
#include "
FWCore/Utilities/interface/InputTag.h
"
27
#include "
DataFormats/Common/interface/RefVector.h
"
28
#include "
DataFormats/HLTReco/interface/TriggerFilterObjectWithRefs.h
"
29
#include "
HLTrigger/HLTcore/interface/defaultModuleLabel.h
"
30
31
//
32
// class declaration
33
//
34
35
template
<
typename
T>
36
class
HLTCollectionProducer
:
public
edm::global::EDProducer
<> {
37
public
:
38
explicit
HLTCollectionProducer
(
const
edm::ParameterSet
&);
39
~HLTCollectionProducer
()
override
;
40
static
void
fillDescriptions
(
edm::ConfigurationDescriptions
& descriptions);
41
void
produce
(
edm::StreamID
,
edm::Event
&,
const
edm::EventSetup
&)
const override
;
42
43
private
:
44
const
edm::InputTag
hltObjectTag_
;
45
const
edm::EDGetTokenT<trigger::TriggerFilterObjectWithRefs>
hltObjectToken_
;
46
const
std::vector<int>
triggerTypes_
;
47
};
48
49
//
50
// constructors and destructor
51
//
52
template
<
typename
T>
53
HLTCollectionProducer<T>::HLTCollectionProducer
(
const
edm::ParameterSet
& iConfig)
54
: hltObjectTag_(iConfig.getParameter<
edm
::
InputTag
>(
"HLTObject"
)),
55
hltObjectToken_(consumes<
trigger
::TriggerFilterObjectWithRefs>(hltObjectTag_)),
56
triggerTypes_(iConfig.getParameter<
std
::
vector
<
int
>>(
"TriggerTypes"
)) {
57
produces<std::vector<T>>();
58
}
59
60
template
<
typename
T>
61
HLTCollectionProducer<T>::~HLTCollectionProducer
() {}
62
63
template
<
typename
T>
64
void
HLTCollectionProducer<T>::fillDescriptions
(
edm::ConfigurationDescriptions
& descriptions) {
65
edm::ParameterSetDescription
desc
;
66
desc
.add<
edm::InputTag
>(
"HLTObject"
,
edm::InputTag
(
"TriggerFilterObjectWithRefs"
));
67
std::vector<int>
triggerTypes
;
68
desc
.add<std::vector<int>>(
"TriggerTypes"
,
triggerTypes
);
69
descriptions.
add
(
defaultModuleLabel
<
HLTCollectionProducer<T>
>(),
desc
);
70
}
71
72
//
73
// member functions
74
//
75
76
// ------------ method called to produce the data ------------
77
template
<
typename
T>
78
void
HLTCollectionProducer<T>::produce
(
edm::StreamID
iStreamID,
79
edm::Event
&
iEvent
,
80
const
edm::EventSetup
& iSetup)
const
{
81
std::unique_ptr<std::vector<T>>
collection
(
new
std::vector<T>());
82
83
// get hold of collection of TriggerFilterObjectsWithRefs
84
edm::Handle<trigger::TriggerFilterObjectWithRefs>
hltObject;
85
iEvent
.getByToken(hltObjectToken_, hltObject);
86
std::vector<edm::Ref<std::vector<T>>> objectRefs;
87
88
for
(
size_t
t
= 0;
t
< triggerTypes_.size(); ++
t
) {
89
objectRefs.clear();
90
hltObject->
getObjects
(triggerTypes_[
t
], objectRefs);
91
for
(
size_t
i
= 0;
i
< objectRefs.size(); ++
i
) {
92
collection
->push_back(*objectRefs[
i
]);
93
}
94
}
95
96
iEvent
.put(
std::move
(
collection
));
97
}
98
99
#endif // HLTCollectionProducer_h
defaultModuleLabel.h
ConfigurationDescriptions.h
edm::StreamID
Definition:
StreamID.h:30
HLTCollectionProducer
Definition:
HLTCollectionProducer.h:36
mps_fire.i
i
Definition:
mps_fire.py:428
edm::EDGetTokenT< trigger::TriggerFilterObjectWithRefs >
edm
HLT enums.
Definition:
AlignableModifier.h:19
HLT_FULL_cff.InputTag
InputTag
Definition:
HLT_FULL_cff.py:89281
edm::ParameterSetDescription
Definition:
ParameterSetDescription.h:52
HLTCollectionProducer::hltObjectTag_
const edm::InputTag hltObjectTag_
Definition:
HLTCollectionProducer.h:44
TriggerFilterObjectWithRefs.h
HLTCollectionProducer::produce
void produce(edm::StreamID, edm::Event &, const edm::EventSetup &) const override
Definition:
HLTCollectionProducer.h:78
edm::Handle< trigger::TriggerFilterObjectWithRefs >
HLTCollectionProducer::triggerTypes_
const std::vector< int > triggerTypes_
Definition:
HLTCollectionProducer.h:46
trigger::TriggerRefsCollections::getObjects
void getObjects(Vids &ids, VRphoton &refs) const
various physics-level getters:
Definition:
TriggerRefsCollections.h:590
HLTCollectionProducer::HLTCollectionProducer
HLTCollectionProducer(const edm::ParameterSet &)
Definition:
HLTCollectionProducer.h:53
edm::ConfigurationDescriptions::add
void add(std::string const &label, ParameterSetDescription const &psetDescription)
Definition:
ConfigurationDescriptions.cc:57
HLTCollectionProducer::hltObjectToken_
const edm::EDGetTokenT< trigger::TriggerFilterObjectWithRefs > hltObjectToken_
Definition:
HLTCollectionProducer.h:45
edm::global::EDProducer
Definition:
EDProducer.h:32
edm::ConfigurationDescriptions
Definition:
ConfigurationDescriptions.h:28
edm::ParameterSet
Definition:
ParameterSet.h:47
defaultModuleLabel
std::string defaultModuleLabel()
Definition:
defaultModuleLabel.h:16
RefVector.h
Event.h
createfilelist.int
int
Definition:
createfilelist.py:10
iEvent
int iEvent
Definition:
GenABIO.cc:224
universalConfigTemplate.collection
collection
Definition:
universalConfigTemplate.py:81
trackerHitRTTI::vector
Definition:
trackerHitRTTI.h:21
edm::EventSetup
Definition:
EventSetup.h:58
ClusterTask_cfi.triggerTypes
triggerTypes
Definition:
ClusterTask_cfi.py:5
InputTag.h
submitPVResolutionJobs.desc
string desc
Definition:
submitPVResolutionJobs.py:251
eostools.move
def move(src, dest)
Definition:
eostools.py:511
std
Definition:
JetResolutionObject.h:76
HLTCollectionProducer::~HLTCollectionProducer
~HLTCollectionProducer() override
Definition:
HLTCollectionProducer.h:61
trigger
Definition:
HLTPrescaleTableCond.h:8
ParameterSet.h
EDProducer.h
edm::Event
Definition:
Event.h:73
submitPVValidationJobs.t
string t
Definition:
submitPVValidationJobs.py:644
HLTCollectionProducer::fillDescriptions
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
Definition:
HLTCollectionProducer.h:64
edm::InputTag
Definition:
InputTag.h:15
Generated for CMSSW Reference Manual by
1.8.16