ATLAS Offline Software
Classes | Public Member Functions | Protected Member Functions | Private Types | Private Member Functions | Private Attributes | List of all members
BTaggingEfficiencyTool Class Reference

#include <BTaggingEfficiencyTool.h>

Inheritance diagram for BTaggingEfficiencyTool:
Collaboration diagram for BTaggingEfficiencyTool:

Classes

struct  SystInfo
 

Public Member Functions

 BTaggingEfficiencyTool (const std::string &name)
 Create a proper constructor for Athena. More...
 
virtual ~BTaggingEfficiencyTool ()
 Create a constructor for standalone usage. More...
 
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. More...
 
virtual void print () const
 Print the state of the tool. More...
 
ServiceHandle< StoreGateSvc > & evtStore ()
 The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc. More...
 
const ServiceHandle< StoreGateSvc > & evtStore () const
 The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc. More...
 
const ServiceHandle< StoreGateSvc > & detStore () const
 The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc. More...
 
virtual StatusCode sysInitialize () override
 Perform system initialization for an algorithm. More...
 
virtual StatusCode sysStart () override
 Handle START transition. More...
 
virtual std::vector< Gaudi::DataHandle * > inputHandles () const override
 Return this algorithm's input handles. More...
 
virtual std::vector< Gaudi::DataHandle * > outputHandles () const override
 Return this algorithm's output handles. More...
 
Gaudi::Details::PropertyBase & declareProperty (Gaudi::Property< T > &t)
 
Gaudi::Details::PropertyBase * declareProperty (const std::string &name, SG::VarHandleKey &hndl, const std::string &doc, const SG::VarHandleKeyType &)
 Declare a new Gaudi property. More...
 
Gaudi::Details::PropertyBase * declareProperty (const std::string &name, SG::VarHandleBase &hndl, const std::string &doc, const SG::VarHandleType &)
 Declare a new Gaudi property. More...
 
Gaudi::Details::PropertyBase * declareProperty (const std::string &name, SG::VarHandleKeyArray &hndArr, const std::string &doc, const SG::VarHandleKeyArrayType &)
 
Gaudi::Details::PropertyBase * declareProperty (const std::string &name, T &property, const std::string &doc, const SG::NotHandleType &)
 Declare a new Gaudi property. More...
 
Gaudi::Details::PropertyBase * declareProperty (const std::string &name, T &property, const std::string &doc="none")
 Declare a new Gaudi property. More...
 
void updateVHKA (Gaudi::Details::PropertyBase &)
 
MsgStream & msg () const
 
MsgStream & msg (const MSG::Level lvl) 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. More...
 
CP::CorrectionCode getEfficiency (const xAOD::Jet &jet, float &eff)
 Computes the data efficiency for the given jet. More...
 
CP::CorrectionCode getInefficiency (const xAOD::Jet &jet, float &eff)
 Computes the data inefficiency for the given jet. More...
 
CP::CorrectionCode getInefficiencyScaleFactor (const xAOD::Jet &jet, float &sf)
 Computes the data/MC inefficiency scale factor for the given jet. More...
 
CP::CorrectionCode getMCEfficiency (const xAOD::Jet &jet, float &eff)
 Computes the MC efficiency for the given jet. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
Other methods implementing the IBTagEfficiencyTool interface
StatusCode initialize ()
 Initialise the tool. More...
 
StatusCode applySystematicVariation (const CP::SystematicSet &set)
 Set the tool to return "shifted" values. More...
 
CP::SystematicSet affectingSystematics () const
 Return a list of all systematic variations supported by this tool. More...
 
CP::SystematicSet recommendedSystematics () const
 Return a list of "recommended" systematic variations supported by this tool. More...
 
bool isAffectedBySystematic (const CP::SystematicVariation &systematic) const
 Returns whether or not the given systematic variation is supported by this tool. More...
 
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). More...
 
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
 
std::string getTaggerName () const
 Retrieve the name of the tagger (as specified in the calibration file) More...
 
std::string getOperatingPoint () const
 Retrieve the operating point (as specified in the calibration file) More...
 
std::string getJetAuthor () const
 Retrieve the jet collection name (as specified in the calibration file) for which this tool was setup. More...
 
bool applySystematics () const
 Specify whether any systematic variation is being used at present. More...
 
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). More...
 

Protected Member Functions

void renounceArray (SG::VarHandleKeyArray &handlesArray)
 remove all handles from I/O resolution More...
 
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. More...
 

Private Types

typedef ServiceHandle< StoreGateSvcStoreGateSvc_t
 

Private Member Functions

bool addSystematics (const std::vector< std::string > &systematicNames, unsigned int flavourID, Analysis::Uncertainty uncType)
 add entries to the systematics registry More...
 
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 More...
 
bool getIndices (unsigned int flavour, unsigned int &sf, unsigned int &ef) const
 helper function for retrieving object indices More...
 
std::string getLabel (int flavourID) const
 convert integer flavour index to its string equivalent More...
 
unsigned int getFlavourID (const std::string &label, bool conventional=true) const
 convert string flavour to its integer index equivalent More...
 
bool fillVariables (const xAOD::Jet &jet, Analysis::CalibrationDataVariables &x) const
 Fill the Analysis::CalibrationDataVariables struct with relevant information pertaining to the jet considered. More...
 
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. More...
 
Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T > &hndl, const SG::VarHandleKeyType &)
 specialization for handling Gaudi::Property<SG::VarHandleKey> More...
 
Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T > &hndl, const SG::VarHandleKeyArrayType &)
 specialization for handling Gaudi::Property<SG::VarHandleKeyArray> More...
 
Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T > &hndl, const SG::VarHandleType &)
 specialization for handling Gaudi::Property<SG::VarHandleBase> More...
 
Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T > &t, const SG::NotHandleType &)
 specialization for handling everything that's not a Gaudi::Property<SG::VarHandleKey> or a <SG::VarHandleKeyArray> More...
 

Private Attributes

std::shared_ptr< Analysis::CalibrationDataInterfaceROOTm_CDI
 pointer to the object doing the actual work More...
 
std::unique_ptr< OnnxUtilm_onnxUtil
 pointer to the onnx tool More...
 
bool m_useFlex = false
 
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) More...
 
StoreGateSvc_t m_detStore
 Pointer to StoreGate (detector store by default) More...
 
std::vector< SG::VarHandleKeyArray * > m_vhka
 
bool m_varHandleArraysDeclared
 
core configuration properties (set at initalization time and not modified afterwards)
asg::AnaToolHandle< IBTaggingSelectionToolm_selectionTool
 we need access to a BTaggingSelectionTool, at least for DL1 weight computation More...
 
std::string m_SFFile
 name of the data/MC efficiency scale factor calibration file (may be changed by the PathResolver) More...
 
std::string m_SFFileFull
 
std::string m_EffFile
 name of the optional MC efficiency file (may be changed by the PathResolver) More...
 
std::string m_EffConfigFile
 
std::map< std::string, std::string > m_SFNames
 names of the data/MC scale factor calibrations More...
 
std::map< std::string, std::string > m_EVReduction
 specification of the eigenvector reduction strategy (if eigenvectors are used) More...
 
std::map< std::string, std::string > m_EffNames
 semicolon-separated lists of MC efficiency parametrisation names More...
 
std::string m_effName
 
std::string m_excludeFromEV
 semicolon-separated list of uncertainties to be excluded from the eigenvector variation procedure for all flavours More...
 
std::map< std::string, std::string > m_excludeFlvFromEV
 semicolon-separated list of uncertainties to be excluded from the eigenvector variation procedure for b, c, and light-flavour jets More...
 
std::map< std::string, std::string > m_uncertaintySuffixes
 optional (per-flavour) suffix that can be used to decorrelate uncertainties (between flavours, or -in case of a result from different runs- between periods) More...
 
bool m_using_conventional_labels
 
std::string m_SFName_flex
 
std::string m_EVReduction_flex
 
