ATLAS Offline Software
Loading...
Searching...
No Matches
BTaggingEfficiencyTool Class Reference

#include <BTaggingEfficiencyTool.h>

Inheritance diagram for BTaggingEfficiencyTool:

Classes

struct  SystInfo

Public Member Functions

 BTaggingEfficiencyTool (const std::string &name)
 Create a proper constructor for Athena.
virtual ~BTaggingEfficiencyTool ()
 Create a constructor for standalone usage.
CP::CorrectionCode getEigenRecompositionCoefficientMap (const std::string &label, std::map< std::string, std::map< std::string, float > > &coefficientMap)
 Run EigenvectorRecomposition method and get the coefficient map.
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
Methods implementing the main jet-by-jet access in the xAOD context
CP::CorrectionCode getScaleFactor (const xAOD::Jet &jet, float &sf)
 Computes the data/MC efficiency scale factor for the given jet.
CP::CorrectionCode getEfficiency (const xAOD::Jet &jet, float &eff)
 Computes the data efficiency for the given jet.
CP::CorrectionCode getInefficiency (const xAOD::Jet &jet, float &eff)
 Computes the data inefficiency for the given jet.
CP::CorrectionCode getInefficiencyScaleFactor (const xAOD::Jet &jet, float &sf)
 Computes the data/MC inefficiency scale factor for the given jet.
CP::CorrectionCode getMCEfficiency (const xAOD::Jet &jet, float &eff)
 Computes the MC efficiency for the given jet.
Methods equivalent to those above but not relying on the xAOD format
CP::CorrectionCode getScaleFactor (int flavour, const Analysis::CalibrationDataVariables &v, float &sf)
 Computes the data/MC efficiency scale factor for the jet, given its kinematics, (possibly) tagger weight and truth flavour.
CP::CorrectionCode getEfficiency (int flavour, const Analysis::CalibrationDataVariables &v, float &eff)
 Computes the data efficiency for the jet, given its kinematics, (possibly) tagger weight and truth flavour.
CP::CorrectionCode getInefficiency (int flavour, const Analysis::CalibrationDataVariables &v, float &eff)
 Computes the data inefficiency for the jet, given its kinematics, (possibly) tagger weight and truth flavour.
CP::CorrectionCode getInefficiencyScaleFactor (int flavour, const Analysis::CalibrationDataVariables &v, float &sf)
 Computes the data/MC inefficiency scale factor for the jet, given its kinematics, (possibly) tagger weight and truth flavour.
CP::CorrectionCode getMCEfficiency (int flavour, const Analysis::CalibrationDataVariables &v, float &eff)
 Computes the MC efficiency for the jet, given its kinematics, (possibly) tagger weight and truth flavour.
CP::CorrectionCode getMCEfficiencyONNX (const std::vector< std::vector< float > > &node_feat, std::vector< float > &effAllJet)
 Computes the MC efficiency of the jets in a given event.
CP::CorrectionCode getMCEfficiencyONNX (const std::vector< std::vector< float > > &node_feat, std::vector< std::vector< float > > &effAllJetAllWp)
 Computes the MC efficiency of the jets in a given event.
Other methods implementing the IBTagEfficiencyTool interface
StatusCode initialize ()
 Initialise the tool.
StatusCode applySystematicVariation (const CP::SystematicSet &set)
 Set the tool to return "shifted" values.
CP::SystematicSet affectingSystematics () const
 Return a list of all systematic variations supported by this tool.
CP::SystematicSet recommendedSystematics () const
 Return a list of "recommended" systematic variations supported by this tool.
bool isAffectedBySystematic (const CP::SystematicVariation &systematic) const
 Returns whether or not the given systematic variation is supported by this tool.
bool setMapIndex (const std::string &flavour, unsigned int index)
 Specify the "map index" to be used for the given jet flavour (at initialisation time it will be set to 0).
bool setMapIndex (unsigned int dsid)
query methods

Utility method returning a detailed list of systematics (including the flavours to which they apply)

const std::map< CP::SystematicVariation, std::vector< std::string > > listSystematics () const
const std::string & getTaggerName () const
 Retrieve the name of the tagger (as specified in the calibration file)
const std::string & getOperatingPoint () const
 Retrieve the operating point (as specified in the calibration file)
const std::string & getJetAuthor () const
 Retrieve the jet collection name (as specified in the calibration file) for which this tool was setup.
bool applySystematics () const
 Specify whether any systematic variation is being used at present.
std::map< std::string, std::vector< std::string > > listScaleFactorSystematics (bool named=false) const
 This merely passes on the request to the underlying CDI object (listSystematics() cannot be used here, as corresponding CP::SystematicVariation objects may not exist).
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

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.

Private Types

typedef ServiceHandle< StoreGateSvcStoreGateSvc_t

Private Member Functions

bool addSystematics (const std::vector< std::string > &systematicNames, unsigned int flavourID, Analysis::Uncertainty uncType)
 add entries to the systematics registry
std::vector< std::string > makeEigenSyst (const std::string &flav, int number, const std::string &suffix)
 generate names for the eigenvector variations for the given jet flavour
bool getIndices (unsigned int flavour, unsigned int &sf, unsigned int &ef) const
 helper function for retrieving object indices
std::string getLabel (int flavourID) const
 convert integer flavour index to its string equivalent
unsigned int getFlavourID (const std::string &label, bool conventional=true) const
 convert string flavour to its integer index equivalent
bool fillVariables (const xAOD::Jet &jet, Analysis::CalibrationDataVariables &x) const
 Fill the Analysis::CalibrationDataVariables struct with relevant information pertaining to the jet considered.
bool fillVariables (const double jetPt, const double jetEta, const double jetTagWeight, Analysis::CalibrationDataVariables &x) const
 Fill the Analysis::CalibrationDataVariables struct with relevant information pertaining to the jet considered.
Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T, V, H > &hndl, const SG::VarHandleKeyType &)
 specialization for handling Gaudi::Property<SG::VarHandleKey>

Private Attributes

std::shared_ptr< Analysis::CalibrationDataInterfaceROOTm_CDI
 pointer to the object doing the actual work
std::unique_ptr< SaltModelm_saltModel
 pointer to the onnx tool
Gaudi::Property< bool > m_useFlex {this, "useFlexibleConfig", false, "Setup the flexible configuration of the xAODBTaggingEfficiencyTool with alternate labeling"}
std::vector< std::string > m_flex_labels
std::vector< unsigned int > m_flex_label_integers
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
core configuration properties (set at initalization time and not modified afterwards)
asg::AnaToolHandle< IBTaggingSelectionToolm_selectionTool
 we need access to a BTaggingSelectionTool, at least for DL1 weight computation
Gaudi::Property< std::string > m_SFFile {this, "ScaleFactorFileName", ftag::defaults::cdi_path, "name of the official scale factor calibration CDI file (uses PathResolver)"}
 name of the data/MC efficiency scale factor calibration file (may be changed by the PathResolver)
std::string m_SFFileFull
Gaudi::Property< std::string > m_SelectionCDIFile {this, "SelectionCDIFileName", "", "name of the CDI file to be used to configure the selection tool if needed, will use the SF CDI file by default"}
Gaudi::Property< std::string > m_EffFile {this, "EfficiencyFileName", "", "name of optional user-provided MC efficiency CDI file"}
 name of the optional MC efficiency file (may be changed by the PathResolver)
Gaudi::Property< std::string > m_EffConfigFile {this, "EfficiencyConfig", "", "name of config file specifying which efficiency map to use with a given samples DSID"}
Gaudi::Property< std::string > m_SFNamesB {this, "ScaleFactorBCalibration", "default", "name of b-jet scale factor calibration object"}
 names of the data/MC scale factor calibrations
Gaudi::Property< std::string > m_SFNamesC {this, "ScaleFactorCCalibration", "default", "name of c-jet scale factor calibration object"}
Gaudi::Property< std::string > m_SFNamesT {this, "ScaleFactorTCalibration", "default", "name of tau-jet scale factor calibration object"}
Gaudi::Property< std::string > m_SFNamesLight {this, "ScaleFactorLightCalibration", "default", "name of light-flavour jet scale factor calibration object"}
std::map< std::string, std::string > m_SFNames
Gaudi::Property< std::string > m_EVReductionB {this, "EigenvectorReductionB", "Loose", "b-jet scale factor Eigenvector reduction strategy; choose between 'Loose', 'Medium', 'Tight'"}
 specification of the eigenvector reduction strategy (if eigenvectors are used)
Gaudi::Property< std::string > m_EVReductionC {this, "EigenvectorReductionC", "Loose", "c-jet scale factor Eigenvector reduction strategy; choose between 'Loose', 'Medium', 'Tight'"}
Gaudi::Property< std::string > m_EVReductionLight {this, "EigenvectorReductionLight", "Loose", "light-flavour jet scale factor Eigenvector reduction strategy; choose between 'Loose', 'Medium', 'Tight'"}
std::map< std::string, std::string > m_EVReduction
Gaudi::Property< std::string > m_EffNamesB {this, "EfficiencyBCalibrations", "", "(semicolon-separated) name(s) of b-jet efficiency object(s)"}
 semicolon-separated lists of MC efficiency parametrisation names
Gaudi::Property< std::string > m_EffNamesC {this, "EfficiencyCCalibrations", "", "(semicolon-separated) name(s) of c-jet efficiency object(s)"}
Gaudi::Property< std::string > m_EffNamesT {this, "EfficiencyTCalibrations", "", "(semicolon-separated) name(s) of tau-jet efficiency object(s)"}
Gaudi::Property< std::string > m_EffNamesLight {this, "EfficiencyLightCalibrations", "", "(semicolon-separated) name(s) of light-flavour-jet efficiency object(s)"}
std::map< std::string, std::string > m_EffNames
Gaudi::Property< std::string > m_effName {this, "EfficiencyCalibrations", "default", "default for all flavors"}
Gaudi::Property< std::string > m_excludeFromEV {this, "ExcludeFromEigenVectorTreatment", "", "(semicolon-separated) names of uncertainties to be excluded from all eigenvector decompositions (if used)"}
 semicolon-separated list of uncertainties to be excluded from the eigenvector variation procedure for all flavours
Gaudi::Property< std::string > m_excludeFlvFromEVB {this, "ExcludeFromEigenVectorBTreatment", "", "(semicolon-separated) names of uncertainties to be excluded from b-jet eigenvector decompositions (if used)"}
 semicolon-separated list of uncertainties to be excluded from the eigenvector variation procedure for b, c, and light-flavour jets
Gaudi::Property< std::string > m_excludeFlvFromEVC {this, "ExcludeFromEigenVectorCTreatment", "", "(semicolon-separated) names of uncertainties to be excluded from c-jet eigenvector decompositions (if used)"}
Gaudi::Property< std::string > m_excludeFlvFromEVLight {this, "ExcludeFromEigenVectorLightTreatment", "", "(semicolon-separated) names of uncertainties to be excluded from light-flavour-jet eigenvector decompositions (if used)"}
std::map< std::string, std::string > m_excludeFlvFromEV
Gaudi::Property< std::string > m_uncertaintySuffixesB {this, "UncertaintyBSuffix", "", "optional suffix for b-jet uncertainty naming"}
 optional (per-flavour) suffix that can be used to decorrelate uncertainties (between flavours, or -in case of a result from different runs- between periods)
Gaudi::Property< std::string > m_uncertaintySuffixesC {this, "UncertaintyCSuffix", "", "optional suffix for c-jet uncertainty naming"}
Gaudi::Property< std::string > m_uncertaintySuffixesT {this, "UncertaintyTSuffix", "", "optional suffix for tau-jet uncertainty naming"}
Gaudi::Property< std::string > m_uncertaintySuffixesLight {this, "UncertaintyLightSuffix", "", "optional suffix for light-flavour-jet uncertainty naming"}
std::map< std::string, std::string > m_uncertaintySuffixes
bool m_using_conventional_labels
Gaudi::Property< std::string > m_SFName_flex {this, "FlexibleScaleFactorCalibrations", "", "(semicolon-separated) name of scale factor calibration object for (0,1,2..) indexed flavour labels, e.g. '0:default;1:default;2:default;3:default'"}
Gaudi::Property< std::string > m_EVReduction_flex {this, "FlexibleEigenvectorReduction", "", "(semicolon-separated) list of eigenvector reduction strategy for (0,1,2..) indexed flavour labels; choose between 'Loose', 'Medium', 'Tight' for different labels, e.g. '0:Loose;1:Loose;2:Loose'"}
Gaudi::Property< std::string > m_EffNames_flex {this, "FlexibleEfficiencyCalibrations", "", "(semicolon-separated) name(s) of efficiency object(s) names for (0,1,2..) indexed flavour labels, e.g. '0:default;1:default;2:default;3:default'"}
Gaudi::Property< std::string > m_uncertaintySuffixes_flex {this, "FlexibleUncertaintySuffix", "", "optional (semicolon-separated) list of suffixes for (0,1,2..) indexed flavour label uncertainty naming, e.g. '0:;1:;2:;3:'"}
Gaudi::Property< std::string > m_excludeFlvFromEV_flex {this, "FlexibleExcludeFromEVTreatment", "", "(semicolon-separated) names of uncertainties to be excluded from (0,1,2..) indexed flavour eigenvector decompositions (if used), e.g. '0:;1:;2:;3:'"}
Gaudi::Property< std::string > m_taggerName {this, "TaggerName", ftag::defaults::tagger, "tagging algorithm name as specified in CDI file"}
 tagger name
Gaudi::Property< std::string > m_selectionTaggerName {this, "SelectionTaggerName", "", "tagging algorithm name as specified in selection CDI file, will use TaggerName by default"}
Gaudi::Property< std::string > m_OP {this, "OperatingPoint", ftag::defaults::pcbt_op, "operating point as specified in CDI file"}
 operating point
Gaudi::Property< std::string > m_jetAuthor {this, "JetAuthor", ftag::defaults::jet_collection, "jet collection & JVF/JVT specification in CDI file"}
 jet collection name
Gaudi::Property< float > m_minPt {this, "MinPt", 0., "minimum jet pT cut"}
 minimum jet pT
Gaudi::Property< std::string > m_systStrategy {this, "SystematicsStrategy", ftag::defaults::strategy, "name of systematics model; presently choose between 'SFEigen' and 'Envelope'"}
 systematics model to be used (current choices are "SFEigen", "SFEigenRefined", and "Envelope") // <-----— Addoing "SFGlobalEigen" to the list
Gaudi::Property< bool > m_useDevFile
 if true, attempt to retrieve the data/MC efficiency scale factor calibration files from the @PathResolver development area
Gaudi::Property< bool > m_coneFlavourLabel {this, "ConeFlavourLabel", true, "specify whether or not to use the cone-based flavour labelling instead of the default ghost association based labelling"}
 if true, use cone-based labelling (as opposed to ghost association)
Gaudi::Property< bool > m_extFlavourLabel {this, "ExtendedFlavourLabel", false, "specify whether or not to use an 'extended' flavour labelling (allowing for multiple HF hadrons or perhaps partons)"}
 if true, use an 'extended' labelling (allowing for multiple HF hadrons -or perhaps partons- in the jet)
Gaudi::Property< bool > m_useRecommendedEVExclusions {this, "ExcludeRecommendedFromEigenVectorTreatment", false, "specify whether or not to add recommended lists to the user specified eigenvector decomposition exclusion lists"}
 if true, extract pre-set lists of uncertainties to be recommended from the EV decomposition (in addition to user specified ones)
Gaudi::Property< bool > m_ignoreOutOfValidityRange {this, "IgnoreOutOfValidityRange", false, "ignore out-of-extrapolation-range errors as returned by the underlying tool"}
 if true, ignore out-of-extrapolation range errors (i.e., return CorrectionCode::Ok if these are encountered)
