CMS 3D CMS Logo

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, edm::ValueMap< float > const *weights=nullptr)
 

Detailed Description

Description: Adds Particle Flow specific information to MET

Implementation: [Notes on implementation]

Definition at line 28 of file PFSpecificAlgo.h.

Constructor & Destructor Documentation

◆ PFSpecificAlgo()

PFSpecificAlgo::PFSpecificAlgo ( )
inline

Definition at line 30 of file PFSpecificAlgo.h.

30 {}

Member Function Documentation

◆ run()

SpecificPFMETData PFSpecificAlgo::run ( const edm::View< reco::Candidate > &  pfCands,
edm::ValueMap< float > const *  weights = nullptr 
)

Definition at line 15 of file PFSpecificAlgo.cc.

15  {
16  if (pfCands.empty())
17  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 (auto const& pfCandPtr : pfCands.ptrs()) {
28  const reco::Candidate* pfCand = pfCandPtr.get();
29  float weight = (weights != nullptr) ? (*weights)[pfCandPtr] : 1.0;
30  if (!pfCand)
31  continue;
32  const double theta = pfCand->theta();
33  const double e = pfCand->energy() * weight;
34  const double et = e * sin(theta);
35  switch (abs(pfCand->pdgId())) {
36  case 211:
37  ChargedHadEt += et;
38  break;
39  case 11:
40  ChargedEMEt += et;
41  break;
42  case 13:
43  MuonEt += et;
44  break;
45  case 22:
46  NeutralEMEt += et;
47  break;
48  case 130:
49  NeutralHadEt += et;
50  break;
51  case 1:
52  type6Et += et;
53  break;
54  case 2:
55  type7Et += et;
56  break;
57  }
58  }
59 
60  const double Et_total = NeutralEMEt + NeutralHadEt + ChargedEMEt + ChargedHadEt + MuonEt + type6Et + type7Et;
62  if (Et_total != 0.0) {
63  specific.NeutralEMFraction = NeutralEMEt / Et_total;
64  specific.NeutralHadFraction = NeutralHadEt / Et_total;
65  specific.ChargedEMFraction = ChargedEMEt / Et_total;
66  specific.ChargedHadFraction = ChargedHadEt / Et_total;
67  specific.MuonFraction = MuonEt / Et_total;
68  specific.Type6Fraction = type6Et / Et_total;
69  specific.Type7Fraction = type7Et / Et_total;
70  }
71  return specific;
72 }

References funct::abs(), MillePedeFileConverter_cfg::e, edm::View< T >::empty(), reco::Candidate::energy(), EgHLTOffHistBins_cfi::et, reco::Candidate::get(), reco::Candidate::pdgId(), edm::View< T >::ptrs(), funct::sin(), timingPdfMaker::specific, reco::Candidate::theta(), theta(), mps_merge::weight, and HLT_FULL_cff::weights.

Referenced by reco::PFMETProducerMVA::produce().

reco::Candidate::energy
virtual double energy() const =0
energy
edm::View::empty
bool empty() const
SpecificPFMETData
MET made from Particle Flow Candidates.
Definition: SpecificPFMETData.h:12
mps_merge.weight
weight
Definition: mps_merge.py:88
edm::View::ptrs
std::vector< Ptr< value_type > > const & ptrs() const
reco::Candidate::get
T get() const
get a component
Definition: Candidate.h:221
reco::Candidate::theta
virtual double theta() const =0
momentum polar angle
funct::sin
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
timingPdfMaker.specific
specific
Definition: timingPdfMaker.py:78
HLT_FULL_cff.weights
weights
Definition: HLT_FULL_cff.py:99166
theta
Geom::Theta< T > theta() const
Definition: Basic3DVectorLD.h:150
EgHLTOffHistBins_cfi.et
et
Definition: EgHLTOffHistBins_cfi.py:8
reco::Candidate::pdgId
virtual int pdgId() const =0
PDG identifier.
reco::Candidate
Definition: Candidate.h:27
funct::abs
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
weight
Definition: weight.py:1
MillePedeFileConverter_cfg.e
e
Definition: MillePedeFileConverter_cfg.py:37