Main Page
Namespaces
Classes
Package Documentation
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Properties
Friends
Macros
Groups
Pages
PhysicsTools
PatAlgos
plugins
RecoMETExtractor.cc
Go to the documentation of this file.
1
12
#include "
FWCore/MessageLogger/interface/MessageLogger.h
"
13
#include "
FWCore/ParameterSet/interface/ConfigurationDescriptions.h
"
14
#include "
FWCore/ParameterSet/interface/ParameterSetDescription.h
"
15
#include "
FWCore/Framework/interface/global/EDProducer.h
"
16
#include "
FWCore/Framework/interface/Event.h
"
17
#include "
FWCore/Framework/interface/ConsumesCollector.h
"
18
#include "
FWCore/ParameterSet/interface/ParameterSet.h
"
19
#include "
FWCore/Utilities/interface/InputTag.h
"
20
#include "
DataFormats/PatCandidates/interface/MET.h
"
21
#include "
DataFormats/METReco/interface/MET.h
"
22
23
#include <memory>
24
25
namespace
pat {
26
27
class
RecoMETExtractor
:
public
edm::global::EDProducer
<> {
28
public
:
29
explicit
RecoMETExtractor
(
const
edm::ParameterSet
&
iConfig
);
30
~RecoMETExtractor
()
override
;
31
32
void
produce
(
edm::StreamID
streamID,
edm::Event
&
iEvent
,
const
edm::EventSetup
& iSetup)
const override
;
33
34
private
:
35
edm::EDGetTokenT<std::vector<pat::MET>
>
metSrcToken_
;
36
37
pat::MET::METCorrectionLevel
corLevel_
;
38
};
39
40
}
// namespace pat
41
42
using namespace
pat;
43
44
RecoMETExtractor::RecoMETExtractor
(
const
edm::ParameterSet
&
iConfig
) {
45
edm::InputTag
metIT = iConfig.
getParameter
<
edm::InputTag
>(
"metSource"
);
46
metSrcToken_
= consumes<pat::METCollection>(metIT);
47
48
std::string
corLevel = iConfig.
getParameter
<
std::string
>(
"correctionLevel"
);
49
50
//all possible met flavors
51
if
(corLevel ==
"raw"
) {
52
corLevel_
=
pat::MET::Raw
;
53
}
else
if
(corLevel ==
"type1"
) {
54
corLevel_
=
pat::MET::Type1
;
55
}
else
if
(corLevel ==
"type01"
) {
56
corLevel_
=
pat::MET::Type01
;
57
}
else
if
(corLevel ==
"typeXY"
) {
58
corLevel_
=
pat::MET::TypeXY
;
59
}
else
if
(corLevel ==
"type1XY"
) {
60
corLevel_
=
pat::MET::Type1XY
;
61
}
else
if
(corLevel ==
"type01XY"
) {
62
corLevel_
=
pat::MET::Type01XY
;
63
}
else
if
(corLevel ==
"type1Smear"
) {
64
corLevel_
=
pat::MET::Type1Smear
;
65
}
else
if
(corLevel ==
"type01Smear"
) {
66
corLevel_
=
pat::MET::Type01Smear
;
67
}
else
if
(corLevel ==
"type1SmearXY"
) {
68
corLevel_
=
pat::MET::Type1SmearXY
;
69
}
else
if
(corLevel ==
"type01SmearXY"
) {
70
corLevel_
=
pat::MET::Type01SmearXY
;
71
}
else
if
(corLevel ==
"rawCalo"
) {
72
corLevel_
=
pat::MET::RawCalo
;
73
}
else
if
(corLevel ==
"rawDeepResponseTune"
) {
74
corLevel_
=
pat::MET::RawDeepResponseTune
;
75
}
else
if
(corLevel ==
"rawDeepResolutionTune"
) {
76
corLevel_
=
pat::MET::RawDeepResolutionTune
;
77
}
else
{
78
//throw exception
79
}
80
81
// produces vector of recoMet
82
produces<std::vector<reco::MET> >();
83
}
84
85
RecoMETExtractor::~RecoMETExtractor
() {}
86
87
void
RecoMETExtractor::produce
(
edm::StreamID
streamID,
edm::Event
&
iEvent
,
const
edm::EventSetup
& iSetup)
const
{
88
edm::Handle<std::vector<pat::MET>
>
src
;
89
iEvent.
getByToken
(
metSrcToken_
, src);
90
if
(src->empty())
91
edm::LogError
(
"RecoMETExtractor::produce"
) <<
"input reco MET collection is empty"
;
92
93
std::vector<reco::MET>* metCol =
new
std::vector<reco::MET>();
94
95
reco::MET
met
(src->front().corSumEt(
corLevel_
), src->front().corP4(
corLevel_
), src->front().vertex());
96
97
metCol->push_back(
met
);
98
99
std::unique_ptr<std::vector<reco::MET> > recoMETs(metCol);
100
iEvent.
put
(
std::move
(recoMETs));
101
}
102
103
#include "
FWCore/Framework/interface/MakerMacros.h
"
104
DEFINE_FWK_MODULE
(
RecoMETExtractor
);
pat::MET::Type1SmearXY
Definition:
MET.h:182
pat::RecoMETExtractor::corLevel_
pat::MET::METCorrectionLevel corLevel_
Definition:
RecoMETExtractor.cc:37
EDProducer.h
edm::Event::put
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition:
Event.h:133
MessageLogger.h
edm::Event::getByToken
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition:
Event.h:539
MET.h
DEFINE_FWK_MODULE
#define DEFINE_FWK_MODULE(type)
Definition:
MakerMacros.h:16
pat::MET::Type1XY
Definition:
MET.h:178
edm::StreamID
Definition:
StreamID.h:30
Event.h
pat::RecoMETExtractor
Retrieves the recoMET from a pat::MET.
Definition:
RecoMETExtractor.cc:27
MakerMacros.h
edm::Handle
Definition:
AssociativeIterator.h:50
pat::RecoMETExtractor::~RecoMETExtractor
~RecoMETExtractor() override
Definition:
RecoMETExtractor.cc:85
pat::MET::Type01XY
Definition:
MET.h:179
pat::MET::TypeXY
Definition:
MET.h:177
pat::MET::Type1Smear
Definition:
MET.h:180
pat::RecoMETExtractor::produce
void produce(edm::StreamID streamID, edm::Event &iEvent, const edm::EventSetup &iSetup) const override
Definition:
RecoMETExtractor.cc:87
edm::EDGetTokenT
Definition:
EDGetToken.h:33
pat::MET::Type01Smear
Definition:
MET.h:181
AlCaHLTBitMon_QueryRunRegistry.string
string string
Definition:
AlCaHLTBitMon_QueryRunRegistry.py:256
ParameterSet.h
pat::MET::Raw
Definition:
MET.h:174
iEvent
int iEvent
Definition:
GenABIO.cc:224
ParameterSetDescription.h
reco::MET
Definition:
MET.h:41
MET.h
eostools.move
def move
Definition:
eostools.py:511
pat::RecoMETExtractor::metSrcToken_
edm::EDGetTokenT< std::vector< pat::MET > > metSrcToken_
Definition:
RecoMETExtractor.cc:35
edm::EventSetup
Definition:
EventSetup.h:59
pat::MET::RawDeepResolutionTune
Definition:
MET.h:188
alcazmumu_cfi.src
tuple src
Definition:
alcazmumu_cfi.py:30
edm::global::EDProducer
Definition:
EDProducer.h:32
pat::MET::RawCalo
Definition:
MET.h:184
pat::MET::Type1
Definition:
MET.h:175
pat::MET::RawDeepResponseTune
Definition:
MET.h:187
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition:
ParameterSet.h:303
pat::MET::METCorrectionLevel
METCorrectionLevel
Definition:
MET.h:173
edm::InputTag
Definition:
InputTag.h:15
pat::MET::Type01
Definition:
MET.h:176
InputTag.h
edm::Log
Definition:
MessageLogger.h:70
edm::ParameterSet
Definition:
ParameterSet.h:47
ConfigurationDescriptions.h
pat::RecoMETExtractor::RecoMETExtractor
RecoMETExtractor(const edm::ParameterSet &iConfig)
Definition:
RecoMETExtractor.cc:44
edm::Event
Definition:
Event.h:73
iConfig
iConfig
Definition:
TSGFromPropagation.cc:56
ConsumesCollector.h
pat::MET::Type01SmearXY
Definition:
MET.h:183
objects.METAnalyzer.met
met
Definition:
METAnalyzer.py:178
Generated for CMSSW Reference Manual by
1.8.5