std::string m_EffNames_flex
 
std::string m_uncertaintySuffixes_flex
 
std::string m_excludeFlvFromEV_flex
 
std::string m_taggerName
 tagger name More...
 
std::string m_OP
 operating point More...
 
std::string m_jetAuthor
 jet collection name More...
 
float m_minPt
 minimum jet pT More...
 
std::string m_systStrategy
 systematics model to be used (current choices are "SFEigen", "SFEigenRefined", and "Envelope") // <-----— Addoing "SFGlobalEigen" to the list More...
 
bool m_useDevFile
 if true, attempt to retrieve the data/MC efficiency scale factor calibration files from the @PathResolver development area More...
 
bool m_coneFlavourLabel
 if true, use cone-based labelling (as opposed to ghost association) More...
 
bool m_extFlavourLabel
 if true, use an 'extended' labelling (allowing for multiple HF hadrons -or perhaps partons- in the jet) More...
 
bool m_useRecommendedEVExclusions
 if true, extract pre-set lists of uncertainties to be recommended from the EV decomposition (in addition to user specified ones) More...
 
bool m_ignoreOutOfValidityRange
 if true, ignore out-of-extrapolation range errors (i.e., return CorrectionCode::Ok if these are encountered) More...
 
bool m_useCTag = false
 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 More...
 
bool m_readFromBTaggingObject = true
 
std::string m_pathToONNX
 if this string is empty, the onnx tool won't be created More...
 
Cached variables
bool m_initialised
 flag to indicate tool is initialized correctly when set More...
 
bool m_applySyst
 
SystInfo m_applyThisSyst
 
std::map< CP::SystematicVariation, SystInfom_systematicsInfo
 
CP::SystematicSet m_systematics
 
bool m_isContinuous
 
bool m_isContinuous2D
 
std::map< std::string, unsigned int > m_mapIndices
 
std::map< unsigned int, unsigned int > m_SFIndices
 actual information identifying scale factor calibration objects More...
 
std::map< unsigned int, unsigned int > m_EffIndices
 actual information identifying efficiency calibration objects More...
 
std::map< unsigned int, unsigned int > m_DSID_to_MapIndex
 

Detailed Description

Definition at line 31 of file BTaggingEfficiencyTool.h.

Member Typedef Documentation

◆ StoreGateSvc_t

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

Definition at line 388 of file AthCommonDataStore.h.

Constructor & Destructor Documentation

◆ BTaggingEfficiencyTool()

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

Create a proper constructor for Athena.

Create a constructor for standalone usage

Definition at line 128 of file BTaggingEfficiencyTool.cxx.

128  : asg::AsgTool( name ), m_selectionTool("") {
129  namespace def = ftag::defaults;
130  declareProperty("TaggerName", m_taggerName=def::tagger, "tagging algorithm name as specified in CDI file");
131  declareProperty("OperatingPoint", m_OP=def::pcbt_op, "operating point as specified in CDI file");
132  declareProperty("JetAuthor", m_jetAuthor=def::jet_collection, "jet collection & JVF/JVT specification in CDI file");
133  declareProperty("MinPt", m_minPt=0, "minimum jet pT cut");
134  declareProperty("ScaleFactorFileName", m_SFFile=def::cdi_path, "name of the official scale factor calibration CDI file (uses PathResolver)");
135  declareProperty("UseDevelopmentFile", m_useDevFile = false, "specify whether or not to use the (PathResolver) area for temporary scale factor calibration CDI files");
136  declareProperty("EfficiencyFileName", m_EffFile = "", "name of optional user-provided MC efficiency CDI file");
137  declareProperty("EfficiencyConfig", m_EffConfigFile = "", "name of config file specifying which efficiency map to use with a given samples DSID");
138  declareProperty("ScaleFactorBCalibration", m_SFNames["B"] = "default", "name of b-jet scale factor calibration object");
139  declareProperty("ScaleFactorCCalibration", m_SFNames["C"] = "default", "name of c-jet scale factor calibration object");
140  declareProperty("ScaleFactorTCalibration", m_SFNames["T"] = "default", "name of tau-jet scale factor calibration object");
141  declareProperty("ScaleFactorLightCalibration", m_SFNames["Light"] = "default","name of light-flavour jet scale factor calibration object");
142  declareProperty("EigenvectorReductionB", m_EVReduction["B"] = "Loose", "b-jet scale factor Eigenvector reduction strategy; choose between 'Loose', 'Medium', 'Tight'");
143  declareProperty("EigenvectorReductionC", m_EVReduction["C"] = "Loose", "c-jet scale factor Eigenvector reduction strategy; choose between 'Loose', 'Medium', 'Tight'");
144  declareProperty("EigenvectorReductionLight", m_EVReduction["Light"] = "Loose", "light-flavour jet scale factor Eigenvector reduction strategy; choose between 'Loose', 'Medium', 'Tight'");
145  declareProperty("EfficiencyCalibrations", m_effName = "default", "default for all flavors");
146  declareProperty("EfficiencyBCalibrations", m_EffNames["B"] = "", "(semicolon-separated) name(s) of b-jet efficiency object(s)");
147  declareProperty("EfficiencyCCalibrations", m_EffNames["C"] = "", "(semicolon-separated) name(s) of c-jet efficiency object(s)");
148  declareProperty("EfficiencyTCalibrations", m_EffNames["T"] = "", "(semicolon-separated) name(s) of tau-jet efficiency object(s)");
149  declareProperty("EfficiencyLightCalibrations", m_EffNames["Light"] = "", "(semicolon-separated) name(s) of light-flavour-jet efficiency object(s)");
150  declareProperty("UncertaintyBSuffix", m_uncertaintySuffixes["B"] = "","optional suffix for b-jet uncertainty naming");
151  declareProperty("UncertaintyCSuffix", m_uncertaintySuffixes["C"] = "","optional suffix for c-jet uncertainty naming");
152  declareProperty("UncertaintyTSuffix", m_uncertaintySuffixes["T"] = "","optional suffix for tau-jet uncertainty naming");
153  declareProperty("UncertaintyLightSuffix", m_uncertaintySuffixes["Light"] = "","optional suffix for light-flavour-jet uncertainty naming");
154  declareProperty("ExcludeFromEigenVectorTreatment", m_excludeFromEV = "", "(semicolon-separated) names of uncertainties to be excluded from all eigenvector decompositions (if used)");
155  declareProperty("ExcludeFromEigenVectorBTreatment", m_excludeFlvFromEV["B"] = "", "(semicolon-separated) names of uncertainties to be excluded from b-jet eigenvector decomposition (if used)");
156  declareProperty("ExcludeFromEigenVectorCTreatment", m_excludeFlvFromEV["C"] = "", "(semicolon-separated) names of uncertainties to be excluded from c-jet eigenvector decomposition (if used)");
157  declareProperty("ExcludeFromEigenVectorLightTreatment",m_excludeFlvFromEV["Light"] = "", "(semicolon-separated) names of uncertainties to be excluded from light-flavour-jet eigenvector decomposition (if used)");
158  declareProperty("ExcludeRecommendedFromEigenVectorTreatment", m_useRecommendedEVExclusions = false, "specify whether or not to add recommended lists to the user specified eigenvector decomposition exclusion lists");
159  // declareProperty("ExcludeJESFromEVTreatment", m_excludeJESFromEV = true, "specify whether or not to exclude JES uncertainties from eigenvector decomposition (if used)");
160  declareProperty("SystematicsStrategy", m_systStrategy=def::strategy, "name of systematics model; presently choose between 'SFEigen' and 'Envelope'");
161  declareProperty("ConeFlavourLabel", m_coneFlavourLabel = true, "specify whether or not to use the cone-based flavour labelling instead of the default ghost association based labelling");
162  declareProperty("ExtendedFlavourLabel", m_extFlavourLabel = false, "specify whether or not to use an 'extended' flavour labelling (allowing for multiple HF hadrons or perhaps partons)");
163  declareProperty("IgnoreOutOfValidityRange", m_ignoreOutOfValidityRange = false, "ignore out-of-extrapolation-range errors as returned by the underlying tool");
164  declareProperty( "useCTagging", m_useCTag=false, "Enabled only for FixedCut or Continuous WPs: define wether the cuts refer to b-tagging or c-tagging");
165  declareProperty( "readFromBTaggingObject", m_readFromBTaggingObject=true, "Enabled to access btagging scores from xAOD::BTagging object; Can be disabled for GN2v01 to access the scores from the jet itself.");
166  // if it is empty, the onnx tool won't be initialised
167  declareProperty( "pathToONNX", m_pathToONNX = "", "path to the onnx file that will be used for inference");
168  // experimental options
169  declareProperty("useFlexibleConfig", m_useFlex = false, "Setup the flexible configuration of the xAODBTaggingEfficiencyTool with alternate labeling");
170  declareProperty("FlexibleScaleFactorCalibrations", m_SFName_flex = "", "(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' ");
171  declareProperty("FlexibleEfficiencyCalibrations", m_EffNames_flex = "", "(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' ");
172  declareProperty("FlexibleEigenvectorReduction", m_EVReduction_flex = "", "(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' ");
173  declareProperty("FlexibleUncertaintySuffix", m_uncertaintySuffixes_flex = "", "optional (semicolon-separated) list of suffixes for (0,1,2..) indexed flavour label uncertainty naming, e.g. '0:;1:;2:;3:' ");
174  declareProperty("FlexibleExcludeFromEVTreatment", m_excludeFlvFromEV_flex = "", "(semicolon-separated) names of uncertainties to be excluded from (0,1,2..) indexed flavour eigenvector decompositions (if used), e.g. '0:;1:;2:;3:' ");
175 
176  // initialise some variables needed for caching
177  // TODO : add configuration of the mapIndices - rather than just using the default of 0
178  //m_mapIndices["Light"] = m_mapIndices["T"] = m_mapIndices["C"] = m_mapIndices["B"] = 0;
179  m_initialised = false;
180  m_applySyst = false;
181  m_isContinuous = false;
182  m_isContinuous2D = false;
184  // declare the selection tool to be private (not absolutely sure this is needed?)
185  m_selectionTool.declarePropertyFor(this, "BTaggingSelectionTool", "selection tool to be used internally");
186 }