Gaudi::Property< bool > m_useCTag {this, "useCTagging", false, "Enabled only for FixedCut or Continuous WPs: define wether the cuts refer to b-tagging or c-tagging"}
 if false, suppress any non-error/warning printout from the underlying tool 1D tagging only: define wether the cuts refer to b-tagging or c-tagging
Gaudi::Property< bool > m_readFromBTaggingObject {this, "readFromBTaggingObject", false, "Enabled to access btagging scores from xAOD::BTagging object; Can be disabled for GN2v01 to access the scores from the jet itself."}
Gaudi::Property< std::string > m_pathToONNX {this, "pathToONNX", "", "path to the onnx file that will be used for inference"}
 if this string is empty, the onnx tool won't be created
Cached variables
bool m_initialised
 flag to indicate tool is initialized correctly when set
bool m_applySyst
SystInfo m_applyThisSyst
std::map< CP::SystematicVariation, SystInfom_systematicsInfo
CP::SystematicSet m_systematics
bool m_isContinuous
bool m_isContinuous2D
std::map< std::string, unsigned int > m_mapIndices
std::map< unsigned int, unsigned int > m_SFIndices
 actual information identifying scale factor calibration objects
std::map< unsigned int, unsigned int > m_EffIndices
 actual information identifying efficiency calibration objects
std::map< unsigned int, unsigned int > m_DSID_to_MapIndex

Detailed Description

Definition at line 31 of file BTaggingEfficiencyTool.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

◆ BTaggingEfficiencyTool()

BTaggingEfficiencyTool::BTaggingEfficiencyTool ( const std::string & name)

Create a proper constructor for Athena.

Create a constructor for standalone usage

Definition at line 126 of file BTaggingEfficiencyTool.cxx.

126 : asg::AsgTool( name ), m_selectionTool("") {
127 // initialise some variables needed for caching
128 // TODO : add configuration of the mapIndices - rather than just using the default of 0
129 //m_mapIndices["Light"] = m_mapIndices["T"] = m_mapIndices["C"] = m_mapIndices["B"] = 0;
130 m_initialised = false;
131 m_applySyst = false;
132 m_isContinuous = false;
133 m_isContinuous2D = false;
135
136 // declare the selection tool to be private (not absolutely sure this is needed?)
137 m_selectionTool.declarePropertyFor(this, "BTaggingSelectionTool", "selection tool to be used internally");
138}
asg::AnaToolHandle< IBTaggingSelectionTool > m_selectionTool
we need access to a BTaggingSelectionTool, at least for DL1 weight computation
bool m_initialised
flag to indicate tool is initialized correctly when set

◆ ~BTaggingEfficiencyTool()

BTaggingEfficiencyTool::~BTaggingEfficiencyTool ( )
virtual

Create a constructor for standalone usage.

Definition at line 140 of file BTaggingEfficiencyTool.cxx.

140 {
141 //delete m_CDI;
142}

Member Function Documentation

◆ addSystematics()

bool BTaggingEfficiencyTool::addSystematics ( const std::vector< std::string > & systematicNames,
unsigned int flavourID,
Analysis::Uncertainty uncType )
private

add entries to the systematics registry

Definition at line 1403 of file BTaggingEfficiencyTool.cxx.

1403 {
1404 for (int i=0, n=systematicNames.size(); i<n; ++i) {
1405 const std::string systName = systematicNames[i];
1406 SystematicVariation up(systName,1);
1407 SystematicVariation down(systName,-1);
1408 std::map<SystematicVariation,SystInfo>::iterator iter = m_systematicsInfo.find(up);
1409 if (iter == m_systematicsInfo.end()) {
1410 // First case: new variation
1411 SystInfo info;
1412 info.isUp = true;
1413 info.uncType = uncType;
1414 info.indexMap[flavourID] = i;
1416 ATH_MSG_VERBOSE("addSystematics: adding " << systName << " for flavour " << getLabel(flavourID));
1417 info.isUp = false;
1418 m_systematicsInfo[down]=info;
1419 } else {
1420 // Second case: already known variation. This can happen if a variation applies to more than one
1421 // jet flavour. Check that indeed it's not registered yet for the requested flavour.
1422 SystInfo info = iter->second; // make a copy
1423 std::map<unsigned int, unsigned int>::const_iterator indIter = info.indexMap.find(flavourID);
1424 if (indIter != info.indexMap.end()) {
1425 ATH_MSG_ERROR("addSystematics : flavourID " << flavourID << " is already in the map for uncertainty '" << systName << "', ignoring");
1426 continue;
1427 } else {
1428 info.indexMap[flavourID] = i;
1430 ATH_MSG_VERBOSE("addSystematics: adding " << systName << " for flavour " << getLabel(flavourID));
1431 info.isUp = false;
1432 m_systematicsInfo[down] = info;
1433 }
1434 }
1435 }
1436 return true;
1437}
#define ATH_MSG_ERROR(x)
#define ATH_MSG_VERBOSE(x)
std::map< CP::SystematicVariation, SystInfo > m_systematicsInfo
std::string getLabel(int flavourID) const
convert integer flavour index to its string equivalent

◆ affectingSystematics()

SystematicSet BTaggingEfficiencyTool::affectingSystematics ( ) const
virtual

Return a list of all systematic variations supported by this tool.

Note that this list depends on the uncertainty model used, and on the (dynamic) configuration of the eigenvector variations (if this uncertainty model is used).

Implements CP::IReentrantSystematicsTool.

Definition at line 1101 of file BTaggingEfficiencyTool.cxx.

1101 {
1102 return m_systematics;
1103}

◆ applySystematics()

bool BTaggingEfficiencyTool::applySystematics ( ) const
inline

Specify whether any systematic variation is being used at present.

Definition at line 197 of file BTaggingEfficiencyTool.h.

197{ return m_applySyst;}

◆ applySystematicVariation()

StatusCode BTaggingEfficiencyTool::applySystematicVariation ( const CP::SystematicSet & set)
virtual

Set the tool to return "shifted" values.

Note that only single-parameter variations or empty sets (the latter are to revert to nominal results) are supported at present; StatusCode::FAILURE will be returned for variations of multiple parameters or variations that aren't recognised.

Implements CP::ISystematicsTool.

Definition at line 1211 of file BTaggingEfficiencyTool.cxx.

1211 {
1212 // If the user is doing the right thing, no need to use the costly filterForAffectingSystematics
1213 // i.e if only 1 variation passed and this variation is in the map. Else, resort to full logic.
1214 if (systConfig.size() == 1 ) {
1215 auto mapIter = m_systematicsInfo.find(*(systConfig.begin()));
1216 if (mapIter != m_systematicsInfo.end()) {
1217 m_applySyst = true;
1218 m_applyThisSyst = mapIter->second;
1219 ATH_MSG_VERBOSE("variation '" << systConfig.begin()->name() << "' applied successfully");
1220 return StatusCode::SUCCESS;
1221 }
1222 }
1223
1224 // First filter out any systematics that do not apply to us
1225 SystematicSet filteredSysts;
1226 if (SystematicSet::filterForAffectingSystematics(systConfig, affectingSystematics(), filteredSysts) != StatusCode::SUCCESS) {
1227 ATH_MSG_ERROR("received unsupported systematics: " << systConfig.name());
1228 return StatusCode::FAILURE;
1229 }
1230 // check the size of the remaining (filtered) SystematicSet
1231 if (filteredSysts.size() == 0) {
1232 // If it is 0 then turn off systematics
1233 ATH_MSG_VERBOSE("empty systematics set; nothing to be done");
1234 m_applySyst = false;
1235 return StatusCode::SUCCESS;
1236 } else if (filteredSysts.size() > 1) {
1237 // Restriction: we allow only a single systematic variation affecting b-tagging
1238 ATH_MSG_WARNING("more than a single b-tagging systematic variation requested but not (yet) supported");
1239 return StatusCode::FAILURE;
1240 } else {
1241 // Interpret the (single) remaining variation
1242 SystematicVariation var = *(filteredSysts.begin());
1243 auto mapIter = m_systematicsInfo.find(var);
1244 if (mapIter == m_systematicsInfo.end()) {
1245 ATH_MSG_WARNING("variation '" << var.name() << "' not found! Cannot apply");
1246 return StatusCode::FAILURE;
1247 }
1248 m_applySyst = true;
1249 m_applyThisSyst = mapIter->second;
1250 ATH_MSG_VERBOSE("variation '" << var.name() << "' applied successfully");
1251 }
1252 return StatusCode::SUCCESS;
1253}
#define ATH_MSG_WARNING(x)
CP::SystematicSet affectingSystematics() const
Return a list of all systematic variations supported by this tool.
const_iterator begin() const
description: const iterator to the beginning of the set
size_t size() const
returns: size of the set
static StatusCode filterForAffectingSystematics(const SystematicSet &systConfig, const SystematicSet &affectingSystematics, SystematicSet &filteredSystematics)
description: filter the systematics for the affected systematics returns: success guarantee: strong f...

◆ 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

◆ fillVariables() [1/2]

bool BTaggingEfficiencyTool::fillVariables ( const double jetPt,
const double jetEta,
const double jetTagWeight,
Analysis::CalibrationDataVariables & x ) const
private

Fill the Analysis::CalibrationDataVariables struct with relevant information pertaining to the jet considered.

Definition at line 1288 of file BTaggingEfficiencyTool.cxx.

1289{
1290 x.jetPt = jetPt;
1291 x.jetEta = jetEta;
1292 x.jetTagWeight = jetTagWeight;
1293 x.jetAuthor = m_jetAuthor;
1294
1295 return true;
1296}
#define x
Gaudi::Property< std::string > m_jetAuthor
jet collection name

◆ fillVariables() [2/2]

bool BTaggingEfficiencyTool::fillVariables ( const xAOD::Jet & jet,
Analysis::CalibrationDataVariables & x ) const
private

Fill the Analysis::CalibrationDataVariables struct with relevant information pertaining to the jet considered.

Returns
false if the requested information cannot be retrieved (this should never happen except if "continuous tagging" is used and the no b-tagging was applied to the jet)

Definition at line 1257 of file BTaggingEfficiencyTool.cxx.

1258{
1259 x.jetPt = jet.pt();
1260 x.jetEta = jet.eta();
1261 x.jetTagWeight = 0.;
1262 x.jetAuthor = m_jetAuthor;
1263 //bool weightOK = true;
1264
1265 if (m_isContinuous2D){
1266 x.jetTagWeight = m_selectionTool->getQuantile(jet)+0.5;
1267 }
1268 else if (m_isContinuous) {
1271 if (!tagInfo) return false;
1272 }
1273 // For now, we defer the tag weight computation to the selection tool only in the case of DL1* (this is likely to be revisited)
1274 if (m_taggerName.value().find("DL1") != std::string::npos ||
1275 m_taggerName.value().find("GN1") != std::string::npos ||
1276 m_taggerName.value().find("GN2") != std::string::npos) {
1277 return (m_selectionTool->getTaggerWeight(jet, x.jetTagWeight, m_useCTag) == CP::CorrectionCode::Ok);
1278 } else {
1279 ATH_MSG_ERROR("BTaggingEfficiencyTool doesn't support tagger: "+m_taggerName);
1280 return CorrectionCode::Error;
1281 }
1282 }
1283
1284 return true;
1285}
Gaudi::Property< bool > m_readFromBTaggingObject
Gaudi::Property< std::string > m_taggerName
tagger name
Gaudi::Property< bool > m_useCTag
if false, suppress any non-error/warning printout from the underlying tool 1D tagging only: define we...
@ Ok
The correction was done successfully.
@ Error
Some error happened during the object correction.
virtual double pt() const
The transverse momentum ( ) of the particle.
Definition Jet_v1.cxx:44
virtual double eta() const
The pseudorapidity ( ) of the particle.
Definition Jet_v1.cxx:49
const BTagging * getBTagging(const SG::AuxElement &part)
Access the default xAOD::BTagging object associated to an object.
BTagging_v1 BTagging
Definition of the current "BTagging version".
Definition BTagging.h:17

◆ getEfficiency() [1/2]

CorrectionCode BTaggingEfficiencyTool::getEfficiency ( const xAOD::Jet & jet,
float & eff )
virtual

Computes the data efficiency for the given jet.

The tagger and operating point under consideration are part of the configuration and hence aren't function arguments.

Implements IBTaggingEfficiencyTool.

Definition at line 789 of file BTaggingEfficiencyTool.cxx.

