CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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 ( 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_),
22  ptRecJetMax(ptMax_),
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
etaMax_(conf.getParameter< double >("etaMax"))
double ratioMax
Definition: AcceptJet.h:71
ptMin_(conf.getParameter< double >("ptMin"))
pMin_(conf.getParameter< double >("pMin"))
etaMin_(conf.getParameter< double >("etaMin"))

Member Function Documentation

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, reco::LeafCandidate::energy(), reco::LeafCandidate::eta(), etaMax, etaMin, reco::PFJet::getPFConstituents(), edm::HandleBase::isValid(), patTestJEC_cfi::jec, metsig::jet, LogDebug, reco::PFJet::neutralEmEnergy(), reco::PFJet::neutralHadronEnergy(), reco::btau::neutralHadronEnergyFraction, reco::LeafCandidate::p(), pRecJetMax, pRecJetMin, reco::LeafCandidate::pt(), 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 chargedEmEnergy() const
chargedEmEnergy
Definition: PFJet.h:139
double pt() const final
transverse momentum
double ptRecJetMin
Definition: AcceptJet.h:64
double ptRecJetMax
Definition: AcceptJet.h:65
bool doJetID
Definition: AcceptJet.h:74
double etaMin
Definition: AcceptJet.h:52
double pRecJetMin
Definition: AcceptJet.h:67
int chargedMultiplicity() const
chargedMultiplicity
Definition: PFJet.h:152
double ratioMax
Definition: AcceptJet.h:71
Jets made from PFObjects.
Definition: PFJet.h:20
float neutralEmEnergy() const
neutralEmEnergy
Definition: PFJet.h:147
double p() const final
magnitude of momentum vector
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
bool isValid() const
Definition: HandleBase.h:70
virtual std::vector< reco::PFCandidatePtr > getPFConstituents() const
get all constituents
Definition: PFJet.cc:41
float neutralHadronEnergy() const
neutralHadronEnergy
Definition: PFJet.h:99
float chargedHadronEnergy() const
chargedHadronEnergy
Definition: PFJet.h:95
#define LogDebug(id)
double energy() const final
energy
double eta() const final
momentum pseudorapidity
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(), alignCSCRings::e, reco::LeafCandidate::eta(), isotrackApplyRegressor::k, and reco::LeafCandidate::phi().

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
double phi() const final
momentum azimuthal angle
double eta() const final
momentum pseudorapidity
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:118
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
tuple d
Definition: ztail.py:151
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
tuple d
Definition: ztail.py:151
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
tuple d
Definition: ztail.py:151
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
tuple d
Definition: ztail.py:151
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
tuple d
Definition: ztail.py:151
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
tuple d
Definition: ztail.py:151
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
tuple d
Definition: ztail.py:151
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
tuple d
Definition: ztail.py:151

Member Data Documentation

bool AcceptJet::doJetID
protected

Definition at line 74 of file AcceptJet.h.

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

double AcceptJet::etaMax
protected

Definition at line 53 of file AcceptJet.h.

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

double AcceptJet::etaMin
protected

Definition at line 52 of file AcceptJet.h.

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

double AcceptJet::pRecJetMax
protected

Definition at line 68 of file AcceptJet.h.

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

double AcceptJet::pRecJetMin
protected

Definition at line 67 of file AcceptJet.h.

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

double AcceptJet::ptRecJetMax
protected

Definition at line 65 of file AcceptJet.h.

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

double AcceptJet::ptRecJetMin
protected

Definition at line 64 of file AcceptJet.h.

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

double AcceptJet::ratioMax
protected

Definition at line 71 of file AcceptJet.h.

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

double AcceptJet::ratioMin
protected

Definition at line 70 of file AcceptJet.h.

Referenced by setRatioMin().