DESY Hbb Analysis Framework
Public Member Functions | Protected Attributes | List of all members
analysis::tools::Jet Class Reference

#include <Jet.h>

Inheritance diagram for analysis::tools::Jet:
analysis::tools::Candidate

Public Member Functions

void addFSR (Jet *)
 add a final state radiation jet, will modify the 4-momentum More...
 
void addMuon (std::shared_ptr< Muon >)
 associate a muon to the jet More...
 
void addMuon (std::vector< std::shared_ptr< Muon > > muons, const float &dr=0.4)
 associate a muon to the jet from a collection of muons More...
 
void addParton (const std::shared_ptr< GenParticle > &)
 add parton that gave rise to jet More...
 
void applyBjetRegression ()
 
void applyJER (const JetResolutionInfo &, const float &drmin=0.2)
 
void associatePartons (const std::vector< std::shared_ptr< GenParticle > > &, const float &dRmax=0.5, const float &ptMin=1., const bool &pythi8=true)
 associate partons to the jet More...
 
float bRegCorr () const
 b-jet regression More...
 
void bRegCorr (const float &)
 b-jet regression More...
 
float bRegRes () const
 
void bRegRes (const float &)
 
float btag (const std::string &) const
 returns the btag value of btag_csvivf More...
 
void btag (const float &)
 sets the btag value More...
 
void btag (const std::string &, const float &)
 sets the btag value for difference algorithms More...
 
void btagAlgo (const std::string &)
 sets the default btag algo More...
 
double btagSF (std::shared_ptr< BTagCalibrationReader > reader, const std::string &flavalgo="Hadron") const
 btag SF More...
 
double btagSFdown (std::shared_ptr< BTagCalibrationReader > reader, const float &nsig=1, const std::string &flavalgo="Hadron") const
 
double btagSFsys (std::shared_ptr< BTagCalibrationReader > reader, const std::string &systype="central", const std::string &flavalgo="Hadron") const
 
double btagSFup (std::shared_ptr< BTagCalibrationReader > reader, const float &nsig=1, const std::string &flavalgo="Hadron") const
 
float chargedEmFraction () const
 
void chargedEmFraction (const float &cEmFrac)
 
float chargedHadronFraction () const
 
void chargedHadronFraction (const float &cHadFrac)
 
float chargedMultiplicity () const
 
void chargedMultiplicity (const float &cMult)
 
float constituents () const
 
std::string extendedFlavour () const
 returns the extended flavour definition More...
 
int flavour () const
 returns the flavour with the Hadron definition (=0 for data) More...
 
int flavour (const std::string &) const
 returns the flavour given a definition (=0 for data) More...
 
void flavour (const int &)
 sets flavour More...
 
void flavour (const std::string &definition, const int &value)
 sets flavour for a given definition More...
 
std::vector< int > flavours () const
 returns the vector containing flavours inside the jet More...
 
JetfsrJet ()
 pointer to the FSR jet More...
 
std::shared_ptr< GenJetgeneratedJet () const
 Pointer to GenJet. More...
 
void generatedJet (std::shared_ptr< GenJet >)
 GenJet matching. More...
 
void genJets (const std::vector< std::shared_ptr< GenJet > > &)
 gen jets More...
 
bool id (const std::string &wp="tight") const
 returns if jet has a given working point More...
 
void id (const float &nHadFrac, const float &nEmFrac, const float &nMult, const float &cHadFrac, const float &cEmFrac, const float &cMult, const float &muFrac, const float &puppi)
 calculates the jet id More...
 
bool idLoose () const
 returns if jet has id loose working point More...
 
void idLoose (const bool &)
 sets if jet id is loose or not More...
 
bool idTight () const
 returns if jet has id tight working point More...
 
void idTight (const bool &)
 sets if jet id is tight or not More...
 
bool isPuppi () const
 returns if jet is Puppi More...
 
void isPuppi (const bool &)
 sets the isPuppi value More...
 
float jecUncert () const
 returns the jet energy correction uncertainty More...
 
void jecUncert (const float &)
 sets the jet energy correction uncertainty More...
 
float jerCorrection (const std::string &var="nominal", const float &nsig=1) const
 
void jerCorrections ()
 
void jerInfo (const JetResolutionInfo &, const std::string &)
 
void jerInfo (const JetResolutionInfo &, const float &drmin=0.2)
 
bool jerMatch (const std::string &)
 JER matching. More...
 
bool jerMatch (const float &drmin=0.2)
 
bool jerMatch () const
 
float jerPtResolution () const
 returns jet pt resolution More...
 
float jerPtResolution (const JetResolution &) const
 returns jet pt resolution from text file More...
 
void jerPtResolution (const float &)
 sets jet energy resolution More...
 
float jerSF () const
 returns jet energy resolution SF More...
 
float jerSF (const JetResolutionScaleFactor &) const
 returns jet energy resolution SF More...
 
void jerSF (const float &)
 sets jet energy resolution SF More...
 
float jerSFdown () const
 returns jet energy resolution SF Down variation More...
 
float jerSFdown (const JetResolutionScaleFactor &) const
 returns jet energy resolution SF Down variation More...
 
void jerSFdown (const float &)
 sets jet energy resolution SF Down variation More...
 
float jerSFup () const
 returns jet energy resolution SF Up variation More...
 
float jerSFup (const JetResolutionScaleFactor &) const
 returns jet energy resolution SF Up variation More...
 
void jerSFup (const float &)
 sets jet energy resolution SF Up variation More...
 
 Jet ()
 default constructor More...
 
 Jet (const float &pt, const float &eta, const float &phi, const float &e)
 constructor from 4-momentum information More...
 
 Jet (const TLorentzVector &p4)
 constructor from TLorentzVector More...
 
std::shared_ptr< Muonmuon () const
 pointer to the muon More...
 
float muonFraction () const
 
void muonFraction (const float &muFrac)
 
float neutralEmFraction () const
 
void neutralEmFraction (const float &nEmFrac)
 
float neutralHadronFraction () const
 
void neutralHadronFraction (const float &nHadFrac)
 
float neutralMultiplicity () const
 
void neutralMultiplicity (const float &nMult)
 
std::vector< std::shared_ptr< GenParticle > > partons () const
 returns the vector of pointers to the generated partons More...
 
float pileupJetIdFullDiscriminant () const
 pile up jet id More...
 
void pileupJetIdFullDiscriminant (const float &discr)
 pile up jet id More...
 
int pileupJetIdFullId () const
 
bool pileupJetIdFullId (const std::string &wp) const
 
void pileupJetIdFullId (const int &id)
 
float qgLikelihood () const
 quark-gluon separation More...
 
void qgLikelihood (const float &discr)
 quark-gluon separation More...
 
int removeParton (const int &)
 remove parton from jet parton list More...
 
double rho () const
 Rho. More...
 
void rho (const double &)
 Rho. More...
 
void rmFSR ()
 remove the final state radiation jet, will change back the original 4-momentum More...
 
void rmMuon ()
 remove muon association to the jet More...
 
 ~Jet ()
 destructor More...
 
- Public Member Functions inherited from analysis::tools::Candidate
 Candidate ()
 default constructor More...
 
 Candidate (const float &pt, const float &eta, const float &phi, const float &e, const float &q)
 constructor from 4-momentum information More...
 
 Candidate (const float &px, const float &py, const float &pz)
 constructor from 3-momentum information More...
 
 Candidate (const float &px, const float &py, const float &pz, const float &q)
 constructor from 3-momentum and charge information More...
 
float deltaPhi (const Candidate &) const
 returns the deltaPhi between this and another candidate More...
 
float deltaR (const Candidate &) const
 returns the deltaR between this and another candidate More...
 
float e () const
 returns the energy More...
 
void e (const float &)
 sets the energy More...
 
float eta () const
 returns the pseudorapidity More...
 
float m () const
 returns the mass More...
 
float mass () const
 returns the mass More...
 
const Candidatematched (const std::string &name)
 returns the pointer to the matched candidate object More...
 
const Candidatematched (const std::string &name) const
 returns the pointer to the matched candidate object More...
 
virtual bool matchTo (const std::vector< Candidate > *cands, const std::string &name, const float &deltaR=0.5)
 function to match this candidate to another object from a list of pointers with a name More...
 
virtual bool matchTo (const std::vector< Candidate > *cands, const std::string &name, const float &delta_pT, const float &deltaR)
 
TVector3 p3 () const
 returns the 4-momentum (TVector3) More...
 
TLorentzVector p4 () const
 returns the 4-momentum (TLorentzVector) More...
 
