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< StoreGateSvc > StoreGateSvc_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::CalibrationDataInterfaceROOT > m_CDI
 pointer to the object doing the actual work
std::unique_ptr< SaltModel > m_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< IBTaggingSelectionTool > m_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 = false
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< bool > m_splitTauCharmEff {this, "splitTauCharmEff", false, "[Expert mode]. If false (recommended value), tau-jets and charm-jets will be treated as a single category in the eigenvector decomposition. If true (not recommended), eigenvector decomposition will be split for tau-jets and charm-jets efficiencies. PLEASE CONTACT FTAG GROUP BEFORE TURNING FLAG TO TRUE FOR YOUR ANALYSIS"}
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

flag to indicate tool is initialized correctly when set

bool m_initialised = false
bool m_applySyst = false
SystInfo m_applyThisSyst
std::map< CP::SystematicVariation, SystInfo > m_systematicsInfo
CP::SystematicSet m_systematics
bool m_isContinuous = false
bool m_isContinuous2D = false
bool m_isMV2Tagger = false
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 376 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
131 // declare the selection tool to be private (not absolutely sure this is needed?)
132 m_selectionTool.declarePropertyFor(this, "BTaggingSelectionTool", "selection tool to be used internally");
133}
asg::AnaToolHandle< IBTaggingSelectionTool > m_selectionTool
we need access to a BTaggingSelectionTool, at least for DL1 weight computation

◆ ~BTaggingEfficiencyTool()

BTaggingEfficiencyTool::~BTaggingEfficiencyTool ( )
virtual

Create a constructor for standalone usage.

Definition at line 135 of file BTaggingEfficiencyTool.cxx.

135 {
136 //delete m_CDI;
137}

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 1432 of file BTaggingEfficiencyTool.cxx.

1432 {
1433 for (int i=0, n=systematicNames.size(); i<n; ++i) {
1434 const std::string systName = systematicNames[i];
1435 SystematicVariation up(systName,1);
1436 SystematicVariation down(systName,-1);
1437 std::map<SystematicVariation,SystInfo>::iterator iter = m_systematicsInfo.find(up);
1438 if (iter == m_systematicsInfo.end()) {
1439 // First case: new variation
1440 SystInfo info;
1441 info.isUp = true;
1442 info.uncType = uncType;
1443 info.indexMap[flavourID] = i;
1445 ATH_MSG_VERBOSE("addSystematics: adding " << systName << " for flavour " << getLabel(flavourID));
1446 info.isUp = false;
1447 m_systematicsInfo[down]=info;
1448 } else {
1449 // Second case: already known variation. This can happen if a variation applies to more than one
1450 // jet flavour. Check that indeed it's not registered yet for the requested flavour.
1451 SystInfo info = iter->second; // make a copy
1452 std::map<unsigned int, unsigned int>::const_iterator indIter = info.indexMap.find(flavourID);
1453 if (indIter != info.indexMap.end()) {
1454 ATH_MSG_ERROR("addSystematics : flavourID " << flavourID << " is already in the map for uncertainty '" << systName << "', ignoring");
1455 continue;
1456 } else {
1457 info.indexMap[flavourID] = i;
1459 ATH_MSG_VERBOSE("addSystematics: adding " << systName << " for flavour " << getLabel(flavourID));
1460 info.isUp = false;
1461 m_systematicsInfo[down] = info;
1462 }
1463 }
1464 }
1465 return true;
1466}
#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 1131 of file BTaggingEfficiencyTool.cxx.

1131 {
1132 return m_systematics;
1133}

◆ applySystematics()

bool BTaggingEfficiencyTool::applySystematics ( ) const
inline

Specify whether any systematic variation is being used at present.

Definition at line 197 of file BTaggingEfficiencyTool.h.

◆ 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 1241 of file BTaggingEfficiencyTool.cxx.

