ATLAS Offline Software
Loading...
Searching...
No Matches
CP::NNJvtEfficiencyTool Class Reference

#include <NNJvtEfficiencyTool.h>

Inheritance diagram for CP::NNJvtEfficiencyTool:
Collaboration diagram for CP::NNJvtEfficiencyTool:

Public Member Functions

 ~NNJvtEfficiencyTool () override=default
virtual StatusCode initialize () override
 Dummy implementation of the initialisation function.
virtual StatusCode sysApplySystematicVariation (const CP::SystematicSet &sys) override
 effects: configure this tool for the given list of systematic variations.
virtual CorrectionCode getEfficiencyScaleFactor (const xAOD::Jet &jet, float &sf) const override
 Calculate the efficiency scale factor for the provided jet.
virtual CorrectionCode getInefficiencyScaleFactor (const xAOD::Jet &jet, float &sf) const override
 Calculate the inefficiency scale factor for the provided jet.
 AsgTool (const std::string &name)
 Constructor specifying the tool instance's name.
 AsgTool (const AsgTool &)=delete
virtual void print () const
 Print the state of the tool.
ServiceHandle< StoreGateSvc > & evtStore ()
 The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.
const ServiceHandle< StoreGateSvc > & detStore () const
 The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc.
virtual StatusCode sysInitialize () override
 Perform system initialization for an algorithm.
virtual StatusCode sysStart () override
 Handle START transition.
virtual std::vector< Gaudi::DataHandle * > inputHandles () const override
 Return this algorithm's input handles.
virtual std::vector< Gaudi::DataHandle * > outputHandles () const override
 Return this algorithm's output handles.
Gaudi::Details::PropertyBase & declareProperty (Gaudi::Property< T, V, H > &t)
void updateVHKA (Gaudi::Details::PropertyBase &)
MsgStream & msg () const
bool msgLvl (const MSG::Level lvl) const
virtual bool isAffectedBySystematic (const SystematicVariation &systematic) const
 returns: whether this tool is affected by the given systematic guarantee: no-fail
virtual SystematicSet affectingSystematics () const
 returns: the list of all systematics this tool can be affected by guarantee: strong failures: out of memory II
virtual SystematicSet recommendedSystematics () const
 returns: the list of all systematics this tool can be affected by guarantee: strong failures: out of memory II
const SystematicSetappliedSystematics () const
 returns: the list of systematics that have been applied to this tool.
std::string appliedSystematicsString () const
 returns: a string representation of appliedSystematics() guarantee: strong failures: out of memory II rationale: this is meant to be used when printing out the applied systematics for debugging purposes (or when embedding them in a string).
virtual StatusCode applySystematicVariation (const SystematicSet &systConfig)
 effects: configure this tool for the given list of systematic variations.
void testInvariant () const
 effects: test the invariance of this object guarantee: no-fail
Additional helper functions, not directly mimicking Athena
template<class T>
const T * getProperty (const std::string &name) const
 Get one of the tool's properties.
const std::string & msg_level_name () const __attribute__((deprecated))
 A deprecated function for getting the message level's name.
const std::string & getName (const void *ptr) const
 Get the name of an object that is / should be in the event store.
SG::sgkey_t getKey (const void *ptr) const
 Get the (hashed) key of an object that is in the event store.

Protected Member Functions

StatusCode initHists (const std::string &file, const std::string &wp)
 Read the input histograms. Passing an empty 'file' string uses dummy SFs.
bool isInRange (const xAOD::Jet &jet) const
CorrectionCode getEffImpl (float x, float y, float &sf) const
CorrectionCode getIneffImpl (float x, float y, float &sf) const
void renounceArray (SG::VarHandleKeyArray &handlesArray)
 remove all handles from I/O resolution
std::enable_if_t< std::is_void_v< std::result_of_t< decltype(&T::renounce)(T)> > &&!std::is_base_of_v< SG::VarHandleKeyArray, T > &&std::is_base_of_v< Gaudi::DataHandle, T >, void > renounce (T &h)
void extraDeps_update_handler (Gaudi::Details::PropertyBase &ExtraDeps)
 Add StoreName to extra input/output deps as needed.
StatusCode addAffectingSystematic (const SystematicVariation &systematic, bool recommended)
 effects: add a systematic to the list of registered systematics.
StatusCode addRecommendedSystematic (const SystematicVariation &systematic)
 effects: add a systematic to the list of recommended systematics failures: unsupported systematic
void addAffectingSystematics (const SystematicSet &systematics)
 effects: add a SystematicSet to the registered systematics.
StatusCode addRecommendedSystematics (const SystematicSet &systematics)
 effects: add a SystematicSet to the recommended systematics.

Protected Attributes

Gaudi::Property< std::string > m_jetContainer
Gaudi::Property< boolm_doTruthRequirement
SG::ReadDecorHandleKey< xAOD::JetContainerm_truthHSLabel
Gaudi::Property< floatm_minEta
Gaudi::Property< floatm_maxEta
Gaudi::Property< floatm_minPtForJvt
Gaudi::Property< floatm_maxPtForJvt
Gaudi::Property< floatm_dummySFError
Gaudi::Property< std::string > m_jetEtaName
std::unique_ptr< TH2 > m_jvtHist
std::unique_ptr< TH2 > m_effHist
bool m_useDummySFs {false}
SG::ConstAccessor< floatm_etaAcc { m_jetEtaName }
int m_appliedSysSigma = 0
std::optional< SG::AuxElement::ConstAccessor< char > > m_accIsHS
SystematicSet m_affectingSystematics
 description: members directly corresponding to accessors