void p4 (const TLorentzVector &)
 sets the 4-momentum (TLorentzVector) More...
 
float phi () const
 returns the azimuthal angle More...
 
float pt () const
 returns the transverse momentum More...
 
float px () const
 returns the x component of the momentum More...
 
void px (const float &)
 sets the x component of the momentum More...
 
float py () const
 returns the y component of the momentum More...
 
void py (const float &)
 sets the y component of the momentum More...
 
float pz () const
 returns the z component of the momentum More...
 
void pz (const float &)
 sets the z component of the momentum More...
 
int q () const
 returns the charge More...
 
void q (const float &)
 sets the charge More...
 
void unmatch (const std::string &)
 unmatch a matched candidate object, i.e. set it to nullptr, useful to remove possible duplicated matching More...
 
virtual ~Candidate ()
 destructor More...
 

Protected Attributes

float bRegCorr_
 b-jet regression More...
 
float bRegRes_
 
float btag_
 btag value More...
 
std::string btagAlgo_
 default btag algo More...
 
std::map< std::string, float > btags_
 btag value for each algo More...
 
float cEmFrac_
 
float cHadFrac_
 
float cMult_
 
std::string extendedFlavour_
 extended flavour identification for merged jets More...
 
std::map< std::string, int > flavour_
 map of flavour to a given definition More...
 
std::vector< int > flavours_
 flavours inside the jet More...
 
Jetfsr_
 final state radiation More...
 
std::shared_ptr< GenJetgenjet_
 generated jet More...
 
std::vector< std::shared_ptr< GenJet > > genjets_
 collection of GenJets More...
 
bool idloose_
 jet id loose working point More...
 
bool idtight_
 jet id tight working point More...
 
bool isPuppi_
 
float jecUnc_
 jet energy correction uncertainty More...
 
JERCorrections jercorr_
 JER correction factor. More...
 
JetResolutionInfo jerinfo_
 JER info. More...
 
bool jermatch_
 JER matching. More...
 
float jerptres_
 jet energy resolution More...
 
float jersf_
 jet energy resolution SF More...
 
float jersfdown_
 jet energy resolution SF Down variation More...
 
float jersfup_
 jet energy resolution SF Up variation More...
 
float muFrac_
 
std::shared_ptr< Muonmuon_
 muon in jet More...
 
float nConst_
 
float nEmFrac_
 
float nHadFrac_
 jet id More...
 
float nMult_
 
std::vector< std::shared_ptr< GenParticle > > partons_
 vector of pointers to Genparticles from merged jets More...
 
float puJetIdFullDisc_
 pileup jet id More...
 
int puJetIdFullId_
 
float qgLikelihood_
 quark-gluon separation More...
 
double rho_
 Fixedgridrho (for JER) More...
 
TLorentzVector uncorrJetp4_
 4-momentum before FSR correction More...
 
- Protected Attributes inherited from analysis::tools::Candidate
std::map< std::string, const Candidate * > matched_
 map of matched candidates More...
 
TLorentzVector p4_
 the 4-momentum More...
 
float q_
 the charge More...
 

Detailed Description

Definition at line 55 of file Jet.h.

Constructor & Destructor Documentation

Jet::Jet ( )

default constructor

Definition at line 21 of file Jet.cc.

References btagAlgo_, extendedFlavour_, fsr_, genjet_, jermatch_, muon_, analysis::tools::Candidate::p4_, and uncorrJetp4_.

21  : Candidate()
22 {
23  extendedFlavour_ = "?";
24  btagAlgo_ = "";
25  fsr_ = nullptr;
26  muon_ = nullptr;
27  uncorrJetp4_ = p4_;
28  genjet_ = nullptr;
29  jermatch_ = false;
30 
31 }
Candidate()
default constructor
Definition: Candidate.cc:18
TLorentzVector uncorrJetp4_
4-momentum before FSR correction
Definition: Jet.h:326
std::string extendedFlavour_
extended flavour identification for merged jets
Definition: Jet.h:277
std::string btagAlgo_
default btag algo
Definition: Jet.h:271
bool jermatch_
JER matching.
Definition: Jet.h:295
std::shared_ptr< GenJet > genjet_
generated jet
Definition: Jet.h:329
TLorentzVector p4_
the 4-momentum
Definition: Candidate.h:114
Jet * fsr_
final state radiation
Definition: Jet.h:324
std::shared_ptr< Muon > muon_
muon in jet
Definition: Jet.h:336
Jet::Jet ( const float &  pt,
const float &  eta,
const float &  phi,
const float &  e 
)

constructor from 4-momentum information

Definition at line 32 of file Jet.cc.

References btagAlgo_, extendedFlavour_, fsr_, genjet_, jermatch_, muon_, analysis::tools::Candidate::p4_, and uncorrJetp4_.

32  : Candidate(pt,eta,phi,e,0.)
33 {
34  extendedFlavour_ = "?";
35  btagAlgo_ = "";
36  fsr_ = nullptr;
37  muon_ = nullptr;
38  uncorrJetp4_ = p4_;
39  genjet_ = nullptr;
40  jermatch_ = false;
41 
42 
43 }
Candidate()
default constructor
Definition: Candidate.cc:18
float eta() const
returns the pseudorapidity
Definition: Candidate.cc:134
float e() const
returns the energy
Definition: Candidate.cc:136
TLorentzVector uncorrJetp4_
4-momentum before FSR correction
Definition: Jet.h:326
float phi() const
returns the azimuthal angle
Definition: Candidate.cc:135
std::string extendedFlavour_
extended flavour identification for merged jets
Definition: Jet.h:277
std::string btagAlgo_
default btag algo
Definition: Jet.h:271
bool jermatch_
JER matching.
Definition: Jet.h:295
std::shared_ptr< GenJet > genjet_
generated jet
Definition: Jet.h:329
float pt() const
returns the transverse momentum
Definition: Candidate.cc:133
TLorentzVector p4_
the 4-momentum
Definition: Candidate.h:114
Jet * fsr_
final state radiation
Definition: Jet.h:324
std::shared_ptr< Muon > muon_
muon in jet
Definition: Jet.h:336
analysis::tools::Jet::Jet ( const TLorentzVector &  p4)

constructor from TLorentzVector

Jet::~Jet ( )

destructor

Definition at line 45 of file Jet.cc.

46 {
47  // do anything here that needs to be done at desctruction time
48  // (e.g. close files, deallocate resources etc.)
49 }

Member Function Documentation

void Jet::addFSR ( Jet j)

add a final state radiation jet, will modify the 4-momentum

Definition at line 414 of file Jet.cc.

References fsr_, analysis::tools::Candidate::p4(), and analysis::tools::Candidate::p4_.

415 {
416  if ( j == nullptr ) return;
417  if ( fsr_ != nullptr )
418  {
419  std::cout << "FSR jet will not be added because FSR already exists" << std::endl;
420  return;
421  }
422  fsr_ = j;
423  p4_ = p4_ + fsr_->p4();
424 }
TLorentzVector p4() const
returns the 4-momentum (TLorentzVector)
Definition: Candidate.cc:143
TLorentzVector p4_
the 4-momentum
Definition: Candidate.h:114
Jet * fsr_
final state radiation
Definition: Jet.h:324
void Jet::addMuon ( std::shared_ptr< Muon m)

associate a muon to the jet

Definition at line 437 of file Jet.cc.

References analysis::tools::Candidate::m(), and muon_.

Referenced by addMuon().

438 {
439  if ( m == nullptr ) return;
440  if ( muon_ != nullptr )
441  {
442  std::cout << "A muon is already associated to this jet" << std::endl;
443  return;
444  }
445  muon_ = m;
446 }
float m() const
returns the mass
Definition: Candidate.cc:137
std::shared_ptr< Muon > muon_
muon in jet
Definition: Jet.h:336
void Jet::addMuon ( std::vector< std::shared_ptr< Muon > >  muons,
const float &  dr = 0.4 
)

associate a muon to the jet from a collection of muons

Definition at line 448 of file Jet.cc.

References addMuon(), analysis::tools::Candidate::deltaR(), and analysis::tools::Candidate::m().

449 {
450  if ( muons.size() == 0 ) return;
451 
452  for ( auto m : muons )
453  {
454  if ( this->deltaR((*m)) < dr )
455  {
456  addMuon(m);
457  return;
458  }
459  }
460 }
float m() const
returns the mass
Definition: Candidate.cc:137
float deltaR(const Candidate &) const
returns the deltaR between this and another candidate
Definition: Candidate.cc:140
void addMuon(std::shared_ptr< Muon >)
associate a muon to the jet
Definition: Jet.cc:437
void Jet::addParton ( const std::shared_ptr< GenParticle > &  parton)