◆ ~BTaggingEfficiencyTool()

BTaggingEfficiencyTool::~BTaggingEfficiencyTool ( )
virtual

Create a constructor for standalone usage.

Definition at line 188 of file BTaggingEfficiencyTool.cxx.

188  {
189  //delete m_CDI;
190 }

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

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

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

1128  {
1129  return m_systematics;
1130 }

◆ applySystematics()

bool BTaggingEfficiencyTool::applySystematics ( ) const
inline

Specify whether any systematic variation is being used at present.

Definition at line 197 of file BTaggingEfficiencyTool.h.

197 { return m_applySyst;}

◆ applySystematicVariation()

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

Set the tool to return "shifted" values.

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

Implements CP::ISystematicsTool.

Definition at line 1238 of file BTaggingEfficiencyTool.cxx.

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

◆ declareGaudiProperty() [1/4]

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

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

Definition at line 170 of file AthCommonDataStore.h.

172  {
173  return *AthCommonDataStore<PBASE>::declareProperty(hndl.name(),
174  hndl.value(),
175  hndl.documentation());
176 
177  }

◆ declareGaudiProperty() [2/4]

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

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

Definition at line 156 of file AthCommonDataStore.h.

158  {
159  return *AthCommonDataStore<PBASE>::declareProperty(hndl.name(),
160  hndl.value(),
161  hndl.documentation());
162 
163  }

◆ declareGaudiProperty() [3/4]

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

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

Definition at line 184 of file AthCommonDataStore.h.

186  {
187  return *AthCommonDataStore<PBASE>::declareProperty(hndl.name(),
188  hndl.value(),
189  hndl.documentation());
190  }

◆ declareGaudiProperty() [4/4]

Gaudi::Details::PropertyBase& AthCommonDataStore< AthCommonMsg< AlgTool > >::declareGaudiProperty ( Gaudi::Property< T > &  t,
const SG::NotHandleType  
)
inlineprivateinherited

specialization for handling everything that's not a Gaudi::Property<SG::VarHandleKey> or a <SG::VarHandleKeyArray>

Definition at line 199 of file AthCommonDataStore.h.

200  {
201  return PBASE::declareProperty(t);
202  }

◆ declareProperty() [1/6]

Gaudi::Details::PropertyBase* AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty ( const std::string &  name,
SG::VarHandleBase hndl,
const std::string &  doc,
const SG::VarHandleType  
)
inlineinherited

Declare a new Gaudi property.

Parameters
nameName of the property.
hndlObject holding the property value.
docDocumentation string for the property.

This is the version for types that derive from SG::VarHandleBase. The property value object is put on the input and output lists as appropriate; then we forward to the base class.

Definition at line 245 of file AthCommonDataStore.h.

249  {
250  this->declare(hndl.vhKey());
251  hndl.vhKey().setOwner(this);
252 
253  return PBASE::declareProperty(name,hndl,doc);
254  }

◆ declareProperty() [2/6]

Gaudi::Details::PropertyBase* AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty ( const std::string &  name,
SG::VarHandleKey hndl,
const std::string &  doc,
const SG::VarHandleKeyType  
)
inlineinherited

Declare a new Gaudi property.

Parameters
nameName of the property.
hndlObject holding the property value.
docDocumentation string for the property.

This is the version for types that derive from SG::VarHandleKey. The property value object is put on the input and output lists as appropriate; then we forward to the base class.

Definition at line 221 of file AthCommonDataStore.h.

225  {
226  this->declare(hndl);
227  hndl.setOwner(this);
228 
229  return PBASE::declareProperty(name,hndl,doc);
230  }

◆ declareProperty() [3/6]

Gaudi::Details::PropertyBase* AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty ( const std::string &  name,
SG::VarHandleKeyArray hndArr,
const std::string &  doc,
const SG::VarHandleKeyArrayType  
)
inlineinherited

Definition at line 259 of file AthCommonDataStore.h.

263  {
264 
265  // std::ostringstream ost;
266  // ost << Algorithm::name() << " VHKA declareProp: " << name
267  // << " size: " << hndArr.keys().size()
268  // << " mode: " << hndArr.mode()
269  // << " vhka size: " << m_vhka.size()
270  // << "\n";
271  // debug() << ost.str() << endmsg;
272 
273  hndArr.setOwner(this);
274  m_vhka.push_back(&hndArr);
275 
276  Gaudi::Details::PropertyBase* p = PBASE::declareProperty(name, hndArr, doc);
277  if (p != 0) {
278  p->declareUpdateHandler(&AthCommonDataStore<PBASE>::updateVHKA, this);
279  } else {
280  ATH_MSG_ERROR("unable to call declareProperty on VarHandleKeyArray "
281  << name);
282  }
283 
284  return p;
285 
286  }

◆ declareProperty() [4/6]

Gaudi::Details::PropertyBase* AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty ( const std::string &  name,
T &  property,
const std::string &  doc,
const SG::NotHandleType  
)
inlineinherited

Declare a new Gaudi property.

Parameters
nameName of the property.
propertyObject holding the property value.
docDocumentation string for the property.

This is the generic version, for types that do not derive from SG::VarHandleKey. It just forwards to the base class version of declareProperty.

Definition at line 333 of file AthCommonDataStore.h.

337  {
338  return PBASE::declareProperty(name, property, doc);
339  }

◆ declareProperty() [5/6]

Gaudi::Details::PropertyBase* AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty ( const std::string &  name,
T &  property,
const std::string &  doc = "none" 
)
inlineinherited

