CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
PFSpecificAlgo.cc
Go to the documentation of this file.
1 // -*- C++ -*-
2 //
3 // Package: METAlgorithms
4 // Class: PFSpecificAlgo
5 //
6 // Original Authors: R. Remington (UF), R. Cavanaugh (UIC/Fermilab)
7 // Created: October 27, 2008
8 //
9 //
10 //____________________________________________________________________________||
13 
14 //____________________________________________________________________________||
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 }
59 
60 //____________________________________________________________________________||
dictionary specific
virtual double energy() const =0
energy
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
Geom::Theta< T > theta() const
size_type size() const
const_iterator begin() 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.
SpecificPFMETData run(const edm::View< reco::Candidate > &pfCands)
virtual int pdgId() const =0
PDG identifier.
boost::indirect_iterator< typename seq_t::const_iterator > const_iterator
Definition: View.h:85
const_iterator end() const