add parton that gave rise to jet

Definition at line 359 of file Jet.cc.

References flavours_, and partons_.

Referenced by associatePartons().

359  { partons_.push_back(parton);
360  flavours_.push_back(parton->pdgId()); }
std::vector< int > flavours_
flavours inside the jet
Definition: Jet.h:275
std::vector< std::shared_ptr< GenParticle > > partons_
vector of pointers to Genparticles from merged jets
Definition: Jet.h:279
void Jet::applyBjetRegression ( )

Definition at line 238 of file Jet.cc.

References bRegCorr(), analysis::tools::Candidate::e(), analysis::tools::Candidate::eta(), analysis::tools::Candidate::p4_, analysis::tools::Candidate::phi(), and analysis::tools::Candidate::pt().

239 {
240  float pt = p4_.Pt()*this->bRegCorr();
241  float eta = p4_.Eta();
242  float phi = p4_.Phi();
243  float e = p4_.E()*this->bRegCorr();
244  p4_.SetPtEtaPhiE(pt,eta,phi,e);
245 }
float bRegCorr() const
b-jet regression
Definition: Jet.cc:235
float eta() const
returns the pseudorapidity
Definition: Candidate.cc:134
float e() const
returns the energy
Definition: Candidate.cc:136
float phi() const
returns the azimuthal angle
Definition: Candidate.cc:135
float pt() const
returns the transverse momentum
Definition: Candidate.cc:133
TLorentzVector p4_
the 4-momentum
Definition: Candidate.h:114
void Jet::applyJER ( const JetResolutionInfo jerinfo,
const float &  drmin = 0.2 
)

Definition at line 213 of file Jet.cc.

References jerCorrection(), jerInfo(), and analysis::tools::Candidate::p4_.

214 {
215  this -> jerInfo(jerinfo,drmin);
216  p4_ = p4_ *this->jerCorrection();
217 }
float jerCorrection(const std::string &var="nominal", const float &nsig=1) const
Definition: Jet.cc:179
TLorentzVector p4_
the 4-momentum
Definition: Candidate.h:114
void jerInfo(const JetResolutionInfo &, const std::string &)
Definition: Jet.cc:199
void Jet::associatePartons ( const std::vector< std::shared_ptr< GenParticle > > &  particles,
const float &  dRmax = 0.5,
const float &  ptMin = 1.,
const bool &  pythi8 = true 
)

associate partons to the jet

Definition at line 477 of file Jet.cc.

References addParton(), extendedFlavour_, flavour(), analysis::tools::Candidate::p4(), analysis::tools::Candidate::pt(), and naf_submit::status().

478 {
479  int flavour = abs(this->flavour());
480  extendedFlavour_ = "udsg";
481  if ( flavour == 5 ) extendedFlavour_ = "b";
482  if ( flavour == 4 ) extendedFlavour_ = "c";
483 
484  int flavCounter = 0;
485  for ( auto & particle : particles )
486  {
487  int pdg = particle->pdgId();
488  int status = particle->status();
489  float pt = particle->pt();
490  if ( pt < ptMin ) continue;
491  if ( pythia8 )
492  {
493  if ( status != 71 && status != 72 ) continue;
494  }
495  else
496  {
497  if ( status != 3 ) continue;
498  }
499  if ( abs(pdg) > 5 && pdg != 21 ) continue;
500  if ( this->p4().DeltaR(particle->p4()) > dRmax ) continue;
501 
502  addParton (particle);
503 
504  if ( abs(pdg) == flavour ) ++flavCounter;
505 
506  }
507 
508  // Need to check for ambiguities!!!
509 
510  // extendedFlavour re-definition
511  if ( flavour == 4 && flavCounter > 1 ) extendedFlavour_ = "cc";
512  if ( flavour == 5 && flavCounter > 1 ) extendedFlavour_ = "bb";
513 
514 }
TLorentzVector p4() const
returns the 4-momentum (TLorentzVector)
Definition: Candidate.cc:143
def status(submission_dir, failed_only=False)
Definition: naf_submit.py:362
std::string extendedFlavour_
extended flavour identification for merged jets
Definition: Jet.h:277
int flavour() const
returns the flavour with the Hadron definition (=0 for data)
Definition: Jet.cc:58
float pt() const
returns the transverse momentum
Definition: Candidate.cc:133
void addParton(const std::shared_ptr< GenParticle > &)
add parton that gave rise to jet
Definition: Jet.cc:359
float Jet::bRegCorr ( ) const

b-jet regression

Definition at line 235 of file Jet.cc.

References bRegCorr_.

Referenced by applyBjetRegression(), bRegCorr(), and analysis::tools::PhysicsObjectTree< Object >::collection().

235 { return bRegCorr_; }
float bRegCorr_
b-jet regression
Definition: Jet.h:317
void Jet::bRegCorr ( const float &  bRegCorr)

b-jet regression

Definition at line 372 of file Jet.cc.

References bRegCorr(), and bRegCorr_.

372 { bRegCorr_ = bRegCorr; }
float bRegCorr() const
b-jet regression
Definition: Jet.cc:235
float bRegCorr_
b-jet regression
Definition: Jet.h:317
float Jet::bRegRes ( ) const

Definition at line 236 of file Jet.cc.

References bRegRes_.

Referenced by bRegRes(), and analysis::tools::PhysicsObjectTree< Object >::collection().

236 { return bRegRes_; }
float bRegRes_
Definition: Jet.h:318
void Jet::bRegRes ( const float &  bRegRes)

Definition at line 373 of file Jet.cc.

References bRegRes(), and bRegRes_.

373 { bRegRes_ = bRegRes; }
float bRegRes_
Definition: Jet.h:318
float bRegRes() const
Definition: Jet.cc:236
float Jet::btag ( const std::string &  algo) const

returns the btag value of btag_csvivf

returns the btag value of algorithm

Definition at line 57 of file Jet.cc.

References btags_.

Referenced by analysis::tools::JetAnalyser::btag(), btag(), analysis::tools::PhysicsObjectTree< Object >::collection(), and main().

57 { return btags_.at(algo); }
std::map< std::string, float > btags_
btag value for each algo
Definition: Jet.h:269
void Jet::btag ( const float &  btag)

sets the btag value

Definition at line 352 of file Jet.cc.

References btag(), and btag_.

352 { btag_ = btag; }
float btag_
btag value
Definition: Jet.h:267
float btag(const std::string &) const
returns the btag value of btag_csvivf
Definition: Jet.cc:57
void Jet::btag ( const std::string &  algo,
const float &  btag 
)

sets the btag value for difference algorithms

Definition at line 353 of file Jet.cc.

References btag(), and btags_.

353 { btags_[algo] = btag; }
std::map< std::string, float > btags_
btag value for each algo
Definition: Jet.h:269
float btag(const std::string &) const
returns the btag value of btag_csvivf
Definition: Jet.cc:57
void Jet::btagAlgo ( const std::string &  algo)

sets the default btag algo

Definition at line 361 of file Jet.cc.

References btagAlgo_.

361 { btagAlgo_ = algo; }
std::string btagAlgo_
default btag algo
Definition: Jet.h:271
double Jet::btagSF ( std::shared_ptr< BTagCalibrationReader reader,
const std::string &  flavalgo = "Hadron" 
) const

btag SF

Definition at line 307 of file Jet.cc.

References btagSFsys().

Referenced by main().

308 {
309  return this -> btagSFsys(reader,"central",flavalgo);
310 }
double btagSFsys(std::shared_ptr< BTagCalibrationReader > reader, const std::string &systype="central", const std::string &flavalgo="Hadron") const
Definition: Jet.cc:289
double Jet::btagSFdown ( std::shared_ptr< BTagCalibrationReader reader,
const float &  nsig = 1,
const std::string &  flavalgo = "Hadron" 
) const

Definition at line 320 of file Jet.cc.

References btagSFsys().

Referenced by main().

321 {
322  double sf = this -> btagSFsys(reader,"central",flavalgo);
323  double sfdown = this -> btagSFsys(reader,"down",flavalgo);
324  double sig1 = fabs(sfdown - sf);
325  sfdown = sf-(nsig*sig1);
326 
327  return sfdown;
328 }
double btagSFsys(std::shared_ptr< BTagCalibrationReader > reader, const std::string &systype="central", const std::string &flavalgo="Hadron") const
Definition: Jet.cc:289
double Jet::btagSFsys ( std::shared_ptr< BTagCalibrationReader reader,
const std::string &  systype = "central",
const std::string &  flavalgo = "Hadron" 
) const