790{
792
793 // get the btag label
795
796 Analysis::CalibrationDataVariables vars;
797
798 if (! fillVariables(jet, vars)) {
799 ATH_MSG_ERROR("unable to fill variables required for efficiency evaluation");
801 }
802
803 return getEfficiency(flavour, vars, eff);
804}
CP::CorrectionCode getEfficiency(const xAOD::Jet &jet, float &eff)
Computes the data efficiency for the given jet.
Gaudi::Property< bool > m_extFlavourLabel
if true, use an 'extended' labelling (allowing for multiple HF hadrons -or perhaps partons- in the je...
Gaudi::Property< bool > m_coneFlavourLabel
if true, use cone-based labelling (as opposed to ghost association)
bool fillVariables(const xAOD::Jet &jet, Analysis::CalibrationDataVariables &x) const
Fill the Analysis::CalibrationDataVariables struct with relevant information pertaining to the jet co...
int jetFlavourLabel(const xAOD::Jet *jet, JetFlavourLabelType=ExclConeHadron)

◆ getEfficiency() [2/2]

CorrectionCode BTaggingEfficiencyTool::getEfficiency ( int flavour,
const Analysis::CalibrationDataVariables & v,
float & eff )

Computes the data efficiency for the jet, given its kinematics, (possibly) tagger weight and truth flavour.

The tagger and operating point under consideration are part of the configuration and hence aren't function arguments.

Definition at line 807 of file BTaggingEfficiencyTool.cxx.

809{
811
813
814 unsigned int sfindex = 0;
815 unsigned int efindex = 0;
816
817 if( !getIndices(flavour,sfindex,efindex)) {
818 ATH_MSG_ERROR("BTaggingEfficiencyTool::getEfficiency call to getIndices failed " << flavour << " " << sfindex << " " << efindex);
820 }
821 Uncertainty unc = None;
822 unsigned int unc_ind = 0;
823
824 if( m_applySyst) {
825
826 unc = m_applyThisSyst.uncType;
827 // if( m_applyThisSyst.isNamed) {
828 // unc = SFNamed;
829 // } else {
830 // unc = SFEigen;
831 // }
832
833 if(!m_applyThisSyst.getIndex(flavour,unc_ind)) {
834 ATH_MSG_VERBOSE("getEfficiency: requested variation cannot be applied to flavour " << getLabel(flavour) << ", returning nominal result");
835 unc = None;
836 }
837 }
838
839 CalibrationStatus status = m_CDI->getEfficiency(v,sfindex,efindex, unc,unc_ind,result, getLabel(flavour));
840 // Interpret what has been retrieved;
841 // this depends both on the uncertainty type and on the up/down setting.
842 eff = result.first; // central value or up variation
843 if (m_applySyst && unc != None) {
844 if (! (unc == SFEigen || unc == SFNamed)){
845 eff += m_applyThisSyst.isUp ? result.second : -result.second ;
846 } else if (!m_applyThisSyst.isUp) {
847 eff = result.second; // down variation
848 }
849 }
850
851 switch (status) {
852 case Analysis::kError:
853 ATH_MSG_ERROR("BTaggingEfficiencyTool::getEfficiency call to underlying code returned a kError!");
855 case Analysis::kRange:
859 default:
860 return CorrectionCode::Ok;
861 }
862}
@ None
bool getIndices(unsigned int flavour, unsigned int &sf, unsigned int &ef) const
helper function for retrieving object indices
Gaudi::Property< bool > m_ignoreOutOfValidityRange
if true, ignore out-of-extrapolation range errors (i.e., return CorrectionCode::Ok if these are encou...
std::shared_ptr< Analysis::CalibrationDataInterfaceROOT > m_CDI
pointer to the object doing the actual work
@ OutOfValidityRange
Input object is out of validity range.
@ Ok
The correction was done successfully.
std::pair< double, double > CalibResult
Uncertainty
specification of type information requested by the user
status
Definition merge.py:16

◆ getEigenRecompositionCoefficientMap()

CorrectionCode BTaggingEfficiencyTool::getEigenRecompositionCoefficientMap ( const std::string & label,
std::map< std::string, std::map< std::string, float > > & coefficientMap )
virtual

Run EigenvectorRecomposition method and get the coefficient map.

Calling EigenVectorRecomposition method in CDI and retrieve recomposition map. If success, coefficientMap would be filled and return ok. If failed, return error. label : flavour label coefficientMap: store returned coefficient map. This map could help expressing eigenvector NPs by linear combination of original uncertainty NPs in workspace level of physics analysis. The coefficient value is stored in the map in the format of: map<"Eigen_B_0", map<"[original uncertainty name]", [corresponding coefficient value]>>

Implements IBTaggingEfficiencyTool.

Definition at line 1183 of file BTaggingEfficiencyTool.cxx.

1183 {
1184 // Calling EigenVectorRecomposition method in CDI and retrieve recomposition map.
1185 // If success, coefficientMap would be filled and return ok.
1186 // If failed, return error.
1187 // label : flavour label
1188 // coefficientMap: store returned coefficient map.
1189 if (! m_initialised) {
1190 ATH_MSG_ERROR("BTaggingEfficiencyTool has not been initialised");
1191 return CorrectionCode::Error;
1192 }
1193 if(label.compare("B") != 0 &&
1194 label.compare("C") != 0 &&
1195 label.compare("T") != 0 &&
1196 label.compare("Light") != 0){
1197 ATH_MSG_ERROR("Flavour label is illegal! Label need to be B,C,T or Light.");
1198 return CorrectionCode::Error;
1199 }
1200 CalibrationStatus status = m_CDI->runEigenVectorRecomposition(m_jetAuthor, label, m_OP);
1201 if (status != Analysis::kSuccess){
1202 ATH_MSG_ERROR("Failure running EigenVectorRecomposition Method.");
1203 return CorrectionCode::Error;
1204 }
1205 coefficientMap = m_CDI->getEigenVectorRecompositionCoefficientMap();
1206 return CorrectionCode::Ok;
1207}
Gaudi::Property< std::string > m_OP
operating point
std::string label(const std::string &format, int i)
Definition label.h:19

◆ getFlavourID()

unsigned int BTaggingEfficiencyTool::getFlavourID ( const std::string & label,
bool conventional = true ) const
inlineprivate

convert string flavour to its integer index equivalent

Definition at line 262 of file BTaggingEfficiencyTool.h.

262 {
263 // always default to "light" = 0
264 if( label.size() <1)
265 return 0;
266 if (conventional){
267 switch (label[0]) {
268 case 'B':
269 return 5; break;
270 case 'C':
271 return 4; break;
272 case 'T':
273 return 15; break;
274 default:
275 return 0;
276 }
277 } else {
278 ATH_MSG_WARNING("Non-conventional label, return flavour ID = 0!");
279 return 0;
280 }
281 }

◆ getIndices()

bool BTaggingEfficiencyTool::getIndices ( unsigned int flavour,
unsigned int & sf,
unsigned int & ef ) const
private

helper function for retrieving object indices

Definition at line 1371 of file BTaggingEfficiencyTool.cxx.

1371 {
1372 auto mapIter = m_SFIndices.find(flavour);
1373 if(mapIter != m_SFIndices.end()) {
1374 sf = mapIter->second;
1375 } else {
1376 return false;
1377 }
1378
1379 mapIter = m_EffIndices.find(flavour);
1380 if(mapIter != m_EffIndices.end()) {
1381 ef = mapIter->second;
1382 } else {
1383 return false;
1384 }
1385 return true;
1386}
std::map< unsigned int, unsigned int > m_SFIndices
actual information identifying scale factor calibration objects
std::map< unsigned int, unsigned int > m_EffIndices
actual information identifying efficiency calibration objects

◆ getInefficiency() [1/2]

CorrectionCode BTaggingEfficiencyTool::getInefficiency ( const xAOD::Jet & jet,
float & eff )
virtual

Computes the data inefficiency for the given jet.

The tagger and operating point under consideration are part of the configuration and hence aren't function arguments.

Implements IBTaggingEfficiencyTool.

Definition at line 865 of file BTaggingEfficiencyTool.cxx.

866{
868
869 // get the btag label
871
872 Analysis::CalibrationDataVariables vars;
873 if (! fillVariables(jet, vars)) {
874 ATH_MSG_ERROR("unable to fill variables required for scale factor evaluation");
876 }
877
878 return getInefficiency (flavour, vars, eff);
879}
CP::CorrectionCode getInefficiency(const xAOD::Jet &jet, float &eff)
Computes the data inefficiency for the given jet.

◆ getInefficiency() [2/2]

CorrectionCode BTaggingEfficiencyTool::getInefficiency ( int flavour,
const Analysis::CalibrationDataVariables & v,
float & eff )

Computes the data inefficiency for the jet, given its kinematics, (possibly) tagger weight and truth flavour.

The tagger and operating point under consideration are part of the configuration and hence aren't function arguments.

Definition at line 882 of file BTaggingEfficiencyTool.cxx.

884{
886
888
889 unsigned int sfindex = 0;
890 unsigned int efindex = 0;
891
892 if( !getIndices(flavour,sfindex,efindex)) {
893 ATH_MSG_ERROR("BTaggingEfficiencyTool::getInefficiency call to getIndices failed " << flavour << " " << sfindex << " " << efindex);
895 }
896 Uncertainty unc = None;
897 unsigned int unc_ind = 0;
898 if( m_applySyst) {
899
900 unc = m_applyThisSyst.uncType;
901 // if( m_applyThisSyst.isNamed) {
902 // unc = SFNamed;
903 // } else {
904 // unc = SFEigen;
905 // }
906
907 if(!m_applyThisSyst.getIndex(flavour,unc_ind)) {
908 ATH_MSG_VERBOSE("getInefficiency: requested variation cannot be applied to flavour " << getLabel(flavour)
909 << ", returning nominal result");
910 unc = None;
911 }
912 }
913
914 CalibrationStatus status = m_CDI->getInefficiency(v, sfindex, efindex, unc, unc_ind, result, getLabel(flavour));
915 // Interpret what has been retrieved;
916 // this depends both on the uncertainty type and on the up/down setting.
917 // For the Total uncertainty, note also the sign change compared to e.g. getEfficiency().
918 eff = result.first; // central value or up variation
919 if (m_applySyst && unc != None) {
920 if (! (unc == SFEigen || unc == SFNamed))
921 eff += m_applyThisSyst.isUp ? -result.second : result.second ;
922 else if (!m_applyThisSyst.isUp) {
923 eff = result.second; // down variation
924 }
925 }
926
927 switch (status) {
928 case Analysis::kError:
929 ATH_MSG_ERROR("BTaggingEfficiencyTool::getInefficiency call to underlying code returned a kError!");
931 case Analysis::kRange:
935 default:
936 return CorrectionCode::Ok;
937 }
938}

◆ getInefficiencyScaleFactor() [1/2]

CorrectionCode BTaggingEfficiencyTool::getInefficiencyScaleFactor ( const xAOD::Jet & jet,
float & sf )
virtual

Computes the data/MC inefficiency scale factor for the given jet.

The tagger and operating point under consideration are part of the configuration and hence aren't function arguments.

Implements IBTaggingEfficiencyTool.

Definition at line 941 of file BTaggingEfficiencyTool.cxx.

942{
945 ATH_MSG_ERROR("Inefficiency SF should NOT be included for the Continous operation point");
947 }
948
949 // get the btag label
951
952 Analysis::CalibrationDataVariables vars;
953 if (! fillVariables(jet, vars)) {
954 ATH_MSG_ERROR("unable to fill variables required for scale factor evaluation");
956 }
957
958 return getInefficiencyScaleFactor( flavour, vars, sf);
959}
CP::CorrectionCode getInefficiencyScaleFactor(const xAOD::Jet &jet, float &sf)
Computes the data/MC inefficiency scale factor for the given jet.

◆ getInefficiencyScaleFactor() [2/2]

CorrectionCode BTaggingEfficiencyTool::getInefficiencyScaleFactor ( int flavour,
const Analysis::CalibrationDataVariables & v,
float & sf )
virtual

Computes the data/MC inefficiency scale factor for the jet, given its kinematics, (possibly) tagger weight and truth flavour.

The tagger and operating point under consideration are part of the configuration and hence aren't function arguments.

Implements IBTaggingEfficiencyTool.

Definition at line 962 of file BTaggingEfficiencyTool.cxx.

964{
967 ATH_MSG_ERROR("Inefficiency SF should NOT be included for the Continous operation point");
969 }
970
972
973 unsigned int sfindex = 0;
974 unsigned int efindex = 0;
975
976 if( !getIndices(flavour,sfindex,efindex)) {
977 ATH_MSG_ERROR("BTaggingEfficiencyTool::getInefficiencyScaleFactor call to getIndices failed " << flavour << " " << sfindex << " " << efindex);
979 }
980 Uncertainty unc=None;
981 unsigned int unc_ind=0;
982 if( m_applySyst) {
983
984 unc = m_applyThisSyst.uncType;
985 // if( m_applyThisSyst.isNamed) {
986 // unc = SFNamed;
987 // } else {
988 // unc = SFEigen;
989 // }
990
991 if(!m_applyThisSyst.getIndex(flavour,unc_ind)) {
992 ATH_MSG_VERBOSE("getInefficiencyScaleFactor: requested variation cannot be applied to flavour " << getLabel(flavour)
993 << ", returning nominal result");
994 unc = None;
995 }
996 }
997
998 CalibrationStatus status = m_CDI->getInefficiencyScaleFactor(v,sfindex,efindex, unc, unc_ind, result, getLabel(flavour));
999 // Interpret what has been retrieved;
1000 // this depends both on the uncertainty type and on the up/down setting.
1001 // For the Total uncertainty, note also the sign change compared to e.g. getScaleFactor().
1002 sf = result.first; // central value or up variation
1003 if (m_applySyst && unc != None) {
1004 if (! (unc == SFEigen || unc == SFNamed))
1005 sf += m_applyThisSyst.isUp ? -result.second : result.second ;
1006 else if (!m_applyThisSyst.isUp) {
1007 sf = result.second; // down variation
1008 }
1009 }
1010
1011 switch (status) {
1012 case Analysis::kError:
1013 ATH_MSG_ERROR("BTaggingEfficiencyTool::getInefficiencyScaleFactor call to underlying code returned a kError!");
1014 return CorrectionCode::Error;
1015 case Analysis::kRange:
1018 case Analysis::kSuccess:
1019 default:
1020 return CorrectionCode::Ok;
1021 }
1022}

◆ getJetAuthor()

const std::string & BTaggingEfficiencyTool::getJetAuthor ( ) const
inlinevirtual

Retrieve the jet collection name (as specified in the calibration file) for which this tool was setup.

Implements IBTaggingEfficiencyTool.

Definition at line 191 of file BTaggingEfficiencyTool.h.

191{ return m_jetAuthor;}

◆ 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()

◆ getLabel()

std::string BTaggingEfficiencyTool::getLabel ( int flavourID) const
inlineprivate

convert integer flavour index to its string equivalent

Definition at line 242 of file BTaggingEfficiencyTool.h.

242 {
243 switch(flavourID) {
244 case 5:
245 return "B";
246 break;
247 case 4:
248 return "C";
249 break;
250 case 15:
251 return "T";
252 break;
253 case 0:
254 return "Light";
255 break;
256 default:
257 return "Light";
258 }
259 }

◆ getMCEfficiency() [1/2]

CorrectionCode BTaggingEfficiencyTool::getMCEfficiency ( const xAOD::Jet & jet,
float & eff )
virtual

Computes the MC efficiency for the given jet.

The tagger and operating point under consideration are part of the configuration and hence aren't function arguments.

Implements IBTaggingEfficiencyTool.

Definition at line 1025 of file BTaggingEfficiencyTool.cxx.

1026{
1028
1029 // get the btag label
1031
1032 Analysis::CalibrationDataVariables vars;
1033 if (! fillVariables(jet, vars)) {
1034 ATH_MSG_ERROR("unable to fill variables required for scale factor evaluation");
1035 return CorrectionCode::Error;
1036 }
1037
1038 return getMCEfficiency( flavour, vars, eff);
1039}
CP::CorrectionCode getMCEfficiency(const xAOD::Jet &jet, float &eff)
Computes the MC efficiency for the given jet.

◆ getMCEfficiency() [2/2]

CorrectionCode BTaggingEfficiencyTool::getMCEfficiency ( int flavour,
const Analysis::CalibrationDataVariables & v,
float & eff )
virtual

Computes the MC efficiency for the jet, given its kinematics, (possibly) tagger weight and truth flavour.

The tagger and operating point under consideration are part of the configuration and hence aren't function arguments.

Implements IBTaggingEfficiencyTool.

Definition at line 1042 of file BTaggingEfficiencyTool.cxx.

1044{
1047
1048 unsigned int sfindex = 0;
1049 unsigned int efindex = 0;
1050
1051 if( !getIndices(flavour,sfindex,efindex)) {
1052 ATH_MSG_ERROR("BTaggingEfficiencyTool::getMCEfficiency call to getIndices failed " << flavour << " " << sfindex << " " << efindex);
1053 return CorrectionCode::Error;
1054 }
1055 Uncertainty unc = None;
1056 // no uncertainty index here as there aren't any uncertainties associated with the MC efficiencies
1057 CalibrationStatus status = m_CDI->getMCEfficiency(v,efindex, unc,result);
1058 eff = result.first;
1059 if( m_applySyst && !m_applyThisSyst.isUp) {
1060 eff = result.second; // down variation
1061 }
1062
1063 switch (status) {
1064 case Analysis::kError:
1065 ATH_MSG_ERROR("BTaggingEfficiencyTool::getMCEfficiency call to underlying code returned a kError!");
1066 return CorrectionCode::Error;
1067 case Analysis::kRange:
1070 case Analysis::kSuccess:
1071 default:
1072 return CorrectionCode::Ok;
1073 }
1074}

◆ getMCEfficiencyONNX() [1/2]

CorrectionCode BTaggingEfficiencyTool::getMCEfficiencyONNX ( const std::vector< std::vector< float > > & node_feat,
std::vector< float > & effAllJet )
virtual

Computes the MC efficiency of the jets in a given event.

(Uses the onnx tool) For fixed cut wp

Implements IBTaggingEfficiencyTool.

Definition at line 1078 of file BTaggingEfficiencyTool.cxx.

1079{
1080 m_saltModel->runInference(node_feat, effAllJet);
1081 return CorrectionCode::Ok;
1082}
std::unique_ptr< SaltModel > m_saltModel
pointer to the onnx tool

◆ getMCEfficiencyONNX() [2/2]

CorrectionCode BTaggingEfficiencyTool::getMCEfficiencyONNX ( const std::vector< std::vector< float > > & node_feat,
std::vector< std::vector< float > > & effAllJetAllWp )
virtual

