CMS 3D CMS Logo

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
METAlgo.cc
Go to the documentation of this file.
1 // -*- C++ -*-
2 //
3 // Package: METAlgorithms
4 // Class: METAlgo
5 //
6 // Original Authors: Michael Schmitt, Richard Cavanaugh The University of Florida
7 // Created: May 31, 2005
8 // $Id: METAlgo.cc,v 1.15 2012/06/08 00:51:28 sakuma Exp $
9 //
10 
11 //____________________________________________________________________________||
14 #include <cmath>
15 
17 {
19  run(candidates, &met, globalThreshold);
20  return met;
21 }
22 
23 //____________________________________________________________________________||
24 void METAlgo::run(edm::Handle<edm::View<reco::Candidate> > candidates, CommonMETData *met, double globalThreshold)
25 {
26  double px = 0.0;
27  double py = 0.0;
28  double pz = 0.0;
29  double et = 0.0;
30 
31  for (unsigned int i = 0; i < candidates->size(); ++i)
32  {
33  const reco::Candidate &cand = (*candidates)[i];
34  if( !(cand.et() > globalThreshold) ) continue;
35  px += cand.px();
36  py += cand.py();
37  pz += cand.pz();
38  et += cand.energy()*sin(cand.theta());
39  }
40 
41  met->mex = -px;
42  met->mey = -py;
43 
44  met->mez = -pz; // included here since it might be useful
45  // for Data Quality Monitering as it should be
46  // symmetrically distributed about the origin
47 
48  met->met = sqrt( px*px + py*py );
49  met->sumet = et;
50  met->phi = atan2( -py, -px ); // no longer needed as MET is now a candidate
51 }
52 
53 //____________________________________________________________________________||
virtual CommonMETData run(edm::Handle< edm::View< reco::Candidate > > candidates, double globalThreshold=0.0)
Definition: METAlgo.cc:16
int i
Definition: DBlmapReader.cc:9
virtual double energy() const =0
energy
virtual double et() const =0
transverse energy
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
virtual double pz() const =0
z coordinate of momentum vector
virtual double theta() const =0
momentum polar angle
T sqrt(T t)
Definition: SSEVec.h:48
Structure containing data common to all types of MET.
Definition: CommonMETData.h:22
virtual double py() const =0
y coordinate of momentum vector
virtual double px() const =0
x coordinate of momentum vector