1241 {
1242 // If the user is doing the right thing, no need to use the costly filterForAffectingSystematics
1243 // i.e if only 1 variation passed and this variation is in the map. Else, resort to full logic.
1244 if (systConfig.size() == 1 ) {
1245 auto mapIter = m_systematicsInfo.find(*(systConfig.begin()));
1246 if (mapIter != m_systematicsInfo.end()) {
1247 m_applySyst = true;
1248 m_applyThisSyst = mapIter->second;
1249 ATH_MSG_VERBOSE("variation '" << systConfig.begin()->name() << "' applied successfully");
1250 return StatusCode::SUCCESS;
1251 }
1252 }
1253
1254 // First filter out any systematics that do not apply to us
1255 SystematicSet filteredSysts;
1256 if (SystematicSet::filterForAffectingSystematics(systConfig, m_systematics, filteredSysts) != StatusCode::SUCCESS) {
1257 ATH_MSG_ERROR("received unsupported systematics: " << systConfig.name());
1258 return StatusCode::FAILURE;
1259 }
1260 // check the size of the remaining (filtered) SystematicSet
1261 if (filteredSysts.size() == 0) {
1262 // If it is 0 then turn off systematics
1263 ATH_MSG_VERBOSE("empty systematics set; nothing to be done");
1264 m_applySyst = false;
1265 return StatusCode::SUCCESS;
1266 } else if (filteredSysts.size() > 1) {
1267 // Restriction: we allow only a single systematic variation affecting b-tagging
1268 ATH_MSG_WARNING("more than a single b-tagging systematic variation requested but not (yet) supported");
1269 return StatusCode::FAILURE;
1270 } else {
1271 // Interpret the (single) remaining variation
1272 SystematicVariation var = *(filteredSysts.begin());
1273 auto mapIter = m_systematicsInfo.find(var);
1274 if (mapIter == m_systematicsInfo.end()) {
1275 ATH_MSG_WARNING("variation '" << var.name() << "' not found! Cannot apply");
1276 return StatusCode::FAILURE;
1277 }
1278 m_applySyst = true;
1279 m_applyThisSyst = mapIter->second;
1280 ATH_MSG_VERBOSE("variation '" << var.name() << "' applied successfully");
1281 }
1282 return StatusCode::SUCCESS;
1283}
#define ATH_MSG_WARNING(x,...)
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 1317 of file BTaggingEfficiencyTool.cxx.

1318{
1319 x.jetPt = jetPt;
1320 x.jetEta = jetEta;
1321 x.jetTagWeight = jetTagWeight;
1322 x.jetAuthor = m_jetAuthor;
1323
1324 return true;
1325}
#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 1287 of file BTaggingEfficiencyTool.cxx.

1288{
1289 x.jetPt = jet.pt();
1290 x.jetEta = jet.eta();
1291 x.jetTagWeight = 0.;
1292 x.jetAuthor = m_jetAuthor;
1293 //bool weightOK = true;
1294
1295 if (m_isContinuous2D){
1296 x.jetTagWeight = m_selectionTool->getQuantile(jet)+0.5;
1297 }
1298 else if (m_isContinuous) {
1301 if (!tagInfo) return false;
1302 }
1303 // For now, we defer the tag weight computation to the selection tool
1304 // This concerns all the recent taggers the only tagger not concerned is MV2 tagger which is quite old
1305 if (!m_isMV2Tagger) {
1306 return (m_selectionTool->getTaggerWeight(jet, x.jetTagWeight, m_useCTag) == CP::CorrectionCode::Ok);
1307 } else {
1308 ATH_MSG_ERROR("BTaggingEfficiencyTool doesn't support tagger: "+m_taggerName);
1309 return CorrectionCode::Error;
1310 }
1311 }
1312
1313 return true;
1314}
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...
@ Error
Some error happened during the object correction.
@ Ok
The correction was done successfully.
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 820 of file BTaggingEfficiencyTool.cxx.

821{
823
824 // get the btag label
826
827 Analysis::CalibrationDataVariables vars;
828
829 if (! fillVariables(jet, vars)) {
830 ATH_MSG_ERROR("unable to fill variables required for efficiency evaluation");
832 }
833
834 return getEfficiency(flavour, vars, eff);
835}
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 838 of file BTaggingEfficiencyTool.cxx.

