Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012 #include "RecoMET/METAlgorithms/interface/METAlgo.h"
00013 #include "DataFormats/Candidate/interface/Candidate.h"
00014 #include <cmath>
00015
00016 CommonMETData METAlgo::run(edm::Handle<edm::View<reco::Candidate> > candidates, double globalThreshold)
00017 {
00018 CommonMETData met;
00019 run(candidates, &met, globalThreshold);
00020 return met;
00021 }
00022
00023
00024 void METAlgo::run(edm::Handle<edm::View<reco::Candidate> > candidates, CommonMETData *met, double globalThreshold)
00025 {
00026 double px = 0.0;
00027 double py = 0.0;
00028 double pz = 0.0;
00029 double et = 0.0;
00030
00031 for (unsigned int i = 0; i < candidates->size(); ++i)
00032 {
00033 const reco::Candidate &cand = (*candidates)[i];
00034 if( !(cand.et() > globalThreshold) ) continue;
00035 px += cand.px();
00036 py += cand.py();
00037 pz += cand.pz();
00038 et += cand.energy()*sin(cand.theta());
00039 }
00040
00041 met->mex = -px;
00042 met->mey = -py;
00043
00044 met->mez = -pz;
00045
00046
00047
00048 met->met = sqrt( px*px + py*py );
00049 met->sumet = et;
00050 met->phi = atan2( -py, -px );
00051 }
00052
00053