Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Include option for 2018 Jetid working points #27184

Merged
merged 8 commits into from
Aug 5, 2019
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
139 changes: 123 additions & 16 deletions PhysicsTools/SelectorUtils/interface/PFJetIDSelectionFunctor.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class PFJetIDSelectionFunctor : public Selector<pat::Jet> {

public: // interface

enum Version_t { FIRSTDATA, RUNIISTARTUP, WINTER16, WINTER17, WINTER17PUPPI, N_VERSIONS };
enum Version_t { FIRSTDATA, RUNIISTARTUP, WINTER16, WINTER17, WINTER17PUPPI, SUMMER18, N_VERSIONS };
enum Quality_t { LOOSE, TIGHT, TIGHTLEPVETO, N_QUALITY};

PFJetIDSelectionFunctor() {}
Expand Down Expand Up @@ -53,6 +53,8 @@ class PFJetIDSelectionFunctor : public Selector<pat::Jet> {
version_ = WINTER17;
else if( versionStr == "WINTER17PUPPI")
version_ = WINTER17PUPPI;
else if( versionStr == "SUMMER18")
version_ = SUMMER18;
else version_ = WINTER17;//set WINTER17 as default


Expand All @@ -66,7 +68,7 @@ class PFJetIDSelectionFunctor : public Selector<pat::Jet> {
// Now check the configuration to see if the user changed anything
if ( params.exists("CHF") ) set("CHF", params.getParameter<double>("CHF") );
if ( params.exists("NHF") ) set("NHF", params.getParameter<double>("NHF") );
if ((version_ != WINTER17 && version_ != WINTER17PUPPI) || quality_ != TIGHT ) {if ( params.exists("CEF") ) set("CEF", params.getParameter<double>("CEF") );}
if ((version_ != WINTER17 && version_ != WINTER17PUPPI && version_ != SUMMER18) || quality_ != TIGHT ) {if ( params.exists("CEF") ) set("CEF", params.getParameter<double>("CEF") );}
if ( params.exists("NEF") ) set("NEF", params.getParameter<double>("NEF") );
if ( params.exists("NCH") ) set("NCH", params.getParameter<int> ("NCH") );
if ( params.exists("nConstituents") ) set("nConstituents", params.getParameter<int> ("nConstituents") );
Expand Down Expand Up @@ -99,6 +101,22 @@ class PFJetIDSelectionFunctor : public Selector<pat::Jet> {
if ( params.exists("nNeutrals_FW_U") ) set("nNeutrals_FW_U", params.getParameter<int> ("nNeutrals_FW_U") );
if ( quality_ == TIGHTLEPVETO ) {if ( params.exists("MUF") ) set("MUF", params.getParameter<double> ("MUF") );}
}
if(version_ == SUMMER18){
if ( params.exists("NHF_TR") ) set("NHF_TR", params.getParameter<double> ("NHF_TR") );
if ( params.exists("NEF_TR") ) set("NEF_TR", params.getParameter<double> ("NEF_TR") );
if ( params.exists("NCH_TR") ) set("NCH_TR", params.getParameter<int> ("NCH_TR") );
if ( params.exists("NEF_EC_L") ) set("NEF_EC_L", params.getParameter<double> ("NEF_EC_L") );
if ( params.exists("NEF_EC_U") ) set("NEF_EC_U", params.getParameter<double> ("NEF_EC_U") );
if ( params.exists("nNeutrals_EC") ) set("nNeutrals_EC", params.getParameter<int> ("nNeutrals_EC") );
if ( params.exists("NHF_FW") ) set("NHF_FW", params.getParameter<double> ("NHF_FW") );
if ( params.exists("NEF_FW") ) set("NEF_FW", params.getParameter<double> ("NEF_FW") );
if ( params.exists("nNeutrals_FW") ) set("nNeutrals_FW", params.getParameter<int> ("nNeutrals_FW") );
if ( quality_ == TIGHTLEPVETO ) {
if ( params.exists("MUF") ) set("MUF", params.getParameter<double> ("MUF") );
if ( params.exists("MUF_TR") ) set("MUF_TR", params.getParameter<double> ("MUF_TR") );
if ( params.exists("CEF_TR") ) set("CEF_TR", params.getParameter<double>("CEF_TR") );
}
}


if ( params.exists("cutsToIgnore") )
Expand All @@ -123,7 +141,7 @@ class PFJetIDSelectionFunctor : public Selector<pat::Jet> {
//
bool operator()( const pat::Jet & jet, pat::strbitset & ret ) override
{
if ( version_ == FIRSTDATA || version_ == RUNIISTARTUP || version_ == WINTER16 || version_ == WINTER17 || version_ == WINTER17PUPPI) {
if ( version_ == FIRSTDATA || version_ == RUNIISTARTUP || version_ == WINTER16 || version_ == WINTER17 || version_ == WINTER17PUPPI || version_ == SUMMER18) {
if ( jet.currentJECLevel() == "Uncorrected" || !jet.jecSetsAvailable() )
return firstDataCuts( jet, ret, version_);
else
Expand All @@ -141,7 +159,7 @@ class PFJetIDSelectionFunctor : public Selector<pat::Jet> {
//
bool operator()( const reco::PFJet & jet, pat::strbitset & ret )
{
if ( version_ == FIRSTDATA || version_ == RUNIISTARTUP || version_ == WINTER16 || version_ == WINTER17 || version_ == WINTER17PUPPI ){ return firstDataCuts( jet, ret, version_);
if ( version_ == FIRSTDATA || version_ == RUNIISTARTUP || version_ == WINTER16 || version_ == WINTER17 || version_ == WINTER17PUPPI || version_ == SUMMER18 ){ return firstDataCuts( jet, ret, version_);
}
else {
return false;
Expand Down Expand Up @@ -289,13 +307,13 @@ class PFJetIDSelectionFunctor : public Selector<pat::Jet> {
}
} // end if basic jet

float etaB=2.4;
// Cuts for |eta| < 2.6 for Summer18
if (version_ != SUMMER18) etaB=2.6;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not to define here etaB for all versions (with some else if statement, for example).
Then you won't have to redefine by hand inside (almost) every if branch

if((version_ != WINTER17 && version_ != WINTER17PUPPI && version_ != SUMMER18) || quality_ != TIGHT ) {if ( ignoreCut(indexCEF_) || ( cef < cut(indexCEF_, double()) || std::abs(jet.eta()) > etaB ) ) passCut( ret, indexCEF_);}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Splitting the line will improve readability (even better if you run clang format since now: it will be enforced anyhow)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(The same apply to most of the lines below...)



// Cuts for |eta| < 2.4 for FIRSTDATA, RUNIISTARTUP, WINTER16 and WINTER17
if((version_ != WINTER17 && version_ != WINTER17PUPPI) || quality_ != TIGHT ) {if ( ignoreCut(indexCEF_) || ( cef < cut(indexCEF_, double()) || std::abs(jet.eta()) > 2.4 ) ) passCut( ret, indexCEF_);}

if ( ignoreCut(indexCHF_) || ( chf > cut(indexCHF_, double()) || std::abs(jet.eta()) > 2.4 ) ) passCut( ret, indexCHF_);
if ( ignoreCut(indexNCH_) || ( nch > cut(indexNCH_, int()) || std::abs(jet.eta()) > 2.4 ) ) passCut( ret, indexNCH_);
if ( ignoreCut(indexCHF_) || ( chf > cut(indexCHF_, double()) || std::abs(jet.eta()) > etaB ) ) passCut( ret, indexCHF_);
if ( ignoreCut(indexNCH_) || ( nch > cut(indexNCH_, int()) || std::abs(jet.eta()) > etaB ) ) passCut( ret, indexNCH_);

if(version_ == FIRSTDATA){// Cuts for all eta for FIRSTDATA
if ( ignoreCut(indexNConstituents_) || ( nconstituents > cut(indexNConstituents_, int()) ) ) passCut( ret, indexNConstituents_);
Expand Down Expand Up @@ -363,6 +381,33 @@ class PFJetIDSelectionFunctor : public Selector<pat::Jet> {
if ( ignoreCut(indexNNeutrals_FW_U_) || ( nneutrals < cut(indexNNeutrals_FW_U_, int()) || std::abs(jet.eta()) <= 3.0 ) ) passCut( ret, indexNNeutrals_FW_U_);

}
else if(version_ == SUMMER18){

// Cuts for |eta| <= 2.6 for SUMMER18 scenario
if ( ignoreCut(indexNConstituents_) || ( nconstituents > cut(indexNConstituents_, int()) || std::abs(jet.eta()) > 2.6 ) ) passCut( ret, indexNConstituents_);
if ( ignoreCut(indexNEF_) || ( nef < cut(indexNEF_, double()) || std::abs(jet.eta()) > 2.6 ) ) passCut( ret, indexNEF_);
if ( ignoreCut(indexNHF_) || ( nhf < cut(indexNHF_, double()) || std::abs(jet.eta()) > 2.6 ) ) passCut( ret, indexNHF_);
if ( quality_ == TIGHTLEPVETO ) {if ( ignoreCut(indexMUF_) || ( muf < cut(indexMUF_, double()) || std::abs(jet.eta()) > 2.6 ) ) passCut( ret, indexMUF_);}

// Cuts for 2.6 <= |eta| <= 2.7 for SUMMER18 scenario
if ( ignoreCut(indexNHF_TR_) || ( nhf < cut(indexNHF_TR_, double()) || std::abs(jet.eta()) <= 2.6 || std::abs(jet.eta()) > 2.7) ) passCut( ret, indexNHF_TR_);
if ( ignoreCut(indexNEF_TR_) || ( nef < cut(indexNEF_TR_, double()) || std::abs(jet.eta()) <= 2.6 || std::abs(jet.eta()) > 2.7) ) passCut( ret, indexNEF_TR_);
if ( ignoreCut(indexNCH_TR_) || ( nch > cut(indexNCH_TR_, double()) || std::abs(jet.eta()) <= 2.6 || std::abs(jet.eta()) > 2.7) ) passCut( ret, indexNCH_TR_);
if ( quality_ == TIGHTLEPVETO ) {
if ( ignoreCut(indexMUF_TR_) || ( muf < cut(indexMUF_TR_, double()) || std::abs(jet.eta()) <= 2.6 || std::abs(jet.eta()) > 2.7) ) passCut( ret, indexMUF_TR_);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some better indentation here is mandatory.
Even better if you have already run clang-format

if ( ignoreCut(indexCEF_TR_) || ( cef < cut(indexCEF_TR_, double()) || std::abs(jet.eta()) <= 2.6 || std::abs(jet.eta()) > 2.7) ) passCut( ret, indexCEF_TR_);
}

// Cuts for 2.7 < |eta| <= 3.0 for SUMMER18 scenario
if ( ignoreCut(indexNEF_EC_L_) || ( nef > cut(indexNEF_EC_L_, double()) || std::abs(jet.eta()) <= 2.7 || std::abs(jet.eta()) > 3.0) ) passCut( ret, indexNEF_EC_L_);
if ( ignoreCut(indexNEF_EC_U_) || ( nef < cut(indexNEF_EC_U_, double()) || std::abs(jet.eta()) <= 2.7 || std::abs(jet.eta()) > 3.0) ) passCut( ret, indexNEF_EC_U_);
if ( ignoreCut(indexNNeutrals_EC_) || ( nneutrals > cut(indexNNeutrals_EC_, int()) || std::abs(jet.eta()) <= 2.7 || std::abs(jet.eta()) > 3.0) ) passCut( ret, indexNNeutrals_EC_);

// Cuts for |eta| > 3.0 for SUMMER18 scenario
if ( ignoreCut(indexNHF_FW_) || ( nhf > cut(indexNHF_FW_, double()) || std::abs(jet.eta()) <= 3.0 ) ) passCut( ret, indexNHF_FW_);
if ( ignoreCut(indexNEF_FW_) || ( nef < cut(indexNEF_FW_, double()) || std::abs(jet.eta()) <= 3.0 ) ) passCut( ret, indexNEF_FW_);
if ( ignoreCut(indexNNeutrals_FW_) || ( nneutrals > cut(indexNNeutrals_FW_, int()) || std::abs(jet.eta()) <= 3.0 ) ) passCut( ret, indexNNeutrals_FW_);
}


//std::cout << "<PFJetIDSelectionFunctor::firstDataCuts>:" << std::endl;
Expand All @@ -379,7 +424,7 @@ class PFJetIDSelectionFunctor : public Selector<pat::Jet> {
{
push_back("CHF" );
push_back("NHF" );
if( (version_ != WINTER17 && version_!=WINTER17PUPPI) || quality_ != TIGHT ) push_back("CEF" );
if( (version_ != WINTER17 && version_!=WINTER17PUPPI && version_!=SUMMER18) || quality_ != TIGHT ) push_back("CEF" );
push_back("NEF" );
push_back("NCH" );
push_back("nConstituents");
Expand Down Expand Up @@ -412,9 +457,24 @@ class PFJetIDSelectionFunctor : public Selector<pat::Jet> {
push_back("nNeutrals_FW_U");
if (quality_ == TIGHTLEPVETO) push_back("MUF");
}

if(version_ == SUMMER18 ){
push_back("NHF_TR");
push_back("NEF_TR");
push_back("NCH_TR");
push_back("NEF_EC_L");
push_back("NEF_EC_U");
push_back("nNeutrals_EC");
push_back("NEF_FW");
push_back("NHF_FW");
push_back("nNeutrals_FW");

if( (version_ == WINTER17 || version_ == WINTER17PUPPI) && quality_ == LOOSE ){
if (quality_ == TIGHTLEPVETO) {
push_back("MUF");
push_back("MUF_TR");
push_back("CEF_TR");
}
}
if( (version_ == WINTER17 || version_ == WINTER17PUPPI || version_ == SUMMER18) && quality_ == LOOSE ){
edm::LogWarning("BadJetIDVersion") << "Winter17 JetID version does not support the LOOSE operating point -- defaulting to TIGHT";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The LogWarning message must take also "Summer18" into account now

quality_ = TIGHT;
}
Expand Down Expand Up @@ -443,7 +503,7 @@ class PFJetIDSelectionFunctor : public Selector<pat::Jet> {
} else if ( quality_ == TIGHT ) {
set("CHF", 0.0);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indentation... or clang-format

set("NHF", 0.9);
if(version_ != WINTER17 && version_ != WINTER17PUPPI ) set("CEF", 0.99);
if(version_ != WINTER17 && version_ != WINTER17PUPPI && version_ != SUMMER18 ) set("CEF", 0.99);
set("NEF", 0.9);
set("NCH", 0);
set("nConstituents", 1);
Expand Down Expand Up @@ -473,6 +533,17 @@ class PFJetIDSelectionFunctor : public Selector<pat::Jet> {
set("nNeutrals_FW_L",2);
set("nNeutrals_FW_U",15);
}
else if(version_ == SUMMER18){
set("NHF_TR",0.9);
set("NEF_TR",0.99);
set("NCH_TR",0);
set("NEF_EC_L",0.02);
set("NEF_EC_U",0.99);
set("nNeutrals_EC",2);
set("NHF_FW",0.2);
set("NEF_FW",0.90);
set("nNeutrals_FW",10);
}

}else if ( quality_ == TIGHTLEPVETO ) {
set("CHF", 0.0);
Expand Down Expand Up @@ -508,6 +579,21 @@ class PFJetIDSelectionFunctor : public Selector<pat::Jet> {
set("NEF_FW",0.90);
set("MUF", 0.8);
}
else if(version_ == SUMMER18){
set("CEF", 0.8);
set("MUF", 0.8);
set("NHF_TR",0.9);
set("NEF_TR",0.99);
set("MUF_TR",0.8);
set("NCH_TR",0);
set("CEF_TR",0.8);
set("NEF_EC_L",0.02);
set("NEF_EC_U",0.99);
set("nNeutrals_EC",2);
set("NHF_FW",0.2);
set("NEF_FW",0.90);
set("nNeutrals_FW",10);
}

}
}
Expand All @@ -517,7 +603,7 @@ class PFJetIDSelectionFunctor : public Selector<pat::Jet> {
indexNConstituents_ = index_type (&bits_, "nConstituents");
indexNEF_ = index_type (&bits_, "NEF");
indexNHF_ = index_type (&bits_, "NHF");
if((version_ != WINTER17 && version_ != WINTER17PUPPI) || quality_ != TIGHT ) indexCEF_ = index_type (&bits_, "CEF");
if((version_ != WINTER17 && version_ != WINTER17PUPPI && version_ != SUMMER18 ) || quality_ != TIGHT ) indexCEF_ = index_type (&bits_, "CEF");

indexCHF_ = index_type (&bits_, "CHF");
indexNCH_ = index_type (&bits_, "NCH");
Expand Down Expand Up @@ -550,7 +636,22 @@ class PFJetIDSelectionFunctor : public Selector<pat::Jet> {
indexNNeutrals_FW_U_ = index_type (&bits_, "nNeutrals_FW_U");
if ( quality_ == TIGHTLEPVETO ) {indexMUF_ = index_type (&bits_, "MUF");}
}

if(version_ == SUMMER18){
indexNHF_TR_ = index_type (&bits_, "NHF_TR");
indexNEF_TR_ = index_type (&bits_, "NEF_TR");
indexNCH_TR_ = index_type (&bits_, "NCH_TR");
indexNEF_EC_L_ = index_type (&bits_, "NEF_EC_L");
indexNEF_EC_U_ = index_type (&bits_, "NEF_EC_U");
indexNNeutrals_EC_ = index_type (&bits_, "nNeutrals_EC");
indexNHF_FW_ = index_type (&bits_, "NHF_FW");
indexNEF_FW_ = index_type (&bits_, "NEF_FW");
indexNNeutrals_FW_ = index_type (&bits_, "nNeutrals_FW");
if ( quality_ == TIGHTLEPVETO ) {
indexMUF_ = index_type (&bits_, "MUF");
indexMUF_TR_ = index_type (&bits_, "MUF_TR");
indexCEF_TR_ = index_type (&bits_, "CEF_TR");
}
}
retInternal_ = getBitTemplate();
}

Expand All @@ -565,6 +666,12 @@ class PFJetIDSelectionFunctor : public Selector<pat::Jet> {
index_type indexCHF_;
index_type indexNCH_;

index_type indexNHF_TR_;
index_type indexNEF_TR_;
index_type indexNCH_TR_;
index_type indexMUF_TR_;
index_type indexCEF_TR_;

index_type indexNHF_FW_;
index_type indexNEF_FW_;
index_type indexNNeutrals_FW_;
Expand Down