Definition at line 289 of file Jet.cc.

References BTagEntry::FLAV_B, BTagEntry::FLAV_C, BTagEntry::FLAV_UDSG, flavour(), and uncorrJetp4_.

Referenced by btagSF(), btagSFdown(), and btagSFup().

290 {
291  double sf = 1;
292 
293  if ( reader == nullptr ) return sf;
294 
295 // if ( this->flavour(flavalgo) == 5 ) sf = reader->eval_auto_bounds(systype, BTagEntry::FLAV_B, fabs(this->eta()), this->pt() );
296 // if ( this->flavour(flavalgo) == 4 ) sf = reader->eval_auto_bounds(systype, BTagEntry::FLAV_C, fabs(this->eta()), this->pt() );
297 // if ( this->flavour(flavalgo) == 0 ) sf = reader->eval_auto_bounds(systype, BTagEntry::FLAV_UDSG, fabs(this->eta()), this->pt() );
298 
299 // to avoid problems with other corrections
300  if ( this->flavour(flavalgo) == 5 ) sf = reader->eval_auto_bounds(systype, BTagEntry::FLAV_B, fabs(uncorrJetp4_.Eta()), uncorrJetp4_.Pt() );
301  if ( this->flavour(flavalgo) == 4 ) sf = reader->eval_auto_bounds(systype, BTagEntry::FLAV_C, fabs(uncorrJetp4_.Eta()), uncorrJetp4_.Pt() );
302  if ( this->flavour(flavalgo) == 0 ) sf = reader->eval_auto_bounds(systype, BTagEntry::FLAV_UDSG, fabs(uncorrJetp4_.Eta()), uncorrJetp4_.Pt() );
303 
304  return sf;
305 }
TLorentzVector uncorrJetp4_
4-momentum before FSR correction
Definition: Jet.h:326
int flavour() const
returns the flavour with the Hadron definition (=0 for data)
Definition: Jet.cc:58
double Jet::btagSFup ( std::shared_ptr< BTagCalibrationReader reader,
const float &  nsig = 1,
const std::string &  flavalgo = "Hadron" 
) const

Definition at line 311 of file Jet.cc.

References btagSFsys().

Referenced by main().

312 {
313  double sf = this -> btagSFsys(reader,"central",flavalgo);
314  double sfup = this -> btagSFsys(reader,"up",flavalgo);
315  double sig1 = fabs(sfup - sf);
316  sfup = sf+(nsig*sig1);
317 
318  return sfup;
319 }
double btagSFsys(std::shared_ptr< BTagCalibrationReader > reader, const std::string &systype="central", const std::string &flavalgo="Hadron") const
Definition: Jet.cc:289
float Jet::chargedEmFraction ( ) const

Definition at line 226 of file Jet.cc.

References cEmFrac_.

226 { return cEmFrac_; }
float cEmFrac_
Definition: Jet.h:306
void analysis::tools::Jet::chargedEmFraction ( const float &  cEmFrac)
float Jet::chargedHadronFraction ( ) const

Definition at line 225 of file Jet.cc.

References cHadFrac_.

225 { return cHadFrac_; }
float cHadFrac_
Definition: Jet.h:305
void analysis::tools::Jet::chargedHadronFraction ( const float &  cHadFrac)
float Jet::chargedMultiplicity ( ) const

Definition at line 227 of file Jet.cc.

References cMult_.

227 { return cMult_; }
void analysis::tools::Jet::chargedMultiplicity ( const float &  cMult)
float Jet::constituents ( ) const

Definition at line 229 of file Jet.cc.

References nConst_.

229 { return nConst_; }
std::string Jet::extendedFlavour ( ) const

returns the extended flavour definition

Definition at line 66 of file Jet.cc.

References extendedFlavour_.

Referenced by analysis::tools::Analysis::btagEfficiency(), and main().

66 { return extendedFlavour_; }
std::string extendedFlavour_
extended flavour identification for merged jets
Definition: Jet.h:277
int Jet::flavour ( ) const

returns the flavour with the Hadron definition (=0 for data)

Definition at line 58 of file Jet.cc.

References flavour_.

Referenced by associatePartons(), analysis::tools::Analysis::btagEfficiency(), btagSFsys(), analysis::tools::PhysicsObjectTree< Object >::collection(), main(), and removeParton().

58 { return flavour_.at("Hadron"); }
std::map< std::string, int > flavour_
map of flavour to a given definition
Definition: Jet.h:273
int Jet::flavour ( const std::string &  definition) const

returns the flavour given a definition (=0 for data)

Definition at line 59 of file Jet.cc.

References flavour_.

59 { return flavour_.at(definition); }
std::map< std::string, int > flavour_
map of flavour to a given definition
Definition: Jet.h:273
void Jet::flavour ( const int &  flav)

sets flavour

Definition at line 354 of file Jet.cc.

References flavour_.

354 { flavour_["Hadron"] = flav; }
std::map< std::string, int > flavour_
map of flavour to a given definition
Definition: Jet.h:273
void Jet::flavour ( const std::string &  definition,
const int &  value 
)

sets flavour for a given definition

Definition at line 355 of file Jet.cc.

References flavour_.

355 { flavour_[definition] = flav; }
std::map< std::string, int > flavour_
map of flavour to a given definition
Definition: Jet.h:273
std::vector< int > Jet::flavours ( ) const

returns the vector containing flavours inside the jet

Definition at line 63 of file Jet.cc.

References flavours_.

63 { return flavours_; }
std::vector< int > flavours_
flavours inside the jet
Definition: Jet.h:275
Jet * Jet::fsrJet ( )

pointer to the FSR jet

Definition at line 432 of file Jet.cc.

References fsr_.

433 {
434  return fsr_;
435 }
Jet * fsr_
final state radiation
Definition: Jet.h:324
std::shared_ptr< GenJet > Jet::generatedJet ( ) const

Pointer to GenJet.

Definition at line 264 of file Jet.cc.

References genjet_.

264 { return genjet_; }
std::shared_ptr< GenJet > genjet_
generated jet
Definition: Jet.h:329
void Jet::generatedJet ( std::shared_ptr< GenJet genjet)

GenJet matching.

Definition at line 377 of file Jet.cc.

References genjet_.

377 { genjet_ = genjet; }
std::shared_ptr< GenJet > genjet_
generated jet
Definition: Jet.h:329
void Jet::genJets ( const std::vector< std::shared_ptr< GenJet > > &  genjets)

gen jets

Definition at line 472 of file Jet.cc.

References genjets_.

473 {
474  genjets_ = genjets;
475 }
std::vector< std::shared_ptr< GenJet > > genjets_
collection of GenJets
Definition: Jet.h:332
bool Jet::id ( const std::string &  wp = "tight") const

returns if jet has a given working point

Definition at line 253 of file Jet.cc.

References idloose_, and idtight_.

Referenced by analysis::tools::PhysicsObjectTree< Object >::collection(), and pileupJetIdFullId().

254 {
255  bool id = false;
256  if ( wp == "none" ) id = true;
257  if ( wp == "tight" ) id = idtight_;
258  if ( wp == "loose" ) id = idloose_;
259 
260  return id;
261 }
bool id(const std::string &wp="tight") const
returns if jet has a given working point
Definition: Jet.cc:253
bool idloose_
jet id loose working point
Definition: Jet.h:281
bool idtight_
jet id tight working point
Definition: Jet.h:283
void Jet::id ( const float &  nHadFrac,
const float &  nEmFrac,
const float &  nMult,
const float &  cHadFrac,
const float &  cEmFrac,
const float &  cMult,
const float &  muFrac,
const float &  puppi 
)

calculates the jet id

Definition at line 518 of file Jet.cc.

References cEmFrac_, cHadFrac_, cMult_, idloose_, idtight_, isPuppi(), isPuppi_, muFrac_, nConst_, nEmFrac_, nHadFrac_, nMult_, and analysis::tools::Candidate::p4_.

