![]() |
![]() |
#include <RecoMET/METAlgorithms/interface/METAlgo.h>
Public Member Functions | |
METAlgo () | |
virtual void | run (edm::Handle< edm::View< reco::Candidate > > candidates, CommonMETData *met, double globalThreshold=0.0) |
virtual CommonMETData | run (edm::Handle< edm::View< reco::Candidate > > candidates, double globalThreshold=0.0) |
virtual | ~METAlgo () |
Description: Calculates MET for given input
Implementation: [Notes on implementation]
CommonMETData METAlgo::run | ( | edm::Handle< edm::View< reco::Candidate > > | candidates, |
double | globalThreshold = 0.0 |
||
) | [virtual] |
Definition at line 16 of file METAlgo.cc.
References CaloMET_cfi::met.
Referenced by cms::METProducer::produce_CaloMET(), cms::METProducer::produce_else(), cms::METProducer::produce_PFClusterMET(), and cms::METProducer::produce_PFMET().
{ CommonMETData met; run(candidates, &met, globalThreshold); return met; }
void METAlgo::run | ( | edm::Handle< edm::View< reco::Candidate > > | candidates, |
CommonMETData * | met, | ||
double | globalThreshold = 0.0 |
||
) | [virtual] |
Definition at line 24 of file METAlgo.cc.
References reco::Candidate::energy(), reco::Candidate::et(), i, CommonMETData::met, CommonMETData::mex, CommonMETData::mey, CommonMETData::mez, CommonMETData::phi, reco::Candidate::px(), reco::Candidate::py(), reco::Candidate::pz(), funct::sin(), mathSSE::sqrt(), CommonMETData::sumet, and reco::Candidate::theta().
{ double px = 0.0; double py = 0.0; double pz = 0.0; double et = 0.0; for (unsigned int i = 0; i < candidates->size(); ++i) { const reco::Candidate &cand = (*candidates)[i]; if( !(cand.et() > globalThreshold) ) continue; px += cand.px(); py += cand.py(); pz += cand.pz(); et += cand.energy()*sin(cand.theta()); } met->mex = -px; met->mey = -py; met->mez = -pz; // included here since it might be useful // for Data Quality Monitering as it should be // symmetrically distributed about the origin met->met = sqrt( px*px + py*py ); met->sumet = et; met->phi = atan2( -py, -px ); // no longer needed as MET is now a candidate }