PhysicsTools
PatAlgos
plugins
GenMETExtractor.cc
Go to the documentation of this file.
1
#include "
PhysicsTools/PatAlgos/plugins/GenMETExtractor.h
"
2
#include "
FWCore/MessageLogger/interface/MessageLogger.h
"
3
#include "
FWCore/ParameterSet/interface/ConfigurationDescriptions.h
"
4
#include "
FWCore/ParameterSet/interface/ParameterSetDescription.h
"
5
6
#include <memory>
7
8
using namespace
pat
;
9
10
GenMETExtractor::GenMETExtractor
(
const
edm::ParameterSet
&iConfig) {
11
edm::InputTag
metIT = iConfig.
getParameter
<
edm::InputTag
>(
"metSource"
);
12
metSrcToken_
= consumes<pat::METCollection>(metIT);
13
14
// produces vector of genMet
15
produces<std::vector<reco::GenMET> >();
16
}
17
18
GenMETExtractor::~GenMETExtractor
() {}
19
20
void
GenMETExtractor::produce
(
edm::StreamID
streamID,
edm::Event
&
iEvent
,
const
edm::EventSetup
&iSetup)
const
{
21
edm::Handle<std::vector<pat::MET>
>
src
;
22
iEvent
.getByToken(
metSrcToken_
,
src
);
23
if
(
src
->empty())
24
edm::LogError
(
"GenMETExtractor::produce"
) <<
"input genMET collection is empty"
;
25
26
const
reco::GenMET
*
genMet
=
src
->front().genMET();
27
28
std::vector<reco::GenMET> *genMetCol =
new
std::vector<reco::GenMET>();
29
genMetCol->push_back((*
genMet
));
30
31
std::unique_ptr<std::vector<reco::GenMET> > genMETs(genMetCol);
32
iEvent
.put(
std::move
(genMETs));
33
}
34
35
#include "
FWCore/Framework/interface/MakerMacros.h
"
36
37
DEFINE_FWK_MODULE
(
GenMETExtractor
);
ConfigurationDescriptions.h
edm::StreamID
Definition:
StreamID.h:30
pat::GenMETExtractor
Retrieves the genMET from a pat::MET.
Definition:
GenMETExtractor.h:27
MessageLogger.h
pat::GenMETExtractor::~GenMETExtractor
~GenMETExtractor() override
Definition:
GenMETExtractor.cc:18
edm::Handle
Definition:
AssociativeIterator.h:50
GenMETExtractor.h
MakerMacros.h
reco::GenMET
Definition:
GenMET.h:20
DEFINE_FWK_MODULE
#define DEFINE_FWK_MODULE(type)
Definition:
MakerMacros.h:16
ParameterSetDescription.h
edm::ParameterSet
Definition:
ParameterSet.h:47
TrackRefitter_38T_cff.src
src
Definition:
TrackRefitter_38T_cff.py:24
iEvent
int iEvent
Definition:
GenABIO.cc:224
pat::GenMETExtractor::metSrcToken_
edm::EDGetTokenT< std::vector< pat::MET > > metSrcToken_
Definition:
GenMETExtractor.h:35
pat::GenMETExtractor::produce
void produce(edm::StreamID streamID, edm::Event &iEvent, const edm::EventSetup &iSetup) const override
Definition:
GenMETExtractor.cc:20
edm::EventSetup
Definition:
EventSetup.h:58
pat
Definition:
HeavyIon.h:7
HepMCValidationHelper::genMet
TLorentzVector genMet(const HepMC::GenEvent *all, double etamin=-9999., double etamax=9999.)
Definition:
HepMCValidationHelper.cc:278
eostools.move
def move(src, dest)
Definition:
eostools.py:511
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition:
ParameterSet.h:303
edm::Event
Definition:
Event.h:73
edm::Log
Definition:
MessageLogger.h:70
pat::GenMETExtractor::GenMETExtractor
GenMETExtractor(const edm::ParameterSet &iConfig)
Definition:
GenMETExtractor.cc:10
edm::InputTag
Definition:
InputTag.h:15
Generated for CMSSW Reference Manual by
1.8.16