526 {
527  this -> isPuppi(puppi>0);
528 
529  float nM;
530  float cM;
531  float numConst;
532  if ( isPuppi_ )
533  {
534  nM = nMult;
535  cM = cMult;
536  numConst = nM + cM;
537  }
538  else
539  {
540  nM = round(nMult);
541  cM = round(cMult);
542  numConst = round(nM + cM);
543  }
544  nHadFrac_ = nHadFrac;
545  nEmFrac_ = nEmFrac;
546  nMult_ = nM;
547  cHadFrac_ = cHadFrac;
548  cEmFrac_ = cEmFrac;
549  cMult_ = cM;
550  muFrac_ = muFrac;
551  nConst_ = numConst;
552 
553  // Jet ID 2017 - only for AK4CHS (slimmedJets)
554  // https://twiki.cern.ch/twiki/bin/view/CMS/JetID13TeVRun2017?rev=6
555  if ( fabs(p4_.Eta()) <= 2.7 )
556  {
557  idloose_ = false;
558  idtight_ = ((nHadFrac<0.90 && nEmFrac<0.90 && numConst>1) && ((abs(p4_.Eta())<=2.4 && cHadFrac>0 && cM>0 ) || fabs(p4_.Eta())>2.4) && fabs(p4_.Eta())<=2.7);
559  }
560  else if ( fabs(p4_.Eta()) > 2.7 && fabs(p4_.Eta()) <= 3. )
561  {
562  idloose_ = false;
563  if ( isPuppi_ )
564  {
565  idtight_ = (nHadFrac<0.99);
566  }
567  else
568  {
569  idtight_ = (nEmFrac>0.02 && nEmFrac<0.99 && nM>2);
570  }
571  }
572  else
573  {
574  idloose_ = false;
575  if ( isPuppi_ )
576  {
577  idtight_ = (nHadFrac>0.02 && nEmFrac<0.90 && nM>10);
578  }
579  else
580  {
581  idtight_ = (nHadFrac>0.02 && nEmFrac<0.90 && nM>10);
582  }
583 
584  }
585 
586 
587 // // Jet ID 2016
588 // // https://twiki.cern.ch/twiki/bin/view/CMS/JetID?rev=95#Recommendations_for_13_TeV_data
589 // if ( fabs(p4_.Eta()) <= 2.7 )
590 // {
591 // idloose_ = ((nHadFrac<0.99 && nEmFrac<0.99 && numConst>1) && ((abs(p4_.Eta())<=2.4 && cHadFrac>0 && cM>0 && cEmFrac<0.99) || fabs(p4_.Eta())>2.4) && fabs(p4_.Eta())<=2.7);
592 // idtight_ = ((nHadFrac<0.90 && nEmFrac<0.90 && numConst>1) && ((abs(p4_.Eta())<=2.4 && cHadFrac>0 && cM>0 && cEmFrac<0.99) || fabs(p4_.Eta())>2.4) && fabs(p4_.Eta())<=2.7);
593 // }
594 // else if ( fabs(p4_.Eta()) > 2.7 && fabs(p4_.Eta()) <= 3. )
595 // {
596 // idloose_ = (nEmFrac<0.90 && nM>2);
597 // idtight_ = (nEmFrac<0.90 && nM>2);
598 // }
599 // else
600 // {
601 // idloose_ = (nEmFrac<0.90 && nM>10);
602 // idtight_ = (nEmFrac<0.90 && nM>10);
603 // }
604 
605 // if ( tag_ == "JetIdOld" )
606 // {
607 // if ( fabs(p4_.Eta()) <= 3.0 )
608 // {
609 // idloose_ = ((nHadFrac<0.99 && nEmFrac<0.99 && numConst>1) && ((abs(p4_.Eta())<=2.4 && cHadFrac>0 && cM>0 && cEmFrac<0.99) || fabs(p4_.Eta())>2.4) && fabs(p4_.Eta())<=3.0);
610 // idtight_ = ((nHadFrac<0.90 && nEmFrac<0.90 && numConst>1) && ((abs(p4_.Eta())<=2.4 && cHadFrac>0 && cM>0 && cEmFrac<0.99) || fabs(p4_.Eta())>2.4) && fabs(p4_.Eta())<=3.0);
611 // }
612 // else
613 // {
614 // idloose_ = (nEmFrac<0.90 && nM>10);
615 // idtight_ = (nEmFrac<0.90 && nM>10);
616 // }
617 // }
618 
619 }
float nEmFrac_
Definition: Jet.h:303
bool isPuppi() const
returns if jet is Puppi
Definition: Jet.cc:55
bool idloose_
jet id loose working point
Definition: Jet.h:281
TLorentzVector p4_
the 4-momentum
Definition: Candidate.h:114
float nHadFrac_
jet id
Definition: Jet.h:302
float cEmFrac_
Definition: Jet.h:306
float cHadFrac_
Definition: Jet.h:305
bool idtight_
jet id tight working point
Definition: Jet.h:283
bool Jet::idLoose ( ) const

returns if jet has id loose working point

Definition at line 60 of file Jet.cc.

References idloose_.

Referenced by main().

60 { return idloose_; }
bool idloose_
jet id loose working point
Definition: Jet.h:281
void Jet::idLoose ( const bool &  loos)

sets if jet id is loose or not

Definition at line 356 of file Jet.cc.

References idloose_.

356 { idloose_ = loos; }
bool idloose_
jet id loose working point
Definition: Jet.h:281
bool Jet::idTight ( ) const

returns if jet has id tight working point

Definition at line 61 of file Jet.cc.

References idtight_.

Referenced by main().

61 { return idtight_; }
bool idtight_
jet id tight working point
Definition: Jet.h:283
void Jet::idTight ( const bool &  tigh)

sets if jet id is tight or not

Definition at line 357 of file Jet.cc.

References idtight_.

357 { idtight_ = tigh; }
bool idtight_
jet id tight working point
Definition: Jet.h:283
bool Jet::isPuppi ( ) const

returns if jet is Puppi

Definition at line 55 of file Jet.cc.

References isPuppi_.

Referenced by id().

55 { return isPuppi_; }
void Jet::isPuppi ( const bool &  ispuppi)

sets the isPuppi value

Definition at line 351 of file Jet.cc.

References isPuppi_.

351 { isPuppi_ = ispuppi; }
float Jet::jecUncert ( ) const

returns the jet energy correction uncertainty

Definition at line 62 of file Jet.cc.

References jecUnc_.

Referenced by analysis::tools::PhysicsObjectTree< Object >::collection().

62 { return jecUnc_; }
float jecUnc_
jet energy correction uncertainty
Definition: Jet.h:285
void Jet::jecUncert ( const float &  ju)

sets the jet energy correction uncertainty

Definition at line 358 of file Jet.cc.

References jecUnc_.

358 { jecUnc_ = ju; }
float jecUnc_
jet energy correction uncertainty
Definition: Jet.h:285
float Jet::jerCorrection ( const std::string &  var = "nominal",
const float &  nsig = 1 
) const

Definition at line 179 of file Jet.cc.

References analysis::tools::JERCorrections::down, jercorr_, analysis::tools::JERCorrections::nominal, and analysis::tools::JERCorrections::up.

Referenced by applyJER(), and main().

180 {
181  float corr = jercorr_.nominal;
182  std::string v = var;
183  std::transform(v.begin(), v.end(), v.begin(), ::tolower);
184  if ( v == "up" )
185  {
186  corr = jercorr_.nominal + (fabs(jercorr_.nominal-jercorr_.up)*nsig);
187 // corr = jercorr_.up;
188  }
189  if ( v == "down" )
190  {
191  corr = jercorr_.nominal - (fabs(jercorr_.nominal-jercorr_.down)*nsig);
192 // corr = jercorr_.down;
193  }
194 
195  return corr;
196 
197 }
JERCorrections jercorr_
JER correction factor.
Definition: Jet.h:297
void Jet::jerCorrections ( )

Definition at line 144 of file Jet.cc.

References analysis::tools::JERCorrections::down, genjet_, jercorr_, jermatch_, jerPtResolution(), jerSF(), jerSFdown(), jerSFup(), analysis::tools::JERCorrections::nominal, analysis::tools::Candidate::pt(), uncorrJetp4_, and analysis::tools::JERCorrections::up.

Referenced by jerInfo().

