CMS 3D CMS Logo

Public Member Functions | Private Attributes

pf2pat::PFMETAlgo Class Reference

#include <PFMETAlgo.h>

List of all members.

Public Member Functions

 PFMETAlgo (const edm::ParameterSet &)
reco::MET produce (const reco::PFCandidateCollection &pfCandidates)
 ~PFMETAlgo ()

Private Attributes

double hfCalibFactor_
 HF calibration factor (in 31X applied by PFProducer)
bool verbose_
 verbose ?

Detailed Description

Definition at line 31 of file PFMETAlgo.h.


Constructor & Destructor Documentation

PFMETAlgo::PFMETAlgo ( const edm::ParameterSet iConfig) [explicit]

Definition at line 18 of file PFMETAlgo.cc.

References edm::ParameterSet::getParameter(), and edm::ParameterSet::getUntrackedParameter().

                                                   {
  

  verbose_ = 
    iConfig.getUntrackedParameter<bool>("verbose",false);

  hfCalibFactor_ = 
    iConfig.getParameter<double>("hfCalibFactor");

}
PFMETAlgo::~PFMETAlgo ( )

Definition at line 31 of file PFMETAlgo.cc.

{ }

Member Function Documentation

reco::MET PFMETAlgo::produce ( const reco::PFCandidateCollection pfCandidates)

HF calibration factor (in 31X applied by PFProducer)

Definition at line 33 of file PFMETAlgo.cc.

References funct::cos(), gather_cfg::cout, reco::LeafCandidate::energy(), i, reco::PFCandidate::particleId(), reco::LeafCandidate::phi(), phi, funct::sin(), mathSSE::sqrt(), theta(), and reco::LeafCandidate::theta().

                                                                          {
  
  double sumEx = 0;
  double sumEy = 0;
  double sumEt = 0;

  for( unsigned i=0; i<pfCandidates.size(); i++ ) {

    const reco::PFCandidate& cand = pfCandidates[i];
    
    double E = cand.energy();

    if( cand.particleId()==PFCandidate::h_HF || 
        cand.particleId()==PFCandidate::egamma_HF ) 
      E *= hfCalibFactor_;

    double phi = cand.phi();
    double cosphi = cos(phi);
    double sinphi = sin(phi);

    double theta = cand.theta();
    double sintheta = sin(theta);
    
    double et = E*sintheta;
    double ex = et*cosphi;
    double ey = et*sinphi;
    
    sumEx += ex;
    sumEy += ey;
    sumEt += et;
  }
  
  double Et = sqrt( sumEx*sumEx + sumEy*sumEy);
  XYZTLorentzVector missingEt( -sumEx, -sumEy, 0, Et);
  
  if(verbose_) {
    cout<<"PFMETAlgo: mEx, mEy, mEt = "
        << missingEt.X() <<", "
        << missingEt.Y() <<", "
        << missingEt.T() <<endl;
  }

  XYZPoint vertex; // dummy vertex
  return MET(sumEt, missingEt, vertex);

 
}

Member Data Documentation

HF calibration factor (in 31X applied by PFProducer)

Definition at line 43 of file PFMETAlgo.h.

verbose ?

Definition at line 46 of file PFMETAlgo.h.