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_) {}

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.

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 }

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.

◆ 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.

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 }

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

Referenced by operator()().

◆ setDoJetID()

void AcceptJet::setDoJetID ( bool  b)
inline

Definition at line 42 of file AcceptJet.h.

42 { doJetID = b; }

References b, and doJetID.

◆ setEtaMax()

void AcceptJet::setEtaMax ( double  d)
inline

Definition at line 33 of file AcceptJet.h.

33 { etaMax = d; }

References ztail::d, and etaMax.

◆ setEtaMin()

void AcceptJet::setEtaMin ( double  d)
inline

Set cut parameters.

Definition at line 32 of file AcceptJet.h.

32 { etaMin = d; }

References ztail::d, and etaMin.

◆ setPRecJetMax()

void AcceptJet::setPRecJetMax ( double  d)
inline

Definition at line 39 of file AcceptJet.h.

39 { pRecJetMax = d; }

References ztail::d, and pRecJetMax.

◆ setPRecJetMin()

void AcceptJet::setPRecJetMin ( double  d)
inline

Definition at line 38 of file AcceptJet.h.

38 { pRecJetMin = d; }

References ztail::d, and pRecJetMin.

◆ setPtRecJetMax()

void AcceptJet::setPtRecJetMax ( double  d)
inline

Definition at line 37 of file AcceptJet.h.

37 { ptRecJetMax = d; }

References ztail::d, and ptRecJetMax.

◆ setPtRecJetMin()

void AcceptJet::setPtRecJetMin ( double  d)
inline

Definition at line 36 of file AcceptJet.h.

36 { ptRecJetMin = d; }

References ztail::d, and ptRecJetMin.

◆ setRatioMax()

void AcceptJet::setRatioMax ( double  d)
inline

Definition at line 41 of file AcceptJet.h.

41 { ratioMax = d; }

References ztail::d, and ratioMax.

◆ setRatioMin()

void AcceptJet::setRatioMin ( double  d)
inline

Definition at line 40 of file AcceptJet.h.

40 { ratioMin = d; }

References ztail::d, and ratioMin.

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().

reco::btau::chargedHadronEnergyFraction
Definition: TaggingVariable.h:103
reco::btau::neutralHadronEnergyFraction
Definition: TaggingVariable.h:104
AcceptJet::ptRecJetMax
double ptRecJetMax
Definition: AcceptJet.h:65
reco::PFJet::getPFConstituents
virtual std::vector< reco::PFCandidatePtr > getPFConstituents() const
get all constituents
Definition: PFJet.cc:41
AcceptJet::ptRecJetMin
double ptRecJetMin
Definition: AcceptJet.h:64
reco::PFJet::chargedHadronEnergy
float chargedHadronEnergy() const
chargedHadronEnergy
Definition: PFJet.h:95
AcceptJet::pRecJetMin
double pRecJetMin
Definition: AcceptJet.h:67
reco::PFJet::chargedMultiplicity
int chargedMultiplicity() const
chargedMultiplicity
Definition: PFJet.h:152
reco::PFJet::chargedEmEnergy
float chargedEmEnergy() const
chargedEmEnergy
Definition: PFJet.h:139
dqmdumpme.k
k
Definition: dqmdumpme.py:60
AcceptJet::etaMax
double etaMax
Definition: AcceptJet.h:53
b
double b
Definition: hdecay.h:118
custom_jme_cff.nConstituents
nConstituents
Definition: custom_jme_cff.py:136
AcceptJet::ratioMax
double ratioMax
Definition: AcceptJet.h:71
LogDebug
#define LogDebug(id)
Definition: MessageLogger.h:233
AcceptJet::pRecJetMax
double pRecJetMax
Definition: AcceptJet.h:68
AcceptJet::ratio
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
AcceptJet::doJetID
bool doJetID
Definition: AcceptJet.h:74
AcceptJet::ratioMin
double ratioMin
Definition: AcceptJet.h:70
reco::PFJet::neutralHadronEnergy
float neutralHadronEnergy() const
neutralHadronEnergy
Definition: PFJet.h:99
metsig::jet
Definition: SignAlgoResolutions.h:47
AcceptJet::etaMin
double etaMin
Definition: AcceptJet.h:52
reco::PFJet
Jets made from PFObjects.
Definition: PFJet.h:20
reco::PFJet::neutralEmEnergy
float neutralEmEnergy() const
neutralEmEnergy
Definition: PFJet.h:147
reco::deltaR
constexpr auto deltaR(const T1 &t1, const T2 &t2) -> decltype(t1.eta())
Definition: deltaR.h:30
jetMETDQMOfflineSource_cff.jec
jec
Definition: jetMETDQMOfflineSource_cff.py:27
ztail.d
d
Definition: ztail.py:151
submitPVValidationJobs.infos
dictionary infos
Definition: submitPVValidationJobs.py:221
MillePedeFileConverter_cfg.e
e
Definition: MillePedeFileConverter_cfg.py:37