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 
T getParameter(std::string const &) const
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:131
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:525
Retrieves the genMET from a pat::MET.
Definition: HeavyIon.h:7
int iEvent
Definition: GenABIO.cc:224
GenMETExtractor(const edm::ParameterSet &iConfig)
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
void produce(edm::StreamID streamID, edm::Event &iEvent, const edm::EventSetup &iSetup) const override
TLorentzVector genMet(const HepMC::GenEvent *all, double etamin=-9999., double etamax=9999.)
def move(src, dest)
Definition: eostools.py:511
edm::EDGetTokenT< std::vector< pat::MET > > metSrcToken_