145 {
146  float c = 1.;
147  float cup = 1.;
148  float cdown = 1.;
149 
150  float sf = this->jerSF();
151  float sfup = this->jerSFup();
152  float sfdown = this->jerSFdown();
153 
154  if ( jermatch_ )
155  {
156 // c += (sf-1)*((this->pt() - genjet_->pt())/this->pt());
157 // cup += (sfup-1)*((this->pt() - genjet_->pt())/this->pt());
158 // cdown += (sfdown-1)*((this->pt() - genjet_->pt())/this->pt());
159  // to avoid problems with regression corrections, use "uncorrected"
160  c += (sf-1)*((this->pt() - genjet_->pt())/uncorrJetp4_.Pt());
161  cup += (sfup-1)*((this->pt() - genjet_->pt())/uncorrJetp4_.Pt());
162  cdown += (sfdown-1)*((this->pt() - genjet_->pt())/uncorrJetp4_.Pt());
163  }
164  else
165  {
166  TRandom3 r(0);
167  float n = r.Gaus(0.,this->jerPtResolution());
168  c += n*sqrt(std::max(sf*sf-1.,0.));
169  cup += n*sqrt(std::max(sfup*sfup-1.,0.));
170  cdown += n*sqrt(std::max(sfdown*sfdown-1.,0.));
171  }
172 
173  jercorr_.nominal = c;
174  jercorr_.up = cup;
175  jercorr_.down = cdown;
176 
177 }
JERCorrections jercorr_
JER correction factor.
Definition: Jet.h:297
float jerSF() const
returns jet energy resolution SF
Definition: Jet.cc:72
float jerPtResolution() const
returns jet pt resolution
Definition: Jet.cc:71
TLorentzVector uncorrJetp4_
4-momentum before FSR correction
Definition: Jet.h:326
bool jermatch_
JER matching.
Definition: Jet.h:295
std::shared_ptr< GenJet > genjet_
generated jet
Definition: Jet.h:329
float pt() const
returns the transverse momentum
Definition: Candidate.cc:133
float jerSFdown() const
returns jet energy resolution SF Down variation
Definition: Jet.cc:73
float jerSFup() const
returns jet energy resolution SF Up variation
Definition: Jet.cc:74
void Jet::jerInfo ( const JetResolutionInfo jerinfo,
const std::string &  collection 
)

Definition at line 199 of file Jet.cc.

References jerCorrections(), jerinfo_, and jerMatch().

Referenced by applyJER(), and main().

200 {
201  jerinfo_ = jerinfo;
202  jerMatch("GenJets");
203  jerCorrections();
204 }
void jerCorrections()
Definition: Jet.cc:144
JetResolutionInfo jerinfo_
JER info.
Definition: Jet.h:299
bool jerMatch() const
Definition: Jet.cc:140
void Jet::jerInfo ( const JetResolutionInfo jerinfo,
const float &  drmin = 0.2 
)

Definition at line 206 of file Jet.cc.

References jerCorrections(), jerinfo_, and jerMatch().

207 {
208  jerinfo_ = jerinfo;
209  jerMatch(drmin);
210  jerCorrections();
211 }
void jerCorrections()
Definition: Jet.cc:144
JetResolutionInfo jerinfo_
JER info.
Definition: Jet.h:299
bool jerMatch() const
Definition: Jet.cc:140
bool Jet::jerMatch ( const std::string &  collection)

JER matching.

Definition at line 101 of file Jet.cc.

References jermatch_, jerPtResolution(), analysis::tools::Candidate::matched(), and analysis::tools::Candidate::pt().

Referenced by main().

102 {
103  float res = this->jerPtResolution();
104  jermatch_ = this->matched("GenJets"); // delta_R matching
105  jermatch_ = jermatch_ && (fabs(this->pt()-this->matched("GenJets")->pt()) < 3.*res*this->pt()); // delta pT
106 
107  return jermatch_;
108 
109 }
float jerPtResolution() const
returns jet pt resolution
Definition: Jet.cc:71
const Candidate * matched(const std::string &name)
returns the pointer to the matched candidate object
Definition: Candidate.cc:147
bool jermatch_
JER matching.
Definition: Jet.h:295
float pt() const
returns the transverse momentum
Definition: Candidate.cc:133
bool Jet::jerMatch ( const float &  drmin = 0.2)

Definition at line 111 of file Jet.cc.

References analysis::tools::Candidate::deltaR(), genjet_, genjets_, jermatch_, jerPtResolution(), and analysis::tools::Candidate::pt().

112 {
113  float res = this->jerPtResolution();
114 
115  std::shared_ptr<GenJet> cand = nullptr;
116  std::shared_ptr<GenJet> nearcand = nullptr;
117  genjet_ = nullptr;
118  float minDeltaR = 100.;
119  for ( size_t i = 0; i < genjets_.size() ; ++i )
120  {
121  cand = genjets_.at(i);
122  if(this->deltaR(*cand) < minDeltaR)
123  {
124  minDeltaR = this->deltaR(*cand);
125  nearcand = cand;
126  }
127  }
128  if(minDeltaR < drmin) jermatch_ = true;
129  else return false;
130 
131  jermatch_ = jermatch_ && (fabs(this->pt()-nearcand->pt()) < 3.*res*this->pt()); // delta pT
132 
133  if (jermatch_) genjet_= nearcand;
134 
135  return jermatch_;
136 
137 }
float jerPtResolution() const
returns jet pt resolution
Definition: Jet.cc:71
bool jermatch_
JER matching.
Definition: Jet.h:295
std::shared_ptr< GenJet > genjet_
generated jet
Definition: Jet.h:329
float pt() const
returns the transverse momentum
Definition: Candidate.cc:133
std::vector< std::shared_ptr< GenJet > > genjets_
collection of GenJets
Definition: Jet.h:332
float deltaR(const Candidate &) const
returns the deltaR between this and another candidate
Definition: Candidate.cc:140
bool Jet::jerMatch ( ) const

Definition at line 140 of file Jet.cc.

References jermatch_.

Referenced by jerInfo().

141 {
142  return jermatch_;
143 }
bool jermatch_
JER matching.
Definition: Jet.h:295
float Jet::jerPtResolution ( ) const

returns jet pt resolution

Definition at line 71 of file Jet.cc.

References jerinfo_, and analysis::tools::JetResolutionInfo::resolution.

Referenced by analysis::tools::PhysicsObjectTree< Object >::collection(), jerCorrections(), and jerMatch().

float jerPtResolution() const
returns jet pt resolution
Definition: Jet.cc:71
JetResolutionInfo jerinfo_
JER info.
Definition: Jet.h:299
float Jet::jerPtResolution ( const JetResolution jer) const

returns jet pt resolution from text file

Definition at line 76 of file Jet.cc.

References analysis::tools::Candidate::eta(), JME::JetResolution::getResolution(), JME::JetEta, JME::JetPt, analysis::tools::Candidate::pt(), JME::Rho, and rho().

77 {
78  JetParameters pars = {{JME::Binning::JetPt, this->pt()}, {JME::Binning::JetEta, this->eta()}, {JME::Binning::Rho, this->rho()}};
79  float res = jer.getResolution(pars);
80  return res;
81 }
float eta() const
returns the pseudorapidity
Definition: Candidate.cc:134
float getResolution(const JetParameters &parameters) const
float pt() const
returns the transverse momentum
Definition: Candidate.cc:133
double rho() const
Rho.
Definition: Jet.cc:250
void Jet::jerPtResolution ( const float &  res)

sets jet energy resolution

Definition at line 363 of file Jet.cc.

References jerptres_.

363 { jerptres_ = res; }
float jerptres_
jet energy resolution
Definition: Jet.h:293
float Jet::jerSF ( ) const

returns jet energy resolution SF

Definition at line 72 of file Jet.cc.

References jerinfo_, and analysis::tools::JetResolutionInfo::scalefactor.

Referenced by analysis::tools::PhysicsObjectTree< Object >::collection(), jerCorrections(), and main().

72 { return jerSF(jerinfo_.scalefactor); }
float jerSF() const
returns jet energy resolution SF
Definition: Jet.cc:72
JetResolutionInfo jerinfo_
JER info.
Definition: Jet.h:299
JME::JetResolutionScaleFactor scalefactor
float Jet::jerSF ( const JetResolutionScaleFactor jersf) const

returns jet energy resolution SF

Definition at line 82 of file Jet.cc.

References analysis::tools::Candidate::eta(), JME::JetResolutionScaleFactor::getScaleFactor(), JME::JetEta, JME::JetPt, and analysis::tools::Candidate::pt().

83 {
84  JetParameters pars = {{JME::Binning::JetPt, this->pt()},{JME::Binning::JetEta, this->eta()}};
85  float sf = jersf.getScaleFactor(pars);
86  return sf;
87 }
float eta() const
returns the pseudorapidity
Definition: Candidate.cc:134
float getScaleFactor(const JetParameters &parameters, Variation variation=Variation::NOMINAL, std::string uncertaintySource="") const
float pt() const
returns the transverse momentum
Definition: Candidate.cc:133
void Jet::jerSF ( const float &  sf)

sets jet energy resolution SF

Definition at line 364 of file Jet.cc.

References jersf_.

364 { jersf_ = sf; }
float jersf_
jet energy resolution SF
Definition: Jet.h:287
float Jet::jerSFdown ( ) const

returns jet energy resolution SF Down variation

Definition at line 73 of file Jet.cc.

References jerinfo_, and analysis::tools::JetResolutionInfo::scalefactor.

