CMS 3D CMS Logo

DistortedMETProducer.cc
Go to the documentation of this file.
1 #include <memory>
6 
9 
10 //
11 // class declaration
12 //
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 
24  double metScaleShift_; // relative shift (0. => no shift)
25 };
26 
30 
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 
45 
48 
51 
54  if (ev.isRealData())
55  return;
56 
57  // MET collection
59  if (!ev.getByToken(metToken_, metCollection)) {
60  edm::LogError("") << ">>> MET collection does not exist !!!";
61  return;
62  }
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 
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
HLT_FULL_cff.InputTag
InputTag
Definition: HLT_FULL_cff.py:85964
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
edm::ParameterSet
Definition: ParameterSet.h:47
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
edm::LogError
Log< level::Error, false > LogError
Definition: MessageLogger.h:123
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:35
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:64
edm::InputTag
Definition: InputTag.h:15
muonDTDigis_cfi.pset
pset
Definition: muonDTDigis_cfi.py:27