SystematicSet m_recommendedSystematics

Private Types

typedef ServiceHandle< StoreGateSvcStoreGateSvc_t

Private Member Functions

Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T, V, H > &hndl, const SG::VarHandleKeyType &)
 specialization for handling Gaudi::Property<SG::VarHandleKey>

Private Attributes

Gaudi::Property< std::string > m_wp
Gaudi::Property< std::string > m_file
StoreGateSvc_t m_evtStore
 Pointer to StoreGate (event store by default)
StoreGateSvc_t m_detStore
 Pointer to StoreGate (detector store by default)
std::vector< SG::VarHandleKeyArray * > m_vhka
bool m_varHandleArraysDeclared
SystematicSetm_appliedSystematics
 description: pointer to currenty applied systematics
std::unordered_map< SystematicSet, SystematicSetm_systFilterMap
 map of cached systematics filtering

Detailed Description

Definition at line 12 of file NNJvtEfficiencyTool.h.

Member Typedef Documentation

◆ StoreGateSvc_t

typedef ServiceHandle<StoreGateSvc> AthCommonDataStore< AthCommonMsg< AlgTool > >::StoreGateSvc_t
privateinherited

Definition at line 388 of file AthCommonDataStore.h.

Constructor & Destructor Documentation

◆ ~NNJvtEfficiencyTool()

CP::NNJvtEfficiencyTool::~NNJvtEfficiencyTool ( )
overridedefault

Member Function Documentation

◆ addAffectingSystematic()

StatusCode CP::SystematicsTool::addAffectingSystematic ( const SystematicVariation & systematic,
bool recommended )
protectedinherited

effects: add a systematic to the list of registered systematics.

It will optionally also add this sytematic to the recommended set. side effects: this will add the systematic to the global list of systematics, if not already there guarantee: strong failures: out of memory II

Definition at line 111 of file SystematicsTool.cxx.

112 {
113
114 RCU_READ_INVARIANT( this );
115
116 SystematicRegistry& reg = SystematicRegistry::getInstance();
117 reg.registerSystematic( systematic );
118 m_affectingSystematics.insert( systematic );
119 if( recommended ) {
120 if( addRecommendedSystematic(systematic) != StatusCode::SUCCESS ) {
121 return StatusCode::FAILURE;
122 }
123 }
124 return StatusCode::SUCCESS;
125 }
#define RCU_READ_INVARIANT(x)
Definition Assert.h:229
static SystematicRegistry & getInstance()
Get the singleton instance of the registry for the curren thread.
StatusCode addRecommendedSystematic(const SystematicVariation &systematic)
effects: add a systematic to the list of recommended systematics failures: unsupported systematic
SystematicSet m_affectingSystematics
description: members directly corresponding to accessors

◆ addAffectingSystematics()

void CP::SystematicsTool::addAffectingSystematics ( const SystematicSet & systematics)
protectedinherited

effects: add a SystematicSet to the registered systematics.

Definition at line 141 of file SystematicsTool.cxx.

142 {
143
144 RCU_READ_INVARIANT( this );
145
146 SystematicRegistry& reg = SystematicRegistry::getInstance();
148 reg.registerSystematics( systematics );
149 }
static const std::vector< std::string > systematics

◆ addRecommendedSystematic()

StatusCode CP::SystematicsTool::addRecommendedSystematic ( const SystematicVariation & systematic)
protectedinherited

effects: add a systematic to the list of recommended systematics failures: unsupported systematic

Definition at line 127 of file SystematicsTool.cxx.

128 {
129
130 RCU_READ_INVARIANT( this );
131
132 SystematicRegistry& reg = SystematicRegistry::getInstance();
133 m_recommendedSystematics.insert( systematic );
134 if( reg.addSystematicToRecommended( systematic ) !=
135 StatusCode::SUCCESS ) {
136 return StatusCode::FAILURE;
137 }
138 return StatusCode::SUCCESS;
139 }
SystematicSet m_recommendedSystematics

◆ addRecommendedSystematics()

StatusCode CP::SystematicsTool::addRecommendedSystematics ( const SystematicSet & systematics)
protectedinherited

effects: add a SystematicSet to the recommended systematics.

Definition at line 151 of file SystematicsTool.cxx.

152 {
153
154 RCU_READ_INVARIANT( this );
155
156 SystematicRegistry& reg = SystematicRegistry::getInstance();
158 if( reg.addSystematicsToRecommended( systematics ) !=
159 StatusCode::SUCCESS ) {
160 return StatusCode::FAILURE;
161 }
162 return StatusCode::SUCCESS;
163 }

◆ affectingSystematics()

SystematicSet CP::SystematicsTool::affectingSystematics ( ) const
virtualinherited

returns: the list of all systematics this tool can be affected by guarantee: strong failures: out of memory II

Implements CP::IReentrantSystematicsTool.