840{
842
844
845 unsigned int sfindex = 0;
846 unsigned int efindex = 0;
847
848 if( !getIndices(flavour,sfindex,efindex)) {
849 ATH_MSG_ERROR("BTaggingEfficiencyTool::getEfficiency call to getIndices failed " << flavour << " " << sfindex << " " << efindex);
851 }
852 Uncertainty unc = None;
853 unsigned int unc_ind = 0;
854
855 if( m_applySyst) {
856
857 unc = m_applyThisSyst.uncType;
858 // if( m_applyThisSyst.isNamed) {
859 // unc = SFNamed;
860 // } else {
861 // unc = SFEigen;
862 // }
863
864 if(!m_applyThisSyst.getIndex(flavour,unc_ind)) {
865 ATH_MSG_VERBOSE("getEfficiency: requested variation cannot be applied to flavour " << getLabel(flavour) << ", returning nominal result");
866 unc = None;
867 }
868 }
869
870 CalibrationStatus status = m_CDI->getEfficiency(v,sfindex,efindex, unc,unc_ind,result, getLabel(flavour));
871 // Interpret what has been retrieved;
872 // this depends both on the uncertainty type and on the up/down setting.
873 eff = result.first; // central value or up variation
874 if (m_applySyst && unc != None) {
875 if (! (unc == SFEigen || unc == SFNamed)){
876 eff += m_applyThisSyst.isUp ? result.second : -result.second ;
877 } else if (!m_applyThisSyst.isUp) {
878 eff = result.second; // down variation
879 }
880 }
881
882 switch (status) {
883 case Analysis::kError:
884 ATH_MSG_ERROR("BTaggingEfficiencyTool::getEfficiency call to underlying code returned a kError!");
886 case Analysis::kRange:
890 default:
891 return CorrectionCode::Ok;
892 }
893}
@ 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.
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 1213 of file BTaggingEfficiencyTool.cxx.

1213 {
1214 // Calling EigenVectorRecomposition method in CDI and retrieve recomposition map.
1215 // If success, coefficientMap would be filled and return ok.
1216 // If failed, return error.
1217 // label : flavour label
1218 // coefficientMap: store returned coefficient map.
1219 if (! m_initialised) {
1220 ATH_MSG_ERROR("BTaggingEfficiencyTool has not been initialised");
1221 return CorrectionCode::Error;
1222 }
1223 if(label.compare("B") != 0 &&
1224 label.compare("C") != 0 &&
1225 label.compare("T") != 0 &&
1226 label.compare("Light") != 0){
1227 ATH_MSG_ERROR("Flavour label is illegal! Label need to be B,C,T or Light.");
1228 return CorrectionCode::Error;
1229 }
1230 CalibrationStatus status = m_CDI->runEigenVectorRecomposition(m_jetAuthor, label, m_OP);
1231 if (status != Analysis::kSuccess){
1232 ATH_MSG_ERROR("Failure running EigenVectorRecomposition Method.");
1233 return CorrectionCode::Error;
1234 }
1235 coefficientMap = m_CDI->getEigenVectorRecompositionCoefficientMap();
1236 return CorrectionCode::Ok;
1237}
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 1400 of file BTaggingEfficiencyTool.cxx.

1400 {
1401 auto mapIter = m_SFIndices.find(flavour);
1402 if(mapIter != m_SFIndices.end()) {
1403 sf = mapIter->second;
1404 } else {
1405 return false;
1406 }
1407
1408 mapIter = m_EffIndices.find(flavour);
1409 if(mapIter != m_EffIndices.end()) {
1410 ef = mapIter->second;
1411 } else {
1412 return false;
1413 }
1414 return true;
1415}
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 896 of file BTaggingEfficiencyTool.cxx.

897{
899
900 // get the btag label
902
903 Analysis::CalibrationDataVariables vars;
904 if (! fillVariables(jet, vars)) {
905 ATH_MSG_ERROR("unable to fill variables required for scale factor evaluation");
907 }
908
909 return getInefficiency (flavour, vars, eff);
910}
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 913 of file BTaggingEfficiencyTool.cxx.

