CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros 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)
 
 ~PFMETAlgo ()
 

Private Attributes

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

Detailed Description

Definition at line 31 of file PFMETAlgo.h.

Constructor & Destructor Documentation

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

Definition at line 18 of file PFMETAlgo.cc.

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

18  {
19 
20 
21  verbose_ =
22  iConfig.getUntrackedParameter<bool>("verbose",false);
23 
25  iConfig.getParameter<double>("hfCalibFactor");
26 
27 }
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
double hfCalibFactor_
HF calibration factor (in 31X applied by PFProducer)
Definition: PFMETAlgo.h:43
bool verbose_
verbose ?
Definition: PFMETAlgo.h:46
PFMETAlgo::~PFMETAlgo ( )

Definition at line 31 of file PFMETAlgo.cc.

31 { }

Member Function Documentation

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

HF calibration factor (in 31X applied by PFProducer)

Definition at line 33 of file PFMETAlgo.cc.

References funct::cos(), gather_cfg::cout, reco::LeafCandidate::energy(), i, HLT_25ns14e33_v3_cff::MET, reco::PFCandidate::particleId(), reco::LeafCandidate::phi(), phi(), funct::sin(), mathSSE::sqrt(), reco::LeafCandidate::theta(), and theta().

Referenced by JSONExport.JsonExport::export(), HTMLExport.HTMLExport::export(), and HTMLExport.HTMLExportStatic::export().

33  {
34 
35  double sumEx = 0;
36  double sumEy = 0;
37  double sumEt = 0;
38 
39  for( unsigned i=0; i<pfCandidates.size(); i++ ) {
40 
41  const reco::PFCandidate& cand = pfCandidates[i];
42 
43  double E = cand.energy();
44 
46  if( cand.particleId()==PFCandidate::h_HF ||
47  cand.particleId()==PFCandidate::egamma_HF )
48  E *= hfCalibFactor_;
49 
50  double phi = cand.phi();
51  double cosphi = cos(phi);
52  double sinphi = sin(phi);
53 
54  double theta = cand.theta();
55  double sintheta = sin(theta);
56 
57  double et = E*sintheta;
58  double ex = et*cosphi;
59  double ey = et*sinphi;
60 
61  sumEx += ex;
62  sumEy += ey;
63  sumEt += et;
64  }
65 
66  double Et = sqrt( sumEx*sumEx + sumEy*sumEy);
67  XYZTLorentzVector missingEt( -sumEx, -sumEy, 0, Et);
68 
69  if(verbose_) {
70  cout<<"PFMETAlgo: mEx, mEy, mEt = "
71  << missingEt.X() <<", "
72  << missingEt.Y() <<", "
73  << missingEt.T() <<endl;
74  }
75 
76  XYZPoint vertex; // dummy vertex
77  return MET(sumEt, missingEt, vertex);
78 
79 
80 }
int i
Definition: DBlmapReader.cc:9
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
Geom::Theta< T > theta() const
double hfCalibFactor_
HF calibration factor (in 31X applied by PFProducer)
Definition: PFMETAlgo.h:43
std::vector< PFCandidatePtr > pfCandidates(const PFJet &jet, int particleId, bool sort=true)
XYZTLorentzVectorD XYZTLorentzVector
Lorentz vector with cylindrical internal representation using pseudorapidity.
Definition: LorentzVector.h:29
virtual double energy() const
energy
T sqrt(T t)
Definition: SSEVec.h:48
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
bool verbose_
verbose ?
Definition: PFMETAlgo.h:46
virtual double theta() const
momentum polar angle
XYZPointD XYZPoint
point in space with cartesian internal representation
Definition: Point3D.h:12
Particle reconstructed by the particle flow algorithm.
Definition: PFCandidate.h:39
tuple cout
Definition: gather_cfg.py:121
virtual ParticleType particleId() const
Definition: PFCandidate.h:373
virtual double phi() const
momentum azimuthal angle

Member Data Documentation

double pf2pat::PFMETAlgo::hfCalibFactor_
private

HF calibration factor (in 31X applied by PFProducer)

Definition at line 43 of file PFMETAlgo.h.

bool pf2pat::PFMETAlgo::verbose_
private

verbose ?

Definition at line 46 of file PFMETAlgo.h.