Reimplemented in CP::JetQGTagger, and met::METSystematicsTool.

Definition at line 40 of file SystematicsTool.cxx.

40 {
41
42 RCU_READ_INVARIANT( this );
44 }

◆ appliedSystematics()

const SystematicSet & CP::SystematicsTool::appliedSystematics ( ) const
inherited

returns: the list of systematics that have been applied to this tool.

this is not including systematics that were applied, but do not affect this tool guarantee: no-fail

Definition at line 54 of file SystematicsTool.cxx.

54 {
55
56 RCU_READ_INVARIANT( this );
57 if(m_appliedSystematics == 0){
58 std::cerr << "SystematicsTool::appliedSystematics WARNING: "
59 << "no systematic configuration has been applied yet. "
60 << "Returning NULL" << std::endl;
61 static const SystematicSet dummy;
62 return dummy;
63 }
65 }
SystematicSet * m_appliedSystematics
description: pointer to currenty applied systematics

◆ appliedSystematicsString()

std::string CP::SystematicsTool::appliedSystematicsString ( ) const
inherited

returns: a string representation of appliedSystematics() guarantee: strong failures: out of memory II rationale: this is meant to be used when printing out the applied systematics for debugging purposes (or when embedding them in a string).

Definition at line 67 of file SystematicsTool.cxx.

67 {
68
69 RCU_READ_INVARIANT( this );
70 return m_appliedSystematics->name();
71 }

◆ applySystematicVariation()

StatusCode CP::SystematicsTool::applySystematicVariation ( const SystematicSet & systConfig)
virtualinherited

effects: configure this tool for the given list of systematic variations.

any requested systematics that are not affecting this tool will be silently ignored (unless they cause other errors). guarantee: basic failures: out of memory II failures: systematic unknown failures: requesting multiple variations on the same systematic (e.g. up & down) failures: requesting an unsupported variation on an otherwise supported systematic (e.g. a 2 sigma variation and the tool only supports 1 sigma variations) failures: unsupported combination of supported systematic failures: other tool specific errors

Implements CP::ISystematicsTool.

Reimplemented in CP::JetQGTagger, and met::METSystematicsTool.

Definition at line 73 of file SystematicsTool.cxx.

74 {
75
77
78 // First, try to find this input set in the map
79 auto itr = m_systFilterMap.find(systConfig);
80
81 // This is a new input set, so we need to filter it
82 if(itr == m_systFilterMap.end()){
83
84 // Filter input systematics with the affecting systematics
85 SystematicSet myAppliedSystematics;
86 if( SystematicSet::
87 filterForAffectingSystematics( systConfig,
89 myAppliedSystematics ) !=
90 StatusCode::SUCCESS ) {
91 return StatusCode::FAILURE;
92 }
93
94 // Insert the new filtered set onto our filter map
95 itr = m_systFilterMap.insert
96 (std::make_pair(systConfig, myAppliedSystematics)).first;
97
98 }
99
100 // Apply the filtered systematics
101 if( sysApplySystematicVariation( itr->second ) !=
102 StatusCode::SUCCESS ) {
103 return StatusCode::FAILURE;
104 }
105
106 // Store the filtered systematics
107 m_appliedSystematics = &itr->second;
108 return StatusCode::SUCCESS;
109 }
#define RCU_CHANGE_INVARIANT(x)
Definition Assert.h:231
virtual StatusCode sysApplySystematicVariation(const SystematicSet &systConfig)=0
effects: configure this tool for the given list of systematic variations.
std::unordered_map< SystematicSet, SystematicSet > m_systFilterMap
map of cached systematics filtering

◆ AsgTool() [1/2]

asg::AsgTool::AsgTool ( const AsgTool & )
deleteinherited

◆ AsgTool() [2/2]

asg::AsgTool::AsgTool ( const std::string & name)
inherited

Constructor specifying the tool instance's name.

Definition at line 51 of file AsgTool.cxx.

60#ifndef XAOD_STANDALONE
61 ::getType(name), ::getName(name), ::getParent(name)
62#else // not XAOD_STANDALONE
63 name
64#endif // not XAOD_STANDALONE
65 )
66#ifdef XAOD_STANDALONE
67 , m_event()
68#endif // XAOD_STANDALONE
69 {
70 ToolStore::put( this ).ignore(); // Register the tool in the ToolStore
71 }
const std::string & getName(const void *ptr) const
Get the name of an object that is / should be in the event store.
Definition AsgTool.cxx:106
::AthAlgTool AsgToolBase
Definition AsgTool.h:33

◆ declareGaudiProperty()

Gaudi::Details::PropertyBase & AthCommonDataStore< AthCommonMsg< AlgTool > >::declareGaudiProperty ( Gaudi::Property< T, V, H > & hndl,
const SG::VarHandleKeyType &  )
inlineprivateinherited

specialization for handling Gaudi::Property<SG::VarHandleKey>

Definition at line 156 of file AthCommonDataStore.h.

158 {
160 hndl.value(),
161 hndl.documentation());
162
163 }
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)

◆ declareProperty()

Gaudi::Details::PropertyBase & AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty ( Gaudi::Property< T, V, H > & t)
inlineinherited

