Main Page
Namespaces
Classes
Package Documentation
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Properties
Friends
Macros
Pages
PhysicsTools
PatAlgos
plugins
RecoMETExtractor.cc
Go to the documentation of this file.
1
#include "
PhysicsTools/PatAlgos/plugins/RecoMETExtractor.h
"
2
#include "
FWCore/MessageLogger/interface/MessageLogger.h
"
3
#include "
FWCore/ParameterSet/interface/ConfigurationDescriptions.h
"
4
#include "
FWCore/ParameterSet/interface/ParameterSetDescription.h
"
5
6
#include <memory>
7
8
using namespace
pat;
9
10
RecoMETExtractor::RecoMETExtractor
(
const
edm::ParameterSet
& iConfig) {
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
39
RecoMETExtractor::~RecoMETExtractor
() {
40
41
}
42
43
44
void
RecoMETExtractor::produce
(
edm::StreamID
streamID,
edm::Event
&
iEvent
,
45
const
edm::EventSetup
& iSetup)
const
{
46
47
edm::Handle<std::vector<pat::MET>
>
src
;
48
iEvent.
getByToken
(
metSrcToken_
, src);
49
if
(src->size()==0)
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().corP4(
corLevel_
), src->front().vertex() );
54
metCol->push_back(
met
);
55
56
std::auto_ptr<std::vector<reco::MET> > recoMETs(metCol);
57
iEvent.
put
(recoMETs);
58
}
59
60
61
#include "
FWCore/Framework/interface/MakerMacros.h
"
62
63
DEFINE_FWK_MODULE
(
RecoMETExtractor
);
pat::MET::Type1SmearXY
Definition:
MET.h:161
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
pat::RecoMETExtractor::corLevel_
pat::MET::METCorrectionLevel corLevel_
Definition:
RecoMETExtractor.h:41
MessageLogger.h
pat::RecoMETExtractor::~RecoMETExtractor
~RecoMETExtractor()
Definition:
RecoMETExtractor.cc:39
edm::Event::getByToken
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition:
Event.h:462
DEFINE_FWK_MODULE
#define DEFINE_FWK_MODULE(type)
Definition:
MakerMacros.h:17
pat::MET::Type1XY
Definition:
MET.h:160
edm::StreamID
Definition:
StreamID.h:30
pat::RecoMETExtractor
Retrieves the recoMET from a pat::MET.
Definition:
RecoMETExtractor.h:27
MakerMacros.h
edm::Handle
Definition:
AssociativeIterator.h:47
pat::MET::Type01XY
Definition:
MET.h:160
pat::MET::TypeXY
Definition:
MET.h:160
pat::MET::Type1Smear
Definition:
MET.h:161
pat::MET::Type01Smear
Definition:
MET.h:161
AlCaHLTBitMon_QueryRunRegistry.string
string string
Definition:
AlCaHLTBitMon_QueryRunRegistry.py:255
edm::LogError
Definition:
MessageLogger.h:164
pat::MET::Raw
Definition:
MET.h:160
iEvent
int iEvent
Definition:
GenABIO.cc:230
ParameterSetDescription.h
edm::Event::put
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition:
Event.h:121
reco::MET
Definition:
MET.h:42
pat::RecoMETExtractor::metSrcToken_
edm::EDGetTokenT< std::vector< pat::MET > > metSrcToken_
Definition:
RecoMETExtractor.h:39
pat::RecoMETExtractor::produce
virtual void produce(edm::StreamID streamID, edm::Event &iEvent, const edm::EventSetup &iSetup) const
Definition:
RecoMETExtractor.cc:44
edm::EventSetup
Definition:
EventSetup.h:45
alcazmumu_cfi.src
tuple src
Definition:
alcazmumu_cfi.py:30
pat::MET::RawCalo
Definition:
MET.h:162
pat::MET::Type1
Definition:
MET.h:160
RecoMETExtractor.h
edm::InputTag
Definition:
InputTag.h:15
pat::MET::Type01
Definition:
MET.h:160
edm::ParameterSet
Definition:
ParameterSet.h:36
ConfigurationDescriptions.h
pat::RecoMETExtractor::RecoMETExtractor
RecoMETExtractor(const edm::ParameterSet &iConfig)
Definition:
RecoMETExtractor.cc:10
edm::Event
Definition:
Event.h:65
pat::MET::Type01SmearXY
Definition:
MET.h:162
objects.METAnalyzer.met
met
Definition:
METAnalyzer.py:178
Generated for CMSSW Reference Manual by
1.8.5