CMS 3D CMS Logo

RecoMETExtractor.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  std::string corLevel = iConfig.getParameter<std::string>("correctionLevel");
15 
16  //all possible met flavors
17  if (corLevel == "raw") {
19  } else if (corLevel == "type1") {
21  } else if (corLevel == "type01") {
23  } else if (corLevel == "typeXY") {
25  } else if (corLevel == "type1XY") {
27  } else if (corLevel == "type01XY") {
29  } else if (corLevel == "type1Smear") {
31  } else if (corLevel == "type01Smear") {
33  } else if (corLevel == "type1SmearXY") {
35  } else if (corLevel == "type01SmearXY") {
37  } else if (corLevel == "rawCalo") {
39  } else if (corLevel == "rawDeepResponseTune") {
41  } else if (corLevel == "rawDeepResolutionTune") {
43  } else {
44  //throw exception
45  }
46 
47  // produces vector of recoMet
48  produces<std::vector<reco::MET> >();
49 }
50 
52 
55  iEvent.getByToken(metSrcToken_, src);
56  if (src->empty())
57  edm::LogError("RecoMETExtractor::produce") << "input reco MET collection is empty";
58 
59  std::vector<reco::MET>* metCol = new std::vector<reco::MET>();
60 
61  reco::MET met(src->front().corSumEt(corLevel_), src->front().corP4(corLevel_), src->front().vertex());
62 
63  metCol->push_back(met);
64 
65  std::unique_ptr<std::vector<reco::MET> > recoMETs(metCol);
66  iEvent.put(std::move(recoMETs));
67 }
68 
70 
T getParameter(std::string const &) const
pat::MET::METCorrectionLevel corLevel_
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:125
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:517
Retrieves the recoMET from a pat::MET.
Definition: HeavyIon.h:7
int iEvent
Definition: GenABIO.cc:224
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
Definition: MET.h:42
edm::EDGetTokenT< std::vector< pat::MET > > metSrcToken_
void produce(edm::StreamID streamID, edm::Event &iEvent, const edm::EventSetup &iSetup) const override
met
===> hadronic RAZOR
RecoMETExtractor(const edm::ParameterSet &iConfig)
def move(src, dest)
Definition: eostools.py:511