Main Page
Namespaces
Classes
Package Documentation
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Properties
Friends
Macros
Pages
src
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
//
8
// class declaration
9
//
10
class
DistortedMETProducer
:
public
edm::EDProducer
{
11
public
:
12
explicit
DistortedMETProducer
(
const
edm::ParameterSet
&);
13
~DistortedMETProducer
();
14
15
private
:
16
virtual
void
beginJob
() ;
17
virtual
void
produce
(
edm::Event
&,
const
edm::EventSetup
&)
override
;
18
virtual
void
endJob
() ;
19
20
edm::InputTag
metTag_
;
21
double
metScaleShift_
;
// relative shift (0. => no shift)
22
};
23
24
#include "
FWCore/MessageLogger/interface/MessageLogger.h
"
25
#include "
DataFormats/Common/interface/Handle.h
"
26
#include "
DataFormats/Common/interface/View.h
"
27
#include "
DataFormats/METReco/interface/MET.h
"
28
#include "
DataFormats/METReco/interface/METFwd.h
"
29
31
DistortedMETProducer::DistortedMETProducer
(
const
edm::ParameterSet
& pset) {
32
33
// What is being produced
34
produces<std::vector<reco::MET> >();
35
36
// Input products
37
metTag_
= pset.
getUntrackedParameter
<
edm::InputTag
> (
"MetTag"
,
edm::InputTag
(
"met"
));
38
// Distortions in MET in Gev**{-1/2}
39
metScaleShift_
= pset.
getUntrackedParameter
<
double
> (
"MetScaleShift"
,1.e-3);
40
41
}
42
44
DistortedMETProducer::~DistortedMETProducer
(){
45
}
46
48
void
DistortedMETProducer::beginJob
() {
49
}
50
52
void
DistortedMETProducer::endJob
(){}
53
55
void
DistortedMETProducer::produce
(
edm::Event
& ev,
const
edm::EventSetup
&) {
56
57
if
(ev.
isRealData
())
return
;
58
59
// MET collection
60
edm::Handle<edm::View<reco::MET>
> metCollection;
61
if
(!ev.
getByLabel
(
metTag_
, metCollection)) {
62
edm::LogError
(
""
) <<
">>> MET collection does not exist !!!"
;
63
return
;
64
}
65
edm::RefToBase<reco::MET>
met
= metCollection->refAt(0);
66
67
std::auto_ptr<reco::METCollection> newmetCollection (
new
reco::METCollection
);
68
69
double
met_et = met->
et
() * (1. +
metScaleShift_
);
70
double
sum_et = met->
sumEt
() * (1. +
metScaleShift_
);
71
double
met_phi = met->
phi
();
72
double
met_ex = met_et*
cos
(met_phi);
73
double
met_ey = met_et*
sin
(met_phi);
74
reco::Particle::LorentzVector
met_p4(met_ex, met_ey, 0., met_et);
75
reco::Particle::Point
met_vtx(0.,0.,0.);
76
reco::MET
* newmet =
new
reco::MET
(sum_et, met_p4, met_vtx);
77
78
newmetCollection->push_back(*newmet);
79
80
ev.
put
(newmetCollection);
81
}
82
83
DEFINE_FWK_MODULE
(
DistortedMETProducer
);
edm::ParameterSet::getUntrackedParameter
T getUntrackedParameter(std::string const &, T const &) const
reco::LeafCandidate::et
virtual double et() const GCC11_FINAL
transverse energy
Definition:
LeafCandidate.h:136
MessageLogger.h
CaloMET_cfi.met
tuple met
Definition:
CaloMET_cfi.py:18
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::RefToBase
Definition:
AssociativeIterator.h:50
DistortedMETProducer::endJob
virtual void endJob()
Definition:
DistortedMETProducer.cc:52
Handle.h
edm::Handle
Definition:
AssociativeIterator.h:48
DistortedMETProducer::metScaleShift_
double metScaleShift_
Definition:
DistortedMETProducer.cc:21
reco::METCollection
std::vector< reco::MET > METCollection
collection of MET objects
Definition:
METCollection.h:23
edm::EventBase::isRealData
bool isRealData() const
Definition:
EventBase.h:60
Frameworkfwd.h
METFwd.h
edm::EDProducer
Definition:
EDProducer.h:22
DistortedMETProducer::beginJob
virtual void beginJob()
Definition:
DistortedMETProducer.cc:48
edm::LogError
Definition:
MessageLogger.h:164
reco::LeafCandidate::phi
virtual float phi() const GCC11_FINAL
momentum azimuthal angle
Definition:
LeafCandidate.h:155
reco::MET::sumEt
double sumEt() const
Definition:
MET.h:48
edm::Event::put
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition:
Event.h:94
reco::MET
Definition:
MET.h:32
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:29
View.h
edm::EventSetup
Definition:
EventSetup.h:44
edm::Event::getByLabel
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition:
Event.h:361
DistortedMETProducer::metTag_
edm::InputTag metTag_
Definition:
DistortedMETProducer.cc:20
EDProducer.h
DistortedMETProducer::produce
virtual void produce(edm::Event &, const edm::EventSetup &) override
Definition:
DistortedMETProducer.cc:55
DistortedMETProducer::~DistortedMETProducer
~DistortedMETProducer()
Definition:
DistortedMETProducer.cc:44
DistortedMETProducer::DistortedMETProducer
DistortedMETProducer(const edm::ParameterSet &)
Definition:
DistortedMETProducer.cc:31
DistortedMETProducer
Definition:
DistortedMETProducer.cc:10
edm::InputTag
Definition:
InputTag.h:17
edm::ParameterSet
Definition:
ParameterSet.h:35
edm::Event
Definition:
Event.h:56
reco::Particle::LorentzVector
math::XYZTLorentzVector LorentzVector
Lorentz vector.
Definition:
Particle.h:25
Generated for CMSSW Reference Manual by
1.8.5