Computes the MC efficiency of the jets in a given event.

(Uses the onnx tool) For continuous wp

Implements IBTaggingEfficiencyTool.

Definition at line 1086 of file BTaggingEfficiencyTool.cxx.

1087{
1088 m_saltModel->runInference(node_feat, effAllJetAllWp);
1089 return CorrectionCode::Ok;
1090}

◆ 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 }

◆ getOperatingPoint()

const std::string & BTaggingEfficiencyTool::getOperatingPoint ( ) const
inlinevirtual

Retrieve the operating point (as specified in the calibration file)

Implements IBTaggingEfficiencyTool.

Definition at line 188 of file BTaggingEfficiencyTool.h.

188{ return m_OP;}

◆ getProperty()

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

Get one of the tool's properties.

◆ getScaleFactor() [1/2]

CorrectionCode BTaggingEfficiencyTool::getScaleFactor ( const xAOD::Jet & jet,
float & sf )
virtual

Computes the data/MC efficiency scale factor for the given jet.

The tagger and operating point under consideration are part of the configuration and hence aren't function arguments.

Implements IBTaggingEfficiencyTool.

Definition at line 701 of file BTaggingEfficiencyTool.cxx.

702{
703 if (! m_initialised) {
704 ATH_MSG_ERROR("BTaggingEfficiencyTool has not been initialised");
706 }
707
708 // get the btag label
709 int flavour{0};
710 if (m_using_conventional_labels){ // if not using conventional labels, so flavour label will have to be set by some other means...
712 }
713
714 Analysis::CalibrationDataVariables vars;
715 //const double pt = jet.pt();
716 //const double eta = jet.eta();
717 //const double tagwe = 0.7; // temporary testing
718 if (! fillVariables(jet, vars)) {
719 //if (! fillVariables(pt, eta, tagwe, vars)){
720 ATH_MSG_ERROR("unable to fill variables required for scale factor evaluation");
722 }
723
724 return getScaleFactor(flavour, vars, sf);
725}
CP::CorrectionCode getScaleFactor(const xAOD::Jet &jet, float &sf)
Computes the data/MC efficiency scale factor for the given jet.

◆ getScaleFactor() [2/2]

CorrectionCode BTaggingEfficiencyTool::getScaleFactor ( int flavour,
const Analysis::CalibrationDataVariables & v,
float & sf )
virtual

Computes the data/MC efficiency scale factor for the jet, given its kinematics, (possibly) tagger weight and truth flavour.

The tagger and operating point under consideration are part of the configuration and hence aren't function arguments.

Implements IBTaggingEfficiencyTool.

Definition at line 728 of file BTaggingEfficiencyTool.cxx.

730{
731 if (! m_initialised) {
732 ATH_MSG_ERROR("BTaggingEfficiencyTool has not been initialised");
734 }
735
737
738 unsigned int sfindex = 0;
739 unsigned int efindex = 0;
740
741 if( !getIndices(flavour,sfindex,efindex)) { //<-------- This method returns true if it can find the sfindex and efindex corresponding to the flavour
742 // These indices are used internally in the CalibrationDataInterfaceROOT. They represent the index where
743 // the CalibrationDataContainer storing the calibration scalefactors/efficiencies are at in the CDIROOT (in m_objects in both cases, but needs a call to getMCScaleFactor in latter case)
744 // Once the container is retrieved by index, the CalibrationDataEigenVariations object is retrieved by container,
745 // which actually returns Up/Down variations, else return SF+SFError
746 ATH_MSG_ERROR("BTaggingEfficiencyTool::getScaleFactor call to getIndices failed " << flavour << " " << sfindex << " " << efindex);
748 }
750 Uncertainty unc = None;
751 unsigned int unc_ind=0; // <----- This is the index of the variation internal to the CDIROOT object
752
753 if( m_applySyst) { // indicate that we want to apply a systematic variation, i.e. return an up/down variation pair
754 unc = m_applyThisSyst.uncType; // type of systematic strategy...
755 if(!m_applyThisSyst.getIndex(flavour,unc_ind)) {
756 ATH_MSG_VERBOSE("getScaleFactor: requested variation cannot be applied to flavour " << getLabel(flavour) << ", returning nominal result");
757 unc = None;
758 }
759 }
760
761 // In all likelihood, the "sfindex" and "efindex" need more work in the CDIROOT (or in the CDGEV)
762 status = (m_isContinuous || m_isContinuous2D) ? m_CDI->getWeightScaleFactor(v,sfindex,efindex, unc,unc_ind,result) : m_CDI->getScaleFactor(v,sfindex,efindex, unc,unc_ind,result, getLabel(flavour));
763
764 // Interpret what has been retrieved;
765 // this depends both on the uncertainty type and on the up/down setting.
766 sf = result.first;
767 if (m_applySyst && unc != None) {
768 if (! (unc == SFEigen || unc == SFNamed || unc == SFGlobalEigen)){
769 sf += m_applyThisSyst.isUp ? result.second : -result.second ;
770 } else if (!m_applyThisSyst.isUp) {
771 sf = result.second; // otherwise, set the sf to the down variation (if down is requested)
772 } // otherwise, doing nothing will return the result.first value, which SHOULD represent the up variation
773 }
774
775 switch (status) {
776 case Analysis::kError:
777 ATH_MSG_ERROR("BTaggingEfficiencyTool::getScaleFactor call to underlying code returned a kError!");
779 case Analysis::kRange:
783 default:
784 return CorrectionCode::Ok;
785 }
786}

◆ getTaggerName()

const std::string & BTaggingEfficiencyTool::getTaggerName ( ) const
inlinevirtual

Retrieve the name of the tagger (as specified in the calibration file)

Implements IBTaggingEfficiencyTool.

Definition at line 185 of file BTaggingEfficiencyTool.h.

185{ return m_taggerName;}

◆ initialize()

StatusCode BTaggingEfficiencyTool::initialize ( void )
virtual

Initialise the tool.

This is the stage at which all of the configuration is done and the underlying CalibrationDataInferfaceROOT object is instantiated. The properties that can be set are documented in the xAOD interface section of the CalibrationDataInterface Twiki page.

Reimplemented from asg::AsgTool.

Definition at line 144 of file BTaggingEfficiencyTool.cxx.

