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
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"
) {
18
corLevel_
=
pat::MET::Raw
;
19
}
else
if
(corLevel ==
"type1"
) {
20
corLevel_
=
pat::MET::Type1
;
21
}
else
if
(corLevel ==
"type01"
) {
22
corLevel_
=
pat::MET::Type01
;
23
}
else
if
(corLevel ==
"typeXY"
) {
24
corLevel_
=
pat::MET::TypeXY
;
25
}
else
if
(corLevel ==
"type1XY"
) {
26
corLevel_
=
pat::MET::Type1XY
;
27
}
else
if
(corLevel ==
"type01XY"
) {
28
corLevel_
=
pat::MET::Type01XY
;
29
}
else
if
(corLevel ==
"type1Smear"
) {
30
corLevel_
=
pat::MET::Type1Smear
;
31
}
else
if
(corLevel ==
"type01Smear"
) {
32
corLevel_
=
pat::MET::Type01Smear
;
33
}
else
if
(corLevel ==
"type1SmearXY"
) {
34
corLevel_
=
pat::MET::Type1SmearXY
;
35
}
else
if
(corLevel ==
"type01SmearXY"
) {
36
corLevel_
=
pat::MET::Type01SmearXY
;
37
}
else
if
(corLevel ==
"rawCalo"
) {
38
corLevel_
=
pat::MET::RawCalo
;
39
}
else
if
(corLevel ==
"rawDeepResponseTune"
) {
40
corLevel_
=
pat::MET::RawDeepResponseTune
;
41
}
else
if
(corLevel ==
"rawDeepResolutionTune"
) {
42
corLevel_
=
pat::MET::RawDeepResolutionTune
;
43
}
else
{
44
//throw exception
45
}
46
47
// produces vector of recoMet
48
produces<std::vector<reco::MET> >();
49
}
50
51
RecoMETExtractor::~RecoMETExtractor
() {}
52
53
void
RecoMETExtractor::produce
(
edm::StreamID
streamID,
edm::Event
&
iEvent
,
const
edm::EventSetup
& iSetup)
const
{
54
edm::Handle<std::vector<pat::MET>
>
src
;
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
69
#include "
FWCore/Framework/interface/MakerMacros.h
"
70
71
DEFINE_FWK_MODULE
(
RecoMETExtractor
);
ConfigurationDescriptions.h
edm::StreamID
Definition:
StreamID.h:30
MessageLogger.h
RecoMETExtractor.h
pat::RecoMETExtractor::corLevel_
pat::MET::METCorrectionLevel corLevel_
Definition:
RecoMETExtractor.h:36
pat::MET::Type01XY
Definition:
MET.h:179
pat::MET::Type1Smear
Definition:
MET.h:180
pat::MET::Type01SmearXY
Definition:
MET.h:183
pat::RecoMETExtractor::~RecoMETExtractor
~RecoMETExtractor() override
Definition:
RecoMETExtractor.cc:51
edm::Handle
Definition:
AssociativeIterator.h:50
BTaggingMonitor_cfi.met
met
Definition:
BTaggingMonitor_cfi.py:84
reco::MET
Definition:
MET.h:41
MakerMacros.h
pat::MET::Type01Smear
Definition:
MET.h:181
pat::MET::RawDeepResponseTune
Definition:
MET.h:187
pat::MET::Raw
Definition:
MET.h:174
DEFINE_FWK_MODULE
#define DEFINE_FWK_MODULE(type)
Definition:
MakerMacros.h:16
pat::MET::RawCalo
Definition:
MET.h:184
pat::RecoMETExtractor::produce
void produce(edm::StreamID streamID, edm::Event &iEvent, const edm::EventSetup &iSetup) const override
Definition:
RecoMETExtractor.cc:53
ParameterSetDescription.h
pat::RecoMETExtractor
Retrieves the recoMET from a pat::MET.
Definition:
RecoMETExtractor.h:26
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition:
AlCaHLTBitMon_QueryRunRegistry.py:256
edm::ParameterSet
Definition:
ParameterSet.h:47
TrackRefitter_38T_cff.src
src
Definition:
TrackRefitter_38T_cff.py:24
pat::MET::Type01
Definition:
MET.h:176
pat::MET::Type1SmearXY
Definition:
MET.h:182
pat::MET::Type1
Definition:
MET.h:175
iEvent
int iEvent
Definition:
GenABIO.cc:224
edm::EventSetup
Definition:
EventSetup.h:58
pat
Definition:
HeavyIon.h:7
pat::RecoMETExtractor::metSrcToken_
edm::EDGetTokenT< std::vector< pat::MET > > metSrcToken_
Definition:
RecoMETExtractor.h:34
pat::MET::TypeXY
Definition:
MET.h:177
pat::RecoMETExtractor::RecoMETExtractor
RecoMETExtractor(const edm::ParameterSet &iConfig)
Definition:
RecoMETExtractor.cc:10
eostools.move
def move(src, dest)
Definition:
eostools.py:511
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition:
ParameterSet.h:303
edm::Event
Definition:
Event.h:73
pat::MET::Type1XY
Definition:
MET.h:178
edm::Log
Definition:
MessageLogger.h:70
edm::InputTag
Definition:
InputTag.h:15
pat::MET::RawDeepResolutionTune
Definition:
MET.h:188
Generated for CMSSW Reference Manual by
1.8.16