Declare a new Gaudi property.

Parameters
nameName of the property.
propertyObject holding the property value.
docDocumentation string for the property.

This dispatches to either the generic declareProperty or the one for VarHandle/Key/KeyArray.

Definition at line 352 of file AthCommonDataStore.h.

355  {
356  typedef typename SG::HandleClassifier<T>::type htype;
357  return declareProperty (name, property, doc, htype());
358  }

◆ declareProperty() [6/6]

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

Definition at line 145 of file AthCommonDataStore.h.

145  {
146  typedef typename SG::HandleClassifier<T>::type htype;
148  }

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

95 { return m_detStore; }

◆ evtStore() [1/2]

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.

85 { return m_evtStore; }

◆ evtStore() [2/2]

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

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

Definition at line 90 of file AthCommonDataStore.h.

90 { return m_evtStore; }

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

1314 {
1315  x.jetPt = jetPt;
1316  x.jetEta = jetEta;
1317  x.jetTagWeight = jetTagWeight;
1318  x.jetAuthor = m_jetAuthor;
1319 
1320  return true;
1321 }

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

1285 {
1286  x.jetPt = jet.pt();
1287  x.jetEta = jet.eta();
1288  x.jetTagWeight = 0.;
1289  x.jetAuthor = m_jetAuthor;
1290  //bool weightOK = true;
1291 
1292  if (m_isContinuous2D){
1293  x.jetTagWeight = m_selectionTool->getQuantile(jet)+0.5;
1294  }
1295  else if (m_isContinuous) {
1298  if (!tagInfo) return false;
1299  }
1300  // For now, we defer the tag weight computation to the selection tool only in the case of DL1* (this is likely to be revisited)
1301  if (m_taggerName.find("DL1") != std::string::npos || m_taggerName.find("GN1") != std::string::npos || m_taggerName.find("GN2") != std::string::npos) {
1303  } else {
1304  ATH_MSG_ERROR("BTaggingEfficiencyTool doesn't support tagger: "+m_taggerName);
1305  return CorrectionCode::Error;
1306  }
1307  }
1308 
1309  return true;
1310 }

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

817 {
818  if (! m_initialised) return CorrectionCode::Error;
819 
820  // get the btag label
822 
824 
825  if (! fillVariables(jet, vars)) {
826  ATH_MSG_ERROR("unable to fill variables required for efficiency evaluation");
827  return CorrectionCode::Error;
828  }
829 
830  return getEfficiency(flavour, vars, eff);
831 }

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

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

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

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

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

1396  {
1397  auto mapIter = m_SFIndices.find(flavour);
1398  if(mapIter != m_SFIndices.end()) {
1399  sf = mapIter->second;
1400  } else {
1401  return false;
1402  }
1403 
1404  mapIter = m_EffIndices.find(flavour);
1405  if(mapIter != m_EffIndices.end()) {
1406  ef = mapIter->second;
1407  } else {
1408  return false;
1409  }
1410  return true;
1411 }

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

893 {
894  if (! m_initialised) return CorrectionCode::Error;
895 
896  // get the btag label
898 
900  if (! fillVariables(jet, vars)) {
901  ATH_MSG_ERROR("unable to fill variables required for scale factor evaluation");
902  return CorrectionCode::Error;
903  }
904 
905  return getInefficiency (flavour, vars, eff);
906 }

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

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

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

969 {
970  if (! m_initialised) return CorrectionCode::Error;
972  ATH_MSG_ERROR("Inefficiency SF should NOT be included for the Continous operation point");
973  return CorrectionCode::Error;
974  }
975 
976  // get the btag label
978 
980  if (! fillVariables(jet, vars)) {
981  ATH_MSG_ERROR("unable to fill variables required for scale factor evaluation");
982  return CorrectionCode::Error;
983  }
984 
985  return getInefficiencyScaleFactor( flavour, vars, sf);
986 }

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

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

◆ getJetAuthor()

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

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

Implements IBTaggingEfficiencyTool.

Definition at line 191 of file BTaggingEfficiencyTool.h.

191 { return m_jetAuthor;}

◆ getKey()

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

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

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

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

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

Definition at line 119 of file AsgTool.cxx.

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

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

1053 {
1054  if (! m_initialised) return CorrectionCode::Error;
1055 
1056  // get the btag label
1058 
1060  if (! fillVariables(jet, vars)) {
1061  ATH_MSG_ERROR("unable to fill variables required for scale factor evaluation");
1062  return CorrectionCode::Error;
1063  }
1064 
1065  return getMCEfficiency( flavour, vars, eff);
1066 }

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

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

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

1106 {
1107  m_onnxUtil->runInference(node_feat, effAllJet);
1108  return CorrectionCode::Ok;
1109 }

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

1114 {
1115  m_onnxUtil->runInference(node_feat, effAllJetAllWp);
1116  return CorrectionCode::Ok;
1117 }

◆ getName()

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

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

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

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

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

Definition at line 106 of file AsgTool.cxx.

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

◆ getOperatingPoint()

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

729 {
730  if (! m_initialised) {
731  ATH_MSG_ERROR("BTaggingEfficiencyTool has not been initialised");
732  return CorrectionCode::Error;
733  }
734 
735  // get the btag label
736  int flavour{0};
737  if (m_using_conventional_labels){ // if not using conventional labels, so flavour label will have to be set by some other means...
739  }
740 
742  //const double pt = jet.pt();
743  //const double eta = jet.eta();
744  //const double tagwe = 0.7; // temporary testing
745  if (! fillVariables(jet, vars)) {
746  //if (! fillVariables(pt, eta, tagwe, vars)){
747  ATH_MSG_ERROR("unable to fill variables required for scale factor evaluation");
748  return CorrectionCode::Error;
749  }
750 
751  return getScaleFactor(flavour, vars, sf);
752 }

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

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

◆ getTaggerName()

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 ( )
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 192 of file BTaggingEfficiencyTool.cxx.

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

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

1122 {
1124  return sys.find( systematic) != sys.end();
1125 }

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

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

◆ listSystematics()

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

Implements IBTaggingEfficiencyTool.

Definition at line 1138 of file BTaggingEfficiencyTool.cxx.

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

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

1384  {
1385  std::vector<std::string> systStrings;
1386  for(int i=0;i<number;++i) {
1387  std::ostringstream ost;
1388  ost << flav << "_" << i << suffix;
1389  std::string basename="FT_EFF_Eigen_"+ost.str();
1390  systStrings.push_back(basename);
1391  }
1392  return systStrings;
1393 }

◆ msg() [1/2]

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

Definition at line 24 of file AthCommonMsg.h.

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

◆ msg() [2/2]

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

Definition at line 27 of file AthCommonMsg.h.

27  {
28  return this->msgStream(lvl);
29  }

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

◆ 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

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

1133  {
1134  return affectingSystematics();
1135 }

◆ renounce()

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

Definition at line 380 of file AthCommonDataStore.h.

381  {
382  h.renounce();
383  PBASE::renounce (h);
384  }

◆ renounceArray()

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

remove all handles from I/O resolution

Definition at line 364 of file AthCommonDataStore.h.

364  {
365  handlesArray.renounce();
366  }

◆ setMapIndex() [1/2]

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

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

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

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

Implements IBTaggingEfficiencyTool.

Definition at line 1327 of file BTaggingEfficiencyTool.cxx.

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

◆ setMapIndex() [2/2]

bool BTaggingEfficiencyTool::setMapIndex ( unsigned int  dsid)
virtual

Implements IBTaggingEfficiencyTool.

Definition at line 1360 of file BTaggingEfficiencyTool.cxx.

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

◆ 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 DerivationFramework::CfAthAlgTool, AthCheckedComponent< AthAlgTool >, AthCheckedComponent<::AthAlgTool >, and asg::AsgMetadataTool.

◆ sysStart()

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

Handle START transition.

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

◆ updateVHKA()

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