915{
917
919
920 unsigned int sfindex = 0;
921 unsigned int efindex = 0;
922
923 if( !getIndices(flavour,sfindex,efindex)) {
924 ATH_MSG_ERROR("BTaggingEfficiencyTool::getInefficiency call to getIndices failed " << flavour << " " << sfindex << " " << efindex);
926 }
927 Uncertainty unc = None;
928 unsigned int unc_ind = 0;
929 if( m_applySyst) {
930
931 unc = m_applyThisSyst.uncType;
932 // if( m_applyThisSyst.isNamed) {
933 // unc = SFNamed;
934 // } else {
935 // unc = SFEigen;
936 // }
937
938 if(!m_applyThisSyst.getIndex(flavour,unc_ind)) {
939 ATH_MSG_VERBOSE("getInefficiency: requested variation cannot be applied to flavour " << getLabel(flavour)
940 << ", returning nominal result");
941 unc = None;
942 }
943 }
944
945 CalibrationStatus status = m_CDI->getInefficiency(v, sfindex, efindex, unc, unc_ind, result, getLabel(flavour));
946 // Interpret what has been retrieved;
947 // this depends both on the uncertainty type and on the up/down setting.
948 // For the Total uncertainty, note also the sign change compared to e.g. getEfficiency().
949 eff = result.first; // central value or up variation
950 if (m_applySyst && unc != None) {
951 if (! (unc == SFEigen || unc == SFNamed))
952 eff += m_applyThisSyst.isUp ? -result.second : result.second ;
953 else if (!m_applyThisSyst.isUp) {
954 eff = result.second; // down variation
955 }
956 }
957
958 switch (status) {
959 case Analysis::kError:
960 ATH_MSG_ERROR("BTaggingEfficiencyTool::getInefficiency call to underlying code returned a kError!");
962 case Analysis::kRange:
966 default:
967 return CorrectionCode::Ok;
968 }
969}

◆ 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 972 of file BTaggingEfficiencyTool.cxx.

973{
976 ATH_MSG_ERROR("Inefficiency SF should NOT be included for the Continous operation point");
978 }
979
980 // get the btag label
982
983 Analysis::CalibrationDataVariables vars;
984 if (! fillVariables(jet, vars)) {
985 ATH_MSG_ERROR("unable to fill variables required for scale factor evaluation");
987 }
988
989 return getInefficiencyScaleFactor( flavour, vars, sf);
990}
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 993 of file BTaggingEfficiencyTool.cxx.

995{
998 ATH_MSG_ERROR("Inefficiency SF should NOT be included for the Continous operation point");
1000 }
1001
1003
1004 unsigned int sfindex = 0;
1005 unsigned int efindex = 0;
1006
1007 if( !getIndices(flavour,sfindex,efindex)) {
1008 ATH_MSG_ERROR("BTaggingEfficiencyTool::getInefficiencyScaleFactor call to getIndices failed " << flavour << " " << sfindex << " " << efindex);
1009 return CorrectionCode::Error;
1010 }
1011 Uncertainty unc=None;
1012 unsigned int unc_ind=0;
1013 if( m_applySyst) {
1014
1015 unc = m_applyThisSyst.uncType;
1016 // if( m_applyThisSyst.isNamed) {
1017 // unc = SFNamed;
1018 // } else {
1019 // unc = SFEigen;
1020 // }
1021
1022 if(!m_applyThisSyst.getIndex(flavour,unc_ind)) {
1023 ATH_MSG_VERBOSE("getInefficiencyScaleFactor: requested variation cannot be applied to flavour " << getLabel(flavour)
1024 << ", returning nominal result");
1025 unc = None;
1026 }
1027 }
1028
1029 CalibrationStatus status = m_CDI->getInefficiencyScaleFactor(v,sfindex,efindex, unc, unc_ind, result, getLabel(flavour));
1030 // Interpret what has been retrieved;
1031 // this depends both on the uncertainty type and on the up/down setting.
1032 // For the Total uncertainty, note also the sign change compared to e.g. getScaleFactor().
1033 sf = result.first; // central value or up variation
1034 if (m_applySyst && unc != None) {
1035 if (! (unc == SFEigen || unc == SFNamed))
1036 sf += m_applyThisSyst.isUp ? -result.second : result.second ;
1037 else if (!m_applyThisSyst.isUp) {
1038 sf = result.second; // down variation
1039 }
1040 }
1041
1042 switch (status) {
1043 case Analysis::kError:
1044 ATH_MSG_ERROR("BTaggingEfficiencyTool::getInefficiencyScaleFactor call to underlying code returned a kError!");
1045 return CorrectionCode::Error;
1046 case Analysis::kRange:
1049 case Analysis::kSuccess:
1050 default:
1051 return CorrectionCode::Ok;
1052 }
1053}

