HLTrigger
JetMET
plugins
HLTScoutingPrimaryVertexProducer.cc
Go to the documentation of this file.
1
// -*- C++ -*-
2
//
3
// Package: HLTrigger/JetMET
4
// Class: HLTScoutingPrimaryVertexProducer
5
6
// system include files
7
#include <memory>
8
9
// user include files
10
#include "
FWCore/Framework/interface/Frameworkfwd.h
"
11
#include "
FWCore/Framework/interface/global/EDProducer.h
"
12
#include "
FWCore/Framework/interface/Event.h
"
13
#include "
FWCore/Framework/interface/MakerMacros.h
"
14
#include "
FWCore/ParameterSet/interface/ParameterSet.h
"
15
#include "
DataFormats/VertexReco/interface/Vertex.h
"
16
#include "
DataFormats/VertexReco/interface/VertexFwd.h
"
17
#include "
DataFormats/Scouting/interface/ScoutingVertex.h
"
18
#include "
DataFormats/Math/interface/deltaR.h
"
19
20
class
HLTScoutingPrimaryVertexProducer
:
public
edm::global::EDProducer
<> {
21
public
:
22
explicit
HLTScoutingPrimaryVertexProducer
(
const
edm::ParameterSet
&);
23
~HLTScoutingPrimaryVertexProducer
()
override
;
24
25
static
void
fillDescriptions
(
edm::ConfigurationDescriptions
& descriptions);
26
27
private
:
28
void
produce
(
edm::StreamID
sid,
edm::Event
&
iEvent
,
edm::EventSetup
const
&
setup
)
const
final
;
29
const
edm::EDGetTokenT<reco::VertexCollection>
vertexCollection_
;
30
};
31
32
//
33
// constructors and destructor
34
//
35
HLTScoutingPrimaryVertexProducer::HLTScoutingPrimaryVertexProducer
(
const
edm::ParameterSet
& iConfig)
36
: vertexCollection_(consumes<
reco
::
VertexCollection
>(iConfig.getParameter<
edm
::
InputTag
>(
"vertexCollection"
))) {
37
//register products
38
produces<ScoutingVertexCollection>(
"primaryVtx"
);
39
}
40
41
HLTScoutingPrimaryVertexProducer::~HLTScoutingPrimaryVertexProducer
() =
default
;
42
43
// ------------ method called to produce the data ------------
44
void
HLTScoutingPrimaryVertexProducer::produce
(
edm::StreamID
sid,
45
edm::Event
&
iEvent
,
46
edm::EventSetup
const
&
setup
)
const
{
47
using namespace
edm
;
48
49
//get vertices
50
Handle<reco::VertexCollection>
vertexCollection
;
51
52
std::unique_ptr<ScoutingVertexCollection> outVertices(
new
ScoutingVertexCollection
());
53
54
if
(
iEvent
.getByToken(
vertexCollection_
,
vertexCollection
)) {
55
for
(
auto
&
vtx
: *
vertexCollection
) {
56
outVertices->emplace_back(
vtx
.x(),
57
vtx
.y(),
58
vtx
.z(),
59
vtx
.zError(),
60
vtx
.xError(),
61
vtx
.yError(),
62
vtx
.tracksSize(),
63
vtx
.chi2(),
64
vtx
.ndof(),
65
vtx
.isValid());
66
}
67
}
68
69
//put output
70
iEvent
.put(
std::move
(outVertices),
"primaryVtx"
);
71
}
72
73
// ------------ method fills 'descriptions' with the allowed parameters for the module ------------
74
void
HLTScoutingPrimaryVertexProducer::fillDescriptions
(
edm::ConfigurationDescriptions
& descriptions) {
75
edm::ParameterSetDescription
desc;
76
desc.
add
<
edm::InputTag
>(
"vertexCollection"
,
edm::InputTag
(
"hltPixelVertices"
));
77
descriptions.
add
(
"hltScoutingPrimaryVertexProducer"
, desc);
78
}
79
80
// declare this class as a framework plugin
81
DEFINE_FWK_MODULE
(
HLTScoutingPrimaryVertexProducer
);
edm::StreamID
Definition:
StreamID.h:30
HLTScoutingPrimaryVertexProducer::fillDescriptions
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
Definition:
HLTScoutingPrimaryVertexProducer.cc:74
edm::ParameterSetDescription::add
ParameterDescriptionBase * add(U const &iLabel, T const &value)
Definition:
ParameterSetDescription.h:95
edm::EDGetTokenT< reco::VertexCollection >
edm
HLT enums.
Definition:
AlignableModifier.h:19
reco::VertexCollection
std::vector< Vertex > VertexCollection
collection of Vertex objects
Definition:
VertexFwd.h:9
HLTScoutingPrimaryVertexProducer::produce
void produce(edm::StreamID sid, edm::Event &iEvent, edm::EventSetup const &setup) const final
Definition:
HLTScoutingPrimaryVertexProducer.cc:44
edm::ParameterSetDescription
Definition:
ParameterSetDescription.h:52
reco
fixed size matrix
Definition:
AlignmentAlgorithmBase.h:45
edm::Handle< reco::VertexCollection >
singleTopDQM_cfi.setup
setup
Definition:
singleTopDQM_cfi.py:37
deltaR.h
HLTScoutingPrimaryVertexProducer::HLTScoutingPrimaryVertexProducer
HLTScoutingPrimaryVertexProducer(const edm::ParameterSet &)
Definition:
HLTScoutingPrimaryVertexProducer.cc:35
MakerMacros.h
DEFINE_FWK_MODULE
#define DEFINE_FWK_MODULE(type)
Definition:
MakerMacros.h:16
edm::ConfigurationDescriptions::add
void add(std::string const &label, ParameterSetDescription const &psetDescription)
Definition:
ConfigurationDescriptions.cc:57
ScoutingVertex.h
HLTScoutingPrimaryVertexProducer
Definition:
HLTScoutingPrimaryVertexProducer.cc:20
edm::global::EDProducer
Definition:
EDProducer.h:32
edm::ConfigurationDescriptions
Definition:
ConfigurationDescriptions.h:28
badGlobalMuonTaggersAOD_cff.vtx
vtx
Definition:
badGlobalMuonTaggersAOD_cff.py:5
Vertex.h
HLT_2018_cff.InputTag
InputTag
Definition:
HLT_2018_cff.py:79016
edm::ParameterSet
Definition:
ParameterSet.h:36
Event.h
ScoutingVertexCollection
std::vector< ScoutingVertex > ScoutingVertexCollection
Definition:
ScoutingVertex.h:69
iEvent
int iEvent
Definition:
GenABIO.cc:224
edm::EventSetup
Definition:
EventSetup.h:57
HLTScoutingPrimaryVertexProducer::vertexCollection_
const edm::EDGetTokenT< reco::VertexCollection > vertexCollection_
Definition:
HLTScoutingPrimaryVertexProducer.cc:29
HLTScoutingPrimaryVertexProducer::~HLTScoutingPrimaryVertexProducer
~HLTScoutingPrimaryVertexProducer() override
VertexFwd.h
eostools.move
def move(src, dest)
Definition:
eostools.py:511
Frameworkfwd.h
spclusmultinvestigator_cfi.vertexCollection
vertexCollection
Definition:
spclusmultinvestigator_cfi.py:4
ParameterSet.h
EDProducer.h
edm::Event
Definition:
Event.h:73
edm::InputTag
Definition:
InputTag.h:15
Generated for CMSSW Reference Manual by
1.8.16