Definition at line 308 of file AthCommonDataStore.h.

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

Member Data Documentation

◆ m_applySyst

bool BTaggingEfficiencyTool::m_applySyst
private

Definition at line 375 of file BTaggingEfficiencyTool.h.

◆ m_applyThisSyst

SystInfo BTaggingEfficiencyTool::m_applyThisSyst
private

Definition at line 376 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

bool BTaggingEfficiencyTool::m_coneFlavourLabel
private

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

Definition at line 347 of file BTaggingEfficiencyTool.h.

◆ m_detStore

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

Pointer to StoreGate (detector store by default)

Definition at line 393 of file AthCommonDataStore.h.

◆ m_DSID_to_MapIndex

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

Definition at line 397 of file BTaggingEfficiencyTool.h.

◆ m_EffConfigFile

std::string BTaggingEfficiencyTool::m_EffConfigFile
private

Definition at line 311 of file BTaggingEfficiencyTool.h.

◆ m_EffFile

std::string BTaggingEfficiencyTool::m_EffFile
private

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

Definition at line 310 of file BTaggingEfficiencyTool.h.

◆ m_EffIndices

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

actual information identifying efficiency calibration objects

Definition at line 394 of file BTaggingEfficiencyTool.h.

◆ m_effName

std::string BTaggingEfficiencyTool::m_effName
private

Definition at line 319 of file BTaggingEfficiencyTool.h.

◆ m_EffNames

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

semicolon-separated lists of MC efficiency parametrisation names

Definition at line 317 of file BTaggingEfficiencyTool.h.

◆ m_EffNames_flex

std::string BTaggingEfficiencyTool::m_EffNames_flex
private

Definition at line 330 of file BTaggingEfficiencyTool.h.

◆ m_EVReduction

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

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

Definition at line 315 of file BTaggingEfficiencyTool.h.

◆ m_EVReduction_flex

std::string BTaggingEfficiencyTool::m_EVReduction_flex
private

Definition at line 329 of file BTaggingEfficiencyTool.h.

◆ m_evtStore

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

Pointer to StoreGate (event store by default)

Definition at line 390 of file AthCommonDataStore.h.

◆ m_excludeFlvFromEV

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

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

Definition at line 323 of file BTaggingEfficiencyTool.h.

◆ m_excludeFlvFromEV_flex

std::string BTaggingEfficiencyTool::m_excludeFlvFromEV_flex
private

Definition at line 332 of file BTaggingEfficiencyTool.h.

◆ m_excludeFromEV

std::string BTaggingEfficiencyTool::m_excludeFromEV
private

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

Definition at line 321 of file BTaggingEfficiencyTool.h.

◆ m_extFlavourLabel

bool BTaggingEfficiencyTool::m_extFlavourLabel
private

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

Definition at line 349 of file BTaggingEfficiencyTool.h.

◆ m_flex_label_integers

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

Definition at line 366 of file BTaggingEfficiencyTool.h.

◆ m_flex_labels

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

Definition at line 365 of file BTaggingEfficiencyTool.h.

◆ m_ignoreOutOfValidityRange

bool BTaggingEfficiencyTool::m_ignoreOutOfValidityRange
private

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

Definition at line 354 of file BTaggingEfficiencyTool.h.

◆ m_initialised

bool BTaggingEfficiencyTool::m_initialised
private

flag to indicate tool is initialized correctly when set

Definition at line 372 of file BTaggingEfficiencyTool.h.

◆ m_isContinuous

bool BTaggingEfficiencyTool::m_isContinuous
private

Definition at line 382 of file BTaggingEfficiencyTool.h.

◆ m_isContinuous2D

bool BTaggingEfficiencyTool::m_isContinuous2D
private

Definition at line 384 of file BTaggingEfficiencyTool.h.

◆ m_jetAuthor

std::string BTaggingEfficiencyTool::m_jetAuthor
private

jet collection name

Definition at line 339 of file BTaggingEfficiencyTool.h.

◆ m_mapIndices

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

Definition at line 389 of file BTaggingEfficiencyTool.h.

◆ m_minPt

float BTaggingEfficiencyTool::m_minPt
private

minimum jet pT

Definition at line 341 of file BTaggingEfficiencyTool.h.

◆ m_onnxUtil

std::unique_ptr<OnnxUtil> BTaggingEfficiencyTool::m_onnxUtil
private

pointer to the onnx tool

Definition at line 298 of file BTaggingEfficiencyTool.h.

◆ m_OP

std::string BTaggingEfficiencyTool::m_OP
private

operating point

Definition at line 337 of file BTaggingEfficiencyTool.h.

◆ m_pathToONNX

std::string BTaggingEfficiencyTool::m_pathToONNX
private

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

Definition at line 360 of file BTaggingEfficiencyTool.h.

◆ m_readFromBTaggingObject

bool BTaggingEfficiencyTool::m_readFromBTaggingObject = true
private

Definition at line 358 of file BTaggingEfficiencyTool.h.

◆ 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

std::string BTaggingEfficiencyTool::m_SFFile
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.

◆ 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 392 of file BTaggingEfficiencyTool.h.

◆ m_SFName_flex

std::string BTaggingEfficiencyTool::m_SFName_flex
private

Definition at line 328 of file BTaggingEfficiencyTool.h.

◆ m_SFNames

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

names of the data/MC scale factor calibrations

Definition at line 313 of file BTaggingEfficiencyTool.h.

◆ m_systematics

CP::SystematicSet BTaggingEfficiencyTool::m_systematics
private

Definition at line 380 of file BTaggingEfficiencyTool.h.

◆ m_systematicsInfo

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

Definition at line 378 of file BTaggingEfficiencyTool.h.

◆ m_systStrategy

std::string BTaggingEfficiencyTool::m_systStrategy
private

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

Definition at line 343 of file BTaggingEfficiencyTool.h.

◆ m_taggerName

std::string BTaggingEfficiencyTool::m_taggerName
private

tagger name

Definition at line 335 of file BTaggingEfficiencyTool.h.

◆ m_uncertaintySuffixes

std::map<std::string, std::string> BTaggingEfficiencyTool::m_uncertaintySuffixes
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 325 of file BTaggingEfficiencyTool.h.

◆ m_uncertaintySuffixes_flex

std::string BTaggingEfficiencyTool::m_uncertaintySuffixes_flex
private

Definition at line 331 of file BTaggingEfficiencyTool.h.

◆ m_useCTag

bool BTaggingEfficiencyTool::m_useCTag = false
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 357 of file BTaggingEfficiencyTool.h.

◆ m_useDevFile

bool BTaggingEfficiencyTool::m_useDevFile
private

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

Definition at line 345 of file BTaggingEfficiencyTool.h.

◆ m_useFlex

bool BTaggingEfficiencyTool::m_useFlex = false
private

Definition at line 364 of file BTaggingEfficiencyTool.h.

◆ m_useRecommendedEVExclusions

bool BTaggingEfficiencyTool::m_useRecommendedEVExclusions
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 352 of file BTaggingEfficiencyTool.h.

◆ m_using_conventional_labels

bool BTaggingEfficiencyTool::m_using_conventional_labels
private

Definition at line 327 of file BTaggingEfficiencyTool.h.

◆ m_varHandleArraysDeclared

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

Definition at line 399 of file AthCommonDataStore.h.

◆ m_vhka

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

Definition at line 398 of file AthCommonDataStore.h.


