CMS 3D CMS Logo

List of all members | Public Member Functions | Protected Member Functions | Protected Attributes
AcceptJet Class Reference

#include <AcceptJet.h>

Public Member Functions

 AcceptJet (const double &etaMin_, const double &etaMax_, const double &ptMin_, const double &ptMax_, const double &pMin_, const double &pMax_, const double &ratioMin_, const double &ratioMax_, const bool &doJetID_)
 
bool operator() (const reco::Jet &jet, const int &jetFlavour, const edm::Handle< reco::SoftLeptonTagInfoCollection > &infos, const double jec) const
 Returns true if jet and associated parton satisfy kinematic cuts. More...
 
void setDoJetID (bool b)
 
void setEtaMax (double d)
 
void setEtaMin (double d)
 Set cut parameters. More...
 
void setPRecJetMax (double d)
 
void setPRecJetMin (double d)
 
void setPtRecJetMax (double d)
 
void setPtRecJetMin (double d)
 
void setRatioMax (double d)
 
void setRatioMin (double d)
 

Protected Member Functions

double ratio (const reco::Jet &jet, const edm::Handle< reco::SoftLeptonTagInfoCollection > &infos) const
 Finds the ratio of the momentum of any leptons in the jet to jet energy. More...
 

Protected Attributes

bool doJetID
 
double etaMax
 
double etaMin
 
double pRecJetMax
 
double pRecJetMin
 
double ptRecJetMax
 
double ptRecJetMin
 
double ratioMax
 
double ratioMin
 

Detailed Description

Decide if jet and associated parton satisfy desired kinematic cuts.

Definition at line 14 of file AcceptJet.h.

Constructor & Destructor Documentation

◆ AcceptJet()

AcceptJet::AcceptJet ( const double &  etaMin_,
const double &  etaMax_,
const double &  ptMin_,
const double &  ptMax_,
const double &  pMin_,
const double &  pMax_,
const double &  ratioMin_,
const double &  ratioMax_,
const bool &  doJetID_ 
)

Definition at line 10 of file AcceptJet.cc.

19  : etaMin(etaMin_),
20  etaMax(etaMax_),
21  ptRecJetMin(ptMin_),
22  ptRecJetMax(ptMax_),
23  pRecJetMin(pMin_),
24  pRecJetMax(pMax_),
25  ratioMin(ratioMin_),
26  ratioMax(ratioMax_),
27  doJetID(doJetID_) {}
double pRecJetMax
Definition: AcceptJet.h:68
double etaMax
Definition: AcceptJet.h:53
double ptRecJetMin
Definition: AcceptJet.h:64
double ratioMin
Definition: AcceptJet.h:70
double ptRecJetMax
Definition: AcceptJet.h:65
bool doJetID
Definition: AcceptJet.h:74
double etaMin
Definition: AcceptJet.h:52
double pRecJetMin
Definition: AcceptJet.h:67
double ratioMax
Definition: AcceptJet.h:71

Member Function Documentation

◆ operator()()

bool AcceptJet::operator() ( const reco::Jet jet,
const int &  jetFlavour,
const edm::Handle< reco::SoftLeptonTagInfoCollection > &  infos,
const double  jec 
) const

Returns true if jet and associated parton satisfy kinematic cuts.

Definition at line 29 of file AcceptJet.cc.

References reco::PFJet::chargedEmEnergy(), reco::PFJet::chargedHadronEnergy(), reco::btau::chargedHadronEnergyFraction, reco::PFJet::chargedMultiplicity(), doJetID, etaMax, etaMin, reco::PFJet::getPFConstituents(), submitPVValidationJobs::infos, jetMETDQMOfflineSource_cff::jec, metsig::jet, LogDebug, custom_jme_cff::nConstituents, reco::PFJet::neutralEmEnergy(), reco::PFJet::neutralHadronEnergy(), reco::btau::neutralHadronEnergyFraction, pRecJetMax, pRecJetMin, ptRecJetMax, ptRecJetMin, ratio(), and ratioMax.

