CMS 3D CMS Logo

GenMETExtractor.cc
Go to the documentation of this file.
1 
22 
23 #include <memory>
24 
25 namespace pat {
26 
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:
36  };
37 
38 } // namespace pat
39 
40 using namespace pat;
41 
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 
51 
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 
68 
ConfigurationDescriptions.h
edm::StreamID
Definition: StreamID.h:30
pat::GenMETExtractor
Retrieves the genMET from a pat::MET.
Definition: GenMETExtractor.cc:27
MessageLogger.h
edm::EDGetTokenT
Definition: EDGetToken.h:33
pat::GenMETExtractor::~GenMETExtractor
~GenMETExtractor() override
Definition: GenMETExtractor.cc:50
edm::Handle
Definition: AssociativeIterator.h:50
MakerMacros.h
reco::GenMET
Definition: GenMET.h:20
DEFINE_FWK_MODULE
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
ParameterSetDescription.h
edm::global::EDProducer
Definition: EDProducer.h:32
GenMET.h
edm::ParameterSet
Definition: ParameterSet.h:47
TrackRefitter_38T_cff.src
src
Definition: TrackRefitter_38T_cff.py:24
Event.h
iEvent
int iEvent
Definition: GenABIO.cc:224
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
edm::EventSetup
Definition: EventSetup.h:58
pat
Definition: HeavyIon.h:7
MET.h
InputTag.h
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
ConsumesCollector.h
ParameterSet.h
EDProducer.h
edm::Event
Definition: Event.h:73
edm::Log
Definition: MessageLogger.h:70
pat::GenMETExtractor::GenMETExtractor
GenMETExtractor(const edm::ParameterSet &iConfig)
Definition: GenMETExtractor.cc:42
edm::InputTag
Definition: InputTag.h:15