144 {
145
146 ATH_MSG_INFO( " Hello BTaggingEfficiencyTool user... initializing");
147 ATH_MSG_INFO( " TaggerName = " << m_taggerName);
148 ATH_MSG_INFO( " OP = " << m_OP);
149 ATH_MSG_INFO( " m_systStrategy is " << m_systStrategy);
150
151 m_SFNames["B"] = m_SFNamesB;
152 m_SFNames["C"] = m_SFNamesC;
153 m_SFNames["T"] = m_SFNamesT;
154 m_SFNames["Light"] = m_SFNamesLight;
155
159
160 m_EffNames["B"] = m_EffNamesB;
161 m_EffNames["C"] = m_EffNamesC;
162 m_EffNames["T"] = m_EffNamesT;
163 m_EffNames["Light"] = m_EffNamesLight;
164
169
173
176
177 // set default MCMC map if they haven't been specified
178 for (auto& [k, v]: m_EffNames) {
179 if (v.size() == 0) v = m_effName;
180 }
181
182 // Use the PathResolver to find the full pathname (behind the scenes this can also be used to download the file),
183 // if the file cannot be found directly.
184 // For consistency with the PathResolver code, use the Boost library to check on this first possibility.
186 std::string location = PathResolverFindCalibFile(m_SFFile);
187 if (location == "") {
188 std::string prepend = "";
189 if (m_useDevFile) {
190 ATH_MSG_WARNING(" Attempting to retrieve b-tagging scale factor calibration file from development area");
191 prepend = "dev/";
192 }
193 prepend += "xAODBTaggingEfficiency/";
194 m_SFFile = prepend + m_SFFile;
196 if (m_SFFileFull == "")
197 ATH_MSG_WARNING(" Unable to retrieve b-tagging scale factor calibration file!");
198 else
199 ATH_MSG_DEBUG(" Retrieving b-tagging scale factor calibration file as " << m_SFFile);
200 } else {
201 m_SFFileFull = location;
202 }
203
204 // The situation for the efficiency file is a bit simpler since it need not reside under "xAODBTaggingEfficiency"
207
208
209 // Strategies for eigenvector reductions (only relevant if eigenvector variations are used, of course).
210 // For now, we will assume that the strategy for tau "jets" is identical to that for c jets.
211 std::map<std::string, Analysis::EVReductionStrategy> EVRedStrategies, mappings;
212 mappings["Loose"] = Analysis::Loose;
213 mappings["Medium"] = Analysis::Medium;
214 mappings["Tight"] = Analysis::Tight;
215
216
217 // Now that we know the CDI file location, let's check if the configuration provided is correct
218 Analysis::CDIReader Reader(m_SFFileFull);
219 if(!Reader.checkConfig(m_taggerName, m_jetAuthor, m_OP, msgLvl(MSG::DEBUG))){
220 ATH_MSG_ERROR( "BTaggingEfficiencyTool configuration is invalid - follow the above suggestions to correct your config!");
221 return StatusCode::FAILURE;
222 };
223
224 std::vector<std::string> config_labels = Reader.getLabels(); // the labels compatible with this configuration
225 std::vector<std::string> flavours;
226 // "pack" the efficiency map names for each flavour. Note that multiple, semicolon separated, entries may exist; so this needs to be decoded first
227 std::map<std::string, std::vector<std::string> > EffNames;
228 std::vector<std::string> EVflavours = { "B", "C", "Light" }; // ideally this would also come from the metadata of the CDI file as well...
229 // specify which systematic variations are to be excluded from the eigenvector decomposition
230 std::map<std::string, std::vector<std::string> > excludeFromEVCov;
231 std::vector<std::string> to_exclude = split(m_excludeFromEV); // uncertainties to exclude from all flavours
232
233 if(!m_useFlex){
234
235 //if a configuration file was provided for efficiency maps, overwrite the efficiency map selection with the one provided in the first line of the config
236 if(not m_EffConfigFile.empty()){
238 std::ifstream eff_config_file(m_EffConfigFile);
239
240 std::string str;
241 std::getline(eff_config_file, str);
242
243 m_EffNames["B"] = str;
244 m_EffNames["C"] = str;
245 m_EffNames["T"] = str;
246 m_EffNames["Light"] = str;
247
248 while (std::getline(eff_config_file, str)) {
249 std::vector<std::string> dsid_and_effmap = split(str,':');
250 unsigned int dsid = std::stoul( dsid_and_effmap[0] );
251 unsigned int map_index = std::stoul( dsid_and_effmap[1] );
252 m_DSID_to_MapIndex[dsid] = map_index;
253 }
254 }
255
256
257
258 flavours = { "B", "C", "Light", "T"};
259
260 for (auto const& flavour : flavours) {
261 EffNames[flavour] = split(m_EffNames[flavour]);
262 }
263
264 ATH_MSG_INFO( " b-jet SF/eff calibration = " << m_SFNames["B"] << " / " << m_EffNames["B"]);
265 ATH_MSG_INFO( " c-jet SF/eff calibration = " << m_SFNames["C"] << " / " << m_EffNames["C"]);
266 ATH_MSG_INFO( " tau-jet SF/eff calibration = " << m_SFNames["T"] << " / " << m_EffNames["T"]);
267 ATH_MSG_INFO( " light-jet SF/eff calibration = " << m_SFNames["Light"] << " / " << m_EffNames["Light"]);
268 ATH_MSG_INFO( " JetAuthor = " << m_jetAuthor);
269
270
271 } else {
272
273 // Set defaults for the following, based on flavour label
274 // metadata if any of the following properties are not set:
275 // - FlexibleScaleFactorCalibrations
276 // - FlexibleEfficiencyCalibrations
277 // - FlexibleEigenvectorReduction
278 // - FlexibleUncertaintySuffix
279 // - FlexibleExcludeFromEVTreatment
280
281 flavours = config_labels; // set the flavours vector from CDI metadata
282 m_flex_labels = flavours; // set the label scheme, for use elsewhere
283 for(const std::string& label : m_flex_labels){
284 m_flex_label_integers.push_back(getFlavourID(label, false)); // populate the ordered flavour ID vector
285 }
286 int size_of_labels = flavours.size();
287 if (m_SFName_flex.empty()){
288 m_SFName_flex = default_flexible(flavours.size(), ":default");
289 } else {ATH_MSG_INFO(" Setting m_SFName_flex : " << m_SFName_flex);}
290 if (m_EffNames_flex.empty()){
291 m_EffNames_flex = default_flexible(flavours.size(), ":default");
292 } else {ATH_MSG_INFO(" Setting m_EffNames_flex : " << m_EffNames_flex);}
293 if (m_EVReduction_flex.empty()){
294 m_EVReduction_flex = default_flexible(flavours.size(), ":Loose");
295 } else {ATH_MSG_INFO(" Setting m_EVReduction_flex : " << m_EVReduction_flex);}
296 if (m_uncertaintySuffixes_flex.empty()){
297 m_uncertaintySuffixes_flex = default_flexible(flavours.size(), ":");
298 } else {ATH_MSG_INFO(" Setting m_uncertaintySuffixes_flex : " << m_uncertaintySuffixes_flex);}
299 if (m_excludeFlvFromEV_flex.empty()){
300 m_excludeFlvFromEV_flex = default_flexible(flavours.size(), ":");
301 } else {ATH_MSG_INFO(" Setting m_excludeFlvFromEV_flex : " << m_excludeFlvFromEV_flex);}
302
303 // empty m_SFNames (filled by the 'default' setting), in the flexible method we want to use the labels found in the CDI file meta-data
304 m_SFNames.clear();
305 std::vector<std::string> efficiencies_map = split(m_EffNames_flex); // split to {"0:default", "1:47100,47200,default", "2:default", "3:default"}
306 for (auto const& effconfig : efficiencies_map) {
307 std::vector<std::string> effmap = split(effconfig, ':'); // split to {"0", "default"}
308 if(effmap.size() != 2){ // check if first flavour label config is written properly // || std::stoi(effmap.at(0)) > (int)flavours.size()
309 ATH_MSG_ERROR( "BTaggingEfficiencyTool configuration is invalid - efficiency files not included properly in the (experimental) flexible configuration!");
310 return StatusCode::FAILURE;
311 }
312 int index = std::stoi(effmap.at(0)); // index of flavour label in 'flavours' vector
313 std::vector<std::string> effcalibs; // vector of efficiency calibrations
314 if(effmap.at(1) != "default"){
315 effcalibs = split(effmap.at(1), ',');
316 } else {
317 effcalibs.push_back(effmap.at(1));
318 }
319 std::string flavour_name = flavours.at(index);
320 m_EffNames[flavour_name] = effmap.at(1); // set this for posterity
321 EffNames[flavour_name] = effcalibs;
322 }
323
324 std::vector<std::string> scalefactor_map = split(m_SFName_flex); // split to {"0:default", "1:47100,47200,default", "2:default", "3:default"}
325 for (auto const& sfconfig : scalefactor_map) {
326 std::vector<std::string> sfmap = split(sfconfig, ':'); // split to {"0", "default"}
327 if(sfmap.size() != 2){ // check if first flavour label config is written properly // || std::stoi(sfmap.at(0)) > (int)flavours.size()
328 ATH_MSG_ERROR( "BTaggingEfficiencyTool configuration is invalid - efficiency files not included properly in the (experimental) flexible configuration!");
329 return StatusCode::FAILURE;
330 }
331 int index = std::stoi(sfmap.at(0)); // index of flavour label in 'flavours' vector
332 std::string flavour_name = flavours.at(index);
333 m_SFNames[flavour_name] = sfmap.at(1);
334 }
335 for(const std::string& flav : flavours){
336 ATH_MSG_INFO( flav + " label SF/eff calibration = " + m_SFNames[flav] + " / " + m_EffNames[flav] ) ;
337 }
338
339 // Now deal with the flexible configurations
340 EVflavours.clear(); // ideally this vector would also come from CDI file metadata
341 EVflavours = flavours; // for now, just set the vector of EV flavours to the flavours vector
342 // construct the flavour m_EVReduction map from m_EVReduction_flex index based configuration
343 std::vector<std::string> evreduction_map = split(m_EVReduction_flex);
344 for (auto const& evred : evreduction_map) {
345 std::vector<std::string> evredmap = split(evred, ':'); // split to {"0", "Loose"}
346 if(evredmap.size() != 2){
347 if(std::stoi(evredmap.at(0)) < size_of_labels){
348 evredmap.push_back("");
349 } else {
350 ATH_MSG_ERROR( "BTaggingEfficiencyTool configuration is invalid - reduction strategies not set properly in the (experimental) flexible configuration!");
351 return StatusCode::FAILURE;
352 }
353 }
354 int index = std::stoi(evredmap.at(0)); // index of flavour label in 'flavours' vector
355 const std::string& flavour_name = flavours.at(index);
356 m_EVReduction[flavour_name] = evredmap.at(1);
357 }
358
359 // construct the flavour m_excludeFlvFromEV map from m_excludeFlvFromEV_flex index based configuration
360 std::vector<std::string> exclusion_map = split(m_excludeFlvFromEV_flex);
361 for (auto const& excl : exclusion_map) {
362 std::vector<std::string> exclmap = split(excl, ':'); // split to {"0", "uncertainty1,uncertainty2,..,uncertaintyN"}
363 if(exclmap.size() != 2){
364 if(std::stoi(exclmap.at(0)) < size_of_labels){
365 exclmap.push_back("");
366 } else {
367 ATH_MSG_ERROR( "BTaggingEfficiencyTool configuration is invalid - uncertainty exclusion not set properly in the (experimental) flexible configuration!");
368 return StatusCode::FAILURE;
369 }
370 }
371 int index = std::stoi(exclmap.at(0)); // index of flavour label in 'flavours' vector
372 std::vector<std::string> uncertainties_to_exclude = split(exclmap.at(1), ',');; // vector of uncertainties to exclude for this flavour
373 const std::string& flavour_name = flavours.at(index);
374 m_excludeFlvFromEV[flavour_name] = exclmap.at(1);
375 }
376 }
377
378 // set the reduction per EV flavour/label, and exclude uncertainties from EV reduction
379 for (auto const& flavour : EVflavours) {
380 EVRedStrategies[flavour] = mappings.find(trim(m_EVReduction[flavour])) == mappings.end() ? mappings["Loose"] : mappings[trim(m_EVReduction[flavour])];
381 excludeFromEVCov[flavour] = to_exclude; // look for uncertainties to be excluded for all flavours
382 std::vector<std::string> further_exclude = split(m_excludeFlvFromEV[flavour]); // now grab the flavour/label specific uncertainties to exclude
383 excludeFromEVCov[flavour].insert(excludeFromEVCov[flavour].end(), further_exclude.begin(), further_exclude.end()); // Append to the existing list
384 }
385
386 // now, handle the edge-cases of EV reduction and extra uncertainties
387 // e.g. C - T calibration duplication in "conventional" flavour labeling
388 // check if the labels are "conventional"
389 std::vector<std::string> conventional_labels = {"B", "C", "Light", "T"};
390 if (flavours == conventional_labels) {
392 }
394 // if using conventional label, we can use the same logic as always
395 EVRedStrategies["T"] = EVRedStrategies["C"];
396
397 // For the SFEigen strategy, tau "jets" are treated differently from other flavours.
398 // First, copy the charm-jet calibration settings
399 excludeFromEVCov["T"] = excludeFromEVCov["C"];
400
401 //high pt extrapolation uncertainties
402 if(m_OP.value().find("Continuous") != std::string::npos){
403 excludeFromEVCov["B"].push_back("extrapolation_pt_b_Eigen*");
404 excludeFromEVCov["C"].push_back("extrapolation_pt_c_Eigen*");
405 excludeFromEVCov["Light"].push_back("extrapolation_pt_l_Eigen*");
406 excludeFromEVCov["T"].push_back("extrapolation_pt_c_Eigen*");
407 }
408 }
409
410 if (m_OP == "Continuous") {
411 // continuous tagging is special in two respects:
412 // 1 the tag weight needs to be retrieved
413 // 2 the generator dependent scale factor rescaling is done differently, and therefore
414 // CalibrationDataInterfaceROOT::getWeightScaleFactor() instead of
415 // CalibrationDataInterfaceROOT::getScaleFactor() must be used
416 m_isContinuous = true;
417 }
418 else if (m_OP.value().find("Continuous2D") != std::string::npos) {
419 m_isContinuous2D = true;
420 }
421 // Note that the instantiation below does not leave a choice: the Eigenvector variations and generator-specific scale factors are always used
422 std::vector<std::string> jetAliases;
423 m_CDI = std::shared_ptr<Analysis::CalibrationDataInterfaceROOT>( new Analysis::CalibrationDataInterfaceROOT(
424 m_taggerName, // tagger name: always needed
425 m_SFFileFull.c_str(), // full pathname of the SF calibration file: always needed
426 (m_EffFile == "") ? 0 : m_EffFile.value().c_str(), // full pathname of optional efficiency file
427 jetAliases, // since we configure the jet "collection name" by hand, we don't need this
428 m_SFNames, // names of the scale factor calibrations to be used
429 EffNames, // names of the efficiency calibrations to be used (can be multiple per flavour)
430 excludeFromEVCov, // names of systematic uncertainties to be excluded from the EV decomposition
431 EVRedStrategies, // strategies for eigenvector reductions
432 m_systStrategy != "Envelope", // assume that eigenvector variations will be used unless the "Envelope" model is used
433 (m_systStrategy=="SFEigen") ? Analysis::SFEigen : Analysis::Uncertainty::SFGlobalEigen,
434 true, // use MC/MC scale factors
435 false, // do not use topology rescaling (only relevant for pseudo-continuous tagging)
436 m_useRecommendedEVExclusions, // if true, add pre-set lists of uncertainties to be excluded from EV decomposition
437 msgLvl(MSG::DEBUG), // if false, suppress any non-error/warning messages
438 flavours // vector of flavour labels, conventional or not
439 ));
440
442 ATH_MSG_INFO("BTEffTool->initialize : setMapIndex(Light)");
443 setMapIndex("Light",0);
444 ATH_MSG_INFO("BTEffTool->initialize : setMapIndex(C)");
445 setMapIndex("C",0);
446 ATH_MSG_INFO("BTEffTool->initialize : setMapIndex(B)");
447 setMapIndex("B",0);
448 ATH_MSG_INFO("BTEffTool->initialize : setMapIndex(T)");
449 setMapIndex("T",0);
450 } else {
451 for(const auto& flavour : flavours){
452 // set map index for each flavour (label) index
453 ATH_MSG_INFO(" - - -BTEffTool->initialize : setMapIndex(" << flavour << ")");
454 setMapIndex(flavour, 0);
455 }
456 }
457
458 ATH_MSG_INFO( "Using systematics model " << m_systStrategy);
459 if (m_systStrategy != "Envelope" && m_useRecommendedEVExclusions) ATH_MSG_INFO( "excluding pre-set uncertainties from eigenvector decomposition");
460
461 // We have a double loop over flavours here.. not nice but this is to ensure that the suffixes are always well determined before using them.
462 // Note that (in the SFEigen model) suffixes are attached to eigenvector variations only (the idea being that named uncertainties, if used, are likely to be correlated).
463 std::vector<std::string> suffixes;
465 for (int i = 0; i < 4; ++i) { // four flavours in conventional label scheme
466 std::string flav = flavours[i]; if (flav == "T") flav = "C";
467 // add an underscore to any specified suffix (if specified and if not already starting with a suffix)
468 std::string test = trim(m_uncertaintySuffixes[flav]);
469 if (test.length() > 0 && test[0] != '_') test.insert(0,"_");
470 suffixes.push_back(test);
471 }
472 } else {
473 // Need to handle the suffixes for the generic labels
474 std::vector<std::string> suffixvec = split(m_uncertaintySuffixes_flex);
475 int size_of_labels = flavours.size();
476 for (auto const& suff : suffixvec) {
477 std::vector<std::string> suffmap = split(suff, ':'); // split to {"0", "uncertainty1,uncertainty2,..,uncertaintyN"}
478 if(suffmap.size() != 2){
479 if(std::stoi(suffmap.at(0)) < size_of_labels){
480 suffmap.push_back("");
481 } else {
482 ATH_MSG_ERROR( "BTaggingEfficiencyTool configuration is invalid - suffix configuration not set properly in the (experimental) flexible configuration!");
483 return StatusCode::FAILURE;
484 }
485 }
486 int index = std::stoi(suffmap.at(0)); // index of flavour label in 'flavours' vector
487 std::string flavour_name = flavours.at(index);
488 // add an underscore to any specified suffix (if specified and if not already starting with a suffix)
489 std::string suffix = trim(suffmap.at(1));
490 if (suffix.length() > 0 && suffix[0] != '_') suffix.insert(0,"_");
491 suffixes.push_back(suffix);
492 }
493 }
494
495 // If the tool has not already been initialised and m_OP and m_jetAuthor have been set - ie via the properties "OperatingPoint" and "JetAuthor"
496 // then autmatically set things up to use these by default
497 // All this must happen before registerSystematics otherwise that won't work
498 for (long unsigned int i = 0; i < flavours.size(); ++i) {
499 // For each flavour, we check the validity of the initialization of the CalibrationInterfaceROOT object (m_CDI)
500 unsigned int flavourID;
502 flavourID = getFlavourID(flavours[i]);
503 } else {
504 flavourID = getFlavourID(flavours[i], false); // in flexible scheme, need to specify the new labels in getFlavourID
505 }
506 // std::map<unsigned int, unsigned int>::const_iterator
507 auto mapIter = m_SFIndices.find(flavourID);
508 if( mapIter==m_SFIndices.end()) { // if the flavour doesn't have an entry need to fail the initialization
509 ATH_MSG_ERROR( "No entry for flavour " << flavourID << " which is " << flavours[i] << " in SFIndices map, invalid initialization");
510 return StatusCode::FAILURE;
511 }
512 int id = mapIter->second;
513 // Implement the different strategies for dealing with uncertainties here.
514 if (m_systStrategy == "SFEigen" || m_systStrategy == "SFGlobalEigen") {
515 //
516 // Generally recommended model: use eigenvector variations. Notes:
517 // - The list of systematics to be excluded from the eigenvector variation approach is dynamic.
518 // - The tau SF are identical to the c-jet ones, with merely one additional uncertainty assigned due to the extrapolation.
519 //
520 unsigned int flavourIDRef;
522 flavourIDRef = (flavourID == 15) ? 4 : flavourID;
523 } else {
524 flavourIDRef = flavourID;
525 }
526 int idRef = m_SFIndices.find(flavourIDRef)->second;
527 // First, handle any named variations
528 std::vector<std::string> systematics = m_CDI->listScaleFactorUncertainties(idRef, flavours.at(i), true); // flavours[i] should be "B", "C", "Light", or "T"
529 // Replace any spaces with underscores (this is to make ROOT browsing happy).
530 // Also, remove the "extrapolation" uncertainty from the list (it will be added later under Extrapolation rather than SFNamed).
531
532 auto it = std::remove (systematics.begin(), systematics.end(),
533 "extrapolation");
534 bool hasExtrapolation = (it != systematics.end());
535 systematics.erase (it, systematics.end());
536 // C++20 alternative:
537 //bool hasExtrapolation = std::erase (systematics, "extrapolation") > 0;
538
539 for (auto& systematic : systematics) {
540 std::replace_if(systematic.begin(), systematic.end(), [] (char c) { return c == ' '; }, '_'); // <--- This just replaces spaces with underscores
541 // We don't add suffixes here but only for EV variations (see JIRA: AFT-343)
542 }
543
544 if (!addSystematics(systematics, flavourID, SFNamed)) { // Add the SFNamed to m_systematicsInfo
545 ATH_MSG_ERROR("SFEigen model: error adding named systematics for flavour " << getLabel(flavourIDRef) << ", invalid initialization"); // For each uncertainty type, have to add ALL uncertainties pertaining to that type
546 return StatusCode::FAILURE;
547 }
548
549 // Add here the extrapolation uncertainty (if it exists -- which ought to be the case).
550 // "Cosmetic" fix: the outside world wants to see "FT_EFF_" prefixes. On the other hand, like for the above named uncertainties, we don't add suffixes here
551 if (hasExtrapolation) {
552 std::vector<std::string> extrapSyst; extrapSyst.push_back(std::string("FT_EFF_extrapolation")); // Add the EXTRAPOLATION to m_systematicsInfo
553 if (! addSystematics(extrapSyst, flavourID, Extrapolation)) {
554 ATH_MSG_ERROR("SFEigen model: error adding extrapolation uncertainty for flavour " << getLabel(flavourIDRef) << ", invalid initialization");
555 return StatusCode::FAILURE;
556 }
557 }
558
559 // And then the eigenvector variations
560 std::vector<std::string> eigenSysts;
561 if (m_systStrategy == "SFEigen"){
563 eigenSysts = makeEigenSyst(getLabel(flavourIDRef),m_CDI->getNumVariations(idRef, SFEigen, getLabel(flavourID)), suffixes[i]); // Add the eigenvariations to m_systematicsInfo
564 } else {
565 eigenSysts = makeEigenSyst(getLabel(flavourIDRef),m_CDI->getNumVariations(idRef, SFEigen, flavours[i]), suffixes[i]); // Add the eigenvariations to m_systematicsInfo
566 }
567 if (!addSystematics(eigenSysts, flavourID, SFEigen)) {
568 ATH_MSG_ERROR("SFEigen model: error adding eigenvector systematics for flavour " << getLabel(flavourIDRef) << ", invalid initialization");
569 return StatusCode::FAILURE;
570 }
571 } else if (m_systStrategy == "SFGlobalEigen") {
573
574 // we have to add the SFGlobalEigen systematics like this...
576 eigenSysts = makeEigenSyst(getLabel(flavourIDRef),m_CDI->getNumVariations(idRef, SFGlobalEigen, getLabel(flavourID)), suffixes[i]); // Add the eigenvariations to m_systematicsInfo
577 } else {
578 std::vector<std::string> eigenSysts = makeEigenSyst(getLabel(flavourIDRef),m_CDI->getNumVariations(idRef, SFGlobalEigen, flavours[i]), suffixes[i]); // Add the eigenvariations to m_systematicsInfo
579 }
580 if (!addSystematics(eigenSysts, flavourID, SFGlobalEigen)) {
581 ATH_MSG_ERROR("SFGlobalEigen model: error adding eigenvector systematics for flavour " << getLabel(flavourIDRef) << " ie " << getLabel(flavourID) << ", invalid initialization");
582 return StatusCode::FAILURE;
583 }
584
586 }
587 // The above should cover all uncertainties except the charm -> tau extrapolation; so we take care of that here.
588 if (flavourID == 15) {
589 // First extract the complete list of uncertainties for taus
590 std::vector<std::string> all_systematics = m_CDI->listScaleFactorUncertainties(id, getLabel(flavourID));
591 // And from this list extract only this particular uncertainty (if it exists)
592 const std::string s_tau_extrap = "extrapolation from charm";
593 if (std::find(all_systematics.begin(), all_systematics.end(), s_tau_extrap) != all_systematics.end()) {
594 // Again, we don't add the suffix here (per JIRA: AFT-343)
595 std::string entry = "FT_EFF_extrapolation_from_charm"; // entry.append(suffixes[i]);
596 std::vector<std::string> extrapSyst; extrapSyst.push_back(entry);
597 if (! addSystematics(extrapSyst, flavourID, TauExtrapolation)) { // <--- Add the TauExtrapolation to m_systematicsInfo
598 ATH_MSG_ERROR("SFEigen model: error adding charm->tau systematics for flavour " << getLabel(flavourID) << ", invalid initialization");
599 return StatusCode::FAILURE;
600 }
601 }
602 }
603 } else if (m_systStrategy == "Envelope") {
604 //
605 // Simplified model: use uncertainty envelopes supplemented by a (common) extrapolation uncertainty
606 // (since the extrapolation uncertainties aren't included in the Total uncertainty). Notes:
607 // - The tau SF are identical to the c-jet ones, with merely one additional uncertainty assigned due to the extrapolation.
608 // - The "total" uncertainty is always expected to be available; the code will bomb if this is not the case.
609 // Also, the "total" uncertainties for different flavours are assumed to be uncorrelated.
610 //
611 unsigned int flavourIDRef = (flavourID == 15) ? 4 : flavourID;
612 int idRef = m_SFIndices.find(flavourIDRef)->second;
613 // First, handle the Total variations; these need different prefixes to reflect them being uncorrelated
614 std::vector<std::string> all_ref_systematics = m_CDI->listScaleFactorUncertainties(idRef,getLabel(flavourID),false);
615 const std::string s_total = "systematics";
616 if (std::find(all_ref_systematics.begin(), all_ref_systematics.end(), s_total) == all_ref_systematics.end()) {
617 ATH_MSG_ERROR("Envelope model: required uncertainty " << s_total << " not found for flavour " << getLabel(flavourIDRef)
618 << ", invalid initialization");
619 return StatusCode::FAILURE;
620 }
621 std::vector<std::string> totalSyst; totalSyst.push_back("FT_EFF_" + getLabel(flavourIDRef) + "_" + s_total + suffixes[i]);
622 if (! addSystematics(totalSyst, flavourID, Total)) {
623 ATH_MSG_ERROR("Envelope model: error adding systematics uncertainty for flavour " << getLabel(flavourIDRef)
624 << ", invalid initialization");
625 return StatusCode::FAILURE;
626 }
627 // Second, handle the extrapolation variations; these are shared between flavours (unless different suffixes are specified)
628 const std::string s_extrap = "extrapolation";
629 if (std::find(all_ref_systematics.begin(), all_ref_systematics.end(), s_extrap) != all_ref_systematics.end()) {
630 std::vector<std::string> extrapSyst; extrapSyst.push_back("FT_EFF_" + s_extrap + suffixes[i]);
631 if (! addSystematics(extrapSyst, flavourID, Extrapolation)) {
632 ATH_MSG_ERROR("Envelope model: error adding extrapolation uncertainty for flavour " << getLabel(flavourIDRef)
633 << ", invalid initialization");
634 return StatusCode::FAILURE;
635 }
636 }
637 // Finally, handle the charm -> tau extrapolation (as in the above)
638 if (flavourID == 15) {
639 // First extract the complete list of uncertainties for taus
640 std::vector<std::string> all_systematics = m_CDI->listScaleFactorUncertainties(id, getLabel(flavourID));
641 // And from this list extract only this particular uncertainty (if it exists)
642 const std::string s_tau_extrap = "extrapolation from charm";
643 if (std::find(all_systematics.begin(), all_systematics.end(), s_tau_extrap) != all_systematics.end()) {
644 std::vector<std::string> extrapSyst; extrapSyst.push_back("FT_EFF_extrapolation_from_charm" + suffixes[i]);
645 if (! addSystematics(extrapSyst, flavourID, TauExtrapolation)) {
646 ATH_MSG_ERROR("Envelope model: error adding charm->tau systematics for flavour " << getLabel(flavourID) << ", invalid initialization");
647 return StatusCode::FAILURE;
648 }
649 }
650 }
651 }
652 } // end flavour loop
653
654 // now fill the SystematicSet
655 for( std::map<SystematicVariation,SystInfo>::const_iterator mapIter = m_systematicsInfo.begin(); mapIter != m_systematicsInfo.end();++mapIter) {
656 const SystematicVariation & variation = mapIter->first;
657 m_systematics.insert(variation);
658 }
659 // systematics framework
660 SystematicRegistry & registry = SystematicRegistry::getInstance();
661 if( registry.registerSystematics(*this) != StatusCode::SUCCESS)
662 return StatusCode::FAILURE;
663
664 // Finally, also initialise the selection tool, if needed (for now this is the case only for DL1 tag weight computations,
665 // so we do this only when DL1 is specified)
666 if (m_taggerName.value().find("DL1") != std::string::npos ||
667 m_taggerName.value().find("GN1") != std::string::npos ||
668 m_taggerName.value().find("GN2") != std::string::npos) {
669 m_selectionTool.setTypeAndName("BTaggingSelectionTool/" + name() + "_selection");
670 ATH_CHECK( m_selectionTool.setProperty("FlvTagCutDefinitionsFileName", m_SelectionCDIFile) );
671 ATH_CHECK( m_selectionTool.setProperty("TaggerName", m_selectionTaggerName) );
672 ATH_CHECK( m_selectionTool.setProperty("OperatingPoint", m_OP) );
673 ATH_CHECK( m_selectionTool.setProperty("JetAuthor", m_jetAuthor) );
674 ATH_CHECK( m_selectionTool.setProperty("MinPt", m_minPt) );
675 ATH_CHECK( m_selectionTool.setProperty("useCTagging", m_useCTag) );
676 ATH_CHECK( m_selectionTool.setProperty("readFromBTaggingObject", m_readFromBTaggingObject) );
677 ATH_CHECK( m_selectionTool.retrieve() );
678 }
679
680 // if the user decides to ignore these errors, at least make her/him aware of this
682 ATH_MSG_INFO("!!!!! You have chosen to disable out-of-validity return codes -- contact the Flavour Tagging group if such jets comprise a substantial part of the phase space in your analysis !!!!!");
683 }
684
685 // create and initialise the onnx tool
686 if (m_pathToONNX != ""){
687 std::string pathtoonnxfile = PathResolverFindCalibFile(m_pathToONNX);
688 if (pathtoonnxfile == ""){
689 ATH_MSG_ERROR("ONNX error: Model file doesn't exist! Please set the property 'pathToONNX' to a valid ONNX file");
690 return StatusCode::FAILURE;
691 }
692 m_saltModel = std::make_unique<SaltModel> (m_pathToONNX);
693 m_saltModel->initialize();
694 }
695
696 m_initialised = true;
697 return StatusCode::SUCCESS;
698}
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_INFO(x)
#define ATH_MSG_DEBUG(x)
static const std::vector< std::string > systematics
std::string PathResolverFindCalibFile(const std::string &logical_file_name)
string trim(string s)
bool msgLvl(const MSG::Level lvl) const
Gaudi::Property< std::string > m_SFNamesB
names of the data/MC scale factor calibrations
Gaudi::Property< std::string > m_EffNamesT
Gaudi::Property< std::string > m_selectionTaggerName
Gaudi::Property< std::string > m_EVReduction_flex
Gaudi::Property< std::string > m_effName
Gaudi::Property< std::string > m_EffConfigFile
Gaudi::Property< std::string > m_excludeFlvFromEVB
semicolon-separated list of uncertainties to be excluded from the eigenvector variation procedure for...
Gaudi::Property< std::string > m_uncertaintySuffixesC
Gaudi::Property< std::string > m_EVReductionLight
Gaudi::Property< bool > m_useDevFile
if true, attempt to retrieve the data/MC efficiency scale factor calibration files from the @PathReso...
Gaudi::Property< std::string > m_SFNamesT
Gaudi::Property< std::string > m_EVReductionC
Gaudi::Property< std::string > m_SFNamesLight
bool setMapIndex(const std::string &flavour, unsigned int index)
Specify the "map index" to be used for the given jet flavour (at initialisation time it will be set t...
std::map< std::string, std::string > m_SFNames
Gaudi::Property< std::string > m_SFFile
name of the data/MC efficiency scale factor calibration file (may be changed by the PathResolver)
std::map< unsigned int, unsigned int > m_DSID_to_MapIndex
Gaudi::Property< std::string > m_excludeFromEV
semicolon-separated list of uncertainties to be excluded from the eigenvector variation procedure for...
Gaudi::Property< std::string > m_uncertaintySuffixesT
Gaudi::Property< std::string > m_EffNamesC
Gaudi::Property< float > m_minPt
minimum jet pT
Gaudi::Property< std::string > m_excludeFlvFromEVLight
unsigned int getFlavourID(const std::string &label, bool conventional=true) const
convert string flavour to its integer index equivalent
std::map< std::string, std::string > m_EffNames
Gaudi::Property< std::string > m_uncertaintySuffixes_flex
Gaudi::Property< std::string > m_EffNamesB
semicolon-separated lists of MC efficiency parametrisation names
Gaudi::Property< std::string > m_SFName_flex
std::map< std::string, std::string > m_uncertaintySuffixes
Gaudi::Property< std::string > m_uncertaintySuffixesB
optional (per-flavour) suffix that can be used to decorrelate uncertainties (between flavours,...
std::map< std::string, std::string > m_excludeFlvFromEV
std::vector< std::string > m_flex_labels
Gaudi::Property< std::string > m_SelectionCDIFile
Gaudi::Property< std::string > m_EffNamesLight
std::vector< unsigned int > m_flex_label_integers
Gaudi::Property< std::string > m_EffFile
name of the optional MC efficiency file (may be changed by the PathResolver)
std::map< std::string, std::string > m_EVReduction
Gaudi::Property< std::string > m_uncertaintySuffixesLight
Gaudi::Property< std::string > m_excludeFlvFromEVC
Gaudi::Property< bool > m_useRecommendedEVExclusions
if true, extract pre-set lists of uncertainties to be recommended from the EV decomposition (in addit...
Gaudi::Property< bool > m_useFlex
bool addSystematics(const std::vector< std::string > &systematicNames, unsigned int flavourID, Analysis::Uncertainty uncType)
add entries to the systematics registry
Gaudi::Property< std::string > m_SFNamesC
Gaudi::Property< std::string > m_EffNames_flex
std::vector< std::string > makeEigenSyst(const std::string &flav, int number, const std::string &suffix)
generate names for the eigenvector variations for the given jet flavour
Gaudi::Property< std::string > m_pathToONNX
if this string is empty, the onnx tool won't be created
Gaudi::Property< std::string > m_excludeFlvFromEV_flex
Gaudi::Property< std::string > m_systStrategy
systematics model to be used (current choices are "SFEigen", "SFEigenRefined", and "Envelope") // <--...
Gaudi::Property< std::string > m_EVReductionB
specification of the eigenvector reduction strategy (if eigenvectors are used)
StatusCode registerSystematics(const IReentrantSystematicsTool &tool)
effects: register all the systematics from the tool
static SystematicRegistry & getInstance()
Get the singleton instance of the registry for the curren thread.
std::vector< std::string > split(const std::string &s, const std::string &t=":")
Definition hcg.cxx:177
str index
Definition DeMoScan.py:362
Pythia8::Reader Reader
DataModel_detail::iterator< DVL > remove(typename DataModel_detail::iterator< DVL > beg, typename DataModel_detail::iterator< DVL > end, const T &value)
Specialization of remove for DataVector/List.

◆ 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 BTaggingEfficiencyTool::isAffectedBySystematic ( const CP::SystematicVariation & systematic) const
virtual

Returns whether or not the given systematic variation is supported by this tool.

Implements CP::ISystematicsTool.

Definition at line 1094 of file BTaggingEfficiencyTool.cxx.

1095{
1096 SystematicSet sys = affectingSystematics();
1097 return sys.find( systematic) != sys.end();
1098}

◆ listScaleFactorSystematics()

std::map< std::string, std::vector< std::string > > BTaggingEfficiencyTool::listScaleFactorSystematics ( bool named = false) const
virtual

This merely passes on the request to the underlying CDI object (listSystematics() cannot be used here, as corresponding CP::SystematicVariation objects may not exist).

This method retrieves all systematic uncertainties known to the relevant calibration objects.

Note that the uncertainty naming does not follow the rewriting conventions leading to the names one will see as CP::SystematicVariations, but rather follows the "raw" names used on input (which are appropriate e.g. when excluding uncertainties from the eigenvalue decomposition).

Since the expected use of this method is in the context of the SFEigen model, we will assume (and not check) that this model is being used. Note: the uncertainties returned are in the format of the underlying CDI, and do not have the rewriting applied to them that one would use in analysis.

Implements IBTaggingEfficiencyTool.

Definition at line 1148 of file BTaggingEfficiencyTool.cxx.

1148 {
1149 std::map<std::string, std::vector<std::string> > uncertainties;
1150
1151 std::vector<unsigned int> all_flavours;
1153 all_flavours = { 5, 4, 15, 0 };
1154 } else {
1155 all_flavours = m_flex_label_integers;
1156 }
1157
1158 for (const unsigned int flavourID : all_flavours){
1159 // Assumed model: use eigenvector variations. In this model, the tau SF are identical to the c-jet ones,
1160 // with merely one additional uncertainty assigned due to the extrapolation.
1161 unsigned int flavourIDRef = flavourID;
1162 if (m_using_conventional_labels and flavourID == 15){
1163 flavourIDRef = 4; // make C - T relationship
1164 }
1165 auto mapIter = m_SFIndices.find(flavourIDRef);
1166 if( mapIter==m_SFIndices.end()) { // if the flavour doesn't have an entry need to fail the initialization
1167 ATH_MSG_ERROR( "No entry for flavour " << flavourIDRef << " in SFIndices map, invalid initialization");
1168 continue;
1169 }
1170 int idRef = mapIter->second;
1171 // Retrieve the actual list
1172 std::vector<std::string> systematics = m_CDI->listScaleFactorUncertainties(idRef, getLabel(flavourID), named);
1173 // For the special case of tau SF, add the extrapolation from charm.
1174 // Since this comes on top of the charm uncertainties, it would always be a "named" uncertainty,
1175 // so there is no need to check for the "named" argument.
1176 if (m_using_conventional_labels and flavourID == 15) systematics.push_back("extrapolation from charm");
1177 uncertainties[getLabel(int(flavourID))] = systematics;
1178 }
1179 return uncertainties;
1180}

◆ listSystematics()

const std::map< SystematicVariation, std::vector< std::string > > BTaggingEfficiencyTool::listSystematics ( ) const
virtual

Implements IBTaggingEfficiencyTool.

Definition at line 1111 of file BTaggingEfficiencyTool.cxx.

1111 {
1112 std::map<SystematicVariation, std::vector<std::string> > results;
1113
1114 if (! m_initialised) {
1115 ATH_MSG_ERROR("listSystematics() cannot be called before initialisation is finished");
1116 return results;
1117 }
1118
1119
1120 std::vector<unsigned int> all_flavours{5, 4, 15, 0};
1122 all_flavours = m_flex_label_integers;
1123 }
1124
1125 for (const auto& info : m_systematicsInfo) {
1126 // The map key is easy...
1127 const SystematicVariation& variation = info.first;
1128 // Then see for which flavours this particular key is relevant
1129 std::vector<std::string> flavours;
1130 for(const unsigned int flavour : all_flavours){ // Grab the number 5,4,15,0 for B,C,T,Light respectively (or other custom labelings)
1131 unsigned int idx;
1132 if (info.second.getIndex(flavour, idx)){ // If the flavour is mapped to an index internally in the SystInfo.indexMap, then return true
1133 flavours.push_back(getLabel(int(flavour)));
1134 }
1135 }
1136 results[variation] = flavours; // <------ Map the list of flavours that a systematic applies to, to the SystematicVariation object that was retrieved from m_systematicsInfo
1137 }
1138 return results;
1139}

◆ makeEigenSyst()

std::vector< std::string > BTaggingEfficiencyTool::makeEigenSyst ( const std::string & flav,
int number,
const std::string & suffix )
private

generate names for the eigenvector variations for the given jet flavour

Definition at line 1359 of file BTaggingEfficiencyTool.cxx.

1359 {
1360 std::vector<std::string> systStrings;
1361 for(int i=0;i<number;++i) {
1362 std::ostringstream ost;
1363 ost << flav << "_" << i << suffix;
1364 std::string basename="FT_EFF_Eigen_"+ost.str();
1365 systStrings.push_back(basename);
1366 }
1367 return systStrings;
1368}
std::string basename(std::string name)
Definition utils.cxx:207
std::string number(const double &d, const std::string &s)
Definition utils.cxx:186

◆ 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 BTaggingEfficiencyTool::recommendedSystematics ( ) const
virtual

Return a list of "recommended" systematic variations supported by this tool.

At present, multiple views of the same uncertainties (beyond the uncertainty model etc., see above) are not implemented, so this method simply calls affectingSystematics() .

Implements CP::IReentrantSystematicsTool.

Definition at line 1106 of file BTaggingEfficiencyTool.cxx.

1106 {
1107 return affectingSystematics();
1108}

◆ 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 }