32  {
33  // temporary fudge to correct for double loop error
34  // jetPartonMomentum /= 2.0;
35 
36  if (fabs(jet.eta()) < etaMin || fabs(jet.eta()) > etaMax)
37  return false;
38 
39  // if ( jetFlavour.underlyingParton4Vec().P() < pPartonMin ||
40  // jetFlavour.underlyingParton4Vec().P() > pPartonMax ) accept = false;
41  //
42  // if ( jetFlavour.underlyingParton4Vec().Pt() < ptPartonMin ||
43  // jetFlavour.underlyingParton4Vec().Pt() > ptPartonMax ) accept = false;
44 
45  if (jet.pt() * jec < ptRecJetMin || jet.pt() * jec > ptRecJetMax)
46  return false;
47 
48  if (jet.p() * jec < pRecJetMin || jet.p() * jec > pRecJetMax)
49  return false;
50 
51  if (!infos.isValid()) {
52  LogDebug("infos not valid") << "A valid SoftLeptonTagInfoCollection was not found!"
53  << " Skipping ratio check.";
54  } else {
55  double pToEratio = ratio(jet, infos);
56  if (pToEratio / jec < ratioMin || pToEratio / jec > ratioMax)
57  return false;
58  }
59 
60  if (doJetID) {
61  const reco::PFJet* pfjet = dynamic_cast<const reco::PFJet*>(&jet);
62  if (pfjet) {
63  double neutralHadronEnergyFraction = pfjet->neutralHadronEnergy() / (jet.energy() * jec);
64  double neutralEmEnergyFraction = pfjet->neutralEmEnergy() / (jet.energy() * jec);
65  int nConstituents = pfjet->getPFConstituents().size();
66  double chargedHadronEnergyFraction = pfjet->chargedHadronEnergy() / (jet.energy() * jec);
67  int chargedMultiplicity = pfjet->chargedMultiplicity();
68  double chargedEmEnergyFraction = pfjet->chargedEmEnergy() / (jet.energy() * jec);
69  if (!(neutralHadronEnergyFraction < 0.99 && neutralEmEnergyFraction < 0.99 && nConstituents > 1 &&
70  chargedHadronEnergyFraction > 0.0 && chargedMultiplicity > 0.0 && chargedEmEnergyFraction < 0.99))
71  return false; //2012 values
72  }
73  //Looks to not work -> to be fixed
74  //else std::cout<<"Jets are not PF jets, put 'doJetID' to False."<<std::endl;
75  }
76 
77  return true;
78 }
double pRecJetMax
Definition: AcceptJet.h:68
double etaMax
Definition: AcceptJet.h:53
float neutralHadronEnergy() const
neutralHadronEnergy
Definition: PFJet.h:99
double ptRecJetMin
Definition: AcceptJet.h:64
int chargedMultiplicity() const
chargedMultiplicity
Definition: PFJet.h:152
float chargedEmEnergy() const
chargedEmEnergy
Definition: PFJet.h:139
double ptRecJetMax
Definition: AcceptJet.h:65
bool doJetID
Definition: AcceptJet.h:74
float neutralEmEnergy() const
neutralEmEnergy
Definition: PFJet.h:147
double etaMin
Definition: AcceptJet.h:52
double pRecJetMin
Definition: AcceptJet.h:67
double ratioMax
Definition: AcceptJet.h:71
Jets made from PFObjects.
Definition: PFJet.h:20
virtual std::vector< reco::PFCandidatePtr > getPFConstituents() const
get all constituents
Definition: PFJet.cc:41
double ratio(const reco::Jet &jet, const edm::Handle< reco::SoftLeptonTagInfoCollection > &infos) const
Finds the ratio of the momentum of any leptons in the jet to jet energy.
Definition: AcceptJet.cc:80
float chargedHadronEnergy() const
chargedHadronEnergy
Definition: PFJet.h:95
#define LogDebug(id)

◆ ratio()

double AcceptJet::ratio ( const reco::Jet jet,
const edm::Handle< reco::SoftLeptonTagInfoCollection > &  infos 
) const
protected

Finds the ratio of the momentum of any leptons in the jet to jet energy.

Definition at line 80 of file AcceptJet.cc.

References reco::deltaR(), MillePedeFileConverter_cfg::e, submitPVValidationJobs::infos, metsig::jet, and dqmdumpme::k.

Referenced by operator()().

80  {
81  double jetRatio = 0.0;
82  reco::SoftLeptonTagInfoCollection::const_iterator infoiter = infos->begin();
83  for (; infoiter != infos->end(); ++infoiter) {
84  if (reco::deltaR(jet.eta(), jet.phi(), infoiter->jet()->eta(), infoiter->jet()->phi()) > 1e-4)
85  continue;
86 
87  if (infoiter->leptons() == 0)
88  break;
89 
90  for (unsigned int k = 0; k != infoiter->leptons(); ++k) {
91  double tempRatio = infoiter->properties(k).ratio;
92  if (tempRatio > jetRatio)
93  jetRatio = tempRatio;
94  }
95  }
96 
97  return jetRatio;
98 }
constexpr auto deltaR(const T1 &t1, const T2 &t2) -> decltype(t1.eta())
Definition: deltaR.h:30