Definition at line 145 of file AthCommonDataStore.h.

145 {
146 typedef typename SG::HandleClassifier<T>::type htype;
148 }
Gaudi::Details::PropertyBase & declareGaudiProperty(Gaudi::Property< T, V, H > &hndl, const SG::VarHandleKeyType &)
specialization for handling Gaudi::Property<SG::VarHandleKey>

◆ detStore()

const ServiceHandle< StoreGateSvc > & AthCommonDataStore< AthCommonMsg< AlgTool > >::detStore ( ) const
inlineinherited

The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc.

Definition at line 95 of file AthCommonDataStore.h.

◆ evtStore()

ServiceHandle< StoreGateSvc > & AthCommonDataStore< AthCommonMsg< AlgTool > >::evtStore ( )
inlineinherited

The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.

Definition at line 85 of file AthCommonDataStore.h.

◆ extraDeps_update_handler()

void AthCommonDataStore< AthCommonMsg< AlgTool > >::extraDeps_update_handler ( Gaudi::Details::PropertyBase & ExtraDeps)
protectedinherited

Add StoreName to extra input/output deps as needed.

use the logic of the VarHandleKey to parse the DataObjID keys supplied via the ExtraInputs and ExtraOuputs Properties to add the StoreName if it's not explicitly given

◆ getEfficiencyScaleFactor()

CorrectionCode CP::JvtEfficiencyToolBase::getEfficiencyScaleFactor ( const xAOD::Jet & jet,
float & sf ) const
overridevirtualinherited

Calculate the efficiency scale factor for the provided jet.

Parameters
jetThe jet whose efficiency should be calculated
[out]sfThe calculated scale factor
Returns
A code signifying the status of the returned scale factor

Implements CP::IJvtEfficiencyTool.

Reimplemented in CP::FJvtEfficiencyTool.

Definition at line 48 of file JvtEfficiencyToolBase.cxx.

48 {
49 if (!isInRange(jet)) {
50 sf = -1;
52 }
54 if (!m_accIsHS->isAvailable(jet)) {
55 ATH_MSG_ERROR("Truth tagging required but not available");
57 }
58 if (!(*m_accIsHS)(jet)) {
59 sf = 1;
60 return CorrectionCode::Ok;
61 }
62 }
63 return getEffImpl(jet.pt(), m_etaAcc(jet), sf);
64 }
#define ATH_MSG_ERROR(x)
@ Error
Some error happened during the object correction.
@ OutOfValidityRange
Input object is out of validity range.
@ Ok
The correction was done successfully.
SG::ConstAccessor< float > m_etaAcc
Gaudi::Property< bool > m_doTruthRequirement
CorrectionCode getEffImpl(float x, float y, float &sf) const
std::optional< SG::AuxElement::ConstAccessor< char > > m_accIsHS
bool isInRange(const xAOD::Jet &jet) const
virtual double pt() const
The transverse momentum ( ) of the particle.
Definition Jet_v1.cxx:44

◆ getEffImpl()

CorrectionCode CP::JvtEfficiencyToolBase::getEffImpl ( float x,
float y,
float & sf ) const
protectedinherited

Definition at line 124 of file JvtEfficiencyToolBase.cxx.

124 {
125 float baseFactor = 1;
126 float errorTerm = m_dummySFError;
127 if (!m_useDummySFs) {
128 if (!getBinContentAndError(*m_jvtHist, x, y, baseFactor, errorTerm)) {
129 sf = -1;
131 }
132 }
133 sf = baseFactor + m_appliedSysSigma * errorTerm;
134 return CorrectionCode::Ok;
135 }
#define y
#define x
std::unique_ptr< TH2 > m_jvtHist
Gaudi::Property< float > m_dummySFError

◆ getInefficiencyScaleFactor()

CorrectionCode CP::JvtEfficiencyToolBase::getInefficiencyScaleFactor ( const xAOD::Jet & jet,
float & sf ) const
overridevirtualinherited

Calculate the inefficiency scale factor for the provided jet.

Parameters
jetThe jet whose inefficiency should be calculated
[out]sfThe calculated scale factor
Returns
A code signifying the status of the returned scale factor

Implements CP::IJvtEfficiencyTool.

Reimplemented in CP::FJvtEfficiencyTool.

Definition at line 67 of file JvtEfficiencyToolBase.cxx.

67 {
68 if (!isInRange(jet)) {
69 sf = -1;
71 }
73 if (!m_accIsHS->isAvailable(jet)) {
74 ATH_MSG_ERROR("Truth tagging required but not available");
76 }
77 if (!(*m_accIsHS)(jet)) {
78 sf = 1;
79 return CorrectionCode::Ok;
80 }
81 }
82 return getIneffImpl(jet.pt(), m_etaAcc(jet), sf);
83 }
CorrectionCode getIneffImpl(float x, float y, float &sf) const

◆ getIneffImpl()

CorrectionCode CP::JvtEfficiencyToolBase::getIneffImpl ( float x,
float y,
float & sf ) const
protectedinherited

Definition at line 137 of file JvtEfficiencyToolBase.cxx.