◆ setMapIndex() [1/2]

bool BTaggingEfficiencyTool::setMapIndex ( const std::string & flavour,
unsigned int index )
virtual

Specify the "map index" to be used for the given jet flavour (at initialisation time it will be set to 0).

Returns
false if the requested index is invalid (in which case no setting will be changed)

See the CalibrationDataInterface documentation for more detail on the meaning of the map index

Implements IBTaggingEfficiencyTool.

Definition at line 1302 of file BTaggingEfficiencyTool.cxx.

1303{
1304 // do nothing unless it's needed!
1305 if (m_initialised && index == m_mapIndices[label]) return true;
1306 // convert to integer index
1307 unsigned int flavourID = -1; // set default, error if ever seen
1309 flavourID = getFlavourID(label);
1310 } else {
1311 auto iter = std::find(m_flex_labels.begin(), m_flex_labels.end(), label);
1312 if (iter != m_flex_labels.end()){
1313 flavourID = getFlavourID(label, false);
1314 }
1315 }
1316 // retrieve the new calibration index
1317 unsigned int effIndex;
1318 if (m_CDI->retrieveCalibrationIndex(label, m_OP, m_jetAuthor, false, effIndex, index)) {
1319 // replace cached information
1321 m_EffIndices[flavourID] = effIndex; // This shortcuts you from flavourID to Eff container
1322 unsigned int sfIndex;
1323 if( m_CDI->retrieveCalibrationIndex(label, m_OP, m_jetAuthor, true, sfIndex, index)) {
1324 m_SFIndices[flavourID] = sfIndex; // This shortcuts you from flavourID to SF container
1325 return true;
1326 } else {
1327 ATH_MSG_ERROR("setMapIndex failed to find a SF calibration object" << label << " " << index);
1328 }
1329 } else {
1330 // flag non-existent calibration object & do nothing
1331 ATH_MSG_ERROR("setMapIndex failed to find an Eff calibration object" << label << " " << index);
1332 }
1333 return false;
1334}
std::map< std::string, unsigned int > m_mapIndices