◆ 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::Event 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::Event, 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 1056 of file BTaggingEfficiencyTool.cxx.

1057{
1059
1060 // get the btag label
1062
1063 Analysis::CalibrationDataVariables vars;
1064 if (! fillVariables(jet, vars)) {
1065 ATH_MSG_ERROR("unable to fill variables required for scale factor evaluation");
1066 return CorrectionCode::Error;
1067 }
1068
1069 return getMCEfficiency( flavour, vars, eff);
1070}
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 1073 of file BTaggingEfficiencyTool.cxx.

1075{
1078
1079 unsigned int sfindex = 0;
1080 unsigned int efindex = 0;
1081
1082 if( !getIndices(flavour,sfindex,efindex)) {
1083 ATH_MSG_ERROR("BTaggingEfficiencyTool::getMCEfficiency call to getIndices failed " << flavour << " " << sfindex << " " << efindex);
1084 return CorrectionCode::Error;
1085 }
1086 Uncertainty unc = None;
1087 // no uncertainty index here as there aren't any uncertainties associated with the MC efficiencies
1088 CalibrationStatus status = m_CDI->getMCEfficiency(v,efindex, unc,result);
1089 eff = result.first;
1090 if( m_applySyst && !m_applyThisSyst.isUp) {
1091 eff = result.second; // down variation
1092 }
1093
1094 switch (status) {
1095 case Analysis::kError:
1096 ATH_MSG_ERROR("BTaggingEfficiencyTool::getMCEfficiency call to underlying code returned a kError!");
1097 return CorrectionCode::Error;
1098 case Analysis::kRange:
1101 case Analysis::kSuccess:
1102 default:
1103 return CorrectionCode::Ok;
1104 }
1105}

◆ 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 1109 of file BTaggingEfficiencyTool.cxx.

1110{
1111 m_saltModel->runInference(node_feat, effAllJet);
1112 return CorrectionCode::Ok;
1113}
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 1117 of file BTaggingEfficiencyTool.cxx.

1118{
1119 m_saltModel->runInference(node_feat, effAllJetAllWp);
1120 return CorrectionCode::Ok;
1121}

◆ 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::Event 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::Event, 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 732 of file BTaggingEfficiencyTool.cxx.

733{
734 if (! m_initialised) {
735 ATH_MSG_ERROR("BTaggingEfficiencyTool has not been initialised");
737 }
738
739 // get the btag label
740 int flavour{0};
741 if (m_using_conventional_labels){ // if not using conventional labels, so flavour label will have to be set by some other means...
743 }
744
745 Analysis::CalibrationDataVariables vars;
746 //const double pt = jet.pt();
747 //const double eta = jet.eta();
748 //const double tagwe = 0.7; // temporary testing
749 if (! fillVariables(jet, vars)) {
750 //if (! fillVariables(pt, eta, tagwe, vars)){
751 ATH_MSG_ERROR("unable to fill variables required for scale factor evaluation");
753 }
754
755 return getScaleFactor(flavour, vars, sf);
756}
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 759 of file BTaggingEfficiencyTool.cxx.