Referenced by analysis::tools::PhysicsObjectTree< Object >::collection(), and jerCorrections().

73 { return jerSFdown(jerinfo_.scalefactor); }
JetResolutionInfo jerinfo_
JER info.
Definition: Jet.h:299
float jerSFdown() const
returns jet energy resolution SF Down variation
Definition: Jet.cc:73
JME::JetResolutionScaleFactor scalefactor
float Jet::jerSFdown ( const JetResolutionScaleFactor jersf) const

returns jet energy resolution SF Down variation

Definition at line 88 of file Jet.cc.

References DOWN, analysis::tools::Candidate::eta(), JME::JetResolutionScaleFactor::getScaleFactor(), JME::JetEta, JME::JetPt, and analysis::tools::Candidate::pt().

89 {
90  JetParameters pars = {{JME::Binning::JetPt, this->pt()},{JME::Binning::JetEta, this->eta()}};
91  float sf = jersf.getScaleFactor(pars,Variation::DOWN);
92  return sf;
93 }
float eta() const
returns the pseudorapidity
Definition: Candidate.cc:134
float getScaleFactor(const JetParameters &parameters, Variation variation=Variation::NOMINAL, std::string uncertaintySource="") const
float pt() const
returns the transverse momentum
Definition: Candidate.cc:133
void Jet::jerSFdown ( const float &  sfd)

sets jet energy resolution SF Down variation

Definition at line 365 of file Jet.cc.

References jersfdown_.

365 { jersfdown_ = sfd; }
float jersfdown_
jet energy resolution SF Down variation
Definition: Jet.h:291
float Jet::jerSFup ( ) const

returns jet energy resolution SF Up variation

Definition at line 74 of file Jet.cc.

References jerinfo_, and analysis::tools::JetResolutionInfo::scalefactor.

Referenced by analysis::tools::PhysicsObjectTree< Object >::collection(), and jerCorrections().

74 { return jerSFup(jerinfo_.scalefactor); }
JetResolutionInfo jerinfo_
JER info.
Definition: Jet.h:299
JME::JetResolutionScaleFactor scalefactor
float jerSFup() const
returns jet energy resolution SF Up variation
Definition: Jet.cc:74
float Jet::jerSFup ( const JetResolutionScaleFactor jersf) const

returns jet energy resolution SF Up variation

Definition at line 94 of file Jet.cc.

References analysis::tools::Candidate::eta(), JME::JetResolutionScaleFactor::getScaleFactor(), JME::JetEta, JME::JetPt, analysis::tools::Candidate::pt(), and UP.

95 {
96  JetParameters pars = {{JME::Binning::JetPt, this->pt()},{JME::Binning::JetEta, this->eta()}};
97  float sf = jersf.getScaleFactor(pars,Variation::UP);
98  return sf;
99 }
float eta() const
returns the pseudorapidity
Definition: Candidate.cc:134
float getScaleFactor(const JetParameters &parameters, Variation variation=Variation::NOMINAL, std::string uncertaintySource="") const
float pt() const
returns the transverse momentum
Definition: Candidate.cc:133
void Jet::jerSFup ( const float &  sfu)

sets jet energy resolution SF Up variation

Definition at line 366 of file Jet.cc.

References jersfup_.

366 { jersfup_ = sfu; }
float jersfup_
jet energy resolution SF Up variation
Definition: Jet.h:289
std::shared_ptr< Muon > Jet::muon ( ) const

pointer to the muon

Definition at line 467 of file Jet.cc.

References muon_.

468 {
469  return muon_;
470 }
std::shared_ptr< Muon > muon_
muon in jet
Definition: Jet.h:336
float Jet::muonFraction ( ) const

Definition at line 228 of file Jet.cc.

References muFrac_.

228 { return muFrac_; }
void analysis::tools::Jet::muonFraction ( const float &  muFrac)
float Jet::neutralEmFraction ( ) const

Definition at line 223 of file Jet.cc.

References nEmFrac_.

223 { return nEmFrac_; }
float nEmFrac_
Definition: Jet.h:303
void analysis::tools::Jet::neutralEmFraction ( const float &  nEmFrac)
float Jet::neutralHadronFraction ( ) const

Definition at line 222 of file Jet.cc.

References nHadFrac_.

222 { return nHadFrac_; }
float nHadFrac_
jet id
Definition: Jet.h:302
void analysis::tools::Jet::neutralHadronFraction ( const float &  nHadFrac)
float Jet::neutralMultiplicity ( ) const

Definition at line 224 of file Jet.cc.

References nMult_.

224 { return nMult_; }
void analysis::tools::Jet::neutralMultiplicity ( const float &  nMult)
std::vector< std::shared_ptr< GenParticle > > Jet::partons ( ) const

returns the vector of pointers to the generated partons

Definition at line 65 of file Jet.cc.

References partons_.

Referenced by analysis::tools::Collection< Object >::associatePartons().

65 { return partons_; }
std::vector< std::shared_ptr< GenParticle > > partons_
vector of pointers to Genparticles from merged jets
Definition: Jet.h:279
float Jet::pileupJetIdFullDiscriminant ( ) const

pile up jet id

Definition at line 232 of file Jet.cc.

References puJetIdFullDisc_.

Referenced by analysis::tools::PhysicsObjectTree< Object >::collection(), and main().

232 { return puJetIdFullDisc_; }
float puJetIdFullDisc_
pileup jet id
Definition: Jet.h:313
void Jet::pileupJetIdFullDiscriminant ( const float &  discr)

pile up jet id

Definition at line 369 of file Jet.cc.

References puJetIdFullDisc_.

369 { puJetIdFullDisc_ = discr; }
float puJetIdFullDisc_
pileup jet id
Definition: Jet.h:313
int Jet::pileupJetIdFullId ( ) const

Definition at line 233 of file Jet.cc.

References puJetIdFullId_.

Referenced by analysis::tools::PhysicsObjectTree< Object >::collection(), and main().

233 { return puJetIdFullId_; }
int puJetIdFullId_
Definition: Jet.h:314
bool Jet::pileupJetIdFullId ( const std::string &  wp) const

Definition at line 331 of file Jet.cc.

References puJetIdFullId_.

332 {
333  std::string wplow = wp;
334  std::transform(wplow.begin(), wplow.end(), wplow.begin(), ::tolower);
335  if ( puJetIdFullId_ < 0 )
336  {
337  std::cout << "analysis:tools::Jet *W* Pileup Jet ID FullId is negative; the collection may not have this information." << std::endl;
338  std::cout << " All jets are accepted." << std::endl;
339  return true;
340  }
341  if ( wplow == "none" ) return true;
342  if ( wplow == "loose" && (puJetIdFullId_ & (1 << 2)) ) return true;
343  if ( wplow == "medium" && (puJetIdFullId_ & (1 << 1)) ) return true;
344  if ( wplow == "tight" && (puJetIdFullId_ & (1 << 0)) ) return true;
345  return false;
346 }
int puJetIdFullId_
Definition: Jet.h:314
void Jet::pileupJetIdFullId ( const int &  id)

Definition at line 370 of file Jet.cc.

References id(), and puJetIdFullId_.

370 { puJetIdFullId_ = id; }
bool id(const std::string &wp="tight") const
returns if jet has a given working point
Definition: Jet.cc:253
int puJetIdFullId_
Definition: Jet.h:314
float Jet::qgLikelihood ( ) const

quark-gluon separation

Definition at line 231 of file Jet.cc.

References qgLikelihood_.

Referenced by analysis::tools::PhysicsObjectTree< Object >::collection(), and main().

231 { return qgLikelihood_; }
float qgLikelihood_
quark-gluon separation
Definition: Jet.h:311
void Jet::qgLikelihood ( const float &  discr)

quark-gluon separation

Definition at line 368 of file Jet.cc.

References qgLikelihood_.

368 { qgLikelihood_ = discr; }
float qgLikelihood_
quark-gluon separation
Definition: Jet.h:311
int Jet::removeParton ( const int &  i)

remove parton from jet parton list

Definition at line 380 of file Jet.cc.

References extendedFlavour_, flavour(), flavours_, and partons_.

