Main Page
Namespaces
Classes
Package Documentation
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
34
// What is being produced
35
produces<std::vector<reco::MET> >();
36
37
// Input products
38
metToken_
= 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
}
43
45
DistortedMETProducer::~DistortedMETProducer
(){
46
}
47
49
void
DistortedMETProducer::beginJob
() {
50
}
51
53
void
DistortedMETProducer::endJob
(){}
54
56
void
DistortedMETProducer::produce
(
edm::Event
&
ev
,
const
edm::EventSetup
&) {
57
58
if
(ev.
isRealData
())
return
;
59
60
// MET collection
61
edm::Handle<edm::View<reco::MET>
>
metCollection
;
62
if
(!ev.
getByToken
(
metToken_
, metCollection)) {
63
edm::LogError
(
""
) <<
">>> MET collection does not exist !!!"
;
64
return
;
65
}
66
edm::RefToBase<reco::MET>
met
= metCollection->refAt(0);
67
68
std::unique_ptr<reco::METCollection> newmetCollection (
new
reco::METCollection
);
69
70
double
met_et = met->
et
() * (1. +
metScaleShift_
);
71
double
sum_et = met->
sumEt
() * (1. +
metScaleShift_
);
72
double
met_phi = met->
phi
();
73
double
met_ex = met_et*
cos
(met_phi);
74
double
met_ey = met_et*
sin
(met_phi);
75
reco::Particle::LorentzVector
met_p4(met_ex, met_ey, 0., met_et);
76
reco::Particle::Point
met_vtx(0.,0.,0.);
77
reco::MET
* newmet =
new
reco::MET
(sum_et, met_p4, met_vtx);
78
79
newmetCollection->push_back(*newmet);
80
81
ev.
put
(
std::move
(newmetCollection));
82
}
83
84
DEFINE_FWK_MODULE
(
DistortedMETProducer
);
edm::ParameterSet::getUntrackedParameter
T getUntrackedParameter(std::string const &, T const &) const
MessageLogger.h
edm::Event::put
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition:
Event.h:137
DistortedMETProducer::~DistortedMETProducer
~DistortedMETProducer() override
Definition:
DistortedMETProducer.cc:45
edm::Event::getByToken
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition:
Event.h:579
MET.h
DEFINE_FWK_MODULE
#define DEFINE_FWK_MODULE(type)
Definition:
MakerMacros.h:17
Event.h
funct::sin
Sin< T >::type sin(const T &t)
Definition:
Sin.h:22
MakerMacros.h
edm::Handle
Definition:
AssociativeIterator.h:48
muonDTDigis_cfi.pset
pset
Definition:
muonDTDigis_cfi.py:27
ev
bool ev
Definition:
Hydjet2Hadronizer.cc:95
DistortedMETProducer::metScaleShift_
double metScaleShift_
Definition:
DistortedMETProducer.cc:24
reco::METCollection
std::vector< reco::MET > METCollection
collection of MET objects
Definition:
METCollection.h:23
edm::EventBase::isRealData
bool isRealData() const
Definition:
EventBase.h:64
edm::EDGetTokenT
Definition:
EDGetToken.h:32
Frameworkfwd.h
METFwd.h
edm::RefToBase
Definition:
AssociativeIterator.h:50
edm::EDProducer
Definition:
EDProducer.h:35
DistortedMETProducer::beginJob
void beginJob() override
Definition:
DistortedMETProducer.cc:49
edm::LogError
Definition:
MessageLogger.h:174
reco::MET::sumEt
double sumEt() const
Definition:
MET.h:56
reco::LeafCandidate::et
double et() const final
transverse energy
Definition:
LeafCandidate.h:112
reco::MET
Definition:
MET.h:42
funct::cos
Cos< T >::type cos(const T &t)
Definition:
Cos.h:22
reco::Particle::Point
math::XYZPoint Point
point in the space
Definition:
Particle.h:25
View.h
edm::EventSetup
Definition:
EventSetup.h:54
DistortedMETProducer::metToken_
edm::EDGetTokenT< edm::View< reco::MET > > metToken_
Definition:
DistortedMETProducer.cc:23
nanoDQM_cfi.MET
MET
Definition:
nanoDQM_cfi.py:256
EDProducer.h
RazorAnalyzer.met
met
===> hadronic RAZOR
Definition:
RazorAnalyzer.py:70
DistortedMETProducer::produce
void produce(edm::Event &, const edm::EventSetup &) override
Definition:
DistortedMETProducer.cc:56
DistortedMETProducer::endJob
void endJob() override
Definition:
DistortedMETProducer.cc:53
DistortedMETProducer::DistortedMETProducer
DistortedMETProducer(const edm::ParameterSet &)
Definition:
DistortedMETProducer.cc:32
DistortedMETProducer
Definition:
DistortedMETProducer.cc:13
MT2Analyzer.metCollection
metCollection
Definition:
MT2Analyzer.py:466
edm::InputTag
Definition:
InputTag.h:15
edm::ParameterSet
Definition:
ParameterSet.h:36
edm::Event
Definition:
Event.h:70
reco::LeafCandidate::phi
double phi() const final
momentum azimuthal angle
Definition:
LeafCandidate.h:133
reco::Particle::LorentzVector
math::XYZTLorentzVector LorentzVector
Lorentz vector.
Definition:
Particle.h:21
eostools.move
def move(src, dest)
Definition:
eostools.py:511
Handle.h
Generated for CMSSW Reference Manual by
1.8.11