The documentation for this class was generated from the following files:
grepfile.info
info
Definition: grepfile.py:38
Analysis::CalibResult
std::pair< double, double > CalibResult
Definition: CalibrationDataInterfaceBase.h:34
xAOD::iterator
JetConstituentVector::iterator iterator
Definition: JetConstituentVector.cxx:68
python.Dso.registry
registry
Definition: Control/AthenaServices/python/Dso.py:159
xAOD::strategy
strategy
Definition: L2CombinedMuon_v1.cxx:107
BTaggingEfficiencyTool::getLabel
std::string getLabel(int flavourID) const
convert integer flavour index to its string equivalent
Definition: BTaggingEfficiencyTool.h:242
beamspotnt.var
var
Definition: bin/beamspotnt.py:1394
BTaggingEfficiencyTool::m_isContinuous2D
bool m_isContinuous2D
Definition: BTaggingEfficiencyTool.h:384
verify_menu_config.results
results
Definition: verify_menu_config.py:67
asg::AsgTool
Base class for the dual-use tool implementation classes.
Definition: AsgTool.h:47
BTaggingEfficiencyTool::m_EffFile
std::string m_EffFile
name of the optional MC efficiency file (may be changed by the PathResolver)
Definition: BTaggingEfficiencyTool.h:310
BTaggingEfficiencyTool::m_mapIndices
std::map< std::string, unsigned int > m_mapIndices
Definition: BTaggingEfficiencyTool.h:389
python.trigbs_prescaleL1.ost
ost
Definition: trigbs_prescaleL1.py:104
get_generator_info.result
result
Definition: get_generator_info.py:21
hotSpotInTAG.suffix
string suffix
Definition: hotSpotInTAG.py:186
StateLessPT_NewConfig.proxy
proxy
Definition: StateLessPT_NewConfig.py:392
BTaggingEfficiencyTool::m_SFName_flex
std::string m_SFName_flex
Definition: BTaggingEfficiencyTool.h:328
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
find
std::string find(const std::string &s)
return a remapped string
Definition: hcg.cxx:135
BTaggingEfficiencyTool::m_ignoreOutOfValidityRange
bool m_ignoreOutOfValidityRange
if true, ignore out-of-extrapolation range errors (i.e., return CorrectionCode::Ok if these are encou...
Definition: BTaggingEfficiencyTool.h:354
BTaggingEfficiencyTool::m_DSID_to_MapIndex
std::map< unsigned int, unsigned int > m_DSID_to_MapIndex
Definition: BTaggingEfficiencyTool.h:397
BTaggingEfficiencyTool::m_uncertaintySuffixes_flex
std::string m_uncertaintySuffixes_flex
Definition: BTaggingEfficiencyTool.h:331
BTaggingEfficiencyTool::getIndices
bool getIndices(unsigned int flavour, unsigned int &sf, unsigned int &ef) const
helper function for retrieving object indices
Definition: BTaggingEfficiencyTool.cxx:1396
asg::AnaToolHandle::retrieve
StatusCode retrieve()
initialize the tool
BTaggingEfficiencyTool::m_excludeFromEV
std::string m_excludeFromEV
semicolon-separated list of uncertainties to be excluded from the eigenvector variation procedure for...
Definition: BTaggingEfficiencyTool.h:321
CP::SystematicSet::size
size_t size() const
returns: size of the set
Definition: SystematicSet.h:71
index
Definition: index.py:1
AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T > &t)
Definition: AthCommonDataStore.h:145
Analysis::SFNamed
@ SFNamed
Definition: CalibrationDataInterfaceROOT.h:70
PlotCalibFromCool.label
label
Definition: PlotCalibFromCool.py:78
BTaggingEfficiencyTool::m_useCTag
bool m_useCTag
if false, suppress any non-error/warning printout from the underlying tool 1D tagging only: define we...
Definition: BTaggingEfficiencyTool.h:357
BTaggingEfficiencyTool::makeEigenSyst
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
Definition: BTaggingEfficiencyTool.cxx:1384
asg::AnaToolHandle::setTypeAndName
void setTypeAndName(const std::string &val_typeAndName)
set the value of type and name
skel.it
it
Definition: skel.GENtoEVGEN.py:396
CP::SystematicSet
Class to wrap a set of SystematicVariations.
Definition: SystematicSet.h:31
AthCommonDataStore< AthCommonMsg< AlgTool > >::m_evtStore
StoreGateSvc_t m_evtStore
Pointer to StoreGate (event store by default)
Definition: AthCommonDataStore.h:390
BTaggingEfficiencyTool::SystInfo::getIndex
bool getIndex(unsigned int flavourID, unsigned int &index) const
Definition: BTaggingEfficiencyTool.cxx:1414
AthCommonDataStore< AthCommonMsg< AlgTool > >::m_vhka
std::vector< SG::VarHandleKeyArray * > m_vhka
Definition: AthCommonDataStore.h:398
BTaggingEfficiencyTool::m_initialised
bool m_initialised
flag to indicate tool is initialized correctly when set
Definition: BTaggingEfficiencyTool.h:372
AthCommonMsg< AlgTool >::msgLvl
bool msgLvl(const MSG::Level lvl) const
Definition: AthCommonMsg.h:30
BTaggingEfficiencyTool::getEfficiency
CP::CorrectionCode getEfficiency(const xAOD::Jet &jet, float &eff)
Computes the data efficiency for the given jet.
Definition: BTaggingEfficiencyTool.cxx:816
IBTaggingSelectionTool::getTaggerWeight
virtual CP::CorrectionCode getTaggerWeight(const xAOD::Jet &jet, double &tagweight) const =0
BTaggingEfficiencyTool::m_EffNames_flex
std::string m_EffNames_flex
Definition: BTaggingEfficiencyTool.h:330
TrigInDetValidation_Base.test
test
Definition: TrigInDetValidation_Base.py:147
read_hist_ntuple.t
t
Definition: read_hist_ntuple.py:5
ATH_MSG_VERBOSE
#define ATH_MSG_VERBOSE(x)
Definition: AthMsgStreamMacros.h:28
BTaggingEfficiencyTool::m_systematics
CP::SystematicSet m_systematics
Definition: BTaggingEfficiencyTool.h:380
dbg::ptr
void * ptr(T *p)
Definition: SGImplSvc.cxx:74
CP::SystematicVariation
Definition: SystematicVariation.h:47
asg::AnaToolHandle::setProperty
StatusCode setProperty(const std::string &property, const T2 &value)
set the given property of the tool.
x
#define x
BTaggingEfficiencyTool::m_extFlavourLabel
bool m_extFlavourLabel
if true, use an 'extended' labelling (allowing for multiple HF hadrons -or perhaps partons- in the je...
Definition: BTaggingEfficiencyTool.h:349
Analysis::TauExtrapolation
@ TauExtrapolation
Definition: CalibrationDataInterfaceROOT.h:70
mapkey::sys
@ sys
Definition: TElectronEfficiencyCorrectionTool.cxx:42
asg::AnaToolHandle::declarePropertyFor
void declarePropertyFor(T2 *tool, const std::string &name, const std::string &description="")
declare as property on the given tool
BTaggingEfficiencyTool::m_effName
std::string m_effName
Definition: BTaggingEfficiencyTool.h:319
mergePhysValFiles.end
end
Definition: DataQuality/DataQualityUtils/scripts/mergePhysValFiles.py:93
python.iconfTool.models.loaders.level
level
Definition: loaders.py:20
BTaggingEfficiencyTool::addSystematics
bool addSystematics(const std::vector< std::string > &systematicNames, unsigned int flavourID, Analysis::Uncertainty uncType)
add entries to the systematics registry
Definition: BTaggingEfficiencyTool.cxx:1428
SG::VarHandleKeyArray::setOwner
virtual void setOwner(IDataHandleHolder *o)=0
Analysis::kSuccess
@ kSuccess
Definition: CalibrationDataVariables.h:57
BTaggingEfficiencyTool::m_isContinuous
bool m_isContinuous
Definition: BTaggingEfficiencyTool.h:382
Analysis::Total
@ Total
Definition: CalibrationDataInterfaceROOT.h:70
IDTPMcnv.htype
htype
Definition: IDTPMcnv.py:29
BTaggingEfficiencyTool::m_EffNames
std::map< std::string, std::string > m_EffNames
semicolon-separated lists of MC efficiency parametrisation names
Definition: BTaggingEfficiencyTool.h:317
PixelModuleFeMask_create_db.remove
string remove
Definition: PixelModuleFeMask_create_db.py:83
BTaggingEfficiencyTool::m_EffIndices
std::map< unsigned int, unsigned int > m_EffIndices
actual information identifying efficiency calibration objects
Definition: BTaggingEfficiencyTool.h:394
BTaggingEfficiencyTool::m_useDevFile
bool m_useDevFile
if true, attempt to retrieve the data/MC efficiency scale factor calibration files from the @PathReso...
Definition: BTaggingEfficiencyTool.h:345
AthCommonDataStore< AthCommonMsg< AlgTool > >::evtStore
ServiceHandle< StoreGateSvc > & evtStore()
The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.
Definition: AthCommonDataStore.h:85
python.utils.AtlRunQueryDQUtils.p
p
Definition: AtlRunQueryDQUtils.py:210
xAOD::jetFlavourLabel
int jetFlavourLabel(const xAOD::Jet *jet, JetFlavourLabelType=ExclConeHadron)
Definition: JetFlavourInfo.cxx:81
jet
Definition: JetCalibTools_PlotJESFactors.cxx:23
AthCommonDataStore
Definition: AthCommonDataStore.h:52
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
BTaggingEfficiencyTool::getMCEfficiency
CP::CorrectionCode getMCEfficiency(const xAOD::Jet &jet, float &eff)
Computes the MC efficiency for the given jet.
Definition: BTaggingEfficiencyTool.cxx:1052
BTaggingEfficiencyTool::m_applySyst
bool m_applySyst
Definition: BTaggingEfficiencyTool.h:375
Analysis::kExtrapolatedRange
@ kExtrapolatedRange
Definition: CalibrationDataVariables.h:59
lumiFormat.i
int i
Definition: lumiFormat.py:85
BTaggingEfficiencyTool::getFlavourID
unsigned int getFlavourID(const std::string &label, bool conventional=true) const
convert string flavour to its integer index equivalent
Definition: BTaggingEfficiencyTool.h:262
beamspotman.n
n
Definition: beamspotman.py:731
Generate_dsid_ranseed.dsid
dsid
Definition: Generate_dsid_ranseed.py:6
Analysis::Uncertainty
Uncertainty
specification of type information requested by the user
Definition: CalibrationDataInterfaceROOT.h:70
Analysis::Medium
@ Medium
Definition: CalibrationDataInterfaceROOT.h:73
Analysis::kError
@ kError
Definition: CalibrationDataVariables.h:60
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
BTaggingEfficiencyTool::m_jetAuthor
std::string m_jetAuthor
jet collection name
Definition: BTaggingEfficiencyTool.h:339
BTaggingEfficiencyTool::m_SFIndices
std::map< unsigned int, unsigned int > m_SFIndices
actual information identifying scale factor calibration objects
Definition: BTaggingEfficiencyTool.h:392
Analysis::Loose
@ Loose
Definition: CalibrationDataInterfaceROOT.h:73
CalibCoolCompareRT.up
up
Definition: CalibCoolCompareRT.py:109
LHEF::Reader
Pythia8::Reader Reader
Definition: Prophecy4fMerger.cxx:11
Analysis::kRange
@ kRange
Definition: CalibrationDataVariables.h:58
Analysis::SFEigen
@ SFEigen
Definition: CalibrationDataInterfaceROOT.h:70
BTaggingEfficiencyTool::setMapIndex
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...
Definition: BTaggingEfficiencyTool.cxx:1327
ftag::defaults::tagger
const std::string tagger
Definition: ToolDefaults.h:11
python.xAODType.dummy
dummy
Definition: xAODType.py:4
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
MSG::name
const std::string & name(Level lvl)
Convenience function for translating message levels to strings.
Definition: MsgLevel.cxx:19
BTaggingEfficiencyTool::m_using_conventional_labels
bool m_using_conventional_labels
Definition: BTaggingEfficiencyTool.h:327
AthCommonDataStore< AthCommonMsg< AlgTool > >::m_detStore
StoreGateSvc_t m_detStore
Pointer to StoreGate (detector store by default)
Definition: AthCommonDataStore.h:393
ftag::defaults::jet_collection
const std::string jet_collection
Definition: ToolDefaults.h:12
BTaggingEfficiencyTool::m_flex_label_integers
std::vector< unsigned int > m_flex_label_integers
Definition: BTaggingEfficiencyTool.h:366
xAOD::BTagging_v1
Definition: BTagging_v1.h:39
BTaggingEfficiencyTool::m_readFromBTaggingObject
bool m_readFromBTaggingObject
Definition: BTaggingEfficiencyTool.h:358
SG::VarHandleKeyArray::renounce
virtual void renounce()=0
SG::HandleClassifier::type
std::conditional< std::is_base_of< SG::VarHandleKeyArray, T >::value, VarHandleKeyArrayType, type2 >::type type
Definition: HandleClassifier.h:54
RivetAnalysis_JO.systName
def systName
Definition: RivetAnalysis_JO.py:32
BTaggingEfficiencyTool::fillVariables
bool fillVariables(const xAOD::Jet &jet, Analysis::CalibrationDataVariables &x) const
Fill the Analysis::CalibrationDataVariables struct with relevant information pertaining to the jet co...
Definition: BTaggingEfficiencyTool.cxx:1284
GetAllXsec.entry
list entry
Definition: GetAllXsec.py:132
BTaggingEfficiencyTool::SystInfo::uncType
Analysis::Uncertainty uncType
Definition: BTaggingEfficiencyTool.h:226
CheckAppliedSFs.systematics
def systematics
Definition: CheckAppliedSFs.py:231
Analysis::CalibrationStatus
CalibrationStatus
Definition: CalibrationDataVariables.h:56
merge_scale_histograms.doc
string doc
Definition: merge_scale_histograms.py:9
CP::SystematicSet::insert
void insert(const SystematicVariation &systematic)
description: insert a systematic into the set
Definition: SystematicSet.cxx:88
python.selection.number
number
Definition: selection.py:20
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:228
TrackCorrType::None
@ None
Base_Fragment.defaults
dictionary defaults
This includes now the top quark, the leptons and the bosons.
Definition: GeneratorFilters/share/common/Base_Fragment.py:79
BTaggingEfficiencyTool::m_systematicsInfo
std::map< CP::SystematicVariation, SystInfo > m_systematicsInfo
Definition: BTaggingEfficiencyTool.h:378
BTaggingEfficiencyTool::m_uncertaintySuffixes
std::map< std::string, std::string > m_uncertaintySuffixes
optional (per-flavour) suffix that can be used to decorrelate uncertainties (between flavours,...
Definition: BTaggingEfficiencyTool.h:325
BTaggingEfficiencyTool::m_minPt
float m_minPt
minimum jet pT
Definition: BTaggingEfficiencyTool.h:341
BTaggingEfficiencyTool::m_pathToONNX
std::string m_pathToONNX
if this string is empty, the onnx tool won't be created
Definition: BTaggingEfficiencyTool.h:360
BTaggingEfficiencyTool::m_selectionTool
asg::AnaToolHandle< IBTaggingSelectionTool > m_selectionTool
we need access to a BTaggingSelectionTool, at least for DL1 weight computation
Definition: BTaggingEfficiencyTool.h:304
IBTaggingSelectionTool::getQuantile
virtual int getQuantile(const xAOD::IParticle *) const =0
Decide in which quantile of the tagger weight distribution the jet belongs The return value represent...
BTaggingEfficiencyTool::getInefficiencyScaleFactor
CP::CorrectionCode getInefficiencyScaleFactor(const xAOD::Jet &jet, float &sf)
Computes the data/MC inefficiency scale factor for the given jet.
Definition: BTaggingEfficiencyTool.cxx:968
BTaggingEfficiencyTool::m_SFFile
std::string m_SFFile
name of the data/MC efficiency scale factor calibration file (may be changed by the PathResolver)
Definition: BTaggingEfficiencyTool.h:307
PathResolverFindCalibFile
std::string PathResolverFindCalibFile(const std::string &logical_file_name)
Definition: PathResolver.cxx:431
xAOD::BTaggingUtilities::getBTagging
const BTagging * getBTagging(const SG::AuxElement &part)
Access the default xAOD::BTagging object associated to an object.
Definition: BTaggingUtilities.cxx:37
BTaggingEfficiencyTool::m_onnxUtil
std::unique_ptr< OnnxUtil > m_onnxUtil
pointer to the onnx tool
Definition: BTaggingEfficiencyTool.h:298
python.PyAthena.v
v
Definition: PyAthena.py:154
ftag::defaults::cdi_path
const std::string cdi_path
Definition: ToolDefaults.h:13
CP::CorrectionCode::Ok
@ Ok
The correction was done successfully.
Definition: CorrectionCode.h:38
DeMoScan.index
string index
Definition: DeMoScan.py:364
a
TList * a
Definition: liststreamerinfos.cxx:10
h
BTaggingEfficiencyTool::getInefficiency
CP::CorrectionCode getInefficiency(const xAOD::Jet &jet, float &eff)
Computes the data inefficiency for the given jet.
Definition: BTaggingEfficiencyTool.cxx:892
python.CaloScaleNoiseConfig.str
str
Definition: CaloScaleNoiseConfig.py:78
BTaggingEfficiencyTool::m_applyThisSyst
SystInfo m_applyThisSyst
Definition: BTaggingEfficiencyTool.h:376
mapkey::sf
@ sf
Definition: TElectronEfficiencyCorrectionTool.cxx:38
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition: AthMsgStreamMacros.h:32
Analysis::CalibrationDataInterfaceROOT
Definition: CalibrationDataInterfaceROOT.h:88
BTaggingEfficiencyTool::m_useRecommendedEVExclusions
bool m_useRecommendedEVExclusions
if true, extract pre-set lists of uncertainties to be recommended from the EV decomposition (in addit...
Definition: BTaggingEfficiencyTool.h:352
CP::SystematicRegistry
This module implements the central registry for handling systematic uncertainties with CP tools.
Definition: SystematicRegistry.h:25
Analysis::SFGlobalEigen
@ SFGlobalEigen
Definition: CalibrationDataInterfaceROOT.h:70
CP::SystematicSet::begin
const_iterator begin() const
description: const iterator to the beginning of the set
Definition: SystematicSet.h:55
BTaggingEfficiencyTool::SystInfo::isUp
bool isUp
Definition: BTaggingEfficiencyTool.h:228
DEBUG
#define DEBUG
Definition: page_access.h:11
BTaggingEfficiencyTool::getScaleFactor
CP::CorrectionCode getScaleFactor(const xAOD::Jet &jet, float &sf)
Computes the data/MC efficiency scale factor for the given jet.
Definition: BTaggingEfficiencyTool.cxx:728
AthCommonMsg< AlgTool >::msg
MsgStream & msg() const
Definition: AthCommonMsg.h:24
Analysis::CalibrationDataVariables
Definition: CalibrationDataVariables.h:42
LArNewCalib_DelayDump_OFC_Cali.idx
idx
Definition: LArNewCalib_DelayDump_OFC_Cali.py:69
BTaggingEfficiencyTool::m_EVReduction
std::map< std::string, std::string > m_EVReduction
specification of the eigenvector reduction strategy (if eigenvectors are used)
Definition: BTaggingEfficiencyTool.h:315
GRLStrUtil::trim
void trim(std::string &input)
Definition: StrUtil.cxx:12
SG::VarHandleBase::vhKey
SG::VarHandleKey & vhKey()
Return a non-const reference to the HandleKey.
Definition: StoreGate/src/VarHandleBase.cxx:623
BTaggingEfficiencyTool::m_CDI
std::shared_ptr< Analysis::CalibrationDataInterfaceROOT > m_CDI
pointer to the object doing the actual work
Definition: BTaggingEfficiencyTool.h:296
BTaggingEfficiencyTool::m_excludeFlvFromEV_flex
std::string m_excludeFlvFromEV_flex
Definition: BTaggingEfficiencyTool.h:332
dqt_zlumi_alleff_HIST.eff
int eff
Definition: dqt_zlumi_alleff_HIST.py:113
L1Topo::Error
Error
The different types of error that can be flagged in the L1TopoRDO.
Definition: Error.h:16
str
Definition: BTagTrackIpAccessor.cxx:11
python.Bindings.keys
keys
Definition: Control/AthenaPython/python/Bindings.py:798
BTaggingEfficiencyTool::m_systStrategy
std::string m_systStrategy
systematics model to be used (current choices are "SFEigen", "SFEigenRefined", and "Envelope") // <--...
Definition: BTaggingEfficiencyTool.h:343
merge.status
status
Definition: merge.py:17
BTaggingEfficiencyTool::m_OP
std::string m_OP
operating point
Definition: BTaggingEfficiencyTool.h:337
BTaggingEfficiencyTool::m_flex_labels
std::vector< std::string > m_flex_labels
Definition: BTaggingEfficiencyTool.h:365
BTaggingEfficiencyTool::m_SFNames
std::map< std::string, std::string > m_SFNames
names of the data/MC scale factor calibrations
Definition: BTaggingEfficiencyTool.h:313
BTaggingEfficiencyTool::affectingSystematics
CP::SystematicSet affectingSystematics() const
Return a list of all systematic variations supported by this tool.
Definition: BTaggingEfficiencyTool.cxx:1128
Analysis::Tight
@ Tight
Definition: CalibrationDataInterfaceROOT.h:73
Analysis::CDIReader
Definition: CDIReader.h:39
BTaggingEfficiencyTool::m_EVReduction_flex
std::string m_EVReduction_flex
Definition: BTaggingEfficiencyTool.h:329
Analysis::Extrapolation
@ Extrapolation
Definition: CalibrationDataInterfaceROOT.h:70
BTaggingEfficiencyTool::m_excludeFlvFromEV
std::map< std::string, std::string > m_excludeFlvFromEV
semicolon-separated list of uncertainties to be excluded from the eigenvector variation procedure for...
Definition: BTaggingEfficiencyTool.h:323
ftag::defaults::pcbt_op
const std::string pcbt_op
Definition: ToolDefaults.h:15
SG::DataProxy
Definition: DataProxy.h:45
BTaggingEfficiencyTool::m_useFlex
bool m_useFlex
Definition: BTaggingEfficiencyTool.h:364
python.compressB64.c
def c
Definition: compressB64.py:93
BTaggingEfficiencyTool::m_taggerName
std::string m_taggerName
tagger name
Definition: BTaggingEfficiencyTool.h:335
AthCommonDataStore::declareGaudiProperty
Gaudi::Details::PropertyBase & declareGaudiProperty(Gaudi::Property< T > &hndl, const SG::VarHandleKeyType &)
specialization for handling Gaudi::Property<SG::VarHandleKey>
Definition: AthCommonDataStore.h:156
BTaggingEfficiencyTool::m_SFFileFull
std::string m_SFFileFull
Definition: BTaggingEfficiencyTool.h:308
Trk::split
@ split
Definition: LayerMaterialProperties.h:38
LheEventFiller_Common.ef
ef
Definition: SFGen_i/share/common/LheEventFiller_Common.py:7
BTaggingEfficiencyTool::m_coneFlavourLabel
bool m_coneFlavourLabel
if true, use cone-based labelling (as opposed to ghost association)
Definition: BTaggingEfficiencyTool.h:347
fitman.k
k
Definition: fitman.py:528
BTaggingEfficiencyTool::m_EffConfigFile
std::string m_EffConfigFile
Definition: BTaggingEfficiencyTool.h:311
beamspotman.basename
basename
Definition: beamspotman.py:640