381 {
382  if ( partons_.size() == 1 )
383  {
384  partons_.clear();
385  flavours_.clear();
386  }
387  else
388  {
389  partons_.erase(partons_.begin()+i);
390  flavours_.erase(flavours_.begin()+i);
391  }
392 
393  // re-do the extendedFlavour
394  int flavour = abs(this->flavour());
395  int flavCounter = 0;
396 
397  for ( auto & flav : flavours_ )
398  if ( abs(flav) == flavour ) ++flavCounter;
399 
400 // if (( flavour == 4 || flavour == 5 ) && flavCounter == 0 )
401 // {
402 // std::cout << "ERROR!!! Jet::removeParton => Original flavour has changed!? " << flavour << "->" << extendedFlavour_ << std::endl;
403 // return -1;
404 // }
405 
406  if ( flavour == 4 && flavCounter > 1 ) extendedFlavour_ == "cc";
407  if ( flavour == 5 && flavCounter > 1 ) extendedFlavour_ == "bb";
408 
409  return 0;
410 
411 }
std::vector< int > flavours_
flavours inside the jet
Definition: Jet.h:275
std::string extendedFlavour_
extended flavour identification for merged jets
Definition: Jet.h:277
int flavour() const
returns the flavour with the Hadron definition (=0 for data)
Definition: Jet.cc:58
std::vector< std::shared_ptr< GenParticle > > partons_
vector of pointers to Genparticles from merged jets
Definition: Jet.h:279
double Jet::rho ( ) const

Rho.

Definition at line 250 of file Jet.cc.

References rho_.

Referenced by analysis::tools::PhysicsObjectTree< Object >::collection(), jerPtResolution(), and rho().

250 { return rho_; }
double rho_
Fixedgridrho (for JER)
Definition: Jet.h:321
void Jet::rho ( const double &  rho)

Rho.

Definition at line 375 of file Jet.cc.

References rho(), and rho_.

375 { rho_ = rho; }
double rho_
Fixedgridrho (for JER)
Definition: Jet.h:321
double rho() const
Rho.
Definition: Jet.cc:250
void Jet::rmFSR ( )

remove the final state radiation jet, will change back the original 4-momentum

Definition at line 426 of file Jet.cc.

References fsr_, analysis::tools::Candidate::p4_, and uncorrJetp4_.

427 {
428  p4_ = uncorrJetp4_;
429  fsr_ = nullptr;
430 }
TLorentzVector uncorrJetp4_
4-momentum before FSR correction
Definition: Jet.h:326
TLorentzVector p4_
the 4-momentum
Definition: Candidate.h:114
Jet * fsr_
final state radiation
Definition: Jet.h:324
void Jet::rmMuon ( )

remove muon association to the jet

Definition at line 462 of file Jet.cc.

References muon_.

463 {
464  muon_ = nullptr;
465 }
std::shared_ptr< Muon > muon_
muon in jet
Definition: Jet.h:336

Member Data Documentation

float analysis::tools::Jet::bRegCorr_
protected

b-jet regression

Definition at line 317 of file Jet.h.

Referenced by bRegCorr().

float analysis::tools::Jet::bRegRes_
protected

Definition at line 318 of file Jet.h.

Referenced by bRegRes().

float analysis::tools::Jet::btag_
protected

btag value

Definition at line 267 of file Jet.h.

Referenced by btag().

std::string analysis::tools::Jet::btagAlgo_
protected

default btag algo

Definition at line 271 of file Jet.h.

Referenced by btagAlgo(), and Jet().

std::map<std::string, float> analysis::tools::Jet::btags_
protected

btag value for each algo

Definition at line 269 of file Jet.h.

Referenced by btag().

float analysis::tools::Jet::cEmFrac_
protected

Definition at line 306 of file Jet.h.

Referenced by chargedEmFraction(), and id().

float analysis::tools::Jet::cHadFrac_
protected

Definition at line 305 of file Jet.h.

Referenced by chargedHadronFraction(), and id().

float analysis::tools::Jet::cMult_
protected

Definition at line 307 of file Jet.h.

Referenced by chargedMultiplicity(), and id().

std::string analysis::tools::Jet::extendedFlavour_
protected

extended flavour identification for merged jets

Definition at line 277 of file Jet.h.

Referenced by associatePartons(), extendedFlavour(), Jet(), and removeParton().

std::map<std::string, int> analysis::tools::Jet::flavour_
protected

map of flavour to a given definition

Definition at line 273 of file Jet.h.

Referenced by flavour().

std::vector<int> analysis::tools::Jet::flavours_
protected

flavours inside the jet

Definition at line 275 of file Jet.h.

Referenced by addParton(), flavours(), and removeParton().

Jet* analysis::tools::Jet::fsr_
protected

final state radiation

Definition at line 324 of file Jet.h.

Referenced by addFSR(), fsrJet(), Jet(), and rmFSR().

std::shared_ptr<GenJet> analysis::tools::Jet::genjet_
protected

generated jet

Definition at line 329 of file Jet.h.

Referenced by generatedJet(), jerCorrections(), jerMatch(), and Jet().

std::vector< std::shared_ptr<GenJet> > analysis::tools::Jet::genjets_
protected

collection of GenJets

Definition at line 332 of file Jet.h.

Referenced by genJets(), and jerMatch().

bool analysis::tools::Jet::idloose_
protected

jet id loose working point

Definition at line 281 of file Jet.h.

Referenced by id(), and idLoose().

bool analysis::tools::Jet::idtight_
protected

jet id tight working point

Definition at line 283 of file Jet.h.

Referenced by id(), and idTight().

bool analysis::tools::Jet::isPuppi_
protected

Definition at line 265 of file Jet.h.

Referenced by id(), and isPuppi().

float analysis::tools::Jet::jecUnc_
protected

jet energy correction uncertainty

Definition at line 285 of file Jet.h.

Referenced by jecUncert().

JERCorrections analysis::tools::Jet::jercorr_
protected

JER correction factor.

Definition at line 297 of file Jet.h.

Referenced by jerCorrection(), and jerCorrections().

JetResolutionInfo analysis::tools::Jet::jerinfo_
protected

JER info.

Definition at line 299 of file Jet.h.

Referenced by jerInfo(), jerPtResolution(), jerSF(), jerSFdown(), and jerSFup().

bool analysis::tools::Jet::jermatch_
protected

JER matching.

Definition at line 295 of file Jet.h.

Referenced by jerCorrections(), jerMatch(), and Jet().

float analysis::tools::Jet::jerptres_
protected

jet energy resolution

Definition at line 293 of file Jet.h.

Referenced by jerPtResolution().

float analysis::tools::Jet::jersf_
protected

jet energy resolution SF

Definition at line 287 of file Jet.h.

Referenced by jerSF().

float analysis::tools::Jet::jersfdown_
protected

jet energy resolution SF Down variation

Definition at line 291 of file Jet.h.

Referenced by jerSFdown().

float analysis::tools::Jet::jersfup_
protected

jet energy resolution SF Up variation

Definition at line 289 of file Jet.h.

Referenced by jerSFup().

float analysis::tools::Jet::muFrac_
protected

Definition at line 308 of file Jet.h.

Referenced by id(), and muonFraction().

std::shared_ptr<Muon> analysis::tools::Jet::muon_
protected

muon in jet

Definition at line 336 of file Jet.h.

Referenced by addMuon(), Jet(), muon(), and rmMuon().

float analysis::tools::Jet::nConst_
protected

Definition at line 309 of file Jet.h.

Referenced by constituents(), and id().

float analysis::tools::Jet::nEmFrac_
protected

Definition at line 303 of file Jet.h.

Referenced by id(), and neutralEmFraction().

float analysis::tools::Jet::nHadFrac_
protected

jet id

Definition at line 302 of file Jet.h.

Referenced by id(), and neutralHadronFraction().

float analysis::tools::Jet::nMult_
protected

Definition at line 304 of file Jet.h.

Referenced by id(), and neutralMultiplicity().

std::vector< std::shared_ptr<GenParticle> > analysis::tools::Jet::partons_
protected

vector of pointers to Genparticles from merged jets

Definition at line 279 of file Jet.h.

Referenced by addParton(), partons(), and removeParton().

float analysis::tools::Jet::puJetIdFullDisc_
protected

pileup jet id

Definition at line 313 of file Jet.h.

Referenced by pileupJetIdFullDiscriminant().

int analysis::tools::Jet::puJetIdFullId_
protected

Definition at line 314 of file Jet.h.

Referenced by pileupJetIdFullId().

float analysis::tools::Jet::qgLikelihood_
protected

quark-gluon separation

Definition at line 311 of file Jet.h.

Referenced by qgLikelihood().

double analysis::tools::Jet::rho_
protected

Fixedgridrho (for JER)

Definition at line 321 of file Jet.h.

Referenced by rho().

TLorentzVector analysis::tools::Jet::uncorrJetp4_
protected

4-momentum before FSR correction

Definition at line 326 of file Jet.h.

Referenced by btagSFsys(), jerCorrections(), Jet(), and rmFSR().


The documentation for this class was generated from the following files: