Main Page
Namespaces
Classes
Package Documentation
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Properties
Friends
Macros
Pages
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
();
17
18
private
:
19
virtual
void
beginJob
()
override
;
20
virtual
void
produce
(
edm::Event
&,
const
edm::EventSetup
&)
override
;
21
virtual
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::auto_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
(newmetCollection);
82
}
83
84
DEFINE_FWK_MODULE
(
DistortedMETProducer
);
edm::ParameterSet::getUntrackedParameter
T getUntrackedParameter(std::string const &, T const &) const
MessageLogger.h
reco::LeafCandidate::et
virtual double et() const
transverse energy
Definition:
LeafCandidate.h:112
edm::Event::getByToken
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition:
Event.h:464
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:47
ev
bool ev
Definition:
Hydjet2Hadronizer.cc:95
Handle.h
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
HLT_25ns14e33_v1_cff.InputTag
tuple InputTag
Definition:
HLT_25ns14e33_v1_cff.py:45333
edm::EDGetTokenT
Definition:
EDGetToken.h:32
Frameworkfwd.h
METFwd.h
edm::RefToBase
Definition:
AssociativeIterator.h:49
edm::EDProducer
Definition:
EDProducer.h:35
DistortedMETProducer::beginJob
virtual void beginJob() override
Definition:
DistortedMETProducer.cc:49
edm::LogError
Definition:
MessageLogger.h:164
reco::MET::sumEt
double sumEt() const
Definition:
MET.h:56
edm::Event::put
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition:
Event.h:120
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:45
DistortedMETProducer::metToken_
edm::EDGetTokenT< edm::View< reco::MET > > metToken_
Definition:
DistortedMETProducer.cc:23
EDProducer.h
DistortedMETProducer::produce
virtual void produce(edm::Event &, const edm::EventSetup &) override
Definition:
DistortedMETProducer.cc:56
DistortedMETProducer::~DistortedMETProducer
~DistortedMETProducer()
Definition:
DistortedMETProducer.cc:45
DistortedMETProducer::endJob
virtual void endJob() override
Definition:
DistortedMETProducer.cc:53
DistortedMETProducer::DistortedMETProducer
DistortedMETProducer(const edm::ParameterSet &)
Definition:
DistortedMETProducer.cc:32
DistortedMETProducer
Definition:
DistortedMETProducer.cc:13
edm::InputTag
Definition:
InputTag.h:18
edm::ParameterSet
Definition:
ParameterSet.h:36
edm::Event
Definition:
Event.h:64
reco::LeafCandidate::phi
virtual double phi() const
momentum azimuthal angle
Definition:
LeafCandidate.h:133
reco::Particle::LorentzVector
math::XYZTLorentzVector LorentzVector
Lorentz vector.
Definition:
Particle.h:21
HLT_25ns14e33_v3_cff.MET
tuple MET
Definition:
HLT_25ns14e33_v3_cff.py:1162
objects.METAnalyzer.met
met
Definition:
METAnalyzer.py:154
objects.METAnalyzer.metCollection
string metCollection
Definition:
METAnalyzer.py:227
Generated for CMSSW Reference Manual by
1.8.5