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 {
40  //throw exception
41  }
42 
43  // produces vector of recoMet
44  produces<std::vector<reco::MET> >();
45 }
46 
48 
51  iEvent.getByToken(metSrcToken_, src);
52  if (src->empty())
53  edm::LogError("RecoMETExtractor::produce") << "input reco MET collection is empty";
54 
55  std::vector<reco::MET>* metCol = new std::vector<reco::MET>();
56 
57  reco::MET met(src->front().corSumEt(corLevel_), src->front().corP4(corLevel_), src->front().vertex());
58 
59  metCol->push_back(met);
60 
61  std::unique_ptr<std::vector<reco::MET> > recoMETs(metCol);
62  iEvent.put(std::move(recoMETs));
63 }
64 
66 
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:131
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:525
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:41
edm::EDGetTokenT< std::vector< pat::MET > > metSrcToken_
void produce(edm::StreamID streamID, edm::Event &iEvent, const edm::EventSetup &iSetup) const override
RecoMETExtractor(const edm::ParameterSet &iConfig)
def move(src, dest)
Definition: eostools.py:511