CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions
PFSpecificAlgo Class Reference

#include <RecoMET/METAlgorithms/interface/PFSpecificAlgo.h>

Public Member Functions

 PFSpecificAlgo ()
 
SpecificPFMETData run (const edm::View< reco::Candidate > &pfCands)
 

Detailed Description

Description: Adds Particle Flow specific information to MET

Implementation: [Notes on implementation]

Definition at line 27 of file PFSpecificAlgo.h.

Constructor & Destructor Documentation

PFSpecificAlgo::PFSpecificAlgo ( )
inline

Definition at line 30 of file PFSpecificAlgo.h.

30 { }

Member Function Documentation

SpecificPFMETData PFSpecificAlgo::run ( const edm::View< reco::Candidate > &  pfCands)

Definition at line 15 of file PFSpecificAlgo.cc.

References funct::abs(), edm::View< T >::begin(), SpecificPFMETData::ChargedEMFraction, SpecificPFMETData::ChargedHadFraction, alignCSCRings::e, edm::View< T >::end(), reco::Candidate::energy(), SpecificPFMETData::MuonFraction, SpecificPFMETData::NeutralEMFraction, SpecificPFMETData::NeutralHadFraction, reco::Candidate::pdgId(), funct::sin(), edm::View< T >::size(), timingPdfMaker::specific, reco::Candidate::theta(), theta(), SpecificPFMETData::Type6Fraction, and SpecificPFMETData::Type7Fraction.

Referenced by cms::PFMETProducer::produce(), and cms::METProducer::produce_PFMET().

16 {
17  if(!pfCands.size()) return SpecificPFMETData();
18 
19  double NeutralEMEt = 0.0;
20  double NeutralHadEt = 0.0;
21  double ChargedEMEt = 0.0;
22  double ChargedHadEt = 0.0;
23  double MuonEt = 0.0;
24  double type6Et = 0.0;
25  double type7Et = 0.0;
26 
27  for( edm::View<reco::Candidate>::const_iterator iPfCand = pfCands.begin(); iPfCand != pfCands.end(); ++iPfCand)
28  {
29  const reco::Candidate* pfCand = dynamic_cast<const reco::Candidate*> (&(*iPfCand));
30  if (!pfCand) continue;
31  const double theta = pfCand->theta();
32  const double e = pfCand->energy();
33  const double et = e*sin(theta);
34  switch (abs(pfCand->pdgId())) {
35  case 211: ChargedHadEt += et; break;
36  case 11: ChargedEMEt += et; break;
37  case 13: MuonEt += et; break;
38  case 22: NeutralEMEt += et; break;
39  case 130: NeutralHadEt += et; break;
40  case 1: type6Et += et; break;
41  case 2: type7Et += et; break;
42  }
43  }
44 
45  const double Et_total = NeutralEMEt + NeutralHadEt + ChargedEMEt + ChargedHadEt + MuonEt + type6Et + type7Et;
47  if (Et_total!=0.0)
48  {
49  specific.NeutralEMFraction = NeutralEMEt/Et_total;
50  specific.NeutralHadFraction = NeutralHadEt/Et_total;
51  specific.ChargedEMFraction = ChargedEMEt/Et_total;
52  specific.ChargedHadFraction = ChargedHadEt/Et_total;
53  specific.MuonFraction = MuonEt/Et_total;
54  specific.Type6Fraction = type6Et/Et_total;
55  specific.Type7Fraction = type7Et/Et_total;
56  }
57  return specific;
58 }
dictionary specific
boost::indirect_iterator< typename seq_t::const_iterator > const_iterator
Definition: View.h:81
virtual double energy() const =0
energy
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
Geom::Theta< T > theta() const
virtual double theta() const =0
momentum polar angle
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
MET made from Particle Flow Candidates.
virtual int pdgId() const =0
PDG identifier.
size_type size() const
const_iterator begin() const
const_iterator end() const