◆ setMapIndex() [2/2]

bool BTaggingEfficiencyTool::setMapIndex ( unsigned int dsid)
virtual

Implements IBTaggingEfficiencyTool.

Definition at line 1335 of file BTaggingEfficiencyTool.cxx.

1335 {
1336
1337 if(m_DSID_to_MapIndex.find(dsid) == m_DSID_to_MapIndex.end() ){
1338 ATH_MSG_WARNING("setMapIndex DSID " << dsid << "not found in config file");
1339
1340 }else{
1341 unsigned int map_index = m_DSID_to_MapIndex[dsid];
1342
1343 bool set_b = setMapIndex("B",map_index);
1344 bool set_c = setMapIndex("C",map_index);
1345 bool set_light = setMapIndex("Light",map_index);
1346 bool set_t = setMapIndex("T",map_index);
1347
1348 return set_b && set_c && set_light && set_t;
1349 }
1350
1351
1352 return false;
1353
1354}

◆ 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.

◆ 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_applySyst

bool BTaggingEfficiencyTool::m_applySyst
private

Definition at line 404 of file BTaggingEfficiencyTool.h.

◆ m_applyThisSyst

SystInfo BTaggingEfficiencyTool::m_applyThisSyst
private

Definition at line 405 of file BTaggingEfficiencyTool.h.

◆ m_CDI

std::shared_ptr<Analysis::CalibrationDataInterfaceROOT> BTaggingEfficiencyTool::m_CDI
private

pointer to the object doing the actual work

Definition at line 296 of file BTaggingEfficiencyTool.h.

◆ m_coneFlavourLabel

Gaudi::Property<bool> BTaggingEfficiencyTool::m_coneFlavourLabel {this, "ConeFlavourLabel", true, "specify whether or not to use the cone-based flavour labelling instead of the default ghost association based labelling"}
private

if true, use cone-based labelling (as opposed to ghost association)

Definition at line 377 of file BTaggingEfficiencyTool.h.

377{this, "ConeFlavourLabel", true, "specify whether or not to use the cone-based flavour labelling instead of the default ghost association based labelling"};

◆ 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_DSID_to_MapIndex

std::map<unsigned int, unsigned int> BTaggingEfficiencyTool::m_DSID_to_MapIndex
private

Definition at line 426 of file BTaggingEfficiencyTool.h.

◆ m_EffConfigFile

Gaudi::Property<std::string> BTaggingEfficiencyTool::m_EffConfigFile {this, "EfficiencyConfig", "", "name of config file specifying which efficiency map to use with a given samples DSID"}
private

Definition at line 312 of file BTaggingEfficiencyTool.h.

312{this, "EfficiencyConfig", "", "name of config file specifying which efficiency map to use with a given samples DSID"};

◆ m_EffFile

Gaudi::Property<std::string> BTaggingEfficiencyTool::m_EffFile {this, "EfficiencyFileName", "", "name of optional user-provided MC efficiency CDI file"}
private

name of the optional MC efficiency file (may be changed by the PathResolver)

Definition at line 311 of file BTaggingEfficiencyTool.h.

311{this, "EfficiencyFileName", "", "name of optional user-provided MC efficiency CDI file"};

◆ m_EffIndices

std::map<unsigned int, unsigned int> BTaggingEfficiencyTool::m_EffIndices
private

actual information identifying efficiency calibration objects

Definition at line 423 of file BTaggingEfficiencyTool.h.

◆ m_effName

Gaudi::Property<std::string> BTaggingEfficiencyTool::m_effName {this, "EfficiencyCalibrations", "default", "default for all flavors"}
private

Definition at line 334 of file BTaggingEfficiencyTool.h.

334{this, "EfficiencyCalibrations", "default", "default for all flavors"};

◆ m_EffNames

std::map<std::string, std::string> BTaggingEfficiencyTool::m_EffNames
private

Definition at line 331 of file BTaggingEfficiencyTool.h.

◆ m_EffNames_flex

Gaudi::Property<std::string> BTaggingEfficiencyTool::m_EffNames_flex {this, "FlexibleEfficiencyCalibrations", "", "(semicolon-separated) name(s) of efficiency object(s) names for (0,1,2..) indexed flavour labels, e.g. '0:default;1:default;2:default;3:default'"}
private

Definition at line 356 of file BTaggingEfficiencyTool.h.

356{this, "FlexibleEfficiencyCalibrations", "", "(semicolon-separated) name(s) of efficiency object(s) names for (0,1,2..) indexed flavour labels, e.g. '0:default;1:default;2:default;3:default'"};

◆ m_EffNamesB

Gaudi::Property<std::string> BTaggingEfficiencyTool::m_EffNamesB {this, "EfficiencyBCalibrations", "", "(semicolon-separated) name(s) of b-jet efficiency object(s)"}
private

semicolon-separated lists of MC efficiency parametrisation names

Definition at line 327 of file BTaggingEfficiencyTool.h.

327{this, "EfficiencyBCalibrations", "", "(semicolon-separated) name(s) of b-jet efficiency object(s)"};

◆ m_EffNamesC

Gaudi::Property<std::string> BTaggingEfficiencyTool::m_EffNamesC {this, "EfficiencyCCalibrations", "", "(semicolon-separated) name(s) of c-jet efficiency object(s)"}
private

Definition at line 328 of file BTaggingEfficiencyTool.h.

328{this, "EfficiencyCCalibrations", "", "(semicolon-separated) name(s) of c-jet efficiency object(s)"};

◆ m_EffNamesLight

Gaudi::Property<std::string> BTaggingEfficiencyTool::m_EffNamesLight {this, "EfficiencyLightCalibrations", "", "(semicolon-separated) name(s) of light-flavour-jet efficiency object(s)"}
private

Definition at line 330 of file BTaggingEfficiencyTool.h.

330{this, "EfficiencyLightCalibrations", "", "(semicolon-separated) name(s) of light-flavour-jet efficiency object(s)"};

◆ m_EffNamesT

Gaudi::Property<std::string> BTaggingEfficiencyTool::m_EffNamesT {this, "EfficiencyTCalibrations", "", "(semicolon-separated) name(s) of tau-jet efficiency object(s)"}
private

Definition at line 329 of file BTaggingEfficiencyTool.h.

329{this, "EfficiencyTCalibrations", "", "(semicolon-separated) name(s) of tau-jet efficiency object(s)"};

◆ m_EVReduction

std::map<std::string, std::string> BTaggingEfficiencyTool::m_EVReduction
private

Definition at line 324 of file BTaggingEfficiencyTool.h.

◆ m_EVReduction_flex

Gaudi::Property<std::string> BTaggingEfficiencyTool::m_EVReduction_flex {this, "FlexibleEigenvectorReduction", "", "(semicolon-separated) list of eigenvector reduction strategy for (0,1,2..) indexed flavour labels; choose between 'Loose', 'Medium', 'Tight' for different labels, e.g. '0:Loose;1:Loose;2:Loose'"}
private

Definition at line 354 of file BTaggingEfficiencyTool.h.

354{this, "FlexibleEigenvectorReduction", "", "(semicolon-separated) list of eigenvector reduction strategy for (0,1,2..) indexed flavour labels; choose between 'Loose', 'Medium', 'Tight' for different labels, e.g. '0:Loose;1:Loose;2:Loose'"};

◆ m_EVReductionB

Gaudi::Property<std::string> BTaggingEfficiencyTool::m_EVReductionB {this, "EigenvectorReductionB", "Loose", "b-jet scale factor Eigenvector reduction strategy; choose between 'Loose', 'Medium', 'Tight'"}
private

specification of the eigenvector reduction strategy (if eigenvectors are used)

Definition at line 321 of file BTaggingEfficiencyTool.h.

321{this, "EigenvectorReductionB", "Loose", "b-jet scale factor Eigenvector reduction strategy; choose between 'Loose', 'Medium', 'Tight'"};

◆ m_EVReductionC

Gaudi::Property<std::string> BTaggingEfficiencyTool::m_EVReductionC {this, "EigenvectorReductionC", "Loose", "c-jet scale factor Eigenvector reduction strategy; choose between 'Loose', 'Medium', 'Tight'"}
private

Definition at line 322 of file BTaggingEfficiencyTool.h.

322{this, "EigenvectorReductionC", "Loose", "c-jet scale factor Eigenvector reduction strategy; choose between 'Loose', 'Medium', 'Tight'"};

◆ m_EVReductionLight

Gaudi::Property<std::string> BTaggingEfficiencyTool::m_EVReductionLight {this, "EigenvectorReductionLight", "Loose", "light-flavour jet scale factor Eigenvector reduction strategy; choose between 'Loose', 'Medium', 'Tight'"}
private

Definition at line 323 of file BTaggingEfficiencyTool.h.

323{this, "EigenvectorReductionLight", "Loose", "light-flavour jet scale factor Eigenvector reduction strategy; choose between 'Loose', 'Medium', 'Tight'"};

◆ 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_excludeFlvFromEV

std::map<std::string, std::string> BTaggingEfficiencyTool::m_excludeFlvFromEV
private

Definition at line 341 of file BTaggingEfficiencyTool.h.

◆ m_excludeFlvFromEV_flex

Gaudi::Property<std::string> BTaggingEfficiencyTool::m_excludeFlvFromEV_flex {this, "FlexibleExcludeFromEVTreatment", "", "(semicolon-separated) names of uncertainties to be excluded from (0,1,2..) indexed flavour eigenvector decompositions (if used), e.g. '0:;1:;2:;3:'"}
private

Definition at line 360 of file BTaggingEfficiencyTool.h.

360{this, "FlexibleExcludeFromEVTreatment", "", "(semicolon-separated) names of uncertainties to be excluded from (0,1,2..) indexed flavour eigenvector decompositions (if used), e.g. '0:;1:;2:;3:'"};

◆ m_excludeFlvFromEVB

Gaudi::Property<std::string> BTaggingEfficiencyTool::m_excludeFlvFromEVB {this, "ExcludeFromEigenVectorBTreatment", "", "(semicolon-separated) names of uncertainties to be excluded from b-jet eigenvector decompositions (if used)"}
private

semicolon-separated list of uncertainties to be excluded from the eigenvector variation procedure for b, c, and light-flavour jets

Definition at line 338 of file BTaggingEfficiencyTool.h.

338{this, "ExcludeFromEigenVectorBTreatment", "", "(semicolon-separated) names of uncertainties to be excluded from b-jet eigenvector decompositions (if used)"};

◆ m_excludeFlvFromEVC

Gaudi::Property<std::string> BTaggingEfficiencyTool::m_excludeFlvFromEVC {this, "ExcludeFromEigenVectorCTreatment", "", "(semicolon-separated) names of uncertainties to be excluded from c-jet eigenvector decompositions (if used)"}
private

Definition at line 339 of file BTaggingEfficiencyTool.h.

339{this, "ExcludeFromEigenVectorCTreatment", "", "(semicolon-separated) names of uncertainties to be excluded from c-jet eigenvector decompositions (if used)"};

◆ m_excludeFlvFromEVLight

Gaudi::Property<std::string> BTaggingEfficiencyTool::m_excludeFlvFromEVLight {this, "ExcludeFromEigenVectorLightTreatment", "", "(semicolon-separated) names of uncertainties to be excluded from light-flavour-jet eigenvector decompositions (if used)"}
private

Definition at line 340 of file BTaggingEfficiencyTool.h.

340{this, "ExcludeFromEigenVectorLightTreatment", "", "(semicolon-separated) names of uncertainties to be excluded from light-flavour-jet eigenvector decompositions (if used)"};

◆ m_excludeFromEV

Gaudi::Property<std::string> BTaggingEfficiencyTool::m_excludeFromEV {this, "ExcludeFromEigenVectorTreatment", "", "(semicolon-separated) names of uncertainties to be excluded from all eigenvector decompositions (if used)"}
private

semicolon-separated list of uncertainties to be excluded from the eigenvector variation procedure for all flavours

Definition at line 336 of file BTaggingEfficiencyTool.h.

