Commit 99e223c6 authored by Nils Erik Krumnack's avatar Nils Erik Krumnack
Browse files

Merge branch 'AT-fix-boostedTagging-inefficiency-SFs' into '21.2'

AnalysisTop: Fix propagation of inefficiency boosted tagging SFs

See merge request !43845
parents 4cdf427d 62dc37a4
...@@ -545,29 +545,27 @@ namespace top { ...@@ -545,29 +545,27 @@ namespace top {
const xAOD::JetContainer* ljets(nullptr); const xAOD::JetContainer* ljets(nullptr);
top::check(evtStore()->retrieve(ljets, m_config->sgKeyLargeRJets( top::check(evtStore()->retrieve(ljets, m_config->sgKeyLargeRJets(
m_nominalSystematicSet.hash())), "Failed to retrieve Jets"); m_nominalSystematicSet.hash())), "Failed to retrieve Jets");
///-- Shallow copy of the xAOD --///
std::pair< xAOD::JetContainer*, xAOD::ShallowAuxContainer* >
shallow_xaod_copy = xAOD::shallowCopyContainer(*ljets);
auto shallowJets = std::make_pair(std::unique_ptr<xAOD::JetContainer>{shallow_xaod_copy.first},
std::unique_ptr<xAOD::ShallowAuxContainer>{shallow_xaod_copy.second});
const size_t njets = ljets->size(); const size_t njets = ljets->size();
const std::unordered_map<std::string,std::string>& sfNames = m_config->boostedTaggerSFnames(); const std::unordered_map<std::string,std::string>& sfNames = m_config->boostedTaggerSFnames();
for(auto& it : m_tagSFuncertTool) { for(auto& it : m_tagSFuncertTool) {
ToolHandle<ICPJetUncertaintiesTool>& tool = it.second; ToolHandle<ICPJetUncertaintiesTool>& tool = it.second;
const std::string& fullName=it.first; const std::string& fullName=it.first;
const SG::AuxElement::Accessor< char > accRange("passedRangeCheck_" + fullName); const SG::AuxElement::Accessor< char > accRange("passedRangeCheck_" + fullName);
const std::string sfNameNominal = sfNames.at(fullName); const std::string sfNameNominal = sfNames.at(fullName);
const SG::AuxElement::Accessor< float > accSF(sfNameNominal); const SG::AuxElement::Accessor< float > accSF(sfNameNominal);
const SG::AuxElement::Decorator< float > decNominalSF(sfNameNominal);
for(const CP::SystematicSet& sys : m_tagSFUncorrelatedSystematics[fullName]) { for(const CP::SystematicSet& sys : m_tagSFUncorrelatedSystematics[fullName]) {
// shallow copy with nominal tagging SFs and efficiencies
// JetUncertainties may apply relative variations, so we need to make sure we always apply on
// shallow copy from nominal tagged jets
std::pair< xAOD::JetContainer*, xAOD::ShallowAuxContainer* >
shallow_xaod_copy = xAOD::shallowCopyContainer(*ljets);
auto shallowJets = std::make_pair(std::unique_ptr<xAOD::JetContainer>{shallow_xaod_copy.first},
std::unique_ptr<xAOD::ShallowAuxContainer>{shallow_xaod_copy.second});
top::check(tool->applySystematicVariation(sys), "Failed to applySystematicVariation"); top::check(tool->applySystematicVariation(sys), "Failed to applySystematicVariation");
...@@ -578,8 +576,6 @@ namespace top { ...@@ -578,8 +576,6 @@ namespace top {
const xAOD::Jet* jet = ljets->at(i); const xAOD::Jet* jet = ljets->at(i);
if(accRange.isAvailable(*shallowJet) && accRange(*shallowJet)) { if(accRange.isAvailable(*shallowJet) && accRange(*shallowJet)) {
// reset the previously syst-shifted SF back to nominal SF from the original jet container
decNominalSF(*shallowJet) = accSF(*jet);
top::check(tool->applyCorrection(*shallowJet), "Failed to applyCorrection"); top::check(tool->applyCorrection(*shallowJet), "Failed to applyCorrection");
float sf = accSF.isAvailable(*shallowJet) ? accSF(*shallowJet) : -999.; float sf = accSF.isAvailable(*shallowJet) ? accSF(*shallowJet) : -999.;
jet->auxdecor<float>(sfNameShifted.c_str()) = sf; jet->auxdecor<float>(sfNameShifted.c_str()) = sf;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment