CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
List of all members | Public Member Functions
METAlgo Class Reference

#include <RecoMET/METAlgorithms/interface/METAlgo.h>

Public Member Functions

 METAlgo ()
 
CommonMETData run (const edm::View< reco::Candidate > &candidates, double globalThreshold=0.0, edm::ValueMap< float > const *weights=nullptr)
 
virtual ~METAlgo ()
 

Detailed Description

Description: Calculates MET for given input

Implementation: [Notes on implementation]

Definition at line 29 of file METAlgo.h.

Constructor & Destructor Documentation

METAlgo::METAlgo ( )
inline

Definition at line 31 of file METAlgo.h.

31 {}
virtual METAlgo::~METAlgo ( )
inlinevirtual

Definition at line 32 of file METAlgo.h.

32 {}

Member Function Documentation

CommonMETData METAlgo::run ( const edm::View< reco::Candidate > &  candidates,
double  globalThreshold = 0.0,
edm::ValueMap< float > const *  weights = nullptr 
)

Definition at line 16 of file METAlgo.cc.

References reco::Candidate::et(), reco::Candidate::get(), HLT_FULL_cff::globalThreshold, CommonMETData::met, objects.METAnalyzer::met, CommonMETData::mex, CommonMETData::mey, CommonMETData::mez, reco::Candidate::p4(), edm::View< T >::ptrs(), runTheMatrix::ret, CommonMETData::sumet, and histoStyle::weight.

Referenced by cms::ElseMETProducer::produce(), cms::PFClusterMETProducer::produce(), cms::CaloMETProducer::produce(), reco::PFMETProducerMVA::produce(), and cms::PFMETProducer::produce().

18  {
20  for (auto const& candPtr : candidates.ptrs()) {
21  const reco::Candidate* cand = candPtr.get();
22  float weight = (weights != nullptr) ? (*weights)[candPtr] : 1.0;
23  if (!(cand->et() * weight > globalThreshold))
24  continue;
25  p4 += cand->p4() * weight;
26  }
28 
30  ret.mex = met.Px();
31  ret.mey = met.Py();
32 
33  ret.mez = met.Pz(); // included here since it might be useful
34  // for Data Quality Monitering as it should be
35  // symmetrically distributed about the origin
36 
37  ret.met = met.Pt();
38 
39  double et = 0.0;
40  for (auto const& candPtr : candidates.ptrs()) {
41  const reco::Candidate* cand = candPtr.get();
42  float weight = (weights != nullptr) ? (*weights)[candPtr] : 1.0;
43  if (!(cand->et() * weight > globalThreshold))
44  continue;
45  et += cand->et() * weight;
46  }
47 
48  ret.sumet = et;
49 
50  return ret;
51 }
tuple ret
prodAgent to be discontinued
virtual double et() const =0
transverse energy
XYZTLorentzVectorD XYZTLorentzVector
Lorentz vector with cylindrical internal representation using pseudorapidity.
Definition: LorentzVector.h:29
tuple globalThreshold
Structure containing data common to all types of MET.
Definition: CommonMETData.h:12
std::vector< Ptr< value_type > > const & ptrs() const
T get() const
get a component
Definition: Candidate.h:221
int weight
Definition: histoStyle.py:51
virtual const LorentzVector & p4() const =0
four-momentum Lorentz vector