CMS 3D CMS Logo

GenMETExtractor.cc
Go to the documentation of this file.
5 
6 #include <memory>
7 
8 using namespace pat;
9 
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 
19 
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 
36 
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