761{
762 if (! m_initialised) {
763 ATH_MSG_ERROR("BTaggingEfficiencyTool has not been initialised");
765 }
766
768
769 unsigned int sfindex = 0;
770 unsigned int efindex = 0;
771
772 if( !getIndices(flavour,sfindex,efindex)) { //<-------- This method returns true if it can find the sfindex and efindex corresponding to the flavour
773 // These indices are used internally in the CalibrationDataInterfaceROOT. They represent the index where
774 // 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)
775 // Once the container is retrieved by index, the CalibrationDataEigenVariations object is retrieved by container,
776 // which actually returns Up/Down variations, else return SF+SFError
777 ATH_MSG_ERROR("BTaggingEfficiencyTool::getScaleFactor call to getIndices failed " << flavour << " " << sfindex << " " << efindex);
779 }
781 Uncertainty unc = None;
782 unsigned int unc_ind=0; // <----- This is the index of the variation internal to the CDIROOT object
783
784 if( m_applySyst) { // indicate that we want to apply a systematic variation, i.e. return an up/down variation pair
785 unc = m_applyThisSyst.uncType; // type of systematic strategy...
786 if(!m_applyThisSyst.getIndex(flavour,unc_ind)) {
787 ATH_MSG_VERBOSE("getScaleFactor: requested variation cannot be applied to flavour " << getLabel(flavour) << ", returning nominal result");
788 unc = None;
789 }
790 }
791
792 // In all likelihood, the "sfindex" and "efindex" need more work in the CDIROOT (or in the CDGEV)
793 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));
794
795 // Interpret what has been retrieved;
796 // this depends both on the uncertainty type and on the up/down setting.
797 sf = result.first;
798 if (m_applySyst && unc != None) {
799 if (! (unc == SFEigen || unc == SFNamed || unc == SFGlobalEigen)){
800 sf += m_applyThisSyst.isUp ? result.second : -result.second ;
801 } else if (!m_applyThisSyst.isUp) {
802 sf = result.second; // otherwise, set the sf to the down variation (if down is requested)
803 } // otherwise, doing nothing will return the result.first value, which SHOULD represent the up variation
804 }
805
806 switch (status) {
807 case Analysis::kError:
808 ATH_MSG_ERROR("BTaggingEfficiencyTool::getScaleFactor call to underlying code returned a kError!");
810 case Analysis::kRange:
814 default:
815 return CorrectionCode::Ok;
816 }
817}

◆ 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 139 of file BTaggingEfficiencyTool.cxx.

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

1126{
1127 return m_systematics.find( systematic) != m_systematics.end();
1128}

◆ 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 1178 of file BTaggingEfficiencyTool.cxx.

1178 {
1179 std::map<std::string, std::vector<std::string> > uncertainties;
1180
1181 std::vector<unsigned int> all_flavours;
1183 all_flavours = { 5, 4, 15, 0 };
1184 } else {
1185 all_flavours = m_flex_label_integers;
1186 }
1187
1188 for (const unsigned int flavourID : all_flavours){
1189 // Assumed model: use eigenvector variations. In this model, the tau SF are identical to the c-jet ones,
1190 // with merely one additional uncertainty assigned due to the extrapolation.
1191 unsigned int flavourIDRef = flavourID;
1192 if (m_using_conventional_labels and flavourID == 15){
1193 flavourIDRef = 4; // make C - T relationship
1194 }
1195 auto mapIter = m_SFIndices.find(flavourIDRef);
1196 if( mapIter==m_SFIndices.end()) { // if the flavour doesn't have an entry need to fail the initialization
1197 ATH_MSG_ERROR( "No entry for flavour " << flavourIDRef << " in SFIndices map, invalid initialization");
1198 continue;
1199 }
1200 int idRef = mapIter->second;
1201 // Retrieve the actual list
1202 std::vector<std::string> systematics = m_CDI->listScaleFactorUncertainties(idRef, getLabel(flavourID), named);
1203 // For the special case of tau SF, add the extrapolation from charm.
1204 // Since this comes on top of the charm uncertainties, it would always be a "named" uncertainty,
1205 // so there is no need to check for the "named" argument.
1206 if (m_using_conventional_labels and flavourID == 15) systematics.push_back("extrapolation from charm");
1207 uncertainties[getLabel(int(flavourID))] = systematics;
1208 }
1209 return uncertainties;
1210}

◆ listSystematics()

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

Implements IBTaggingEfficiencyTool.

Definition at line 1141 of file BTaggingEfficiencyTool.cxx.

