HLTrigger
HLTfilters
plugins
TestBXVectorRefProducer.cc
Go to the documentation of this file.
1
// -*- C++ -*-
2
//
3
// Package: HLTrigger/TestBXVectorRefProducer
4
// Class: TestBXVectorRefProducer
5
//
13
//
14
// Original Author: Vladimir Rekovic
15
// Created: Fri, 12 Feb 2016 09:56:04 GMT
16
//
17
//
18
19
// system include files
20
#include <memory>
21
22
// user include files
23
#include "
FWCore/Framework/interface/Frameworkfwd.h
"
24
#include "
FWCore/Framework/interface/stream/EDProducer.h
"
25
26
#include "
FWCore/Framework/interface/Event.h
"
27
#include "
FWCore/Framework/interface/MakerMacros.h
"
28
29
#include "
FWCore/ParameterSet/interface/ParameterSet.h
"
30
#include "
FWCore/Utilities/interface/StreamID.h
"
31
32
//#include "DataFormats/L1Trigger/interface/BXVector.h"
33
#include "
DataFormats/L1Trigger/interface/Jet.h
"
34
35
//
36
// class declaration
37
//
38
39
class
TestBXVectorRefProducer
:
public
edm::stream::EDProducer
<> {
40
public
:
41
explicit
TestBXVectorRefProducer
(
const
edm::ParameterSet
&);
42
~TestBXVectorRefProducer
()
override
;
43
44
static
void
fillDescriptions
(
edm::ConfigurationDescriptions
& descriptions);
45
46
private
:
47
void
beginStream
(
edm::StreamID
)
override
;
48
void
produce
(
edm::Event
&,
const
edm::EventSetup
&)
override
;
49
void
endStream
()
override
;
50
51
//virtual void beginRun(edm::Run const&, edm::EventSetup const&) override;
52
//virtual void endRun(edm::Run const&, edm::EventSetup const&) override;
53
//virtual void beginLuminosityBlock(edm::LuminosityBlock const&, edm::EventSetup const&) override;
54
//virtual void endLuminosityBlock(edm::LuminosityBlock const&, edm::EventSetup const&) override;
55
56
// ----------member data ---------------------------
57
bool
doRefs_
;
58
edm::InputTag
src_
;
59
edm::EDGetTokenT<l1t::JetBxCollection>
token_
;
60
};
61
62
//
63
// constants, enums and typedefs
64
//
65
66
//
67
// static data member definitions
68
//
69
70
//
71
// constructors and destructor
72
//
73
TestBXVectorRefProducer::TestBXVectorRefProducer
(
const
edm::ParameterSet
& iConfig) {
74
//now do what ever other initialization is needed
75
src_
= iConfig.
getParameter
<
edm::InputTag
>(
"src"
);
76
doRefs_
= iConfig.
getParameter
<
bool
>(
"doRefs"
);
77
token_
= consumes<l1t::JetBxCollection>(
src_
);
78
79
//register your products
80
produces<vector<int>>(
"jetPt"
).setBranchAlias(
"jetPt"
);
81
82
if
(
doRefs_
) {
83
produces<l1t::JetRefVector>(
"l1tJetRef"
).setBranchAlias(
"l1tJetRef"
);
84
}
85
}
86
87
TestBXVectorRefProducer::~TestBXVectorRefProducer
() {
88
// do anything here that needs to be done at destruction time
89
// (e.g. close files, deallocate resources etc.)
90
}
91
92
//
93
// member functions
94
//
95
96
// ------------ method called to produce the data ------------
97
void
TestBXVectorRefProducer::produce
(
edm::Event
&
iEvent
,
const
edm::EventSetup
& iSetup) {
98
using namespace
edm
;
99
100
unique_ptr<vector<int>> jetMom(
new
vector<int>);
101
unique_ptr<l1t::JetRefVector> jetRef(
new
l1t::JetRefVector
);
102
103
// retrieve the tracks
104
Handle<l1t::JetBxCollection>
jets
;
105
iEvent
.getByToken(
token_
,
jets
);
106
if
(!
jets
.isValid())
107
return
;
108
109
const
int
size
=
jets
->size();
110
jetMom->reserve(
size
);
111
112
l1t::JetBxCollection::const_iterator
iter;
113
114
for
(iter =
jets
->begin(0); iter !=
jets
->end(0); ++iter) {
115
jetMom->push_back(iter->pt());
116
117
l1t::JetRef
myref(
jets
,
jets
->key(iter));
118
jetRef->push_back(myref);
119
120
}
// end for
121
122
iEvent
.put(
std::move
(jetMom),
"jetPt"
);
123
124
if
(
doRefs_
)
125
iEvent
.put(
std::move
(jetRef),
"l1tJetRef"
);
126
127
return
;
128
}
129
130
// ------------ method called once each stream before processing any runs, lumis or events ------------
131
void
TestBXVectorRefProducer::beginStream
(
edm::StreamID
) {}
132
133
// ------------ method called once each stream after processing all runs, lumis and events ------------
134
void
TestBXVectorRefProducer::endStream
() {}
135
136
// ------------ method called when starting to processes a run ------------
137
/*
138
void
139
TestBXVectorRefProducer::beginRun(edm::Run const&, edm::EventSetup const&)
140
{
141
}
142
*/
143
144
// ------------ method called when ending the processing of a run ------------
145
/*
146
void
147
TestBXVectorRefProducer::endRun(edm::Run const&, edm::EventSetup const&)
148
{
149
}
150
*/
151
152
// ------------ method called when starting to processes a luminosity block ------------
153
/*
154
void
155
TestBXVectorRefProducer::beginLuminosityBlock(edm::LuminosityBlock const&, edm::EventSetup const&)
156
{
157
}
158
*/
159
160
// ------------ method called when ending the processing of a luminosity block ------------
161
/*
162
void
163
TestBXVectorRefProducer::endLuminosityBlock(edm::LuminosityBlock const&, edm::EventSetup const&)
164
{
165
}
166
*/
167
168
// ------------ method fills 'descriptions' with the allowed parameters for the module ------------
169
void
TestBXVectorRefProducer::fillDescriptions
(
edm::ConfigurationDescriptions
& descriptions) {
170
//The following says we do not know what parameters are allowed so do no validation
171
// Please change this to state exactly what you do use, even if it is no parameters
172
edm::ParameterSetDescription
desc
;
173
desc
.setUnknown();
174
descriptions.
addDefault
(
desc
);
175
}
176
177
// declare this class as a framework plugin
178
DEFINE_FWK_MODULE
(
TestBXVectorRefProducer
);
edm::StreamID
Definition:
StreamID.h:30
TestBXVectorRefProducer::endStream
void endStream() override
Definition:
TestBXVectorRefProducer.cc:134
edm::EDGetTokenT
Definition:
EDGetToken.h:33
BXVector::const_iterator
std::vector< T >::const_iterator const_iterator
Definition:
BXVector.h:18
edm
HLT enums.
Definition:
AlignableModifier.h:19
TestBXVectorRefProducer::fillDescriptions
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
Definition:
TestBXVectorRefProducer.cc:169
edm::ParameterSetDescription
Definition:
ParameterSetDescription.h:52
TestBXVectorRefProducer::~TestBXVectorRefProducer
~TestBXVectorRefProducer() override
Definition:
TestBXVectorRefProducer.cc:87
EDProducer.h
Jet.h
singleTopDQM_cfi.jets
jets
Definition:
singleTopDQM_cfi.py:42
edm::RefVector
Definition:
EDProductfwd.h:27
TestBXVectorRefProducer::src_
edm::InputTag src_
Definition:
TestBXVectorRefProducer.cc:58
edm::Handle
Definition:
AssociativeIterator.h:50
edm::Ref
Definition:
AssociativeIterator.h:58
MakerMacros.h
DEFINE_FWK_MODULE
#define DEFINE_FWK_MODULE(type)
Definition:
MakerMacros.h:16
edm::ConfigurationDescriptions
Definition:
ConfigurationDescriptions.h:28
edm::ParameterSet
Definition:
ParameterSet.h:47
Event.h
iEvent
int iEvent
Definition:
GenABIO.cc:224
edm::stream::EDProducer
Definition:
EDProducer.h:36
TestBXVectorRefProducer::beginStream
void beginStream(edm::StreamID) override
Definition:
TestBXVectorRefProducer.cc:131
edm::EventSetup
Definition:
EventSetup.h:58
TestBXVectorRefProducer::produce
void produce(edm::Event &, const edm::EventSetup &) override
Definition:
TestBXVectorRefProducer.cc:97
TestBXVectorRefProducer::token_
edm::EDGetTokenT< l1t::JetBxCollection > token_
Definition:
TestBXVectorRefProducer.cc:59
submitPVResolutionJobs.desc
string desc
Definition:
submitPVResolutionJobs.py:251
eostools.move
def move(src, dest)
Definition:
eostools.py:511
TestBXVectorRefProducer::TestBXVectorRefProducer
TestBXVectorRefProducer(const edm::ParameterSet &)
Definition:
TestBXVectorRefProducer.cc:73
TestBXVectorRefProducer::doRefs_
bool doRefs_
Definition:
TestBXVectorRefProducer.cc:57
Frameworkfwd.h
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition:
ParameterSet.h:303
TestBXVectorRefProducer
Definition:
TestBXVectorRefProducer.cc:39
ParameterSet.h
edm::Event
Definition:
Event.h:73
edm::ConfigurationDescriptions::addDefault
void addDefault(ParameterSetDescription const &psetDescription)
Definition:
ConfigurationDescriptions.cc:99
StreamID.h
edm::InputTag
Definition:
InputTag.h:15
findQualityFiles.size
size
Write out results.
Definition:
findQualityFiles.py:443
Generated for CMSSW Reference Manual by
1.8.16