CMS 3D CMS Logo

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
List of all members | Public Member Functions | Private Attributes
pf2pat::PFMETAlgo Class Reference

#include <PFMETAlgo.h>

Public Member Functions

 PFMETAlgo (const edm::ParameterSet &)
 
reco::MET produce (const reco::PFCandidateCollection &pfCandidates) const
 

Private Attributes

double hfCalibFactor_
 HF calibration factor (in 31X applied by PFProducer) More...
 
bool verbose_
 verbose ? More...
 

Detailed Description

Definition at line 26 of file PFMETAlgo.h.

Constructor & Destructor Documentation

◆ PFMETAlgo()

PFMETAlgo::PFMETAlgo ( const edm::ParameterSet iConfig)
explicit

Definition at line 17 of file PFMETAlgo.cc.

References edm::ParameterSet::getParameter(), and edm::ParameterSet::getUntrackedParameter().

17  {
18  verbose_ = iConfig.getUntrackedParameter<bool>("verbose", false);
19 
20  hfCalibFactor_ = iConfig.getParameter<double>("hfCalibFactor");
21 }
T getParameter(std::string const &) const
Definition: ParameterSet.h:307
double hfCalibFactor_
HF calibration factor (in 31X applied by PFProducer)
Definition: PFMETAlgo.h:34
T getUntrackedParameter(std::string const &, T const &) const
bool verbose_
verbose ?
Definition: PFMETAlgo.h:37

Member Function Documentation

◆ produce()

reco::MET PFMETAlgo::produce ( const reco::PFCandidateCollection pfCandidates) const

HF calibration factor (in 31X applied by PFProducer)

Definition at line 23 of file PFMETAlgo.cc.

References funct::cos(), gather_cfg::cout, EgHLTOffHistBins_cfi::et, mps_fire::i, HLTTauDQMOffline_cfi::MET, zmumugammaAnalyzer_cfi::pfCandidates, funct::sin(), mathSSE::sqrt(), objects.METAnalyzer::sumEt, theta(), and bphysicsOniaDQM_cfi::vertex.

23  {
24  double sumEx = 0;
25  double sumEy = 0;
26  double sumEt = 0;
27 
28  for (unsigned i = 0; i < pfCandidates.size(); i++) {
30 
31  double E = cand.energy();
32 
34  if (cand.particleId() == PFCandidate::h_HF || cand.particleId() == PFCandidate::egamma_HF)
35  E *= hfCalibFactor_;
36 
37  double phi = cand.phi();
38  double cosphi = cos(phi);
39  double sinphi = sin(phi);
40 
41  double theta = cand.theta();
42  double sintheta = sin(theta);
43 
44  double et = E * sintheta;
45  double ex = et * cosphi;
46  double ey = et * sinphi;
47 
48  sumEx += ex;
49  sumEy += ey;
50  sumEt += et;
51  }
52 
53  double Et = sqrt(sumEx * sumEx + sumEy * sumEy);
54  XYZTLorentzVector missingEt(-sumEx, -sumEy, 0, Et);
55 
56  if (verbose_) {
57  cout << "PFMETAlgo: mEx, mEy, mEt = " << missingEt.X() << ", " << missingEt.Y() << ", " << missingEt.T() << endl;
58  }
59 
60  XYZPoint vertex; // dummy vertex
61  return MET(sumEt, missingEt, vertex);
62 }
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
double hfCalibFactor_
HF calibration factor (in 31X applied by PFProducer)
Definition: PFMETAlgo.h:34
T sqrt(T t)
Definition: SSEVec.h:19
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
bool verbose_
verbose ?
Definition: PFMETAlgo.h:37
XYZPointD XYZPoint
point in space with cartesian internal representation
Definition: Point3D.h:12
Particle reconstructed by the particle flow algorithm.
Definition: PFCandidate.h:41
Geom::Theta< T > theta() const
math::XYZTLorentzVector XYZTLorentzVector
Definition: RawParticle.h:25

Member Data Documentation

◆ hfCalibFactor_

double pf2pat::PFMETAlgo::hfCalibFactor_
private

HF calibration factor (in 31X applied by PFProducer)

Definition at line 34 of file PFMETAlgo.h.

◆ verbose_

bool pf2pat::PFMETAlgo::verbose_
private

verbose ?

Definition at line 37 of file PFMETAlgo.h.