1141 {
1142 std::map<SystematicVariation, std::vector<std::string> > results;
1143
1144 if (! m_initialised) {
1145 ATH_MSG_ERROR("listSystematics() cannot be called before initialisation is finished");
1146 return results;
1147 }
1148
1149
1150 std::vector<unsigned int> all_flavours{5, 4, 15, 0};
1152 all_flavours = m_flex_label_integers;
1153 }
1154
1155 for (const auto& info : m_systematicsInfo) {
1156 // The map key is easy...
1157 const SystematicVariation& variation = info.first;
1158 // Then see for which flavours this particular key is relevant
1159 std::vector<std::string> flavours;
1160 for(const unsigned int flavour : all_flavours){ // Grab the number 5,4,15,0 for B,C,T,Light respectively (or other custom labelings)
1161 unsigned int idx;
1162 if (info.second.getIndex(flavour, idx)){ // If the flavour is mapped to an index internally in the SystInfo.indexMap, then return true
1163 flavours.push_back(getLabel(int(flavour)));
1164 }
1165 }
1166 results[variation] = flavours; // <------ Map the list of flavours that a systematic applies to, to the SystematicVariation object that was retrieved from m_systematicsInfo
1167 }
1168 return results;
1169}

◆ 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 1388 of file BTaggingEfficiencyTool.cxx.

1388 {
1389 std::vector<std::string> systStrings;
1390 for(int i=0;i<number;++i) {
1391 std::ostringstream ost;
1392 ost << flav << "_" << i << suffix;
1393 std::string basename="FT_EFF_Eigen_"+ost.str();
1394 systStrings.push_back(basename);
1395 }
1396 return systStrings;
1397}
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()

void asg::AsgTool::print ( ) const
virtualinherited

Print the state of the tool.

Implements asg::IAsgTool.

Reimplemented in AsgHelloTool, HI::HIPileupTool, JetFromPseudojet, JetPileupLabelingTool, JetPseudojetRetriever, JetSubStructureMomentToolsBase, JetTruthLabelingTool, and KtDeltaRTool.

Definition at line 131 of file AsgTool.cxx.

131 {
132
133 ATH_MSG_INFO( "AsgTool " << name() << " @ " << this );
134 return;
135 }

◆ 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 1136 of file BTaggingEfficiencyTool.cxx.

1136 {
1137 return affectingSystematics();
1138}
CP::SystematicSet affectingSystematics() const
Return a list of all systematic variations supported by this tool.

◆ 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 368 of file AthCommonDataStore.h.

369 {
370 h.renounce();
372 }
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 352 of file AthCommonDataStore.h.

352 {
354 }

◆ 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 1331 of file BTaggingEfficiencyTool.cxx.

1332{
1333 // do nothing unless it's needed!
1334 if (m_initialised && index == m_mapIndices[label]) return true;
1335 // convert to integer index
1336 unsigned int flavourID = -1; // set default, error if ever seen
1338 flavourID = getFlavourID(label);
1339 } else {
1340 auto iter = std::find(m_flex_labels.begin(), m_flex_labels.end(), label);
1341 if (iter != m_flex_labels.end()){
1342 flavourID = getFlavourID(label, false);
1343 }
1344 }
1345 // retrieve the new calibration index
1346 unsigned int effIndex;
1347 if (m_CDI->retrieveCalibrationIndex(label, m_OP, m_jetAuthor, false, effIndex, index)) {
1348 // replace cached information
1350 m_EffIndices[flavourID] = effIndex; // This shortcuts you from flavourID to Eff container
1351 unsigned int sfIndex;
1352 if( m_CDI->retrieveCalibrationIndex(label, m_OP, m_jetAuthor, true, sfIndex, index)) {
1353 m_SFIndices[flavourID] = sfIndex; // This shortcuts you from flavourID to SF container
1354 return true;
1355 } else {
1356 ATH_MSG_ERROR("setMapIndex failed to find a SF calibration object" << label << " " << index);
1357 }
1358 } else {
1359 // flag non-existent calibration object & do nothing
1360 ATH_MSG_ERROR("setMapIndex failed to find an Eff calibration object" << label << " " << index);
1361 }
1362 return false;
1363}
std::map< std::string, unsigned int > m_mapIndices