◆ setDoJetID()

void AcceptJet::setDoJetID ( bool  b)
inline

Definition at line 42 of file AcceptJet.h.

References b, and doJetID.

42 { doJetID = b; }
bool doJetID
Definition: AcceptJet.h:74
double b
Definition: hdecay.h:120

◆ setEtaMax()

void AcceptJet::setEtaMax ( double  d)
inline

Definition at line 33 of file AcceptJet.h.

References ztail::d, and etaMax.

33 { etaMax = d; }
double etaMax
Definition: AcceptJet.h:53
d
Definition: ztail.py:151

◆ setEtaMin()

void AcceptJet::setEtaMin ( double  d)
inline

Set cut parameters.

Definition at line 32 of file AcceptJet.h.

References ztail::d, and etaMin.

32 { etaMin = d; }
double etaMin
Definition: AcceptJet.h:52
d
Definition: ztail.py:151

◆ setPRecJetMax()

void AcceptJet::setPRecJetMax ( double  d)
inline

Definition at line 39 of file AcceptJet.h.

References ztail::d, and pRecJetMax.

39 { pRecJetMax = d; }
double pRecJetMax
Definition: AcceptJet.h:68
d
Definition: ztail.py:151

◆ setPRecJetMin()

void AcceptJet::setPRecJetMin ( double  d)
inline

Definition at line 38 of file AcceptJet.h.

References ztail::d, and pRecJetMin.

38 { pRecJetMin = d; }
double pRecJetMin
Definition: AcceptJet.h:67
d
Definition: ztail.py:151

◆ setPtRecJetMax()

void AcceptJet::setPtRecJetMax ( double  d)
inline

Definition at line 37 of file AcceptJet.h.

References ztail::d, and ptRecJetMax.

37 { ptRecJetMax = d; }
double ptRecJetMax
Definition: AcceptJet.h:65
d
Definition: ztail.py:151

◆ setPtRecJetMin()

void AcceptJet::setPtRecJetMin ( double  d)
inline

Definition at line 36 of file AcceptJet.h.

References ztail::d, and ptRecJetMin.

36 { ptRecJetMin = d; }
double ptRecJetMin
Definition: AcceptJet.h:64
d
Definition: ztail.py:151

◆ setRatioMax()

void AcceptJet::setRatioMax ( double  d)
inline

Definition at line 41 of file AcceptJet.h.

References ztail::d, and ratioMax.

41 { ratioMax = d; }
double ratioMax
Definition: AcceptJet.h:71
d
Definition: ztail.py:151

◆ setRatioMin()

void AcceptJet::setRatioMin ( double  d)
inline

Definition at line 40 of file AcceptJet.h.

References ztail::d, and ratioMin.

40 { ratioMin = d; }
double ratioMin
Definition: AcceptJet.h:70
d
Definition: ztail.py:151

Member Data Documentation

◆ doJetID

bool AcceptJet::doJetID
protected

Definition at line 74 of file AcceptJet.h.

Referenced by operator()(), and setDoJetID().

◆ etaMax

double AcceptJet::etaMax
protected

Definition at line 53 of file AcceptJet.h.

Referenced by operator()(), and setEtaMax().

◆ etaMin

double AcceptJet::etaMin
protected

Definition at line 52 of file AcceptJet.h.

Referenced by operator()(), and setEtaMin().

◆ pRecJetMax

double AcceptJet::pRecJetMax
protected

Definition at line 68 of file AcceptJet.h.

Referenced by operator()(), and setPRecJetMax().

◆ pRecJetMin

double AcceptJet::pRecJetMin
protected

Definition at line 67 of file AcceptJet.h.

Referenced by operator()(), and setPRecJetMin().

◆ ptRecJetMax

double AcceptJet::ptRecJetMax
protected

Definition at line 65 of file AcceptJet.h.

Referenced by operator()(), and setPtRecJetMax().

◆ ptRecJetMin

double AcceptJet::ptRecJetMin
protected

Definition at line 64 of file AcceptJet.h.

Referenced by operator()(), and setPtRecJetMin().

◆ ratioMax

double AcceptJet::ratioMax
protected

Definition at line 71 of file AcceptJet.h.

Referenced by operator()(), and setRatioMax().

◆ ratioMin

double AcceptJet::ratioMin
protected

Definition at line 70 of file AcceptJet.h.

Referenced by setRatioMin().