CMS 3D CMS Logo

RecoMETExtractor.cc
Go to the documentation of this file.
5 
6 #include <memory>
7 
8 using namespace pat;
9 
11 
12  edm::InputTag metIT = iConfig.getParameter<edm::InputTag>("metSource");
13  metSrcToken_ = consumes<pat::METCollection>(metIT);
14 
15  std::string corLevel = iConfig.getParameter<std::string>("correctionLevel");
16 
17  //all possible met flavors
18  if(corLevel=="raw") { corLevel_=pat::MET::Raw;}
19  else if(corLevel=="type1") { corLevel_=pat::MET::Type1;}
20  else if(corLevel=="type01") { corLevel_=pat::MET::Type01;}
21  else if(corLevel=="typeXY") { corLevel_=pat::MET::TypeXY;}
22  else if(corLevel=="type1XY") { corLevel_=pat::MET::Type1XY;}
23  else if(corLevel=="type01XY") { corLevel_=pat::MET::Type01XY;}
24  else if(corLevel=="type1Smear") { corLevel_=pat::MET::Type1Smear;}
25  else if(corLevel=="type01Smear") { corLevel_=pat::MET::Type01Smear;}
26  else if(corLevel=="type1SmearXY") { corLevel_=pat::MET::Type1SmearXY;}
27  else if(corLevel=="type01SmearXY") { corLevel_=pat::MET::Type01SmearXY;}
28  else if(corLevel=="rawCalo") { corLevel_=pat::MET::RawCalo;}
29  else {
30  //throw exception
31 
32  }
33 
34  // produces vector of recoMet
35  produces<std::vector<reco::MET> >();
36 }
37 
38 
40 
41 }
42 
43 
45  const edm::EventSetup & iSetup) const {
46 
48  iEvent.getByToken(metSrcToken_, src);
49  if(src->empty()) edm::LogError("RecoMETExtractor::produce") << "input reco MET collection is empty" ;
50 
51  std::vector<reco::MET> *metCol = new std::vector<reco::MET>();
52 
53  reco::MET met(src->front().corSumEt(corLevel_), src->front().corP4(corLevel_), src->front().vertex() );
54 
55  metCol->push_back( met );
56 
57  std::unique_ptr<std::vector<reco::MET> > recoMETs(metCol);
58  iEvent.put(std::move(recoMETs));
59 }
60 
61 
63 
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:136
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:519
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:17
Retrieves the recoMET from a pat::MET.
Definition: HeavyIon.h:7
int iEvent
Definition: GenABIO.cc:230
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:510