◆ setMapIndex() [2/2]

bool BTaggingEfficiencyTool::setMapIndex ( unsigned int dsid)
virtual

Implements IBTaggingEfficiencyTool.

Definition at line 1364 of file BTaggingEfficiencyTool.cxx.

1364 {
1365
1366 if(m_DSID_to_MapIndex.find(dsid) == m_DSID_to_MapIndex.end() ){
1367 ATH_MSG_WARNING("setMapIndex DSID " << dsid << "not found in config file");
1368
1369 }else{
1370 unsigned int map_index = m_DSID_to_MapIndex[dsid];
1371
1372 bool set_b = setMapIndex("B",map_index);
1373 bool set_c = setMapIndex("C",map_index);
1374 bool set_light = setMapIndex("Light",map_index);
1375 bool set_t = setMapIndex("T",map_index);
1376
1377 return set_b && set_c && set_light && set_t;
1378 }
1379
1380
1381 return false;
1382
1383}

◆ 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 >, and AthCheckedComponent<::AthAlgTool >.

◆ 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 298 of file AthCommonDataStore.h.

298 {
299 for (auto &a : m_vhka) {
301 for (auto k : keys) {
302 k->setOwner(this);
303 }
304 }
305 }
std::vector< SG::VarHandleKeyArray * > m_vhka

Member Data Documentation

◆ m_applySyst

bool BTaggingEfficiencyTool::m_applySyst = false
private

Definition at line 403 of file BTaggingEfficiencyTool.h.

◆ m_applyThisSyst

SystInfo BTaggingEfficiencyTool::m_applyThisSyst
private

Definition at line 404 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 381 of file AthCommonDataStore.h.

◆ m_DSID_to_MapIndex

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

Definition at line 429 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 426 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 378 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 397 of file BTaggingEfficiencyTool.h.

◆ m_flex_labels

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

Definition at line 396 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 = false
private

Definition at line 402 of file BTaggingEfficiencyTool.h.

◆ m_isContinuous

bool BTaggingEfficiencyTool::m_isContinuous = false
private

Definition at line 410 of file BTaggingEfficiencyTool.h.

◆ m_isContinuous2D

bool BTaggingEfficiencyTool::m_isContinuous2D = false
private

Definition at line 412 of file BTaggingEfficiencyTool.h.

◆ m_isMV2Tagger

bool BTaggingEfficiencyTool::m_isMV2Tagger = false
private

Definition at line 418 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 421 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 391 of file BTaggingEfficiencyTool.h.

391{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 424 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_splitTauCharmEff

Gaudi::Property<bool> BTaggingEfficiencyTool::m_splitTauCharmEff {this, "splitTauCharmEff", false, "[Expert mode]. If false (recommended value), tau-jets and charm-jets will be treated as a single category in the eigenvector decomposition. If true (not recommended), eigenvector decomposition will be split for tau-jets and charm-jets efficiencies. PLEASE CONTACT FTAG GROUP BEFORE TURNING FLAG TO TRUE FOR YOUR ANALYSIS"}
private

Definition at line 389 of file BTaggingEfficiencyTool.h.

389{this, "splitTauCharmEff", false, "[Expert mode]. If false (recommended value), tau-jets and charm-jets will be treated as a single category in the eigenvector decomposition. If true (not recommended), eigenvector decomposition will be split for tau-jets and charm-jets efficiencies. PLEASE CONTACT FTAG GROUP BEFORE TURNING FLAG TO TRUE FOR YOUR ANALYSIS"};

◆ m_systematics

CP::SystematicSet BTaggingEfficiencyTool::m_systematics
private

Definition at line 408 of file BTaggingEfficiencyTool.h.

◆ m_systematicsInfo

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

Definition at line 406 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 395 of file BTaggingEfficiencyTool.h.

395{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 = false
private

Definition at line 350 of file BTaggingEfficiencyTool.h.

◆ m_varHandleArraysDeclared

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

Definition at line 387 of file AthCommonDataStore.h.

◆ m_vhka

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

Definition at line 386 of file AthCommonDataStore.h.


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