336{this, "ExcludeFromEigenVectorTreatment", "", "(semicolon-separated) names of uncertainties to be excluded from all eigenvector decompositions (if used)"};

◆ m_extFlavourLabel

Gaudi::Property<bool> BTaggingEfficiencyTool::m_extFlavourLabel {this, "ExtendedFlavourLabel", false, "specify whether or not to use an 'extended' flavour labelling (allowing for multiple HF hadrons or perhaps partons)"}
private

if true, use an 'extended' labelling (allowing for multiple HF hadrons -or perhaps partons- in the jet)

Definition at line 379 of file BTaggingEfficiencyTool.h.

379{this, "ExtendedFlavourLabel", false, "specify whether or not to use an 'extended' flavour labelling (allowing for multiple HF hadrons or perhaps partons)"};

◆ m_flex_label_integers

std::vector<unsigned int> BTaggingEfficiencyTool::m_flex_label_integers
private

Definition at line 395 of file BTaggingEfficiencyTool.h.

◆ m_flex_labels

std::vector<std::string> BTaggingEfficiencyTool::m_flex_labels
private

Definition at line 394 of file BTaggingEfficiencyTool.h.

◆ m_ignoreOutOfValidityRange

Gaudi::Property<bool> BTaggingEfficiencyTool::m_ignoreOutOfValidityRange {this, "IgnoreOutOfValidityRange", false, "ignore out-of-extrapolation-range errors as returned by the underlying tool"}
private

if true, ignore out-of-extrapolation range errors (i.e., return CorrectionCode::Ok if these are encountered)

Definition at line 383 of file BTaggingEfficiencyTool.h.

383{this, "IgnoreOutOfValidityRange", false, "ignore out-of-extrapolation-range errors as returned by the underlying tool"};

◆ m_initialised

bool BTaggingEfficiencyTool::m_initialised
private

flag to indicate tool is initialized correctly when set

Definition at line 401 of file BTaggingEfficiencyTool.h.

◆ m_isContinuous

bool BTaggingEfficiencyTool::m_isContinuous
private

Definition at line 411 of file BTaggingEfficiencyTool.h.

◆ m_isContinuous2D

bool BTaggingEfficiencyTool::m_isContinuous2D
private

Definition at line 413 of file BTaggingEfficiencyTool.h.

◆ m_jetAuthor

Gaudi::Property<std::string> BTaggingEfficiencyTool::m_jetAuthor {this, "JetAuthor", ftag::defaults::jet_collection, "jet collection & JVF/JVT specification in CDI file"}
private

jet collection name

Definition at line 368 of file BTaggingEfficiencyTool.h.

368{this, "JetAuthor", ftag::defaults::jet_collection, "jet collection & JVF/JVT specification in CDI file"};
const std::string jet_collection

◆ m_mapIndices

std::map<std::string, unsigned int> BTaggingEfficiencyTool::m_mapIndices
private

Definition at line 418 of file BTaggingEfficiencyTool.h.

◆ m_minPt

Gaudi::Property<float> BTaggingEfficiencyTool::m_minPt {this, "MinPt", 0., "minimum jet pT cut"}
private

minimum jet pT

Definition at line 370 of file BTaggingEfficiencyTool.h.

370{this, "MinPt", 0., "minimum jet pT cut"};

◆ m_OP

Gaudi::Property<std::string> BTaggingEfficiencyTool::m_OP {this, "OperatingPoint", ftag::defaults::pcbt_op, "operating point as specified in CDI file"}
private

operating point

Definition at line 366 of file BTaggingEfficiencyTool.h.

366{this, "OperatingPoint", ftag::defaults::pcbt_op, "operating point as specified in CDI file"};
const std::string pcbt_op

◆ m_pathToONNX

Gaudi::Property<std::string> BTaggingEfficiencyTool::m_pathToONNX {this, "pathToONNX", "", "path to the onnx file that will be used for inference"}
private

if this string is empty, the onnx tool won't be created

Definition at line 389 of file BTaggingEfficiencyTool.h.

389{this, "pathToONNX", "", "path to the onnx file that will be used for inference"};

◆ m_readFromBTaggingObject

Gaudi::Property<bool> BTaggingEfficiencyTool::m_readFromBTaggingObject {this, "readFromBTaggingObject", false, "Enabled to access btagging scores from xAOD::BTagging object; Can be disabled for GN2v01 to access the scores from the jet itself."}
private

Definition at line 387 of file BTaggingEfficiencyTool.h.

387{this, "readFromBTaggingObject", false, "Enabled to access btagging scores from xAOD::BTagging object; Can be disabled for GN2v01 to access the scores from the jet itself."};

◆ m_saltModel

std::unique_ptr<SaltModel> BTaggingEfficiencyTool::m_saltModel
private

pointer to the onnx tool

Definition at line 298 of file BTaggingEfficiencyTool.h.

◆ m_SelectionCDIFile

Gaudi::Property<std::string> BTaggingEfficiencyTool::m_SelectionCDIFile {this, "SelectionCDIFileName", "", "name of the CDI file to be used to configure the selection tool if needed, will use the SF CDI file by default"}
private

Definition at line 309 of file BTaggingEfficiencyTool.h.

309{this, "SelectionCDIFileName", "", "name of the CDI file to be used to configure the selection tool if needed, will use the SF CDI file by default"};

◆ m_selectionTaggerName

Gaudi::Property<std::string> BTaggingEfficiencyTool::m_selectionTaggerName {this, "SelectionTaggerName", "", "tagging algorithm name as specified in selection CDI file, will use TaggerName by default"}
private

Definition at line 364 of file BTaggingEfficiencyTool.h.

364{this, "SelectionTaggerName", "", "tagging algorithm name as specified in selection CDI file, will use TaggerName by default"};

◆ m_selectionTool

asg::AnaToolHandle<IBTaggingSelectionTool> BTaggingEfficiencyTool::m_selectionTool
private

we need access to a BTaggingSelectionTool, at least for DL1 weight computation

Definition at line 304 of file BTaggingEfficiencyTool.h.

◆ m_SFFile

Gaudi::Property<std::string> BTaggingEfficiencyTool::m_SFFile {this, "ScaleFactorFileName", ftag::defaults::cdi_path, "name of the official scale factor calibration CDI file (uses PathResolver)"}
private

name of the data/MC efficiency scale factor calibration file (may be changed by the PathResolver)

Definition at line 307 of file BTaggingEfficiencyTool.h.

307{this, "ScaleFactorFileName", ftag::defaults::cdi_path, "name of the official scale factor calibration CDI file (uses PathResolver)"};
const std::string cdi_path

◆ m_SFFileFull

std::string BTaggingEfficiencyTool::m_SFFileFull
private

Definition at line 308 of file BTaggingEfficiencyTool.h.

◆ m_SFIndices

std::map<unsigned int, unsigned int> BTaggingEfficiencyTool::m_SFIndices
private

actual information identifying scale factor calibration objects

Definition at line 421 of file BTaggingEfficiencyTool.h.

◆ m_SFName_flex

Gaudi::Property<std::string> BTaggingEfficiencyTool::m_SFName_flex {this, "FlexibleScaleFactorCalibrations", "", "(semicolon-separated) name of scale factor calibration object for (0,1,2..) indexed flavour labels, e.g. '0:default;1:default;2:default;3:default'"}
private

Definition at line 352 of file BTaggingEfficiencyTool.h.

352{this, "FlexibleScaleFactorCalibrations", "", "(semicolon-separated) name of scale factor calibration object for (0,1,2..) indexed flavour labels, e.g. '0:default;1:default;2:default;3:default'"};

◆ m_SFNames

std::map<std::string, std::string> BTaggingEfficiencyTool::m_SFNames
private

Definition at line 318 of file BTaggingEfficiencyTool.h.

◆ m_SFNamesB

Gaudi::Property<std::string> BTaggingEfficiencyTool::m_SFNamesB {this, "ScaleFactorBCalibration", "default", "name of b-jet scale factor calibration object"}
private

names of the data/MC scale factor calibrations

Definition at line 314 of file BTaggingEfficiencyTool.h.

314{this, "ScaleFactorBCalibration", "default", "name of b-jet scale factor calibration object"};

◆ m_SFNamesC

Gaudi::Property<std::string> BTaggingEfficiencyTool::m_SFNamesC {this, "ScaleFactorCCalibration", "default", "name of c-jet scale factor calibration object"}
private

Definition at line 315 of file BTaggingEfficiencyTool.h.

315{this, "ScaleFactorCCalibration", "default", "name of c-jet scale factor calibration object"};

◆ m_SFNamesLight

Gaudi::Property<std::string> BTaggingEfficiencyTool::m_SFNamesLight {this, "ScaleFactorLightCalibration", "default", "name of light-flavour jet scale factor calibration object"}
private

Definition at line 317 of file BTaggingEfficiencyTool.h.

317{this, "ScaleFactorLightCalibration", "default", "name of light-flavour jet scale factor calibration object"};

◆ m_SFNamesT

Gaudi::Property<std::string> BTaggingEfficiencyTool::m_SFNamesT {this, "ScaleFactorTCalibration", "default", "name of tau-jet scale factor calibration object"}
private

Definition at line 316 of file BTaggingEfficiencyTool.h.

316{this, "ScaleFactorTCalibration", "default", "name of tau-jet scale factor calibration object"};

◆ m_systematics

CP::SystematicSet BTaggingEfficiencyTool::m_systematics
private

Definition at line 409 of file BTaggingEfficiencyTool.h.

◆ m_systematicsInfo

std::map<CP::SystematicVariation,SystInfo> BTaggingEfficiencyTool::m_systematicsInfo
private

Definition at line 407 of file BTaggingEfficiencyTool.h.

◆ m_systStrategy

Gaudi::Property<std::string> BTaggingEfficiencyTool::m_systStrategy {this, "SystematicsStrategy", ftag::defaults::strategy, "name of systematics model; presently choose between 'SFEigen' and 'Envelope'"}
private

systematics model to be used (current choices are "SFEigen", "SFEigenRefined", and "Envelope") // <-----— Addoing "SFGlobalEigen" to the list

Definition at line 372 of file BTaggingEfficiencyTool.h.

372{this, "SystematicsStrategy", ftag::defaults::strategy, "name of systematics model; presently choose between 'SFEigen' and 'Envelope'"};
const std::string strategy

◆ m_taggerName

Gaudi::Property<std::string> BTaggingEfficiencyTool::m_taggerName {this, "TaggerName", ftag::defaults::tagger, "tagging algorithm name as specified in CDI file"}
private

tagger name

Definition at line 363 of file BTaggingEfficiencyTool.h.

363{this, "TaggerName", ftag::defaults::tagger, "tagging algorithm name as specified in CDI file"};
const std::string tagger

◆ m_uncertaintySuffixes

std::map<std::string, std::string> BTaggingEfficiencyTool::m_uncertaintySuffixes
private

Definition at line 348 of file BTaggingEfficiencyTool.h.

◆ m_uncertaintySuffixes_flex

Gaudi::Property<std::string> BTaggingEfficiencyTool::m_uncertaintySuffixes_flex {this, "FlexibleUncertaintySuffix", "", "optional (semicolon-separated) list of suffixes for (0,1,2..) indexed flavour label uncertainty naming, e.g. '0:;1:;2:;3:'"}
private

Definition at line 358 of file BTaggingEfficiencyTool.h.

358{this, "FlexibleUncertaintySuffix", "", "optional (semicolon-separated) list of suffixes for (0,1,2..) indexed flavour label uncertainty naming, e.g. '0:;1:;2:;3:'"};

◆ m_uncertaintySuffixesB

Gaudi::Property<std::string> BTaggingEfficiencyTool::m_uncertaintySuffixesB {this, "UncertaintyBSuffix", "", "optional suffix for b-jet uncertainty naming"}
private

optional (per-flavour) suffix that can be used to decorrelate uncertainties (between flavours, or -in case of a result from different runs- between periods)

Definition at line 344 of file BTaggingEfficiencyTool.h.

344{this, "UncertaintyBSuffix", "", "optional suffix for b-jet uncertainty naming"};

◆ m_uncertaintySuffixesC

Gaudi::Property<std::string> BTaggingEfficiencyTool::m_uncertaintySuffixesC {this, "UncertaintyCSuffix", "", "optional suffix for c-jet uncertainty naming"}
private

Definition at line 345 of file BTaggingEfficiencyTool.h.

345{this, "UncertaintyCSuffix", "", "optional suffix for c-jet uncertainty naming"};

◆ m_uncertaintySuffixesLight

Gaudi::Property<std::string> BTaggingEfficiencyTool::m_uncertaintySuffixesLight {this, "UncertaintyLightSuffix", "", "optional suffix for light-flavour-jet uncertainty naming"}
private

Definition at line 347 of file BTaggingEfficiencyTool.h.

347{this, "UncertaintyLightSuffix", "", "optional suffix for light-flavour-jet uncertainty naming"};

◆ m_uncertaintySuffixesT

Gaudi::Property<std::string> BTaggingEfficiencyTool::m_uncertaintySuffixesT {this, "UncertaintyTSuffix", "", "optional suffix for tau-jet uncertainty naming"}
private

Definition at line 346 of file BTaggingEfficiencyTool.h.

346{this, "UncertaintyTSuffix", "", "optional suffix for tau-jet uncertainty naming"};

◆ m_useCTag

Gaudi::Property<bool> BTaggingEfficiencyTool::m_useCTag {this, "useCTagging", false, "Enabled only for FixedCut or Continuous WPs: define wether the cuts refer to b-tagging or c-tagging"}
private

if false, suppress any non-error/warning printout from the underlying tool 1D tagging only: define wether the cuts refer to b-tagging or c-tagging

Definition at line 386 of file BTaggingEfficiencyTool.h.

386{this, "useCTagging", false, "Enabled only for FixedCut or Continuous WPs: define wether the cuts refer to b-tagging or c-tagging"};

◆ m_useDevFile

Gaudi::Property<bool> BTaggingEfficiencyTool::m_useDevFile
private
Initial value:
{this, "UseDevelopmentFile", false,
"specify whether or not to use the (PathResolver) area for temporary scale factor calibration CDI files"}

if true, attempt to retrieve the data/MC efficiency scale factor calibration files from the @PathResolver development area

Definition at line 374 of file BTaggingEfficiencyTool.h.

374 {this, "UseDevelopmentFile", false,
375 "specify whether or not to use the (PathResolver) area for temporary scale factor calibration CDI files"};

◆ m_useFlex

Gaudi::Property<bool> BTaggingEfficiencyTool::m_useFlex {this, "useFlexibleConfig", false, "Setup the flexible configuration of the xAODBTaggingEfficiencyTool with alternate labeling"}
private

Definition at line 393 of file BTaggingEfficiencyTool.h.

393{this, "useFlexibleConfig", false, "Setup the flexible configuration of the xAODBTaggingEfficiencyTool with alternate labeling"};

◆ m_useRecommendedEVExclusions

Gaudi::Property<bool> BTaggingEfficiencyTool::m_useRecommendedEVExclusions {this, "ExcludeRecommendedFromEigenVectorTreatment", false, "specify whether or not to add recommended lists to the user specified eigenvector decomposition exclusion lists"}
private

if true, extract pre-set lists of uncertainties to be recommended from the EV decomposition (in addition to user specified ones)

Definition at line 381 of file BTaggingEfficiencyTool.h.

381{this, "ExcludeRecommendedFromEigenVectorTreatment", false, "specify whether or not to add recommended lists to the user specified eigenvector decomposition exclusion lists"};

◆ m_using_conventional_labels

bool BTaggingEfficiencyTool::m_using_conventional_labels
private

Definition at line 350 of file BTaggingEfficiencyTool.h.

◆ 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.


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