Skip to content
Snippets Groups Projects
Verified Commit fe019953 authored by Tadej Novak's avatar Tadej Novak
Browse files

JVT efficiency updates

parent 20d5ef35
No related branches found
No related tags found
No related merge requests found
Pipeline #692374 passed
/*
Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration
Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
*/
/// @author Nils Krumnack
......@@ -53,6 +53,18 @@ namespace CP
private:
std::string m_truthJetsName;
/// \brief differenciate between JVT and fJVT
private:
bool m_dofJVT = false;
/// \brief the decoration for the fJVT selection
private:
std::string m_fJVTStatus;
/// \brief the accessor for \ref m_fJVTStatus
private:
std::unique_ptr<ISelectionAccessor> m_fJVTStatusAccessor;
/// \brief the decoration for the JVT selection
private:
std::string m_selection;
......
/*
Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration
Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
*/
/// @author Nils Krumnack
......@@ -27,6 +27,8 @@ namespace CP
, m_truthJetsName("AntiKt4TruthJets")
{
declareProperty ("efficiencyTool", m_efficiencyTool, "the efficiency tool we apply");
declareProperty ("dofJVT", m_dofJVT, "differenciate between JVT and fJVT");
declareProperty ("fJVTStatus", m_fJVTStatus, "the decoration for the fJVT status");
declareProperty ("selection", m_selection, "the decoration for the JVT selection");
declareProperty ("efficiency", m_efficiency, "the decoration for the JVT efficiency");
declareProperty ("skipBadEfficiency", m_skipBadEfficiency, "whether to skip efficiency calculation if the selection failed");
......@@ -38,12 +40,21 @@ namespace CP
StatusCode JvtEfficiencyAlg ::
initialize ()
{
if (m_dofJVT && m_fJVTStatus.empty())
{
ANA_MSG_ERROR ("fJVTStatus decoration needs to be configured when running fJVT");
return StatusCode::FAILURE;
}
ANA_CHECK (m_efficiencyTool.retrieve());
m_systematicsList.addHandle (m_jetHandle);
ANA_CHECK (m_systematicsList.addAffectingSystematics (m_efficiencyTool->affectingSystematics()));
ANA_CHECK (m_systematicsList.initialize());
ANA_CHECK (m_outOfValidity.initialize());
if (m_dofJVT && !m_fJVTStatus.empty())
ANA_CHECK (makeSelectionAccessor (m_fJVTStatus, m_fJVTStatusAccessor));
if (!m_selection.empty())
ANA_CHECK (makeSelectionAccessor (m_selection, m_selectionAccessor));
......@@ -74,14 +85,18 @@ namespace CP
bool goodJet = true;
if (m_selectionAccessor || m_skipBadEfficiency)
{
goodJet = m_efficiencyTool->passesJvtCut (*jet);
goodJet = m_dofJVT ? m_fJVTStatusAccessor->getBool (*jet) : m_efficiencyTool->passesJvtCut (*jet);
if (m_selectionAccessor)
m_selectionAccessor->setBool (*jet, goodJet);
}
if (m_efficiencyAccessor && (goodJet || !m_skipBadEfficiency))
if (m_efficiencyAccessor)
{
float efficiency = 1;
ANA_CHECK_CORRECTION (m_outOfValidity, *jet, m_efficiencyTool->getEfficiencyScaleFactor (*jet, efficiency));
if (goodJet) {
ANA_CHECK_CORRECTION (m_outOfValidity, *jet, m_efficiencyTool->getEfficiencyScaleFactor (*jet, efficiency));
} else if (!m_skipBadEfficiency) {
ANA_CHECK_CORRECTION (m_outOfValidity, *jet, m_efficiencyTool->getInefficiencyScaleFactor (*jet, efficiency));
}
(*m_efficiencyAccessor) (*jet) = efficiency;
}
}
......
# Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration
# Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
# AnaAlgorithm import(s):
from AnaAlgorithm.AnaAlgSequence import AnaAlgSequence
......@@ -39,7 +39,8 @@ smallRSysts = "|".join([
"(^JET_EffectiveNP_.*)",
"(^JET_GroupedNP_.*)"])
jvtSysts = "|".join([
"(^JET_JvtEfficiency$)",
"(^JET_JvtEfficiency$)"])
fjvtSysts = "|".join([
"(^JET_fJvtEfficiency$)"])
def makeJetAnalysisSequence( dataType, jetCollection, postfix = '', deepCopyOutput = False,
......@@ -130,7 +131,7 @@ def makeJetAnalysisSequence( dataType, jetCollection, postfix = '', deepCopyOutp
def makeSmallRJetAnalysisSequence( seq, cutlist, cutlength, dataType, jetCollection,
jetInput, postfix = '', runJvtUpdate = True,
runJvtEfficiency = True, runJvtSelection = False,
runJvtEfficiency = True,
reduction = "Global", JEROption = "Simple"):
"""Add algorithms for the R=0.4 jets.
......@@ -145,7 +146,6 @@ def makeSmallRJetAnalysisSequence( seq, cutlist, cutlength, dataType, jetCollect
runJvtUpdate -- Determines whether or not to update JVT on the jets
runJvtEfficiency -- Determines whether or not to recalculate the JVT
efficiency
runJvtSelection -- Determines whether or not to run the JVT selection
reduction -- Which NP reduction scheme should be used (All, Global, Category, Scenario)
JEROption -- Which variant of the reduction should be used (All, Full, Simple). Note that not all combinations of reduction and JEROption are valid!
"""
......@@ -225,7 +225,9 @@ def makeSmallRJetAnalysisSequence( seq, cutlist, cutlength, dataType, jetCollect
if runJvtEfficiency:
alg = createAlgorithm( 'CP::JvtEfficiencyAlg', 'JvtEfficiencyAlg'+postfix )
addPrivateTool( alg, 'efficiencyTool', 'CP::JetJvtEfficiency' )
alg.selection = 'jvt_selection' if runJvtSelection else 'jvt_selection,as_char'
alg.efficiencyTool.SFFile = 'JetJvtEfficiency/Moriond2018/JvtSFFile_EMTopoJets.root'
alg.efficiencyTool.WorkingPoint = 'Medium'
alg.selection = 'jvt_selection'
alg.efficiency = 'jvt_efficiency'
# Disable efficiency decorations if running on data
# We still want to run the JVT selection
......@@ -237,10 +239,27 @@ def makeSmallRJetAnalysisSequence( seq, cutlist, cutlength, dataType, jetCollect
alg.skipBadEfficiency = 0
seq.append( alg, inputPropName = 'jets', outputPropName = 'jetsOut',
affectingSystematics = jvtSysts )
if runJvtSelection:
cutlist.append('jvt_selection')
cutlength.append(1)
alg = createAlgorithm( 'CP::JvtEfficiencyAlg', 'ForwardJvtEfficiencyAlg' )
addPrivateTool( alg, 'efficiencyTool', 'CP::JetJvtEfficiency' )
alg.efficiencyTool.SFFile = 'JetJvtEfficiency/Moriond2018/fJvtSFFile.root'
alg.efficiencyTool.WorkingPoint = 'Tight'
alg.dofJVT = True
alg.fJVTStatus = 'passFJVT,as_char'
alg.selection = 'fjvt_selection'
alg.efficiency = 'fjvt_efficiency'
# Disable efficiency decorations if running on data
# We still want to run the JVT selection
if dataType == 'data':
alg.efficiency = ''
alg.truthJetCollection = ''
alg.outOfValidity = 2
alg.outOfValidityDeco = 'no_fjvt'
alg.skipBadEfficiency = 0
seq.append( alg, inputPropName = 'jets', outputPropName = 'jetsOut',
affectingSystematics = fjvtSysts )
pass
# Return the sequence:
return seq, cutlist, cutlength
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment