CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
pat::CalculatePtRatioRel Class Reference

#include <CalculatePtRatioRel.h>

Public Member Functions

 CalculatePtRatioRel (float dR2max)
 
std::array< float, 2 > computePtRatioRel (const pat::Muon &imuon, const reco::JetTagCollection &bTags, const reco::JetCorrector *correctorL1=nullptr, const reco::JetCorrector *correctorL1L2L3Res=nullptr) const
 
 ~CalculatePtRatioRel ()
 

Private Attributes

float dR2max_
 

Detailed Description

Definition at line 18 of file CalculatePtRatioRel.h.

Constructor & Destructor Documentation

◆ CalculatePtRatioRel()

CalculatePtRatioRel::CalculatePtRatioRel ( float  dR2max)

Definition at line 10 of file CalculatePtRatioRel.cc.

10 : dR2max_(dR2max) {}

◆ ~CalculatePtRatioRel()

CalculatePtRatioRel::~CalculatePtRatioRel ( )

Definition at line 12 of file CalculatePtRatioRel.cc.

12 {}

Member Function Documentation

◆ computePtRatioRel()

std::array< float, 2 > CalculatePtRatioRel::computePtRatioRel ( const pat::Muon imuon,
const reco::JetTagCollection bTags,
const reco::JetCorrector correctorL1 = nullptr,
const reco::JetCorrector correctorL1L2L3Res = nullptr 
) const

Definition at line 29 of file CalculatePtRatioRel.cc.

References TtFullHadKinFitProducer_cfi::bTags, reco::JetCorrector::correction(), HLTMuonOfflineAnalyzer_cfi::deltaR2, dR2max_, f, SiStripPI::max, PatBasicFWLiteJetAnalyzer_Selector_cfg::outputs, and electrons_cff::ptRel.

32  {
33  //Initialise loop variables
34  float minDr2 = 9999;
35  double jecL1L2L3Res = 1.;
36  double jecL1 = 1.;
37 
38  // Compute corrected isolation variables
39  const float chIso = muon.pfIsolationR04().sumChargedHadronPt;
40  const float nIso = muon.pfIsolationR04().sumNeutralHadronEt;
41  const float phoIso = muon.pfIsolationR04().sumPhotonEt;
42  const float puIso = muon.pfIsolationR04().sumPUPt;
43  const float dbCorrectedIsolation = chIso + std::max(nIso + phoIso - .5f * puIso, 0.f);
44  const float dbCorrectedRelIso = dbCorrectedIsolation / muon.pt();
45 
46  float JetPtRatio = 1. / (1 + dbCorrectedRelIso);
47  float JetPtRel = 0.;
48 
49  const reco::Candidate::LorentzVector& muP4(muon.p4());
50  for (const auto& tagI : bTags) {
51  // for each muon with the lepton
52  float dr2 = deltaR2(*(tagI.first), muon);
53  if (dr2 > minDr2)
54  continue;
55  minDr2 = dr2;
56 
57  reco::Candidate::LorentzVector jetP4(tagI.first->p4());
58 
59  if (correctorL1 && correctorL1L2L3Res) {
60  jecL1L2L3Res = correctorL1L2L3Res->correction(*(tagI.first));
61  jecL1 = correctorL1->correction(*(tagI.first));
62  }
63 
64  if (minDr2 < dR2max_) {
65  if ((jetP4 - muP4).Rho() < 0.0001) {
66  JetPtRel = 0.;
67  JetPtRatio = 1.;
68  } else {
69  jetP4 -= muP4 / jecL1;
70  jetP4 *= jecL1L2L3Res;
71  jetP4 += muP4;
72 
73  JetPtRatio = muP4.pt() / jetP4.pt();
74  JetPtRel = ptRel(muP4, jetP4);
75  }
76  }
77  }
78 
79  if (JetPtRatio > 1.5)
80  JetPtRatio = 1.5;
81 
82  std::array<float, 2> outputs = {{JetPtRatio, JetPtRel}};
83  return outputs;
84 };
double correction(const LorentzVector &fJet) const
get correction using Jet information only
Definition: JetCorrector.h:46
double f[11][100]
math::XYZTLorentzVector LorentzVector
Lorentz vector.
Definition: Candidate.h:36

Member Data Documentation

◆ dR2max_

float pat::CalculatePtRatioRel::dR2max_
private

Definition at line 30 of file CalculatePtRatioRel.h.

Referenced by computePtRatioRel().