CMS 3D CMS Logo

Public Types | Public Member Functions

METAlgo Class Reference

#include <METAlgo.h>

List of all members.

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 ()

Detailed Description

Calculates MET for given input CaloTower collection. Does corrections based on supplied parameters.

Author:
M. Schmitt, R. Cavanaugh, The University of Florida
Version:
1st Version May 14, 2005

Definition at line 21 of file METAlgo.h.


Member Typedef Documentation

typedef std::vector<const reco::Candidate> METAlgo::InputCollection

Definition at line 25 of file METAlgo.h.


Constructor & Destructor Documentation

METAlgo::METAlgo ( )

Definition at line 20 of file METAlgo.cc.

{}
METAlgo::~METAlgo ( ) [virtual]

Definition at line 26 of file METAlgo.cc.

{}

Member Function Documentation

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(), reco::Candidate::energy(), reco::Candidate::et(), collect_tpl::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