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

Adding Support for JVT Scale Factors #1691

Merged
merged 3 commits into from
Jun 10, 2024
Merged
Show file tree
Hide file tree
Changes from all 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
9 changes: 7 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,13 @@ jobs:
- 25.2.3
- 25.2.4
- 25.2.5
- 25.2.6

- 25.2.6
- 25.2.7
- 25.2.8
- 25.2.9
- 25.2.10
- 25.2.11

steps:
- uses: actions/checkout@master
- name: build ${{ env['RELEASE'] }}
Expand Down
85 changes: 48 additions & 37 deletions Root/JetSelector.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -642,6 +642,7 @@ bool JetSelector :: executeSelection ( const xAOD::JetContainer* inJets,
}

i_jet = 0;

for ( auto jet_itr : *inJets ) { // duplicated of basic loop

// removing of duplicates
Expand Down Expand Up @@ -757,34 +758,41 @@ bool JetSelector :: executeSelection ( const xAOD::JetContainer* inJets,

// create passed JVT decorator
static const SG::AuxElement::Decorator<char> passedJVT( m_outputJVTPassed );

if ( syst_it.name().empty() ) {
passedJVT( *jet ) = 1; // passes by default
}

// obtain JVT SF as a float (to be stored away separately)
float jvtSF(1.0);
if ( m_JVT_tool_handle->isInRange(*jet) ) {
// If we do not enforce JVT veto and the jet hasn't passed the JVT cut, we need to calculate the inefficiency scale factor for it
if ( m_noJVTVeto && !m_JVT_tool_handle->passesJvtCut(*jet) ) {
if ( syst_it.name().empty() ) {
passedJVT( *jet ) = 0; // mark as not passed
}
if ( m_getJVTSF && m_JVT_tool_handle->getInefficiencyScaleFactor( *jet, jvtSF ) != CP::CorrectionCode::Ok ) {
ANA_MSG_ERROR( "Error in JVT Tool getInefficiencyScaleFactor");
return EL::StatusCode::FAILURE;
}
} else { // otherwise classic efficiency scale factor
if ( syst_it.name().empty() ) {
passedJVT( *jet ) = 1;
CP::CorrectionCode result_code;
// If we do not enforce JVT veto and the jet hasn't passed the JVT cut, we need to calculate the inefficiency scale factor for it
if ( m_noJVTVeto && !m_JVT_tool_handle->passesJvtCut(*jet) ) {
if ( syst_it.name().empty() ) {
passedJVT( *jet ) = 0; // mark as not passed
}
if ( m_getJVTSF ){
result_code = m_JVT_tool_handle->getInefficiencyScaleFactor( *jet, jvtSF );
if (result_code == CP::CorrectionCode::OutOfValidityRange) {
jvtSF = 1;
} else if (result_code != CP::CorrectionCode::Ok and result_code != CP::CorrectionCode::OutOfValidityRange) {
ANA_MSG_ERROR( "Error in JVT Tool getInefficiencyScaleFactor");
return EL::StatusCode::FAILURE;
}
if ( m_getJVTSF && m_JVT_tool_handle->getEfficiencyScaleFactor( *jet, jvtSF ) != CP::CorrectionCode::Ok ) {
ANA_MSG_ERROR( "Error in JVT Tool getEfficiencyScaleFactor");
return EL::StatusCode::FAILURE;
}
} else { // otherwise classic efficiency scale factor
if ( syst_it.name().empty() ) {
passedJVT( *jet ) = 1;
}
if ( m_getJVTSF ){
result_code = m_JVT_tool_handle->getEfficiencyScaleFactor( *jet, jvtSF );
if (result_code == CP::CorrectionCode::OutOfValidityRange) {
jvtSF = 1;
} else if (result_code != CP::CorrectionCode::Ok and result_code != CP::CorrectionCode::OutOfValidityRange) {
ANA_MSG_ERROR( "Error in JVT Tool getEfficiencyScaleFactor");
return EL::StatusCode::FAILURE;
}
}
}
sfVecJVT.push_back(jvtSF);
sfVecJVT.push_back(jvtSF);

ANA_MSG_DEBUG( "===>>>");
ANA_MSG_DEBUG( "Jet " << idx << ", pt = " << jet->pt()*1e-3 << " GeV, |eta| = " << std::fabs(jet->eta()) );
Expand Down Expand Up @@ -816,12 +824,10 @@ bool JetSelector :: executeSelection ( const xAOD::JetContainer* inJets,
static const SG::AuxElement::Decorator<char> passedJVT( m_outputJVTPassed );
passedJVT( *jet ) = 1; // passes by default

if ( m_JVT_tool_handle->isInRange(*jet) ) {
if ( m_noJVTVeto && !m_JVT_tool_handle->passesJvtCut(*jet) ) {
passedJVT( *jet ) = 0; // mark as not passed
} else {
passedJVT( *jet ) = 1;
}
if ( m_noJVTVeto && !m_JVT_tool_handle->passesJvtCut(*jet) ) {
passedJVT( *jet ) = 0; // mark as not passed
} else {
passedJVT( *jet ) = 1;
}
}
}
Expand Down Expand Up @@ -889,18 +895,23 @@ bool JetSelector :: executeSelection ( const xAOD::JetContainer* inJets,
}

float fjvtSF(1.0);
if ( m_fJVT_eff_tool_handle->isInRange(*jet) ) {
// If we do not enforce JVT veto and the jet hasn't passed the JVT cut, we need to calculate the inefficiency scale factor for it
if ( !m_dofJVTVeto && !m_fJVT_eff_tool_handle->passesJvtCut(*jet)) {
if ( m_fJVT_eff_tool_handle->getInefficiencyScaleFactor( *jet, fjvtSF ) != CP::CorrectionCode::Ok ) {
ANA_MSG_ERROR( "Error in fJVT Tool getInefficiencyScaleFactor");
return EL::StatusCode::FAILURE;
}
} else { // otherwise classic efficiency scale factor
if ( m_fJVT_eff_tool_handle->getEfficiencyScaleFactor( *jet, fjvtSF ) != CP::CorrectionCode::Ok ) {
ANA_MSG_ERROR( "Error in fJVT Tool getEfficiencyScaleFactor");
return EL::StatusCode::FAILURE;
}
CP::CorrectionCode result_code;
// If we do not enforce JVT veto and the jet hasn't passed the JVT cut, we need to calculate the inefficiency scale factor for it
if ( !m_dofJVTVeto && !m_fJVT_eff_tool_handle->passesJvtCut(*jet)) {
result_code = m_fJVT_eff_tool_handle->getInefficiencyScaleFactor( *jet, fjvtSF );
if ( result_code == CP::CorrectionCode::OutOfValidityRange) {
fjvtSF = 1;
} else if ( result_code != CP::CorrectionCode::Ok ) {
ANA_MSG_ERROR( "Error in fJVT Tool getInefficiencyScaleFactor");
return EL::StatusCode::FAILURE;
}
} else { // otherwise classic efficiency scale factor
result_code = m_fJVT_eff_tool_handle->getEfficiencyScaleFactor( *jet, fjvtSF );
if ( result_code == CP::CorrectionCode::OutOfValidityRange) {
fjvtSF = 1;
} else if ( m_fJVT_eff_tool_handle->getEfficiencyScaleFactor( *jet, fjvtSF ) != CP::CorrectionCode::Ok ) {
ANA_MSG_ERROR( "Error in fJVT Tool getEfficiencyScaleFactor");
return EL::StatusCode::FAILURE;
}
}
sfVecfJVT.push_back(fjvtSF);
Expand Down
Loading