src
PhysicsTools
PatAlgos
plugins
GenMETExtractor.cc
Go to the documentation of this file.
1
12
#include "
DataFormats/METReco/interface/GenMET.h
"
13
#include "
DataFormats/PatCandidates/interface/MET.h
"
14
#include "
FWCore/Framework/interface/ConsumesCollector.h
"
15
#include "
FWCore/Framework/interface/Event.h
"
16
#include "
FWCore/Framework/interface/global/EDProducer.h
"
17
#include "
FWCore/MessageLogger/interface/MessageLogger.h
"
18
#include "
FWCore/ParameterSet/interface/ConfigurationDescriptions.h
"
19
#include "
FWCore/ParameterSet/interface/ParameterSet.h
"
20
#include "
FWCore/ParameterSet/interface/ParameterSetDescription.h
"
21
#include "
FWCore/Utilities/interface/InputTag.h
"
22
23
#include <memory>
24
25
namespace
pat
{
26
27
class
GenMETExtractor
:
public
edm::global::EDProducer
<> {
28
public
:
29
explicit
GenMETExtractor
(
const
edm::ParameterSet
&iConfig);
30
~GenMETExtractor
()
override
;
31
32
void
produce
(
edm::StreamID
streamID,
edm::Event
&
iEvent
,
const
edm::EventSetup
&iSetup)
const override
;
33
34
private
:
35
edm::EDGetTokenT<std::vector<pat::MET>
>
metSrcToken_
;
36
};
37
38
}
// namespace pat
39
40
using namespace
pat
;
41
42
GenMETExtractor::GenMETExtractor
(
const
edm::ParameterSet
&iConfig) {
43
edm::InputTag
metIT = iConfig.
getParameter
<
edm::InputTag
>(
"metSource"
);
44
metSrcToken_
= consumes<pat::METCollection>(metIT);
45
46
// produces vector of genMet
47
produces<std::vector<reco::GenMET> >();
48
}
49
50
GenMETExtractor::~GenMETExtractor
() {}
51
52
void
GenMETExtractor::produce
(
edm::StreamID
streamID,
edm::Event
&
iEvent
,
const
edm::EventSetup
&iSetup)
const
{
53
edm::Handle<std::vector<pat::MET>
>
src
;
54
iEvent
.getByToken(
metSrcToken_
,
src
);
55
if
(
src
->empty())
56
edm::LogError
(
"GenMETExtractor::produce"
) <<
"input genMET collection is empty"
;
57
58
const
reco::GenMET
*
genMet
=
src
->front().genMET();
59
60
std::vector<reco::GenMET> *genMetCol =
new
std::vector<reco::GenMET>();
61
genMetCol->push_back((*
genMet
));
62
63
std::unique_ptr<std::vector<reco::GenMET> > genMETs(genMetCol);
64
iEvent
.put(
std::move
(genMETs));
65
}
66
67
#include "
FWCore/Framework/interface/MakerMacros.h
"
68
69
DEFINE_FWK_MODULE
(
GenMETExtractor
);
EDProducer.h
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition:
ParameterSet.h:303
MessageLogger.h
DEFINE_FWK_MODULE
#define DEFINE_FWK_MODULE(type)
Definition:
MakerMacros.h:16
edm::StreamID
Definition:
StreamID.h:30
Event.h
MakerMacros.h
edm::Handle
Definition:
AssociativeIterator.h:50
GenMET.h
pat::GenMETExtractor
Retrieves the genMET from a pat::MET.
Definition:
GenMETExtractor.cc:27
edm::EDGetTokenT
Definition:
EDGetToken.h:33
pat
Definition:
HeavyIon.h:7
ParameterSet.h
iEvent
int iEvent
Definition:
GenABIO.cc:224
pat::GenMETExtractor::GenMETExtractor
GenMETExtractor(const edm::ParameterSet &iConfig)
Definition:
GenMETExtractor.cc:42
ParameterSetDescription.h
MET.h
edm::EventSetup
Definition:
EventSetup.h:59
edm::global::EDProducer
Definition:
EDProducer.h:32
pat::GenMETExtractor::~GenMETExtractor
~GenMETExtractor() override
Definition:
GenMETExtractor.cc:50
TrackRefitter_38T_cff.src
src
Definition:
TrackRefitter_38T_cff.py:24
HepMCValidationHelper::genMet
TLorentzVector genMet(const HepMC::GenEvent *all, double etamin=-9999., double etamax=9999.)
Definition:
HepMCValidationHelper.cc:280
edm::InputTag
Definition:
InputTag.h:15
reco::GenMET
Definition:
GenMET.h:20
InputTag.h
edm::Log
Definition:
MessageLogger.h:70
edm::ParameterSet
Definition:
ParameterSet.h:47
ConfigurationDescriptions.h
edm::Event
Definition:
Event.h:73
ConsumesCollector.h
eostools.move
def move(src, dest)
Definition:
eostools.py:511
pat::GenMETExtractor::metSrcToken_
edm::EDGetTokenT< std::vector< pat::MET > > metSrcToken_
Definition:
GenMETExtractor.cc:35
pat::GenMETExtractor::produce
void produce(edm::StreamID streamID, edm::Event &iEvent, const edm::EventSetup &iSetup) const override
Definition:
GenMETExtractor.cc:52
Generated for CMSSW Reference Manual by
1.8.14