137 {
138 if (m_useDummySFs) {
140 return CorrectionCode::Ok;
141 }
142 float baseFactor, errorTerm, effFactor, errorEffTerm;
143 if (!getBinContentAndError(*m_jvtHist, x, y, baseFactor, errorTerm) ||
144 !getBinContentAndError(*m_effHist, x, y, effFactor, errorEffTerm)) {
145 sf = -1;
147 }
148 baseFactor += errorTerm * m_appliedSysSigma;
149 effFactor += errorEffTerm * m_appliedSysSigma;
150
151 sf = (1 - baseFactor * effFactor) / (1 - effFactor);
152 return CorrectionCode::Ok;
153 }
std::unique_ptr< TH2 > m_effHist

◆ getKey()

SG::sgkey_t asg::AsgTool::getKey ( const void * ptr) const
inherited

Get the (hashed) key of an object that is in the event store.

This is a bit of a special one. StoreGateSvc and xAOD::TEvent both provide ways for getting the SG::sgkey_t key for an object that is in the store, based on a bare pointer. But they provide different interfaces for doing so.

In order to allow tools to efficiently perform this operation, they can use this helper function.

See also
asg::AsgTool::getName
Parameters
ptrThe bare pointer to the object that the event store should know about
Returns
The hashed key of the object in the store. If not found, an invalid (zero) key.

Definition at line 119 of file AsgTool.cxx.

119 {
120
121#ifdef XAOD_STANDALONE
122 // In case we use @c xAOD::TEvent, we have a direct function call
123 // for this.
124 return evtStore()->event()->getKey( ptr );
125#else
126 const SG::DataProxy* proxy = evtStore()->proxy( ptr );
127 return ( proxy == nullptr ? 0 : proxy->sgkey() );
128#endif // XAOD_STANDALONE
129 }
ServiceHandle< StoreGateSvc > & evtStore()

◆ getName()

const std::string & asg::AsgTool::getName ( const void * ptr) const
inherited

Get the name of an object that is / should be in the event store.

This is a bit of a special one. StoreGateSvc and xAOD::TEvent both provide ways for getting the std::string name for an object that is in the store, based on a bare pointer. But they provide different interfaces for doing so.

In order to allow tools to efficiently perform this operation, they can use this helper function.

See also
asg::AsgTool::getKey
Parameters
ptrThe bare pointer to the object that the event store should know about
Returns
The string name of the object in the store. If not found, an empty string.

Definition at line 106 of file AsgTool.cxx.

106 {
107
108#ifdef XAOD_STANDALONE
109 // In case we use @c xAOD::TEvent, we have a direct function call
110 // for this.
111 return evtStore()->event()->getName( ptr );
112#else
113 const SG::DataProxy* proxy = evtStore()->proxy( ptr );
114 static const std::string dummy = "";
115 return ( proxy == nullptr ? dummy : proxy->name() );
116#endif // XAOD_STANDALONE
117 }

◆ getProperty()

template<class T>
const T * asg::AsgTool::getProperty ( const std::string & name) const
inherited

Get one of the tool's properties.

◆ initHists()

StatusCode CP::JvtEfficiencyToolBase::initHists ( const std::string & file,
const std::string & wp )
protectedinherited

Read the input histograms. Passing an empty 'file' string uses dummy SFs.

Definition at line 85 of file JvtEfficiencyToolBase.cxx.

85 {
86 if (file.empty()) {
87 m_useDummySFs = true;
88 ATH_MSG_INFO("No SF file provided, running with dummy SFs of 1 +/- " << m_dummySFError);
89 return StatusCode::SUCCESS;
90 }
91 std::string resolved = PathResolverFindCalibFile(file);
92 if (resolved.empty()) {
93 ATH_MSG_ERROR("Could not locate file " << file);
94 return StatusCode::FAILURE;
95 }
96 std::unique_ptr<TFile> fIn(TFile::Open(resolved.c_str(), "READ"));
97 if (!fIn) {
98 ATH_MSG_ERROR("Failed to open file " << resolved);
99 return StatusCode::FAILURE;
100 }
101
102 std::string jvtName = "Jvt" + wp;
103 m_jvtHist.reset(fIn->Get<TH2>(jvtName.c_str()));
104 if (!m_jvtHist) {
106 "Could not open SF histogram "
107 << jvtName << ". Please check the supported working points.");
108 return StatusCode::FAILURE;
109 }
110 m_jvtHist->SetDirectory(nullptr);
111 std::string effName = "Eff" + wp;
112 m_effHist.reset(fIn->Get<TH2>(effName.c_str()));
113 if (!m_effHist) {
115 "Could not open efficiency histogram "
116 << jvtName << ". Please check the supported working points.");
117 return StatusCode::FAILURE;
118 }
119 m_effHist->SetDirectory(nullptr);
120
121 return StatusCode::SUCCESS;
122 }
#define ATH_MSG_INFO(x)
std::string PathResolverFindCalibFile(const std::string &logical_file_name)
TFile * file

◆ initialize()

StatusCode CP::NNJvtEfficiencyTool::initialize ( void )
overridevirtual

Dummy implementation of the initialisation function.

It's here to allow the dual-use tools to skip defining an initialisation function. Since many are doing so...

Reimplemented from CP::JvtEfficiencyToolBase.

Definition at line 9 of file NNJvtEfficiencyTool.cxx.

