#include <METAlgo.h>
Public Types | |
typedef std::vector< const reco::Candidate > | InputCollection |
Public Member Functions | |
METAlgo () | |
virtual void | run (edm::Handle< edm::View< reco::Candidate > >, CommonMETData *, double) |
virtual | ~METAlgo () |
Calculates MET for given input CaloTower collection. Does corrections based on supplied parameters.
typedef std::vector<const reco::Candidate> METAlgo::InputCollection |
METAlgo::METAlgo | ( | ) |
Definition at line 20 of file METAlgo.cc.
{}
METAlgo::~METAlgo | ( | ) | [virtual] |
Definition at line 26 of file METAlgo.cc.
{}
void METAlgo::run | ( | edm::Handle< edm::View< reco::Candidate > > | input, |
CommonMETData * | met, | ||
double | globalThreshold | ||
) | [virtual] |
Definition at line 41 of file METAlgo.cc.
References funct::cos(), alignCSCRings::e, reco::Candidate::energy(), reco::Candidate::et(), LaserDQM_cfg::input, CommonMETData::met, CommonMETData::mex, CommonMETData::mey, CommonMETData::mez, reco::Candidate::phi(), phi, CommonMETData::phi, funct::sin(), mathSSE::sqrt(), CommonMETData::sumet, theta(), and reco::Candidate::theta().
Referenced by cms::METProducer::produce().
{ double sum_et = 0.0; double sum_ex = 0.0; double sum_ey = 0.0; double sum_ez = 0.0; // Loop over Candidate Objects and calculate MET and related quantities /* CandidateCollection::const_iterator candidate; for( candidate = input->begin(); candidate != input->end(); candidate++ ) */ for (unsigned int candidate_i = 0; candidate_i < input->size(); candidate_i++) { const Candidate *candidate = &((*input)[candidate_i]); if( candidate->et() > globalThreshold ) { double phi = candidate->phi(); double theta = candidate->theta(); double e = candidate->energy(); double et = e*sin(theta); sum_ez += e*cos(theta); sum_et += et; sum_ex += et*cos(phi); sum_ey += et*sin(phi); } } met->mex = -sum_ex; met->mey = -sum_ey; met->mez = -sum_ez; met->met = sqrt( sum_ex*sum_ex + sum_ey*sum_ey ); // cout << "MET = " << met->met << endl; met->sumet = sum_et; met->phi = atan2( -sum_ey, -sum_ex ); // since MET is now a candidate, } // this is no longer needed