ElectroWeakAnalysis
Utilities
src
DistortedMETProducer.cc
Go to the documentation of this file.
1
#include <memory>
2
#include "
FWCore/Framework/interface/Frameworkfwd.h
"
3
#include "
FWCore/Framework/interface/MakerMacros.h
"
4
#include "
FWCore/Framework/interface/EDProducer.h
"
5
#include "
FWCore/Framework/interface/Event.h
"
6
7
#include "
DataFormats/Common/interface/View.h
"
8
#include "
DataFormats/METReco/interface/MET.h
"
9
10
//
11
// class declaration
12
//
13
class
DistortedMETProducer
:
public
edm::EDProducer
{
14
public
:
15
explicit
DistortedMETProducer
(
const
edm::ParameterSet
&);
16
~DistortedMETProducer
()
override
;
17
18
private
:
19
void
beginJob
()
override
;
20
void
produce
(
edm::Event
&,
const
edm::EventSetup
&)
override
;
21
void
endJob
()
override
;
22
23
edm::EDGetTokenT<edm::View<reco::MET>
>
metToken_
;
24
double
metScaleShift_
;
// relative shift (0. => no shift)
25
};
26
27
#include "
FWCore/MessageLogger/interface/MessageLogger.h
"
28
#include "
DataFormats/Common/interface/Handle.h
"
29
#include "
DataFormats/METReco/interface/METFwd.h
"
30
32
DistortedMETProducer::DistortedMETProducer
(
const
edm::ParameterSet
&
pset
) {
33
// What is being produced
34
produces<std::vector<reco::MET> >();
35
36
// Input products
37
metToken_
=
38
consumes<edm::View<reco::MET> >(
pset
.getUntrackedParameter<
edm::InputTag
>(
"MetTag"
,
edm::InputTag
(
"met"
)));
39
// Distortions in MET in Gev**{-1/2}
40
metScaleShift_
=
pset
.getUntrackedParameter<
double
>(
"MetScaleShift"
, 1.e-3);
41
}
42
44
DistortedMETProducer::~DistortedMETProducer
() {}
45
47
void
DistortedMETProducer::beginJob
() {}
48
50
void
DistortedMETProducer::endJob
() {}
51
53
void
DistortedMETProducer::produce
(
edm::Event
&
ev
,
const
edm::EventSetup
&) {
54
if
(
ev
.isRealData())
55
return
;
56
57
// MET collection
58
edm::Handle<edm::View<reco::MET>
>
metCollection
;
59
if
(!
ev
.getByToken(
metToken_
,
metCollection
)) {
60
edm::LogError
(
""
) <<
">>> MET collection does not exist !!!"
;
61
return
;
62
}
63
edm::RefToBase<reco::MET>
met
=
metCollection
->refAt(0);
64
65
std::unique_ptr<reco::METCollection> newmetCollection(
new
reco::METCollection
);
66
67
double
met_et =
met
->et() * (1. +
metScaleShift_
);
68
double
sum_et =
met
->sumEt() * (1. +
metScaleShift_
);
69
double
met_phi =
met
->phi();
70
double
met_ex = met_et *
cos
(met_phi);
71
double
met_ey = met_et *
sin
(met_phi);
72
reco::Particle::LorentzVector
met_p4(met_ex, met_ey, 0., met_et);
73
reco::Particle::Point
met_vtx(0., 0., 0.);
74
reco::MET
* newmet =
new
reco::MET
(sum_et, met_p4, met_vtx);
75
76
newmetCollection->push_back(*newmet);
77
78
ev
.put(
std::move
(newmetCollection));
79
}
80
81
DEFINE_FWK_MODULE
(
DistortedMETProducer
);
Handle.h
MessageLogger.h
EDProducer.h
susyDQM_cfi.metCollection
metCollection
Definition:
susyDQM_cfi.py:11
edm::EDGetTokenT
Definition:
EDGetToken.h:33
DistortedMETProducer::~DistortedMETProducer
~DistortedMETProducer() override
Definition:
DistortedMETProducer.cc:44
DistortedMETProducer::beginJob
void beginJob() override
Definition:
DistortedMETProducer.cc:47
edm::Handle
Definition:
AssociativeIterator.h:50
reco::Particle::LorentzVector
math::XYZTLorentzVector LorentzVector
Lorentz vector.
Definition:
Particle.h:21
BTaggingMonitor_cfi.met
met
Definition:
BTaggingMonitor_cfi.py:84
funct::sin
Sin< T >::type sin(const T &t)
Definition:
Sin.h:22
reco::METCollection
std::vector< reco::MET > METCollection
collection of MET objects
Definition:
METCollection.h:22
reco::MET
Definition:
MET.h:41
MakerMacros.h
funct::cos
Cos< T >::type cos(const T &t)
Definition:
Cos.h:22
DEFINE_FWK_MODULE
#define DEFINE_FWK_MODULE(type)
Definition:
MakerMacros.h:16
DistortedMETProducer::metScaleShift_
double metScaleShift_
Definition:
DistortedMETProducer.cc:24
DistortedMETProducer
Definition:
DistortedMETProducer.cc:13
HLT_2018_cff.InputTag
InputTag
Definition:
HLT_2018_cff.py:79016
edm::ParameterSet
Definition:
ParameterSet.h:36
edm::LogError
Definition:
MessageLogger.h:183
Event.h
DistortedMETProducer::produce
void produce(edm::Event &, const edm::EventSetup &) override
Definition:
DistortedMETProducer.cc:53
DistortedMETProducer::metToken_
edm::EDGetTokenT< edm::View< reco::MET > > metToken_
Definition:
DistortedMETProducer.cc:23
edm::EventSetup
Definition:
EventSetup.h:57
MET.h
eostools.move
def move(src, dest)
Definition:
eostools.py:511
Frameworkfwd.h
DistortedMETProducer::endJob
void endJob() override
Definition:
DistortedMETProducer.cc:50
ev
bool ev
Definition:
Hydjet2Hadronizer.cc:95
METFwd.h
edm::EDProducer
Definition:
EDProducer.h:36
edm::RefToBase
Definition:
AssociativeIterator.h:54
reco::Particle::Point
math::XYZPoint Point
point in the space
Definition:
Particle.h:25
DistortedMETProducer::DistortedMETProducer
DistortedMETProducer(const edm::ParameterSet &)
Definition:
DistortedMETProducer.cc:32
View.h
edm::Event
Definition:
Event.h:73
HLTTauDQMOffline_cfi.MET
MET
Definition:
HLTTauDQMOffline_cfi.py:70
edm::InputTag
Definition:
InputTag.h:15
muonDTDigis_cfi.pset
pset
Definition:
muonDTDigis_cfi.py:27
Generated for CMSSW Reference Manual by
1.8.16