9 {
14 ATH_MSG_ERROR("failed to set up NNJvt systematics");
15 return StatusCode::FAILURE;
16 }
17 return StatusCode::SUCCESS;
18 }
#define ATH_CHECK
Evaluate an expression and check for errors.
StatusCode initHists(const std::string &file, const std::string &wp)
Read the input histograms. Passing an empty 'file' string uses dummy SFs.
virtual StatusCode initialize() override
Dummy implementation of the initialisation function.
Gaudi::Property< std::string > m_wp
Gaudi::Property< std::string > m_file
StatusCode addAffectingSystematic(const SystematicVariation &systematic, bool recommended)
effects: add a systematic to the list of registered systematics.
static const SystematicVariation NNJvtEfficiencyUp("JET_NNJvtEfficiency", 1)
static const SystematicVariation NNJvtEfficiencyDown("JET_NNJvtEfficiency", -1)

◆ inputHandles()

virtual std::vector< Gaudi::DataHandle * > AthCommonDataStore< AthCommonMsg< AlgTool > >::inputHandles ( ) const
overridevirtualinherited

Return this algorithm's input handles.

We override this to include handle instances from key arrays if they have not yet been declared. See comments on updateVHKA.

◆ isAffectedBySystematic()

bool CP::SystematicsTool::isAffectedBySystematic ( const SystematicVariation & systematic) const
virtualinherited

returns: whether this tool is affected by the given systematic guarantee: no-fail

Implements CP::ISystematicsTool.

Reimplemented in CP::JetQGTagger, and met::METSystematicsTool.

Definition at line 31 of file SystematicsTool.cxx.

32 {
33
34 RCU_READ_INVARIANT( this );
35 return ( m_affectingSystematics.find( systematic ) !=
37 }

◆ isInRange()

bool CP::JvtEfficiencyToolBase::isInRange ( const xAOD::Jet & jet) const
protectedinherited

Definition at line 155 of file JvtEfficiencyToolBase.cxx.

155 {
156 if (jet.pt() < m_minPtForJvt || jet.pt() > m_maxPtForJvt)
157 return false;
158 float eta = m_etaAcc(jet);
159 return std::abs(eta) >= m_minEta && std::abs(eta) <= m_maxEta;
160 }
Scalar eta() const
pseudorapidity method
Gaudi::Property< float > m_minEta
Gaudi::Property< float > m_minPtForJvt
Gaudi::Property< float > m_maxEta
Gaudi::Property< float > m_maxPtForJvt

◆ msg()

MsgStream & AthCommonMsg< AlgTool >::msg ( ) const
inlineinherited

Definition at line 24 of file AthCommonMsg.h.

24 {
25 return this->msgStream();
26 }

◆ msg_level_name()

const std::string & asg::AsgTool::msg_level_name ( ) const
inherited

A deprecated function for getting the message level's name.

Instead of using this, weirdly named function, user code should get the string name of the current minimum message level (in case they really need it...), with:

MSG::name( msg().level() )

This function's name doesn't follow the ATLAS coding rules, and as such will be removed in the not too distant future.

Returns
The string name of the current minimum message level that's printed

Definition at line 101 of file AsgTool.cxx.

101 {
102
103 return MSG::name( msg().level() );
104 }
MsgStream & msg() const
const std::string & name(Level lvl)
Convenience function for translating message levels to strings.
Definition MsgLevel.cxx:19

◆ msgLvl()

bool AthCommonMsg< AlgTool >::msgLvl ( const MSG::Level lvl) const
inlineinherited

Definition at line 30 of file AthCommonMsg.h.

30 {
31 return this->msgLevel(lvl);
32 }

◆ outputHandles()

virtual std::vector< Gaudi::DataHandle * > AthCommonDataStore< AthCommonMsg< AlgTool > >::outputHandles ( ) const
overridevirtualinherited

Return this algorithm's output handles.

We override this to include handle instances from key arrays if they have not yet been declared. See comments on updateVHKA.

◆ print()

◆ recommendedSystematics()

SystematicSet CP::SystematicsTool::recommendedSystematics ( ) const
virtualinherited

returns: the list of all systematics this tool can be affected by guarantee: strong failures: out of memory II

Implements CP::IReentrantSystematicsTool.

Reimplemented in CP::JetQGTagger, and met::METSystematicsTool.

Definition at line 47 of file SystematicsTool.cxx.

47 {
48
49 RCU_READ_INVARIANT( this );
51 }

◆ renounce()

std::enable_if_t< std::is_void_v< std::result_of_t< decltype(&T::renounce)(T)> > &&!std::is_base_of_v< SG::VarHandleKeyArray, T > &&std::is_base_of_v< Gaudi::DataHandle, T >, void > AthCommonDataStore< AthCommonMsg< AlgTool > >::renounce ( T & h)
inlineprotectedinherited

Definition at line 380 of file AthCommonDataStore.h.

381 {
382 h.renounce();
384 }
std::enable_if_t< std::is_void_v< std::result_of_t< decltype(&T::renounce)(T)> > &&!std::is_base_of_v< SG::VarHandleKeyArray, T > &&std::is_base_of_v< Gaudi::DataHandle, T >, void > renounce(T &h)

◆ renounceArray()

void AthCommonDataStore< AthCommonMsg< AlgTool > >::renounceArray ( SG::VarHandleKeyArray & handlesArray)
inlineprotectedinherited

remove all handles from I/O resolution

Definition at line 364 of file AthCommonDataStore.h.

364 {
366 }

◆ sysApplySystematicVariation()

StatusCode CP::NNJvtEfficiencyTool::sysApplySystematicVariation ( const CP::SystematicSet & systConfig)
overridevirtual

effects: configure this tool for the given list of systematic variations.

systConfig is guaranteed to contain only supported systematics. guarantee: basic failures: out of memory II failures: unsupported combination of supported systematics failures: other tool specific errors

Implements CP::SystematicsTool.

Definition at line 20 of file NNJvtEfficiencyTool.cxx.

20 {
21 if (sys.find(NNJvtEfficiencyUp) != sys.end())
23 else if (sys.find(NNJvtEfficiencyDown) != sys.end())
25 else
27 return StatusCode::SUCCESS;
28 }

◆ sysInitialize()

virtual StatusCode AthCommonDataStore< AthCommonMsg< AlgTool > >::sysInitialize ( )
overridevirtualinherited

Perform system initialization for an algorithm.

We override this to declare all the elements of handle key arrays at the end of initialization. See comments on updateVHKA.

Reimplemented in asg::AsgMetadataTool, AthCheckedComponent< AthAlgTool >, AthCheckedComponent<::AthAlgTool >, and DerivationFramework::CfAthAlgTool.

◆ sysStart()

virtual StatusCode AthCommonDataStore< AthCommonMsg< AlgTool > >::sysStart ( )
overridevirtualinherited

Handle START transition.

We override this in order to make sure that conditions handle keys can cache a pointer to the conditions container.

◆ testInvariant()

void CP::SystematicsTool::testInvariant ( ) const
inherited

effects: test the invariance of this object guarantee: no-fail

Definition at line 165 of file SystematicsTool.cxx.

165 {
166
167 //RCU_INVARIANT( this != 0 );
168 }

◆ updateVHKA()

void AthCommonDataStore< AthCommonMsg< AlgTool > >::updateVHKA ( Gaudi::Details::PropertyBase & )
inlineinherited

Definition at line 308 of file AthCommonDataStore.h.

308 {
309 // debug() << "updateVHKA for property " << p.name() << " " << p.toString()
310 // << " size: " << m_vhka.size() << endmsg;
311 for (auto &a : m_vhka) {
313 for (auto k : keys) {
314 k->setOwner(this);
315 }
316 }
317 }
std::vector< SG::VarHandleKeyArray * > m_vhka

Member Data Documentation

◆ m_accIsHS

std::optional<SG::AuxElement::ConstAccessor<char> > CP::JvtEfficiencyToolBase::m_accIsHS
protectedinherited

Definition at line 63 of file JvtEfficiencyToolBase.h.

◆ m_affectingSystematics

SystematicSet CP::SystematicsTool::m_affectingSystematics
protectedinherited

description: members directly corresponding to accessors

Definition at line 146 of file SystematicsTool.h.

◆ m_appliedSysSigma

int CP::JvtEfficiencyToolBase::m_appliedSysSigma = 0
protectedinherited

Definition at line 61 of file JvtEfficiencyToolBase.h.

◆ m_appliedSystematics

SystematicSet* CP::SystematicsTool::m_appliedSystematics
privateinherited

description: pointer to currenty applied systematics

Definition at line 151 of file SystematicsTool.h.

◆ m_detStore

StoreGateSvc_t AthCommonDataStore< AthCommonMsg< AlgTool > >::m_detStore
privateinherited

Pointer to StoreGate (detector store by default)

Definition at line 393 of file AthCommonDataStore.h.

◆ m_doTruthRequirement

Gaudi::Property<bool> CP::JvtEfficiencyToolBase::m_doTruthRequirement
protectedinherited
Initial value:
{
this, "DoTruthReq", true,
"Use the truth-matching requirement. **Strongly** recommended"}

Definition at line 37 of file JvtEfficiencyToolBase.h.

37 {
38 this, "DoTruthReq", true,
39 "Use the truth-matching requirement. **Strongly** recommended"};

◆ m_dummySFError

Gaudi::Property<float> CP::JvtEfficiencyToolBase::m_dummySFError
protectedinherited
Initial value:
{
this, "DummySFError", 0.1, "The amount by which to vary the dummy SF"}

Definition at line 50 of file JvtEfficiencyToolBase.h.

50 {
51 this, "DummySFError", 0.1, "The amount by which to vary the dummy SF"};

◆ m_effHist

std::unique_ptr<TH2> CP::JvtEfficiencyToolBase::m_effHist
protectedinherited

Definition at line 56 of file JvtEfficiencyToolBase.h.

◆ m_etaAcc

SG::ConstAccessor<float> CP::JvtEfficiencyToolBase::m_etaAcc { m_jetEtaName }
protectedinherited

Definition at line 59 of file JvtEfficiencyToolBase.h.

59{ m_jetEtaName };
Gaudi::Property< std::string > m_jetEtaName

◆ m_evtStore

StoreGateSvc_t AthCommonDataStore< AthCommonMsg< AlgTool > >::m_evtStore
privateinherited

Pointer to StoreGate (event store by default)

Definition at line 390 of file AthCommonDataStore.h.

◆ m_file

Gaudi::Property<std::string> CP::NNJvtEfficiencyTool::m_file
private
Initial value:
{
this, "SFFile", "",
"The file containing the SF histograms. Set to the empty string to use dummy scale "
"factors."}

Definition at line 25 of file NNJvtEfficiencyTool.h.

25 {
26 this, "SFFile", "",
27 "The file containing the SF histograms. Set to the empty string to use dummy scale "
28 "factors."};

◆ m_jetContainer

Gaudi::Property<std::string> CP::JvtEfficiencyToolBase::m_jetContainer
protectedinherited
Initial value:
{
this, "JetContainer", "",
"The name of the jet container, used to correctly initialize the read handles"}

Definition at line 34 of file JvtEfficiencyToolBase.h.

34 {
35 this, "JetContainer", "",
36 "The name of the jet container, used to correctly initialize the read handles"};

◆ m_jetEtaName

Gaudi::Property<std::string> CP::JvtEfficiencyToolBase::m_jetEtaName
protectedinherited
Initial value:
{
this, "JetEtaName", "eta", "The name of the jet eta to use."}

Definition at line 53 of file JvtEfficiencyToolBase.h.

53 {
54 this, "JetEtaName", "eta", "The name of the jet eta to use."};

◆ m_jvtHist

std::unique_ptr<TH2> CP::JvtEfficiencyToolBase::m_jvtHist
protectedinherited

Definition at line 55 of file JvtEfficiencyToolBase.h.

◆ m_maxEta

Gaudi::Property<float> CP::JvtEfficiencyToolBase::m_maxEta
protectedinherited
Initial value:
{
this, "MaxEtaForJvt", 2.5, "All jets with |eta| above this are out of range"}

Definition at line 44 of file JvtEfficiencyToolBase.h.

44 {
45 this, "MaxEtaForJvt", 2.5, "All jets with |eta| above this are out of range"};

◆ m_maxPtForJvt

Gaudi::Property<float> CP::JvtEfficiencyToolBase::m_maxPtForJvt
protectedinherited
Initial value:
{
this, "MaxPtForJvt", 60e3, "All jets with pT above this are out of range"}

Definition at line 48 of file JvtEfficiencyToolBase.h.

48 {
49 this, "MaxPtForJvt", 60e3, "All jets with pT above this are out of range"};

◆ m_minEta

Gaudi::Property<float> CP::JvtEfficiencyToolBase::m_minEta
protectedinherited
Initial value:
{
this, "MinEtaForJvt", -1, "All jets with |eta| below this are out of range"}

Definition at line 42 of file JvtEfficiencyToolBase.h.

42 {
43 this, "MinEtaForJvt", -1, "All jets with |eta| below this are out of range"};

◆ m_minPtForJvt

Gaudi::Property<float> CP::JvtEfficiencyToolBase::m_minPtForJvt
protectedinherited
Initial value:
{
this, "MinPtForJvt", 20e3, "All jets with pT below this are out of range"}

Definition at line 46 of file JvtEfficiencyToolBase.h.

46 {
47 this, "MinPtForJvt", 20e3, "All jets with pT below this are out of range"};

◆ m_recommendedSystematics

SystematicSet CP::SystematicsTool::m_recommendedSystematics
protectedinherited

Definition at line 147 of file SystematicsTool.h.

◆ m_systFilterMap

std::unordered_map<SystematicSet, SystematicSet> CP::SystematicsTool::m_systFilterMap
privateinherited

map of cached systematics filtering

Definition at line 154 of file SystematicsTool.h.

◆ m_truthHSLabel

SG::ReadDecorHandleKey<xAOD::JetContainer> CP::JvtEfficiencyToolBase::m_truthHSLabel
protectedinherited
Initial value:
{
this, "TruthHSLabel", "isJvtHS", "Label for truth-matched jets"}

Definition at line 40 of file JvtEfficiencyToolBase.h.

40 {
41 this, "TruthHSLabel", "isJvtHS", "Label for truth-matched jets"};

◆ m_useDummySFs

bool CP::JvtEfficiencyToolBase::m_useDummySFs {false}
protectedinherited

Definition at line 57 of file JvtEfficiencyToolBase.h.

57{false};

◆ m_varHandleArraysDeclared

bool AthCommonDataStore< AthCommonMsg< AlgTool > >::m_varHandleArraysDeclared
privateinherited

Definition at line 399 of file AthCommonDataStore.h.

◆ m_vhka

std::vector<SG::VarHandleKeyArray*> AthCommonDataStore< AthCommonMsg< AlgTool > >::m_vhka
privateinherited

Definition at line 398 of file AthCommonDataStore.h.

◆ m_wp

Gaudi::Property<std::string> CP::NNJvtEfficiencyTool::m_wp
private
Initial value:
{
this, "WorkingPoint", "FixedEffPt", "The working point to use."}

Definition at line 23 of file NNJvtEfficiencyTool.h.

23 {
24 this, "WorkingPoint", "FixedEffPt", "The working point to use."};

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