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

Tool to apply flavour-tagging requirements on jets @modified by Ilaria Luise, Nilotpal Kakati in March 2022. More...

#include <BTaggingTruthTaggingTool.h>

Inheritance diagram for BTaggingTruthTaggingTool:
Collaboration diagram for BTaggingTruthTaggingTool:

Classes

struct  jetVariable
struct  TagBin
 Create a proper constructor for Athena. More...
struct  TRFinfo

Public Member Functions

 BTaggingTruthTaggingTool (const std::string &name)
 Create a constructor for standalone usage.
StatusCode CalculateResults (std::vector< float > &pt, std::vector< float > &eta, std::vector< int > &flav, std::vector< float > &tagw, Analysis::TruthTagResults &results, int rand_seed=-1)
StatusCode CalculateResults (const xAOD::JetContainer &jets, Analysis::TruthTagResults &results, int rand_seed=-1)
StatusCode CalculateResultsONNX (const std::vector< std::vector< float > > &node_feat, std::vector< float > &tagw, Analysis::TruthTagResults &results, int rand_seed=-1)
StatusCode CalculateResultsONNX (const xAOD::JetContainer &jets, const std::vector< std::vector< float > > &node_feat, Analysis::TruthTagResults &results, int rand_seed=-1)
StatusCode setEffMapIndex (const std::string &flavour, unsigned int index)
 Declare the interface that the class provides.
void setUseSystematics (bool useSystematics)
virtual ~BTaggingTruthTaggingTool ()
StatusCode initialize ()
 Dummy implementation of the initialisation function.
CP::SystematicSet affectingSystematics () const
 the list of all systematics this tool can be affected by
StatusCode applySystematicVariation (const CP::SystematicSet &systConfig)
 effects: configure this tool for the given list of systematic variations.
CP::SystematicSet recommendedSystematics () const
 the list of all systematics this tool recommends to use
bool isAffectedBySystematic (const CP::SystematicVariation &systematic) const
 Declare the interface that this class provides.
virtual void print () const
 Print the state of the tool.
ServiceHandle< StoreGateSvc > & evtStore ()
 The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.
const ServiceHandle< StoreGateSvc > & detStore () const
 The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc.
virtual StatusCode sysInitialize () override
 Perform system initialization for an algorithm.
virtual StatusCode sysStart () override
 Handle START transition.
virtual std::vector< Gaudi::DataHandle * > inputHandles () const override
 Return this algorithm's input handles.
virtual std::vector< Gaudi::DataHandle * > outputHandles () const override
 Return this algorithm's output handles.
Gaudi::Details::PropertyBase & declareProperty (Gaudi::Property< T, V, H > &t)
void updateVHKA (Gaudi::Details::PropertyBase &)
MsgStream & msg () const
bool msgLvl (const MSG::Level lvl) const
Additional helper functions, not directly mimicking Athena
template<class T>
const T * getProperty (const std::string &name) const
 Get one of the tool's properties.
const std::string & msg_level_name () const __attribute__((deprecated))
 A deprecated function for getting the message level's name.
const std::string & getName (const void *ptr) const
 Get the name of an object that is / should be in the event store.
SG::sgkey_t getKey (const void *ptr) const
 Get the (hashed) key of an object that is in the event store.

Protected Member Functions

void renounceArray (SG::VarHandleKeyArray &handlesArray)
 remove all handles from I/O resolution
std::enable_if_t< std::is_void_v< std::result_of_t< decltype(&T::renounce)(T)> > &&!std::is_base_of_v< SG::VarHandleKeyArray, T > &&std::is_base_of_v< Gaudi::DataHandle, T >, void > renounce (T &h)
void extraDeps_update_handler (Gaudi::Details::PropertyBase &ExtraDeps)
 Add StoreName to extra input/output deps as needed.

Private Types

enum  NjetsTagStrategy { AllJets =-1 , Leading2SignalJets =2 , Leading3SignalJets =3 }
 will be set according to m_taggingStrategy More...
typedef ServiceHandle< StoreGateSvcStoreGateSvc_t

Private Member Functions

StatusCode CalculateResults (TRFinfo &trfinf, Analysis::TruthTagResults &results, int rand_seed=-1)
StatusCode setJets (TRFinfo &trfinf, std::vector< float > &pt, std::vector< float > &eta, std::vector< int > &flav, std::vector< float > &tagw)
StatusCode setJets (TRFinfo &trfinf, const xAOD::JetContainer &jets)
StatusCode setJets (TRFinfo &trfinf, std::vector< int > &flav, std::vector< Analysis::CalibrationDataVariables > *vars)
StatusCode setJets (TRFinfo &trfinf, const std::vector< std::vector< float > > &node_feat, std::vector< float > &tagw)
StatusCode setJets (TRFinfo &trfinf, const xAOD::JetContainer &jets, const std::vector< std::vector< float > > &node_feat)
StatusCode setJets (TRFinfo &trfinf, std::vector< int > &flav, const std::vector< Analysis::CalibrationDataVariables > *vars, const std::vector< std::vector< float > > &node_feat)
StatusCode GetTruthTagWeights (TRFinfo &trfinf, std::vector< float > &trf_weight_ex, std::vector< float > &trf_weight_in)
StatusCode getTagPermutation (TRFinfo &trfinf, std::vector< std::vector< bool > > &trf_chosen_perm_ex, std::vector< std::vector< bool > > &trf_chosen_perm_in)
StatusCode getQuantiles (TRFinfo &trfinf, std::vector< std::vector< int > > &trf_bin_ex, std::vector< std::vector< int > > &trf_bin_in)
float getEvtSF (TRFinfo &trfinf, std::vector< int > &quantiles)
StatusCode getDirectTaggedJets (TRFinfo &trfinf, std::vector< bool > &is_tagged)
StatusCode getTRFweight (TRFinfo &trfinf, unsigned int nbtag, bool isInclusive)
StatusCode getAllEffMC (TRFinfo &trfinf)
StatusCode getAllEffMCCDI (TRFinfo &trfinf)
StatusCode getAllEffMCGNN (TRFinfo &trfinf)
StatusCode getAllEffSF (TRFinfo &trfinf, int=0)
int jetFlavourLabel (const xAOD::Jet &jet)
int GAFinalHadronFlavourLabel (const xAOD::Jet &jet)
int ExclusiveConeHadronFlavourLabel (const xAOD::Jet &jet)
std::vector< std::string > split (const std::string &str, char token)
StatusCode check_syst_range (unsigned int sys)
std::vector< std::vector< bool > > generatePermutations (int njets, int tags, int start=0)
float trfWeight (TRFinfo &trfinf, const std::vector< bool > &tags)
StatusCode chooseAllTagPermutation (TRFinfo &trfinf, unsigned int nbtag)
StatusCode chooseTagPermutation (TRFinfo &trfinf, unsigned int nbtag, bool isIncl)
StatusCode chooseAllTagBins (TRFinfo &trfinf)
StatusCode chooseTagBins_cum (TRFinfo &trfinf, std::vector< bool > &tagconf, bool isIncl, unsigned int nbtag)
StatusCode generateRandomTaggerScores (std::vector< std::vector< int > > &quantiles, std::vector< std::vector< float > > &btag_scores, std::vector< std::vector< float > > &ctag_scores)
float getTagBinsConfProb (TRFinfo &trfinf, std::vector< int > &tagws)
StatusCode fillVariables (const xAOD::Jet &jet, Analysis::CalibrationDataVariables &x)
StatusCode fillVariables (const float jetPt, const float jetEta, const float jetTagWeight, Analysis::CalibrationDataVariables &x)
Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T, V, H > &hndl, const SG::VarHandleKeyType &)
 specialization for handling Gaudi::Property<SG::VarHandleKey>

Private Attributes

std::vector< std::string > m_availableOP_fixCut = {"FixedCutBEff_85", "FixedCutBEff_77","FixedCutBEff_70","FixedCutBEff_60"}
TFile * m_inf {}
std::vector< TagBinm_cuts
bool m_initialised {}
std::vector< CP::SystematicSetm_eff_syst
std::vector< std::string > m_sys_name
Gaudi::Property< std::string > m_SFFile {this, "ScaleFactorFileName", "xAODBTaggingEfficiency/13TeV/2016-20_7-13TeV-MC15-CDI-July12_v1.root", "name of the official scale factor calibration CDI file (uses PathResolver)"}
 name of the data/MC efficiency scale factor calibration file (may be changed by the PathResolver)
Gaudi::Property< std::string > m_EffFile {this, "EfficiencyFileName", "", "name of optional user-provided MC efficiency CDI file"}
 name of the optional MC efficiency file (may be changed by the PathResolver)
Gaudi::Property< std::string > m_SFBName {this, "ScaleFactorBCalibration", "default", "name of b-jet scale factor calibration object"}
 name of the data/MC scale factor calibration for b jets
Gaudi::Property< std::string > m_SFCName {this, "ScaleFactorCCalibration", "default", "name of c-jet scale factor calibration object"}
 name of the data/MC scale factor calibration for charm jets
Gaudi::Property< std::string > m_SFTName {this, "ScaleFactorTCalibration", "default", "name of tau-jet scale factor calibration object"}
 name of the data/MC scale factor calibration for tau jets
Gaudi::Property< std::string > m_SFLightName {this, "ScaleFactorLightCalibration", "default", "name of light-flavour jet scale factor calibration object"}
 name of the data/MC scale factor calibration for light-flavour jets
Gaudi::Property< std::string > m_EVReductionB {this, "EigenvectorReductionB", "Loose", "b-jet scale factor Eigenvector reduction strategy; choose between 'Loose', 'Medium', 'Tight'"}
 specification of the eigenvector reduction strategy for b jets (if eigenvectors are used)
Gaudi::Property< std::string > m_EVReductionC {this, "EigenvectorReductionC", "Loose", "c-jet scale factor Eigenvector reduction strategy; choose between 'Loose', 'Medium', 'Tight'"}
 specification of the eigenvector reduction strategy for c jets (if eigenvectors are used)
Gaudi::Property< std::string > m_EVReductionLight {this, "EigenvectorReductionLight", "Loose","light-flavour jet scale factor Eigenvector reduction strategy; choose between 'Loose', 'Medium', 'Tight'"}
 specification of the eigenvector reduction strategy for light-flavour jets (if eigenvectors are used)
Gaudi::Property< std::string > m_EffBName {this, "EfficiencyBCalibrations", "default", "(semicolon-separated) name(s) of b-jet efficiency object(s)"}
 semicolon-separated list of MC efficiency parametrisation names for b jets
Gaudi::Property< std::string > m_EffCName {this, "EfficiencyCCalibrations", "default", "(semicolon-separated) name(s) of c-jet efficiency object(s)"}
 semicolon-separated list of MC efficiency parametrisation names for charm jets
Gaudi::Property< std::string > m_EffTName {this, "EfficiencyTCalibrations", "default", "(semicolon-separated) name(s) of tau-jet efficiency object(s)"}
 semicolon-separated list of MC efficiency parametrisation names for tau jets
Gaudi::Property< std::string > m_EffLightName {this, "EfficiencyLightCalibrations", "default", "(semicolon-separated) name(s) of light-flavour-jet efficiency object(s)"}
 semicolon-separated list of MC efficiency parametrisation names for light-flavour jets
Gaudi::Property< std::string > m_excludeFromEV {this, "ExcludeFromEigenVectorTreatment", "", "(semicolon-separated) names of uncertainties to be excluded from eigenvector decomposition (if used)"}
 semicolon-separated list of uncertainties to be excluded from the eigenvector variation procedure
Gaudi::Property< std::string > m_taggerName {this, "TaggerName", "MV2c10", "tagging algorithm name as specified in CDI file"}
 tagger name
Gaudi::Property< std::string > m_OP {this, "OperatingPoint", "FixedCutBEff_77", "operating point as specified in CDI file"}
 operating point
Gaudi::Property< std::string > m_cutBenchmark {this, "CutBenchmark", "1,2", "if you want to run in continuous you need to fix a benchmark - it does something only if running in Continuous OP"}
 operating point when running in Continuous
Gaudi::Property< std::string > m_jetAuthor {this, "JetAuthor", "AntiKt4EMTopoJets", "jet collection & JVF/JVT specification in CDI file"}
 jet collection name
Gaudi::Property< std::string > m_systStrategy {this, "SystematicsStrategy", "SFEigen", "name of systematics model; presently choose between 'SFEigen' and 'Envelope'"}
 systematics model to be used (current choices are "SFEigen" and "Envelope")
Gaudi::Property< bool > m_useDevFile {this, "UseDevelopmentFile", false, "specify whether or not to use the (PathResolver) area for temporary scale factor calibration CDI files"}
 if true, attempt to retrieve the data/MC efficiency scale factor calibration files from the @PathResolver development area
Gaudi::Property< bool > m_coneFlavourLabel {this, "ConeFlavourLabel", true, "specify whether or not to use the cone-based flavour labelling instead of the default ghost association based labelling"}
 if true, use cone-based labelling (as opposed to ghost association)
Gaudi::Property< std::string > m_excludeEV {this, "ExcludeSpecificEigens", "" , "(semicolon-separated) names of Eigens you want to exclude. in case of continuous some eigenvectors can be ignored to make the computation faster"}
 in case of continuous WP you can choose to ignore some of the eigenvectors
Gaudi::Property< bool > m_doDirectTag {this, "doDirectTagging", false , "If set to true it also computes and stores the direct tagging choice and the related SFs for each jet"}
 possibility to compute the direct tagging SFs map directly from the TruthTaggingTool
Gaudi::Property< std::string > m_pathToONNX {this, "pathToONNX", "", "path to the onnx file that will be used for inference"}
 if this string is empty, the onnx tool won't be used
Gaudi::Property< std::string > m_taggingStrategy {this, "TaggingStrategy", "AllJets", "tagging strategy in the Analysis (eg. 'leading2SignalJets' in boosted VHbb). Required to do TT with GNN"}
 tagging strategy is required to do TT with GNN, when we don't want to truth tag all the jets (eg. 'leading2SignalJets')
NjetsTagStrategy m_njetsTagStrategy {AllJets}
Gaudi::Property< float > m_minPt {this, "MinPt", 20000 , "Minimum jet pT cut (in MeV)"}
Gaudi::Property< float > m_maxEta {this, "MaxEta", 2.5, "Maximum jet eta cut"}
Gaudi::Property< float > m_maxRangePt {this, "MaxRangePt", 1000000 , "Max pT range (in MeV)"}
Gaudi::Property< bool > m_doOnlyUpVariations {this, "StoreOnlyUpVariations", false , "If set to true it processes only the __1up b-tagging variations. It speeds up the computation in case of symmetric variations."}
bool m_continuous {}
bool m_continuous2D {}
Gaudi::Property< bool > m_ignoreSF {this, "IgnoreScaleFactors", true, "ignore scale factors in computation of TRF weight"}
Gaudi::Property< bool > m_usePerm {this, "UsePermutations", true, "if the chosen permutation is used, a reweighting is applied to the TRF weight for systematics"}
Gaudi::Property< bool > m_useQuantile {this, "UseQuantile", true, "if the chosen quantile is used, a reweighting is applied to the TRF weight for systematics"}
Gaudi::Property< bool > m_useSys {this, "UseSystematics", false, "will the results contain all systematic variations, or just the nominal"}
Gaudi::Property< int > m_nbtag {this, "MaxNtagged", 2, "what is the maximal possible number of tagged jets"}
int m_nbins {}
std::vector< int > m_OperatingBins
unsigned int m_OP_index_for_GNN {}
std::map< int, asg::AnaToolHandle< IBTaggingEfficiencyTool > > m_effTool_allBins
asg::AnaToolHandle< IBTaggingEfficiencyToolm_effTool
asg::AnaToolHandle< IBTaggingSelectionToolm_selTool
StoreGateSvc_t m_evtStore
 Pointer to StoreGate (event store by default)
StoreGateSvc_t m_detStore
 Pointer to StoreGate (detector store by default)
std::vector< SG::VarHandleKeyArray * > m_vhka
bool m_varHandleArraysDeclared

Detailed Description

Tool to apply flavour-tagging requirements on jets @modified by Ilaria Luise, Nilotpal Kakati in March 2022.

Author
C. Rizzi, M. Ughetto @contact chiar.nosp@m.a.ri.nosp@m.zzi@c.nosp@m.ern..nosp@m.ch, mughe.nosp@m.tto@.nosp@m.cern..nosp@m.ch @contact ilari.nosp@m.a.lu.nosp@m.ise@c.nosp@m.ern..nosp@m.ch, nkaka.nosp@m.ti@c.nosp@m.ern.c.nosp@m.h

Definition at line 48 of file BTaggingTruthTaggingTool.h.

Member Typedef Documentation

◆ StoreGateSvc_t

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

Definition at line 388 of file AthCommonDataStore.h.

Member Enumeration Documentation

◆ NjetsTagStrategy

will be set according to m_taggingStrategy

Enumerator
AllJets 
Leading2SignalJets 
Leading3SignalJets 

Definition at line 262 of file BTaggingTruthTaggingTool.h.

Constructor & Destructor Documentation

◆ BTaggingTruthTaggingTool()

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

Create a constructor for standalone usage.

Definition at line 39 of file BTaggingTruthTaggingTool.cxx.

40 : asg::AsgTool( name ),
41 m_effTool ("BTaggingEfficiencyTool/effTool", this),
42 m_selTool ("BTaggingSelectionTool/selTool", this)
43 {
44
45 m_initialised = false;
46}
asg::AnaToolHandle< IBTaggingSelectionTool > m_selTool
asg::AnaToolHandle< IBTaggingEfficiencyTool > m_effTool

◆ ~BTaggingTruthTaggingTool()

BTaggingTruthTaggingTool::~BTaggingTruthTaggingTool ( )
virtual

Definition at line 1060 of file BTaggingTruthTaggingTool.cxx.

1060 {
1061
1062 // delete trfinf.jets;
1063
1064}

Member Function Documentation

◆ affectingSystematics()

SystematicSet BTaggingTruthTaggingTool::affectingSystematics ( ) const
virtual

the list of all systematics this tool can be affected by

Implements CP::IReentrantSystematicsTool.

Definition at line 59 of file BTaggingTruthTaggingTool.cxx.

59 {
60 return m_effTool->affectingSystematics();
61}

◆ applySystematicVariation()

StatusCode BTaggingTruthTaggingTool::applySystematicVariation ( const CP::SystematicSet & systConfig)
virtual

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

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

Implements CP::ISystematicsTool.

Definition at line 63 of file BTaggingTruthTaggingTool.cxx.

64{
65 for (auto syst : systConfig) {
66 CP::SystematicSet myset;
67 ATH_MSG_WARNING("applySystematicVariation was called for " << syst.name() << " but BTaggingTruthTaggingTool does not apply Systematic Variations");
68 //the truth tagging tool provides results for all possible systematic variations in its results objects, the user does not need to call each one seperatly.
69 }
70 return StatusCode::SUCCESS;
71}
#define ATH_MSG_WARNING(x)

◆ CalculateResults() [1/3]

StatusCode BTaggingTruthTaggingTool::CalculateResults ( const xAOD::JetContainer & jets,
Analysis::TruthTagResults & results,
int rand_seed = -1 )
virtual

Implements IBTaggingTruthTaggingTool.

Definition at line 528 of file BTaggingTruthTaggingTool.cxx.

528 {
529
530 ANA_CHECK_SET_TYPE (StatusCode);
531
532 TRFinfo trfinf;
533
534 ANA_CHECK(setJets(trfinf,jets));
535
536 return CalculateResults(trfinf,results,rand_seed);
537}
#define ANA_CHECK(EXP)
check whether the given expression was successful
#define ANA_CHECK_SET_TYPE(TYPE)
set the type for ANA_CHECK to report failures
StatusCode CalculateResults(TRFinfo &trfinf, Analysis::TruthTagResults &results, int rand_seed=-1)
StatusCode setJets(TRFinfo &trfinf, std::vector< float > &pt, std::vector< float > &eta, std::vector< int > &flav, std::vector< float > &tagw)

◆ CalculateResults() [2/3]

StatusCode BTaggingTruthTaggingTool::CalculateResults ( std::vector< float > & pt,
std::vector< float > & eta,
std::vector< int > & flav,
std::vector< float > & tagw,
Analysis::TruthTagResults & results,
int rand_seed = -1 )
virtual

Implements IBTaggingTruthTaggingTool.

Definition at line 517 of file BTaggingTruthTaggingTool.cxx.

517 {
518
519 ANA_CHECK_SET_TYPE (StatusCode);
520
521 TRFinfo trfinf;
522
523 ANA_CHECK(setJets(trfinf,pt, eta, flav, tagw));
524
525 return CalculateResults(trfinf,results,rand_seed);
526}
Scalar eta() const
pseudorapidity method

◆ CalculateResults() [3/3]

StatusCode BTaggingTruthTaggingTool::CalculateResults ( TRFinfo & trfinf,
Analysis::TruthTagResults & results,
int rand_seed = -1 )
private

Definition at line 436 of file BTaggingTruthTaggingTool.cxx.

436 {
437 ANA_CHECK_SET_TYPE (StatusCode);
438 results.clear();
439
440 if(rand_seed!=-1){
441 trfinf.rand.SetSeed(rand_seed);
442 }
443
444 std::vector<float> trf_weight_ex, trf_weight_in;
445
446 trf_weight_ex.clear();
447 trf_weight_in.clear();
448
449 ANA_CHECK(GetTruthTagWeights(trfinf, trf_weight_ex, trf_weight_in));
450
451 ANA_CHECK(getTagPermutation(trfinf,results.trf_chosen_perm_ex,results.trf_chosen_perm_in));
452
453 //modify quantiles according to the different conventions
454 ANA_CHECK(getQuantiles(trfinf,results.trf_bin_ex, results.trf_bin_in));
455
456 //new tagger scores
457 ANA_CHECK(generateRandomTaggerScores(results.trf_bin_ex, results.trf_bin_score_ex, results.trf_ctag_bin_score_ex));
458 ANA_CHECK(generateRandomTaggerScores(results.trf_bin_in, results.trf_bin_score_in, results.trf_ctag_bin_score_in));
459
460 //direct tag
461 if(m_doDirectTag)
462 ANA_CHECK( getDirectTaggedJets(trfinf, results.is_tagged) );
463
464 //handle systematics
465 unsigned int n_systs = (m_useSys) ? m_eff_syst.size() : 1;
466 results.syst_names.clear();
467
468 for(unsigned int sys = 0; sys < n_systs; ++sys){
469 if(sys!=0 && m_useSys) {
470 ANA_CHECK_THROW( m_effTool->applySystematicVariation(m_eff_syst[sys]) );
471 }
472
473 results.syst_names.push_back(m_sys_name.at(sys));
474
475 results.map_trf_weight_ex[m_sys_name.at(sys)].resize(trfinf.trfw_ex.size());
476 results.map_trf_weight_in[m_sys_name.at(sys)].resize(trfinf.trfw_in.size());
477
478 results.map_SF_ex[m_sys_name.at(sys)].resize(trfinf.trfw_ex.size());
479 results.map_SF_in[m_sys_name.at(sys)].resize(trfinf.trfw_in.size());
480
481 //direct tagging
482 if(m_doDirectTag){
483 std::vector<int> is_tagged;
484 for(auto t : results.is_tagged){
485 is_tagged.push_back(static_cast<int>(t));
486 }
487 results.map_SF[m_sys_name.at(sys)]=getEvtSF(trfinf,is_tagged);
488 }
489
490 //go over the ntag combinations.
491 //ntj = number of tagged jets
492 for(unsigned int ntj=0; ntj< trfinf.trfw_ex.size(); ntj++){
493 if(ntj > trfinf.njets) {
494 results.map_SF_ex[m_sys_name.at(sys)].at(ntj) = 1.;
495 results.map_SF_in[m_sys_name.at(sys)].at(ntj) = 1.;
496 ATH_MSG_DEBUG("number of jets: " <<trfinf.njets <<" less than max btag: " <<m_nbtag <<". Return BTag SF = 1. Consider applying an event pre-selection if this happens too often.");
497 }
498 else{
499 results.map_SF_ex[m_sys_name.at(sys)].at(ntj) = getEvtSF(trfinf,results.trf_bin_ex.at(ntj));
500 results.map_SF_in[m_sys_name.at(sys)].at(ntj) = getEvtSF(trfinf,results.trf_bin_in.at(ntj));
501 }
502
503 results.map_trf_weight_ex[m_sys_name.at(sys)].at(ntj) = trfinf.trfw_ex.at(ntj) * results.map_SF_ex[m_sys_name.at(sys)].at(ntj);
504 results.map_trf_weight_in[m_sys_name.at(sys)].at(ntj) = trfinf.trfw_in.at(ntj) * results.map_SF_in[m_sys_name.at(sys)].at(ntj);
505 }
506 }
507
508 if(m_useSys) { // reset syst to nominal
509 CP::SystematicSet defaultSet;
510 ANA_CHECK_THROW( m_effTool->applySystematicVariation(defaultSet) );
511 }
512
513 return StatusCode::SUCCESS;
514
515}
#define ATH_MSG_DEBUG(x)
#define ANA_CHECK_THROW(EXP)
check whether the given expression was successful, throwing an exception on failure
std::vector< std::string > m_sys_name
float getEvtSF(TRFinfo &trfinf, std::vector< int > &quantiles)
StatusCode getQuantiles(TRFinfo &trfinf, std::vector< std::vector< int > > &trf_bin_ex, std::vector< std::vector< int > > &trf_bin_in)
std::vector< CP::SystematicSet > m_eff_syst
Gaudi::Property< bool > m_doDirectTag
possibility to compute the direct tagging SFs map directly from the TruthTaggingTool
StatusCode getDirectTaggedJets(TRFinfo &trfinf, std::vector< bool > &is_tagged)
Gaudi::Property< bool > m_useSys
StatusCode GetTruthTagWeights(TRFinfo &trfinf, std::vector< float > &trf_weight_ex, std::vector< float > &trf_weight_in)
StatusCode getTagPermutation(TRFinfo &trfinf, std::vector< std::vector< bool > > &trf_chosen_perm_ex, std::vector< std::vector< bool > > &trf_chosen_perm_in)
StatusCode generateRandomTaggerScores(std::vector< std::vector< int > > &quantiles, std::vector< std::vector< float > > &btag_scores, std::vector< std::vector< float > > &ctag_scores)

◆ CalculateResultsONNX() [1/2]

StatusCode BTaggingTruthTaggingTool::CalculateResultsONNX ( const std::vector< std::vector< float > > & node_feat,
std::vector< float > & tagw,
Analysis::TruthTagResults & results,
int rand_seed = -1 )
virtual

Implements IBTaggingTruthTaggingTool.

Definition at line 540 of file BTaggingTruthTaggingTool.cxx.

540 {
541
542 ANA_CHECK_SET_TYPE (StatusCode);
543
544 TRFinfo trfinf;
545
546 ANA_CHECK(setJets(trfinf, node_feat, tagw));
547
548 return CalculateResults(trfinf, results, rand_seed);
549}

◆ CalculateResultsONNX() [2/2]

StatusCode BTaggingTruthTaggingTool::CalculateResultsONNX ( const xAOD::JetContainer & jets,
const std::vector< std::vector< float > > & node_feat,
Analysis::TruthTagResults & results,
int rand_seed = -1 )
virtual

Implements IBTaggingTruthTaggingTool.

Definition at line 552 of file BTaggingTruthTaggingTool.cxx.

552 {
553
554 ANA_CHECK_SET_TYPE (StatusCode);
555
556 TRFinfo trfinf;
557
558 ANA_CHECK(setJets(trfinf, jets, node_feat));
559
560 return CalculateResults(trfinf, results, rand_seed);
561}

◆ check_syst_range()

StatusCode BTaggingTruthTaggingTool::check_syst_range ( unsigned int sys)
private

Definition at line 1052 of file BTaggingTruthTaggingTool.cxx.

1052 {
1053 if(sys < m_eff_syst.size()) return StatusCode::SUCCESS;
1054 ATH_MSG_ERROR(sys << " Out of range of available systematics");
1055 return StatusCode::FAILURE;
1056}
#define ATH_MSG_ERROR(x)

◆ chooseAllTagBins()

StatusCode BTaggingTruthTaggingTool::chooseAllTagBins ( TRFinfo & trfinf)
private

Definition at line 879 of file BTaggingTruthTaggingTool.cxx.

879 {
880 ANA_CHECK_SET_TYPE (StatusCode);
881 trfinf.tbins_ex.clear();
882 trfinf.tbins_in.clear();
883 trfinf.tbins_ex.resize( trfinf.trfw_ex.size());
884 trfinf.tbins_in.resize( trfinf.trfw_in.size());
885
886 trfinf.binsprob_ex.clear();
887 trfinf.binsprob_in.clear();
888 trfinf.binsprob_ex.resize( trfinf.trfw_ex.size());
889 trfinf.binsprob_in.resize( trfinf.trfw_in.size());
890
891 if(trfinf.perm_ex.size() != trfinf.perm_in.size()) ATH_MSG_WARNING("Different sizes in exclusive and inclusive permutation choices");
892
893 for(unsigned int nb=0; nb<trfinf.perm_ex.size(); nb++) {
894 ANA_CHECK(chooseTagBins_cum(trfinf,trfinf.perm_ex.at(nb), false, nb));
895 ANA_CHECK(chooseTagBins_cum(trfinf,trfinf.perm_in.at(nb), true, nb));
896 }
897 return StatusCode::SUCCESS;
898}
StatusCode chooseTagBins_cum(TRFinfo &trfinf, std::vector< bool > &tagconf, bool isIncl, unsigned int nbtag)

◆ chooseAllTagPermutation()

StatusCode BTaggingTruthTaggingTool::chooseAllTagPermutation ( TRFinfo & trfinf,
unsigned int nbtag )
private

Definition at line 784 of file BTaggingTruthTaggingTool.cxx.

784 {
785
786 ANA_CHECK_SET_TYPE (StatusCode);
787
788 if(!m_usePerm){
789 return StatusCode::FAILURE;
790 }
791
792 unsigned int njets = trfinf.njets;
793 unsigned int limit = (njets > 7) ? 8 : njets+1;
794 unsigned int max = (njets < nbtag+1) ? limit : nbtag+1;
795
796 trfinf.perm_ex.clear(), trfinf.perm_ex.resize(nbtag+1);
797 trfinf.perm_in.clear(), trfinf.perm_in.resize(nbtag+1);
798
799 trfinf.permprob_ex.clear(), trfinf.permprob_ex.resize(nbtag+1);
800 trfinf.permprob_in.clear(), trfinf.permprob_in.resize(nbtag+1);
801
802 for(unsigned int i=0; i<max; i++) { // need +1 as 0 is included
803 ANA_CHECK(chooseTagPermutation(trfinf,i,false));
804 ANA_CHECK(chooseTagPermutation(trfinf,i,true));
805 }
806
807 return StatusCode::SUCCESS;
808}
#define max(a, b)
Definition cfImp.cxx:41
Gaudi::Property< bool > m_usePerm
StatusCode chooseTagPermutation(TRFinfo &trfinf, unsigned int nbtag, bool isIncl)

◆ chooseTagBins_cum()

StatusCode BTaggingTruthTaggingTool::chooseTagBins_cum ( TRFinfo & trfinf,
std::vector< bool > & tagconf,
bool isIncl,
unsigned int nbtag )
private

Definition at line 901 of file BTaggingTruthTaggingTool.cxx.

901 {
902 std::vector<int> btagops;
903
904 ATH_MSG_DEBUG("chooseTagBins_cum ntag: " <<nbtag);
905
906 std::vector<float> incl;
907 std::vector<float> untagged_bins;
908 float prob = 1.;
909
910 //define the untagged bins
911 for (int bin=0; bin<m_nbins; bin++) {
912 if (std::count(m_OperatingBins.begin(), m_OperatingBins.end(), bin)) continue;
913 untagged_bins.push_back(bin);
914 }
915
916 //How to calculate Probabilities:
917 //sum: [---- P(bin 0) -----][-- P(bin 1) ---][- P(bin 2) -]
918 //random X up to sum of the bins. pick one prob based on the efficiency
919 for(unsigned int j=0; j<tagconf.size(); j++) {
920
921 ATH_MSG_DEBUG("tagconf.at(tc) " <<tagconf.at(j));
922
923 if(tagconf.at(j)) { // tagged jet
924 float sum=0.;
925 incl.clear();
926 for (int tagged_bin : m_OperatingBins){
927 sum += trfinf.effMC_allBins[tagged_bin][j];
928 incl.push_back(sum);
929 }
930
931 float theX = trfinf.rand.Uniform(sum);
932 auto tag_index = std::lower_bound(incl.begin(), incl.end(), theX) - incl.begin();
933 float tbin_choice = m_OperatingBins[tag_index];
934 btagops.push_back(tbin_choice);
935 prob *= (trfinf.effMC_allBins[tbin_choice][j]);
936 ATH_MSG_DEBUG("it " <<tag_index <<" theX " <<theX <<" effMC " <<trfinf.effMC_allBins[tbin_choice][j] <<" prob* " <<prob);
937 } //tagged
938 else { // untagged jet
939 float untag_sum = 0. ;
940 incl.clear();
941 //sum over untagged bins
942 for(auto bin : untagged_bins){
943 untag_sum += trfinf.effMC_allBins[bin][j];
944 incl.push_back(untag_sum);
945 }
946
947 float theX = trfinf.rand.Uniform(untag_sum);
948 auto untag_index = std::lower_bound(incl.begin(), incl.end(), theX) - incl.begin();
949 float utbin_choice = untagged_bins[untag_index];
950 btagops.push_back(utbin_choice);
951 prob *= 1 - trfinf.effMC_allBins[utbin_choice][j];
952 ATH_MSG_DEBUG(" unt_bin " <<untag_index <<" theX " <<theX<<" 1-effMC " <<1-trfinf.effMC_allBins[utbin_choice][j] <<" prob* " <<prob);
953 }
954 }
955
956 if(btagops.size() != tagconf.size()) {
957 ATH_MSG_ERROR("You should not be here -> wrong size of tag bins vector. btagops: " <<btagops.size() <<" tagconf: " <<tagconf.size());
958 return StatusCode::FAILURE;
959 }
960 if(isIncl) {
961 trfinf.tbins_in.at(nbtag) = btagops;
962 trfinf.binsprob_in.at(nbtag) = prob;
963 ATH_MSG_DEBUG("incl, nbtag " << nbtag << " prob " << prob);
964 }
965 else {
966 trfinf.tbins_ex.at(nbtag) = btagops;
967 trfinf.binsprob_ex.at(nbtag) = prob;
968 ATH_MSG_DEBUG("excl, nbtag " << nbtag << " prob " << prob);
969 }
970 return StatusCode::SUCCESS;
971}

◆ chooseTagPermutation()

StatusCode BTaggingTruthTaggingTool::chooseTagPermutation ( TRFinfo & trfinf,
unsigned int nbtag,
bool isIncl )
private

Definition at line 810 of file BTaggingTruthTaggingTool.cxx.

810 {
811 std::vector<float> incl;
812 std::vector<std::pair<unsigned int, unsigned int> > trackPerm;
813 float sum = 0;
814 if(isIncl) {
815 for(unsigned int itag=nbtag; itag < trfinf.permsWeight.size(); itag++) {
816 for(unsigned int ip = 0; ip < trfinf.permsWeight.at(itag).size(); ip++) {
817 sum += trfinf.permsWeight.at(itag).at(ip);
818 incl.push_back(sum);
819 trackPerm.push_back(std::make_pair(itag,ip));
820 }
821 }
822 }
823 else { // in exclusive case
824 sum = trfinf.permsSumWeight.at(nbtag).back();
825 incl = trfinf.permsSumWeight.at(nbtag);
826 for(unsigned int ip = 0; ip < trfinf.permsSumWeight.at(nbtag).size(); ip++) trackPerm.push_back(std::make_pair(nbtag,ip));
827 }
828 float theX = trfinf.rand.Uniform(sum);
829 for(unsigned int ip=0; ip < incl.size(); ip++) {
830 ATH_MSG_DEBUG("incl.at(ip): " << incl.at(ip) << " theX: " << theX);
831 if(incl.at(ip) >= theX) {
832 if(isIncl) {
833 trfinf.perm_in.at(nbtag) = trfinf.perms[trfinf.njets].at(trackPerm.at(ip).first).at(trackPerm.at(ip).second);
834 trfinf.permprob_in.at(nbtag) = trfinf.permsWeight.at(trackPerm.at(ip).first).at(trackPerm.at(ip).second) / trfinf.trfw_in.at(nbtag);
835 }
836 else {
837 trfinf.perm_ex.at(nbtag) = trfinf.perms[trfinf.njets].at(trackPerm.at(ip).first).at(trackPerm.at(ip).second);
838 trfinf.permprob_ex.at(nbtag) = trfinf.permsWeight.at(trackPerm.at(ip).first).at(trackPerm.at(ip).second) / trfinf.trfw_ex.at(nbtag);
839 }
840 return StatusCode::SUCCESS;
841 }
842 }
843 return StatusCode::SUCCESS;
844}

◆ declareGaudiProperty()

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

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

Definition at line 156 of file AthCommonDataStore.h.

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

◆ declareProperty()

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

Definition at line 145 of file AthCommonDataStore.h.

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

◆ detStore()

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

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

Definition at line 95 of file AthCommonDataStore.h.

◆ evtStore()

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

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

Definition at line 85 of file AthCommonDataStore.h.

◆ ExclusiveConeHadronFlavourLabel()

int BTaggingTruthTaggingTool::ExclusiveConeHadronFlavourLabel ( const xAOD::Jet & jet)
private

Definition at line 1091 of file BTaggingTruthTaggingTool.cxx.

1091 {
1092 // default label means "invalid"
1093 int label = -1;
1094 // We don't check the return value, as we would not be able to handle it gracefully anyway
1095 jet.getAttribute("HadronConeExclTruthLabelID",label);
1096 return label;
1097}
bool getAttribute(AttributeID type, T &value) const
Retrieve attribute moment by enum.
std::string label(const std::string &format, int i)
Definition label.h:19

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

StatusCode BTaggingTruthTaggingTool::fillVariables ( const float jetPt,
const float jetEta,
const float jetTagWeight,
Analysis::CalibrationDataVariables & x )
private

Definition at line 409 of file BTaggingTruthTaggingTool.cxx.

409 {
410 x.jetPt = jetPt;
411 x.jetEta = jetEta;
412 x.jetTagWeight = jetTagWeight;
413 x.jetAuthor = m_jetAuthor;
414 return StatusCode::SUCCESS;
415}
#define x
Gaudi::Property< std::string > m_jetAuthor
jet collection name

◆ fillVariables() [2/2]

StatusCode BTaggingTruthTaggingTool::fillVariables ( const xAOD::Jet & jet,
Analysis::CalibrationDataVariables & x )
private

Definition at line 392 of file BTaggingTruthTaggingTool.cxx.

392 {
393 x.jetPt = jet.pt();
394 x.jetEta = jet.eta();
395 x.jetAuthor = m_jetAuthor;
396
398 if (!tagInfo) return StatusCode::FAILURE;
399
400 CorrectionCode code = m_selTool->getTaggerWeight(jet, x.jetTagWeight);
402 ATH_MSG_ERROR("BTaggingSelectionTool::getTaggerWeight returned CorrectionCode::Error");
403 return StatusCode::FAILURE;
404 }
405
406 return StatusCode::SUCCESS;
407}
@ OutOfValidityRange
Input object is out of validity range.
@ Ok
The correction was done successfully.
virtual double pt() const
The transverse momentum ( ) of the particle.
Definition Jet_v1.cxx:44
virtual double eta() const
The pseudorapidity ( ) of the particle.
Definition Jet_v1.cxx:49
const BTagging * getBTagging(const SG::AuxElement &part)
Access the default xAOD::BTagging object associated to an object.
BTagging_v1 BTagging
Definition of the current "BTagging version".
Definition BTagging.h:17

◆ GAFinalHadronFlavourLabel()

int BTaggingTruthTaggingTool::GAFinalHadronFlavourLabel ( const xAOD::Jet & jet)
private

Definition at line 1074 of file BTaggingTruthTaggingTool.cxx.

1074 {
1075
1076 const std::string labelB = "GhostBHadronsFinal";
1077 const std::string labelC = "GhostCHadronsFinal";
1078 const std::string labelTau = "GhostTausFinal";
1079
1080 std::vector<const IParticle*> ghostB;
1081 if (jet.getAssociatedObjects<IParticle>(labelB, ghostB) && ghostB.size() > 0) return 5;
1082 std::vector<const IParticle*> ghostC;
1083 if (jet.getAssociatedObjects<IParticle>(labelC, ghostC) && ghostC.size() > 0) return 4;
1084 std::vector<const IParticle*> ghostTau;
1085 if (jet.getAssociatedObjects<IParticle>(labelTau, ghostTau) && ghostTau.size() > 0) return 15;
1086
1087
1088 return 0;
1089}
std::vector< const T * > getAssociatedObjects(const std::string &name) const
get associated objects as a vector<object> this compact form throws an exception if the object is not...

◆ generatePermutations()

std::vector< std::vector< bool > > BTaggingTruthTaggingTool::generatePermutations ( int njets,
int tags,
int start = 0 )
private

Definition at line 639 of file BTaggingTruthTaggingTool.cxx.

639 {
640 std::vector<std::vector<bool> > perm;
641 std::vector<std::vector<bool> > temp_perm;
642 if(tags==0){
643 std::vector<bool> tags(njets,false);
644 perm.push_back(tags);
645 }
646 else if(tags == njets) {
647 std::vector<bool> tags(njets,true);
648 perm.push_back(tags);
649 }
650 else {
651 for(int i=start; i<njets;i++){
652 temp_perm = generatePermutations(njets,tags-1,i+1);
653 for(unsigned int j=0; j<temp_perm.size(); j++){
654 temp_perm.at(j).at(i)=true;
655 perm.push_back(temp_perm.at(j));
656 }
657 }
658 }
659 return perm;
660}
std::vector< std::vector< bool > > generatePermutations(int njets, int tags, int start=0)
std::vector< std::string > tags
Definition hcg.cxx:105

◆ generateRandomTaggerScores()

StatusCode BTaggingTruthTaggingTool::generateRandomTaggerScores ( std::vector< std::vector< int > > & quantiles,
std::vector< std::vector< float > > & btag_scores,
std::vector< std::vector< float > > & ctag_scores )
private

Definition at line 1128 of file BTaggingTruthTaggingTool.cxx.

1128 {
1129
1130 TRandom3 random;
1131
1132 btag_scores.clear();
1133 btag_scores.resize(quantiles.size());
1134
1135 if(m_continuous2D){
1136 ctag_scores.clear();
1137 ctag_scores.resize(quantiles.size());
1138 }
1139
1140 for(unsigned int i=0; i <quantiles.size(); i++ ){
1141
1142 btag_scores.at(i).resize(quantiles.at(i).size());
1143 if(m_continuous2D)
1144 ctag_scores.at(i).resize(quantiles.at(i).size());
1145
1146 unsigned int njets = quantiles.at(i).size();
1147 for(unsigned int j=0; j < njets; j++ ){
1148
1149 int temp_quantile = (m_continuous2D) ? quantiles.at(i).at(j) : quantiles.at(i).at(j) -1;
1150
1151 float btag_low = m_cuts[temp_quantile].bcut_low;
1152 float btag_hig = m_cuts[temp_quantile].bcut_hig;
1153
1154 float ctag_low = m_cuts[temp_quantile].ccut_low;
1155 float ctag_hig = m_cuts[temp_quantile].ccut_hig;
1156
1157 btag_scores.at(i).at(j) = btag_low + random.Uniform()*(btag_hig - btag_low );
1158 if(m_continuous2D)
1159 ctag_scores.at(i).at(j) = ctag_low + random.Uniform()*(ctag_hig - ctag_low );
1160 }
1161 }
1162 return StatusCode::SUCCESS;
1163
1164}

◆ getAllEffMC()

StatusCode BTaggingTruthTaggingTool::getAllEffMC ( TRFinfo & trfinf)
private

Definition at line 563 of file BTaggingTruthTaggingTool.cxx.

563 {
564 if (trfinf.node_feat.size() == 0){
565 return getAllEffMCCDI(trfinf);
566 } else {
567 return getAllEffMCGNN(trfinf);
568 }
569}
StatusCode getAllEffMCGNN(TRFinfo &trfinf)
StatusCode getAllEffMCCDI(TRFinfo &trfinf)

◆ getAllEffMCCDI()

StatusCode BTaggingTruthTaggingTool::getAllEffMCCDI ( TRFinfo & trfinf)
private

Definition at line 607 of file BTaggingTruthTaggingTool.cxx.

607 {
608
609 float eff_all =1.;
610 for(int bin = 0; bin < m_nbins; bin++)
611 trfinf.effMC_allBins[bin].clear();
612
613 for(size_t jet=0; jet < trfinf.jets.size(); jet++){
614 for(int bin = 0; bin < m_nbins; bin++){ // loop on bins
615 eff_all=1.;
616
617 //set a dumb value of the truth tag weight to get the different efficiency maps for each bin. to be improved..
618 if (m_continuous2D)
619 trfinf.jets.at(jet).vars.jetTagWeight = bin+0.5;
620 else
621 trfinf.jets.at(jet).vars.jetTagWeight = (m_cuts[bin].bcut_low + m_cuts[bin].bcut_hig)/2.;
622
623 ATH_MSG_DEBUG("effMC_allBins: tag bin: " <<bin <<" tagw: " << trfinf.jets.at(jet).vars.jetTagWeight <<" " <<m_cuts[bin].bcut_low <<" " << m_cuts[bin].bcut_hig <<" " <<trfinf.jets.at(jet).vars.jetPt <<" " <<trfinf.jets.at(jet).vars.jetEta <<" " <<trfinf.jets.at(jet).flav);
624 //get the efficiency
625 CorrectionCode code = m_effTool->getMCEfficiency(trfinf.jets.at(jet).flav, trfinf.jets.at(jet).vars, eff_all);
627 ATH_MSG_ERROR("BTaggingEfficiencyTool::getMCEfficiency returned CorrectionCode::Error");
628 return StatusCode::FAILURE;
629 }
630
631 trfinf.effMC_allBins[bin].push_back(eff_all);
632 ATH_MSG_DEBUG("effMC_allBins: tag bin: " <<bin <<" tagw: " << trfinf.jets.at(jet).vars.jetTagWeight <<" eff: " <<eff_all);
633 } // end loop on bins
634 } // end loop on jets
635
636 return StatusCode::SUCCESS;
637}

◆ getAllEffMCGNN()

StatusCode BTaggingTruthTaggingTool::getAllEffMCGNN ( TRFinfo & trfinf)
private

Definition at line 572 of file BTaggingTruthTaggingTool.cxx.

572 {
573
574 for(int bin = 0; bin < m_nbins; bin++)
575 trfinf.effMC_allBins[bin].clear();
576
577 //extract efficiency
578 std::vector<std::vector<float>> tmp_effMC_allBins; // shape:{num_jets, num_wp}
579 CorrectionCode code = m_effTool->getMCEfficiencyONNX(trfinf.node_feat, tmp_effMC_allBins);
580
582 ATH_MSG_ERROR("BTaggingEfficiencyTool::getMCEfficiencyONNX returned CorrectionCode::Error");
583 return StatusCode::FAILURE;
584 }
585
586 if(m_continuous) {
587 for(int bin = 0; bin < m_nbins; bin++){
588 // need to transpose
589 std::vector<float> tmp_effMC_oneBin; // shape: {num_jet} = trfinf.njets
590 for (unsigned int jet_index=0; jet_index<trfinf.njets; jet_index++){
591 tmp_effMC_oneBin.push_back(tmp_effMC_allBins[jet_index][bin]);
592 }
593 trfinf.effMC_allBins[bin] = tmp_effMC_oneBin;
594 }
595 } // m_continuous
596 else{
597 for (unsigned int jet_index=0; jet_index<trfinf.njets; jet_index++){
598 float tmp_effMC = std::accumulate(tmp_effMC_allBins[jet_index].begin()+m_OP_index_for_GNN, tmp_effMC_allBins[jet_index].end(), 0.0);
599 trfinf.effMC_allBins[0].push_back(1-tmp_effMC);
600 trfinf.effMC_allBins[1].push_back(tmp_effMC);
601 }
602 } // !m_continuous
603
604 return StatusCode::SUCCESS;
605}

◆ getAllEffSF()

StatusCode BTaggingTruthTaggingTool::getAllEffSF ( TRFinfo & trfinf,
int = 0 )
private

◆ getDirectTaggedJets()

StatusCode BTaggingTruthTaggingTool::getDirectTaggedJets ( TRFinfo & trfinf,
std::vector< bool > & is_tagged )
private

Definition at line 994 of file BTaggingTruthTaggingTool.cxx.

994 {
995 is_tagged.clear();
996 std::vector<int> appo;
997 auto is_jettag = false;
998 for(const auto &jet : trfinf.jets) {
999 ATH_MSG_DEBUG("pt " << jet.vars.jetPt << " eta " << jet.vars.jetEta << " wei " << jet.vars.jetTagWeight);
1000 is_jettag = static_cast<bool>(m_selTool->accept(jet.vars.jetPt, jet.vars.jetEta, jet.vars.jetTagWeight));
1001
1002 ATH_MSG_DEBUG("is tagged? " << is_jettag);
1003 if(is_jettag) is_tagged.push_back(1);
1004 else is_tagged.push_back(0);
1005 }
1006
1007 return StatusCode::SUCCESS;
1008}

◆ getEvtSF()

float BTaggingTruthTaggingTool::getEvtSF ( TRFinfo & trfinf,
std::vector< int > & quantiles )
private

Definition at line 1011 of file BTaggingTruthTaggingTool.cxx.

1011 {
1012
1013 float SF = 1.;
1014
1015 if (m_ignoreSF)
1016 return SF;
1017
1018 for(unsigned int i =0; i< trfinf.njets; i++) {
1019 float jetSF = 1;
1020
1021 if(!m_continuous){ //FixedCut
1022
1023 bool is_btagged = quantiles.at(i);
1024 auto code = (is_btagged) ? m_effTool->getScaleFactor(trfinf.jets.at(i).flav, trfinf.jets.at(i).vars, jetSF) : m_effTool->getInefficiencyScaleFactor(trfinf.jets.at(i).flav, trfinf.jets.at(i).vars, jetSF);
1025
1027 ATH_MSG_ERROR("BTaggingEfficiencyTool::getScaleFactor returned CorrectionCode::Error");
1028 return -99.;
1029 }
1030 }
1031 else{ //continuous & continuous2D
1032 int bin = quantiles.at(i);
1033 //set new tagweight bin according to the final decision
1034 //the quantile convention for continuous is: bin+1!
1035 trfinf.jets.at(i).vars.jetTagWeight = (m_continuous2D) ? bin+0.5 : (m_cuts[bin-1].bcut_low + m_cuts[bin-1].bcut_hig)/2.;
1036
1037 auto code = m_effTool->getScaleFactor(trfinf.jets.at(i).flav, trfinf.jets.at(i).vars, jetSF);
1039 ATH_MSG_ERROR("BTaggingEfficiencyTool::getScaleFactor returned CorrectionCode::Error");
1040 return -99;
1041 }
1042 ATH_MSG_DEBUG("BIN " <<bin <<"SF: pt " <<trfinf.jets.at(i).vars.jetPt <<" " <<trfinf.jets.at(i).vars.jetEta <<" " <<trfinf.jets.at(i).vars.jetTagWeight <<" jetSF " <<jetSF);
1043 }
1044 SF*=jetSF;
1045 } //loop over jets
1046
1047 ATH_MSG_DEBUG(" FINAL SF : " <<SF);
1048 return SF;
1049}
Gaudi::Property< bool > m_ignoreSF
const float SF[NF]
Cross sections for Fluor.

◆ getKey()

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

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

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

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

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

Definition at line 119 of file AsgTool.cxx.

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

◆ getName()

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

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

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

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

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

Definition at line 106 of file AsgTool.cxx.

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

◆ getProperty()

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

Get one of the tool's properties.

◆ getQuantiles()

StatusCode BTaggingTruthTaggingTool::getQuantiles ( TRFinfo & trfinf,
std::vector< std::vector< int > > & trf_bin_ex,
std::vector< std::vector< int > > & trf_bin_in )
private

Definition at line 859 of file BTaggingTruthTaggingTool.cxx.

859 {
860 trf_bin_ex.resize(trfinf.tbins_ex.size());
861 for(unsigned int i =0; i<trfinf.tbins_ex.size(); i++)
862 trf_bin_ex.at(i).resize(trfinf.tbins_ex.at(i).size());
863
864 trf_bin_in.resize(trfinf.tbins_in.size());
865 for(unsigned int i =0; i<trfinf.tbins_in.size(); i++)
866 trf_bin_in.at(i).resize(trfinf.tbins_in.at(i).size());
867 // increasing the value by 1 to match conventions in selectionTool (not continuous2D)
868 for(unsigned int i =0; i<trfinf.tbins_ex.size(); i++)
869 for(unsigned int j=0; j<trfinf.tbins_ex.at(i).size(); j++)
870 trf_bin_ex.at(i).at(j)= (m_continuous2D || !m_continuous) ? trfinf.tbins_ex.at(i).at(j) : trfinf.tbins_ex.at(i).at(j) +1;
871
872 for(unsigned int i =0; i<trfinf.tbins_in.size(); i++)
873 for(unsigned int j=0; j<trfinf.tbins_in.at(i).size(); j++)
874 trf_bin_in.at(i).at(j) = (m_continuous2D || !m_continuous) ? trfinf.tbins_in.at(i).at(j) : trfinf.tbins_in.at(i).at(j) +1;
875
876 return StatusCode::SUCCESS;
877}

◆ getTagBinsConfProb()

float BTaggingTruthTaggingTool::getTagBinsConfProb ( TRFinfo & trfinf,
std::vector< int > & tagws )
private

Definition at line 973 of file BTaggingTruthTaggingTool.cxx.

973 {
974 float prob = 1.;
975 for(unsigned int j=0; j<tagws.size(); j++) {
976
977 float sum_tag = 0.;
978 //calculate sum of all tagged bins
979 for (auto bin : m_OperatingBins)
980 sum_tag += trfinf.effMC_allBins[bin][j];
981
982 if(std::count(m_OperatingBins.begin(), m_OperatingBins.end(), tagws.at(j) ) ) { // tagged
983 prob *= (trfinf.effMC_allBins[tagws.at(j)][j]) / sum_tag;
984 ATH_MSG_DEBUG("prob " << prob);
985 }
986 else { // untagged
987 prob *= (1 - trfinf.effMC_allBins[tagws.at(j)][j]) / (1 - sum_tag);
988 ATH_MSG_DEBUG("prob " << prob);
989 }
990 }
991 return prob;
992}

◆ getTagPermutation()

StatusCode BTaggingTruthTaggingTool::getTagPermutation ( TRFinfo & trfinf,
std::vector< std::vector< bool > > & trf_chosen_perm_ex,
std::vector< std::vector< bool > > & trf_chosen_perm_in )
private

Definition at line 767 of file BTaggingTruthTaggingTool.cxx.

767 {
768 trf_chosen_perm_ex.resize(m_nbtag+1);
769 trf_chosen_perm_in.resize(m_nbtag+1);
770 trf_chosen_perm_ex = trfinf.perm_ex;
771 trf_chosen_perm_in = trfinf.perm_in;
772 std::string print_perm = "Permutation: ";
773 for(const auto& perm: trfinf.perm_ex){
774 for(auto is: perm) {
775 if(is) print_perm+=std::to_string(1);
776 else print_perm+=std::to_string(0);
777 print_perm+=" ";
778 }
779 }
780 ATH_MSG_DEBUG(print_perm);
781 return StatusCode::SUCCESS;
782}

◆ getTRFweight()

StatusCode BTaggingTruthTaggingTool::getTRFweight ( TRFinfo & trfinf,
unsigned int nbtag,
bool isInclusive )
private

Definition at line 687 of file BTaggingTruthTaggingTool.cxx.

687 {
688
689 unsigned int njets = trfinf.njets;
690 // Consider permutations of njet jets with up to limit b-tags
691 unsigned int limit = (njets > 7) ? 8 : njets+1;
692
693 // Permutations: njets, ntags, permutations
694 auto& perm = trfinf.perms[njets];
695 if (perm.empty()) { // if I don't have already saved the possible permutations for njet
696 perm.resize (limit);
697 for(unsigned int i=0;i<limit;i++)
698 trfinf.perms[njets].at(i) = generatePermutations(njets,i);
699 }
700 trfinf.permsWeight.clear(), trfinf.permsWeight.resize(limit); // trfinf.permsWeight.at(i).at(j): TRF weight of the j-th perm with i b-tags
701 trfinf.permsSumWeight.clear(), trfinf.permsSumWeight.resize(limit); // trfinf.permsSumWeight.at(i).at(j): partial sum of TRF weight of the permutations with i b-tags up to j (0,1,..,j-th) perm. Used in the choice of the selected permutation
702
703 // compute TRF weight
704 unsigned int max = nbtag+1; // from 0 to nbtag b-tags --> nbtag+1 positions
705 trfinf.trfw_ex.clear(), trfinf.trfw_in.clear();
706 trfinf.trfw_ex.resize(max), trfinf.trfw_in.resize(max);
707
708 //clear and resize elements of trfinf
709 trfinf.perm_ex.clear(), trfinf.perm_in.clear(); // vector<vector<bool>> --> for each number of tags the chosen permutation
710 trfinf.perm_ex.resize(max), trfinf.perm_in.resize(max);
711 trfinf.permprob_ex.clear(), trfinf.permprob_in.clear(); // probability of the perm in trfinf.perm_ex/in
712 trfinf.permprob_ex.resize(max), trfinf.permprob_in.resize(max);
713
714 if(isInclusive) {
715 for(unsigned int i=0; i<limit; i++) { // note: I consider maximum limit tags. It's an approximation
716 std::vector<float> weights;
717 float sum = 0.;
718 float w = 0.; //weight
719 trfinf.permsWeight.at(i).clear();
720 trfinf.permsSumWeight.at(i).clear();
721 trfinf.permsWeight.at(i).resize(trfinf.perms[njets].at(i).size());
722 trfinf.permsSumWeight.at(i).resize(trfinf.perms[njets].at(i).size());
723
724 // loop on all the permutations with i tags
725 for(unsigned int p=0; p<trfinf.perms[njets].at(i).size(); p++) {
726
727 w = trfWeight(trfinf,trfinf.perms[njets].at(i).at(p));
728 sum+=w;
729 trfinf.permsWeight.at(i).at(p) = w;
730 trfinf.permsSumWeight.at(i).at(p) = sum;
731
732 ATH_MSG_DEBUG("nbtag = " << i << " wei = " << w << " sum = " << sum);
733 }
734 if(i<limit && i<max) {
735 // note: I need to already have the exclusive weights filled to compite the inclusive
736 trfinf.trfw_ex.at(i) = sum; // sum of TRF weights for all perm with i b-tags
737 if(i == 0) trfinf.trfw_in.at(0) = 1.;
738 else trfinf.trfw_in.at(i) = trfinf.trfw_in.at(i-1) - trfinf.trfw_ex.at(i-1); // P(>=4) = P(>=3) - P(==3)
739 ATH_MSG_DEBUG("i = " << i << " sum = " << sum << " TRF in " << trfinf.trfw_in.at(i) << " ex = " << trfinf.trfw_ex.at(i));
740 }
741 }
742 ATH_MSG_DEBUG("before return, nbtag = " << nbtag << " size de trfinf.trfw_in = " << trfinf.trfw_in.size());
743 return StatusCode::SUCCESS;
744 }
745 else { // exclusive case, only one calculation needed
746 std::vector<float> weights;
747 float sum = 0., w = 0.;
748 size_t size = trfinf.perms[njets].at(nbtag).size();
749 trfinf.permsWeight.at(nbtag).clear();
750 trfinf.permsSumWeight.at(nbtag).clear();
751 trfinf.permsWeight.at(nbtag).resize(size);
752 trfinf.permsSumWeight.at(nbtag).resize(size);
753 // loop on all the permutations with i tags
754 for(unsigned int p=0; p<trfinf.perms[njets].at(nbtag).size(); p++) {
755 w = trfWeight(trfinf,trfinf.perms[njets].at(nbtag).at(p));
756 sum+=w;
757 trfinf.permsWeight.at(nbtag).at(p) = w;
758 trfinf.permsSumWeight.at(nbtag).at(p) = sum;
759 }
760 trfinf.trfw_ex.at(nbtag) = sum;
761 return StatusCode::SUCCESS;
762 }
763 return StatusCode::SUCCESS;
764}
float trfWeight(TRFinfo &trfinf, const std::vector< bool > &tags)

◆ GetTruthTagWeights()

StatusCode BTaggingTruthTaggingTool::GetTruthTagWeights ( TRFinfo & trfinf,
std::vector< float > & trf_weight_ex,
std::vector< float > & trf_weight_in )
private

Definition at line 417 of file BTaggingTruthTaggingTool.cxx.

417 {
418
419 ANA_CHECK_SET_TYPE (StatusCode);
420 //get MC efficiencies
421 ANA_CHECK(getAllEffMC(trfinf));
422 //compute truth tag weights
423 ANA_CHECK(getTRFweight(trfinf,m_nbtag, true));
424 // choice of the selected permutation
426
427 // choice of the tagged bins
429
430 trf_weight_ex = trfinf.trfw_ex;
431 trf_weight_in = trfinf.trfw_in;
432 return StatusCode::SUCCESS;
433}
StatusCode getAllEffMC(TRFinfo &trfinf)
StatusCode chooseAllTagPermutation(TRFinfo &trfinf, unsigned int nbtag)
StatusCode getTRFweight(TRFinfo &trfinf, unsigned int nbtag, bool isInclusive)
StatusCode chooseAllTagBins(TRFinfo &trfinf)

◆ initialize()

StatusCode BTaggingTruthTaggingTool::initialize ( void )
virtual

Dummy implementation of the initialisation function.

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

Reimplemented from asg::AsgTool.

Definition at line 83 of file BTaggingTruthTaggingTool.cxx.

83 {
84
85 ANA_CHECK_SET_TYPE (StatusCode);
86 m_initialised = true;
87
88 ANA_CHECK(m_selTool.setProperty("MaxEta", m_maxEta));
89 ANA_CHECK(m_selTool.setProperty("MaxRangePt", m_maxRangePt));
90 ANA_CHECK(m_selTool.setProperty("MinPt", m_minPt));
91 ANA_CHECK(m_selTool.setProperty("TaggerName", m_taggerName));
92 ANA_CHECK(m_selTool.setProperty("OperatingPoint", m_OP));
93 ANA_CHECK(m_selTool.setProperty("JetAuthor", m_jetAuthor));
94 ANA_CHECK(m_selTool.setProperty("FlvTagCutDefinitionsFileName", m_SFFile));
95 ANA_CHECK(m_selTool.initialize());
96
97 ANA_CHECK(m_effTool.setProperty("MinPt", m_minPt));
98 ANA_CHECK(m_effTool.setProperty("TaggerName", m_taggerName));
99 ANA_CHECK(m_effTool.setProperty("OperatingPoint", m_OP));
100 ANA_CHECK(m_effTool.setProperty("JetAuthor", m_jetAuthor));
101 ANA_CHECK(m_effTool.setProperty("ScaleFactorFileName", m_SFFile ));
102 ANA_CHECK(m_effTool.setProperty("UseDevelopmentFile", m_useDevFile ));
103 ANA_CHECK(m_effTool.setProperty("EfficiencyFileName", m_EffFile ));
104 ANA_CHECK(m_effTool.setProperty("ScaleFactorBCalibration", m_SFBName ));
105 ANA_CHECK(m_effTool.setProperty("ScaleFactorCCalibration", m_SFCName ));
106 ANA_CHECK(m_effTool.setProperty("ScaleFactorTCalibration", m_SFTName ));
107 ANA_CHECK(m_effTool.setProperty("ScaleFactorLightCalibration", m_SFLightName ));
108 ANA_CHECK(m_effTool.setProperty("EigenvectorReductionB", m_EVReductionB ));
109 ANA_CHECK(m_effTool.setProperty("EigenvectorReductionC", m_EVReductionC ));
110 ANA_CHECK(m_effTool.setProperty("EigenvectorReductionLight", m_EVReductionLight ));
111 ANA_CHECK(m_effTool.setProperty("EfficiencyBCalibrations", m_EffBName ));
112 ANA_CHECK(m_effTool.setProperty("EfficiencyCCalibrations", m_EffCName ));
113 ANA_CHECK(m_effTool.setProperty("EfficiencyTCalibrations", m_EffTName ));
114 ANA_CHECK(m_effTool.setProperty("EfficiencyLightCalibrations", m_EffLightName ));
115 ANA_CHECK(m_effTool.setProperty("ExcludeFromEigenVectorTreatment", m_excludeFromEV ));
116 ANA_CHECK(m_effTool.setProperty("SystematicsStrategy", m_systStrategy ));
117 ANA_CHECK(m_effTool.setProperty("ConeFlavourLabel", m_coneFlavourLabel ));
118 ANA_CHECK(m_effTool.setProperty("pathToONNX", m_pathToONNX ));
119
120 ANA_CHECK(m_effTool.initialize());
121
122 m_continuous = false;
123 m_continuous2D = false;
124 if(m_OP.value().find("Continuous") != std::string::npos){
125 ATH_MSG_INFO("You are running in Continuous and you chose " << m_cutBenchmark <<" as benchmarks" );
126 m_continuous = true;
127 if(m_OP.value().find("Continuous2D") != std::string::npos)
128 m_continuous2D = true;
129
130 //tokenize the quantiles that will be used as tagged bin indices.
131 std::vector<std::string> tag_benchmarks = split(m_cutBenchmark, ',');
132 for (const auto & tag_bin : tag_benchmarks ){
134 m_OperatingBins.push_back(std::atoi(tag_bin.c_str()));
135 else //continuous
136 m_OperatingBins.push_back(std::atoi(tag_bin.c_str())-1); //different convention
137 }
138 }
139 else{ //FixedCut working points
140 m_OperatingBins.clear();
141 m_OperatingBins.push_back(1); //first bin: untagged, second bin: tagged.
142}
143
145 ATH_MSG_ERROR("UseQuantile is available only in Continuous WP. Please consider switching the Operating Point.");
146 return StatusCode::FAILURE;
147 }
148
149 if (m_pathToONNX != ""){
150 // 60% = 4, 70% = 3, 77% = 2, 85% = 1, 100% = 0
151 m_OP_index_for_GNN = find(m_availableOP_fixCut.begin(), m_availableOP_fixCut.end(), m_OP) - m_availableOP_fixCut.begin() + 1; // GNN predicts 5 bins
152 }
153
154 m_eff_syst.clear();
155 m_sys_name.clear();
156 CP::SystematicSet def_set;
157 m_eff_syst.push_back(def_set);
158 m_sys_name.push_back("Nominal");
159
160 if(m_useSys){
161 std::vector<std::string> excludeEV_vector;
162 if(m_excludeEV != "")
163 excludeEV_vector = split(m_excludeEV, ';');
164 CP::SystematicSet systs = m_effTool->affectingSystematics();
165 for (const auto & syst : systs) {
166 CP::SystematicSet myset;
167 string s = syst.name();
168 if(m_doOnlyUpVariations && s.find("__1down") !=string::npos) continue;
169 if(std::any_of(excludeEV_vector.begin(), excludeEV_vector.end(), [&s](const std::string& str) { return str.find(s) != std::string::npos; })) continue;
170 myset.insert(syst);
171 if(m_excludeEV != "")
172 ATH_MSG_INFO("Adding systematic " << syst.name() << "to the list ");
173 else
174 ATH_MSG_DEBUG("Adding systematic " << syst.name() << "to the list ");
175 m_eff_syst.push_back(myset);
176 m_sys_name.push_back(syst.name());
177 }
178 }
179
180 ATH_MSG_INFO("end of systematics ");
181
182 //set the cuts
183 TString pathtofile = PathResolverFindCalibFile(m_SFFile);
184 m_inf = TFile::Open(pathtofile, "read");
185
186 float min_cut_low = (m_taggerName == "MV2c10") ? -1 : -20;
187 float max_cut_hig = (m_taggerName == "MV2c10") ? +1 : +20;
188
189 if(m_OP == "Continuous"){
190 std::vector<float> bin_edges;
191 bin_edges.push_back(min_cut_low);
192 for (const std::string& bin_name : m_availableOP_fixCut){
193 TString cutname = m_taggerName+"/"+m_jetAuthor+"/"+bin_name+"/cutvalue";
194 float cutval = ((TVector*) m_inf->Get(cutname))[0](0);
195 bin_edges.push_back(cutval);
196 }
197 bin_edges.push_back(max_cut_hig);
198 for (unsigned int be = 0 ; be < bin_edges.size()-1 ; be++){
199 //check if the bin is one of the bins used for btagging
200 //NB. i+1 is to follow the convention 1-5!
201 bool is_tagbin = std::count(m_OperatingBins.begin(), m_OperatingBins.end(), be);
202 TagBin one_cut = TagBin(is_tagbin, bin_edges.at(be), bin_edges.at(be+1));
203 m_cuts.push_back(one_cut);
204 }
205 } //== continuous
206 else if (m_OP.value().find("Continuous2D") != std::string::npos){
207 ATH_MSG_INFO("TruthTagging initialization: Working with Continuous2D WP.");
208 TString cutname = m_taggerName+"/"+m_jetAuthor+"/Continuous2D/cutvalue";
209 TMatrixD* cuts2D = (TMatrixD*) m_inf->Get(cutname);
210 ATH_MSG_DEBUG("Counting " <<cuts2D->GetNrows() <<" bins ");
211
212 for (int bin = 0; bin < cuts2D->GetNrows(); bin++){
213 ATH_MSG_DEBUG("INITIALIZATION c-cuts : " <<(*cuts2D)(bin,0) <<" "
214 <<(*cuts2D)(bin,1) <<" b-cuts : "
215 <<(*cuts2D)(bin,2) <<" "
216 <<(*cuts2D)(bin,3));
217
218 //check if the bin is one of the bins used for btagging
219 //NB. i follows the convention 0-4 of the continuous2D tagging
220 bool is_tagbin = std::count(m_OperatingBins.begin(), m_OperatingBins.end(), bin);
221
222 //set protection limits, so the final generated tagweight values have a meaning
223 float c_tagcut_low = ((*cuts2D)(bin,0) < min_cut_low) ? min_cut_low : (*cuts2D)(bin,0);
224 float c_tagcut_hig = ((*cuts2D)(bin,1) > max_cut_hig) ? max_cut_hig : (*cuts2D)(bin,1);
225 float b_tagcut_low = ((*cuts2D)(bin,2) < min_cut_low) ? min_cut_low : (*cuts2D)(bin,2);
226 float b_tagcut_hig = ((*cuts2D)(bin,3) > max_cut_hig) ? max_cut_hig : (*cuts2D)(bin,3);
227
228 TagBin one_cut = TagBin(is_tagbin, b_tagcut_low, b_tagcut_hig, c_tagcut_low, c_tagcut_hig);
229 m_cuts.push_back(one_cut);
230 }
231 }//continuous2D
232 else{ //fixed-cut
233 TString cutname = m_taggerName+"/"+m_jetAuthor+"/"+m_OP+"/cutvalue";
234 float cutval = ((TVector*) m_inf->Get(cutname))[0](0);
235
236 TagBin untag_bin = TagBin(false, min_cut_low, cutval); //bin 0
237 TagBin tag_bin = TagBin(true, cutval, max_cut_hig); //bin 1
238
239 m_cuts.push_back(untag_bin);
240 m_cuts.push_back(tag_bin);
241 } //FixedCut
242
243 if(m_continuous)
244 for (const auto& c : m_cuts){
245 ATH_MSG_INFO("b-tag low: " <<c.bcut_low <<" b-tag hig: " <<c.bcut_hig <<" c-tag low: " <<c.ccut_low <<" c-tag hig: " <<c.ccut_hig <<" Added to tag bins: " <<c.is_tagbin);
246 }
247
248 //total number of bins. helpful in loops
249 m_nbins = m_cuts.size(); //FixedCut
250 ATH_MSG_INFO("Total number of bins: " <<m_nbins);
251
252
253 // "AllJets" is the default strategy
254 if (m_taggingStrategy == "AllJets"){
256 } else if (m_taggingStrategy == "Leading2SignalJets"){
258 } else if (m_taggingStrategy == "Leading3SignalJets"){
260 } else {
261 ATH_MSG_ERROR("BTaggingTruthTaggingTool::tagging strategy " << m_taggingStrategy << " is not implemented in the TruthTagging Tool");
262 return StatusCode::FAILURE;
263 }
264
265 return StatusCode::SUCCESS;
266 }
#define ATH_MSG_INFO(x)
std::string PathResolverFindCalibFile(const std::string &logical_file_name)
Gaudi::Property< std::string > m_SFBName
name of the data/MC scale factor calibration for b jets
std::vector< std::string > split(const std::string &str, char token)
Gaudi::Property< float > m_maxRangePt
Gaudi::Property< bool > m_useQuantile
Gaudi::Property< std::string > m_taggerName
tagger name
Gaudi::Property< std::string > m_EffFile
name of the optional MC efficiency file (may be changed by the PathResolver)
Gaudi::Property< std::string > m_OP
operating point
Gaudi::Property< float > m_maxEta
Gaudi::Property< std::string > m_EVReductionB
specification of the eigenvector reduction strategy for b jets (if eigenvectors are used)
Gaudi::Property< std::string > m_EVReductionLight
specification of the eigenvector reduction strategy for light-flavour jets (if eigenvectors are used)
Gaudi::Property< bool > m_coneFlavourLabel
if true, use cone-based labelling (as opposed to ghost association)
Gaudi::Property< std::string > m_EVReductionC
specification of the eigenvector reduction strategy for c jets (if eigenvectors are used)
Gaudi::Property< bool > m_doOnlyUpVariations
Gaudi::Property< std::string > m_SFCName
name of the data/MC scale factor calibration for charm jets
Gaudi::Property< std::string > m_SFLightName
name of the data/MC scale factor calibration for light-flavour jets
Gaudi::Property< std::string > m_EffTName
semicolon-separated list of MC efficiency parametrisation names for tau jets
Gaudi::Property< bool > m_useDevFile
if true, attempt to retrieve the data/MC efficiency scale factor calibration files from the @PathReso...
Gaudi::Property< std::string > m_excludeEV
in case of continuous WP you can choose to ignore some of the eigenvectors
Gaudi::Property< std::string > m_SFTName
name of the data/MC scale factor calibration for tau jets
Gaudi::Property< std::string > m_EffCName
semicolon-separated list of MC efficiency parametrisation names for charm jets
Gaudi::Property< float > m_minPt
Gaudi::Property< std::string > m_systStrategy
systematics model to be used (current choices are "SFEigen" and "Envelope")
Gaudi::Property< std::string > m_taggingStrategy
tagging strategy is required to do TT with GNN, when we don't want to truth tag all the jets (eg....
Gaudi::Property< std::string > m_EffBName
semicolon-separated list of MC efficiency parametrisation names for b jets
std::vector< std::string > m_availableOP_fixCut
Gaudi::Property< std::string > m_SFFile
name of the data/MC efficiency scale factor calibration file (may be changed by the PathResolver)
Gaudi::Property< std::string > m_excludeFromEV
semicolon-separated list of uncertainties to be excluded from the eigenvector variation procedure
Gaudi::Property< std::string > m_cutBenchmark
operating point when running in Continuous
Gaudi::Property< std::string > m_EffLightName
semicolon-separated list of MC efficiency parametrisation names for light-flavour jets
Gaudi::Property< std::string > m_pathToONNX
if this string is empty, the onnx tool won't be used
void insert(const SystematicVariation &systematic)
description: insert a systematic into the set
std::string find(const std::string &s)
return a remapped string
Definition hcg.cxx:138
Create a proper constructor for Athena.

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

Declare the interface that this class provides.

returns: whether this tool is affected by the given systematics

Implements CP::ISystematicsTool.

Definition at line 73 of file BTaggingTruthTaggingTool.cxx.

74{
75 SystematicSet sys = affectingSystematics();
76 return sys.find( systematic) != sys.end();
77}
CP::SystematicSet affectingSystematics() const
the list of all systematics this tool can be affected by

◆ jetFlavourLabel()

int BTaggingTruthTaggingTool::jetFlavourLabel ( const xAOD::Jet & jet)
private

Definition at line 1067 of file BTaggingTruthTaggingTool.cxx.

1067 {
1070 else
1071 return GAFinalHadronFlavourLabel(jet);
1072}
int ExclusiveConeHadronFlavourLabel(const xAOD::Jet &jet)
int GAFinalHadronFlavourLabel(const xAOD::Jet &jet)

◆ msg()

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

Definition at line 24 of file AthCommonMsg.h.

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

◆ msg_level_name()

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

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

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

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

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

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

Definition at line 101 of file AsgTool.cxx.

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

◆ msgLvl()

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

Definition at line 30 of file AthCommonMsg.h.

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

◆ outputHandles()

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

Return this algorithm's output handles.

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

◆ print()

◆ recommendedSystematics()

SystematicSet BTaggingTruthTaggingTool::recommendedSystematics ( ) const
virtual

the list of all systematics this tool recommends to use

Implements CP::IReentrantSystematicsTool.

Definition at line 79 of file BTaggingTruthTaggingTool.cxx.

79 {
80 return affectingSystematics();
81}

◆ renounce()

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

Definition at line 380 of file AthCommonDataStore.h.

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

◆ renounceArray()

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

remove all handles from I/O resolution

Definition at line 364 of file AthCommonDataStore.h.

364 {
366 }

◆ setEffMapIndex()

StatusCode BTaggingTruthTaggingTool::setEffMapIndex ( const std::string & flavour,
unsigned int index )
virtual

Declare the interface that the class provides.

Implements IBTaggingTruthTaggingTool.

Definition at line 48 of file BTaggingTruthTaggingTool.cxx.

48 {
49 ANA_CHECK(m_effTool->setMapIndex(flavour, index));
50 return StatusCode::SUCCESS;
51}

◆ setJets() [1/6]

StatusCode BTaggingTruthTaggingTool::setJets ( TRFinfo & trfinf,
const std::vector< std::vector< float > > & node_feat,
std::vector< float > & tagw )
private

Definition at line 323 of file BTaggingTruthTaggingTool.cxx.

323 {
324 ANA_CHECK_SET_TYPE (StatusCode);
325 if(node_feat.size()!=tagw.size()){
326 ATH_MSG_ERROR( "Vectors of node_feat (outer axis) and tagw should have same size" );
327 return StatusCode::FAILURE;
328 }
329
330 std::vector<int> flav;
331 std::vector<Analysis::CalibrationDataVariables>* vars = new std::vector<Analysis::CalibrationDataVariables>(0);
332 for(unsigned int i =0; i<tagw.size(); i++){
333 Analysis::CalibrationDataVariables vars_appo;
334
335 // node_feat[i] is always {flav, pt, eta, ...}
336 float pt = node_feat.at(i)[1];
337 float eta = node_feat.at(i)[2];
338
339 ANA_CHECK(fillVariables(pt, eta, tagw.at(i), vars_appo));
340 vars->push_back(vars_appo);
341 flav.push_back(node_feat.at(i)[0]);
342 }
343
344 ANA_CHECK(setJets(trfinf, flav, vars, node_feat));
345 return StatusCode::SUCCESS;
346}
StatusCode fillVariables(const xAOD::Jet &jet, Analysis::CalibrationDataVariables &x)

◆ setJets() [2/6]

StatusCode BTaggingTruthTaggingTool::setJets ( TRFinfo & trfinf,
const xAOD::JetContainer & jets )
private

Definition at line 288 of file BTaggingTruthTaggingTool.cxx.

288 {
289 ANA_CHECK_SET_TYPE (StatusCode);
290 std::vector<int> flav;
291 std::vector<Analysis::CalibrationDataVariables>* vars = new std::vector<Analysis::CalibrationDataVariables>(0);
292 for(const auto jet : jets) {
293 Analysis::CalibrationDataVariables vars_appo;
294 ANA_CHECK(fillVariables(*jet, vars_appo));
295 vars->push_back(vars_appo);
296 flav.push_back(jetFlavourLabel(*jet));
297 }
298
299 ANA_CHECK(setJets(trfinf,flav, vars));
300 delete vars;
301 flav.clear();
302 return StatusCode::SUCCESS;
303}
int jetFlavourLabel(const xAOD::Jet &jet)

◆ setJets() [3/6]

StatusCode BTaggingTruthTaggingTool::setJets ( TRFinfo & trfinf,
const xAOD::JetContainer & jets,
const std::vector< std::vector< float > > & node_feat )
private

Definition at line 349 of file BTaggingTruthTaggingTool.cxx.

349 {
350 ANA_CHECK_SET_TYPE (StatusCode);
351 std::vector<int> flav;
352 std::vector<Analysis::CalibrationDataVariables>* vars = new std::vector<Analysis::CalibrationDataVariables>(0);
353 for(const auto jet : jets) {
354 Analysis::CalibrationDataVariables vars_appo;
355 ANA_CHECK(fillVariables(*jet, vars_appo));
356 vars->push_back(vars_appo);
357 flav.push_back(jetFlavourLabel(*jet));
358 }
359
360 ANA_CHECK(setJets(trfinf, flav, vars, node_feat));
361 flav.clear();
362 return StatusCode::SUCCESS;
363}

◆ setJets() [4/6]

StatusCode BTaggingTruthTaggingTool::setJets ( TRFinfo & trfinf,
std::vector< float > & pt,
std::vector< float > & eta,
std::vector< int > & flav,
std::vector< float > & tagw )
private

Definition at line 269 of file BTaggingTruthTaggingTool.cxx.

269 {
270 ANA_CHECK_SET_TYPE (StatusCode);
271 if(pt.size()!=eta.size() || pt.size()!=flav.size() || pt.size()!=tagw.size()){
272 ATH_MSG_ERROR( "Vectors of pt, eta, flav and tagw should have same size" );
273 return StatusCode::FAILURE;
274 }
275
276 std::vector<Analysis::CalibrationDataVariables>* vars = new std::vector<Analysis::CalibrationDataVariables>(0);
277 for(unsigned int i =0; i<pt.size(); i++){
278 Analysis::CalibrationDataVariables vars_appo;
279 ANA_CHECK(fillVariables(pt.at(i), eta.at(i), tagw.at(i), vars_appo));
280 vars->push_back(vars_appo);
281 }
282
283 ANA_CHECK(setJets(trfinf,flav, vars));
284 delete vars;
285 return StatusCode::SUCCESS;
286}

◆ setJets() [5/6]

StatusCode BTaggingTruthTaggingTool::setJets ( TRFinfo & trfinf,
std::vector< int > & flav,
const std::vector< Analysis::CalibrationDataVariables > * vars,
const std::vector< std::vector< float > > & node_feat )
private

Definition at line 368 of file BTaggingTruthTaggingTool.cxx.

368 {
369 if(flav.size()!=vars->size()){
370 ATH_MSG_ERROR( "Vector of CalibrationDataVariables and flavour should have same size" );
371 return StatusCode::FAILURE;
372 }
373 trfinf.jets.clear();
374
375 if (m_njetsTagStrategy == -1){
376 trfinf.njets = vars->size();
377 } else {
378 trfinf.njets = std::min(static_cast<unsigned int>(m_njetsTagStrategy), static_cast<unsigned int>(vars->size()));
379 }
380
381 for(unsigned int i =0; i<trfinf.njets; i++){
382 jetVariable jetVar_appo;
383 jetVar_appo.flav=flav.at(i);
384 jetVar_appo.vars=vars->at(i);
385 trfinf.jets.push_back(jetVar_appo);
386 }
387 trfinf.node_feat = node_feat;
388 return StatusCode::SUCCESS;
389}

◆ setJets() [6/6]

StatusCode BTaggingTruthTaggingTool::setJets ( TRFinfo & trfinf,
std::vector< int > & flav,
std::vector< Analysis::CalibrationDataVariables > * vars )
private

Definition at line 305 of file BTaggingTruthTaggingTool.cxx.

305 {
306 if(flav.size()!=vars->size()){
307 ATH_MSG_ERROR( "Vector of CalibrationDataVariables and flavour should have same size" );
308 return StatusCode::FAILURE;
309 }
310 trfinf.jets.clear();
311 for(unsigned int i =0; i<vars->size(); i++){
312 jetVariable jetVar_appo;
313 jetVar_appo.flav=flav.at(i);
314 jetVar_appo.vars=vars->at(i);
315 trfinf.jets.push_back(jetVar_appo);
316
317 }
318 trfinf.njets=trfinf.jets.size();
319 return StatusCode::SUCCESS;
320}

◆ setUseSystematics()

void BTaggingTruthTaggingTool::setUseSystematics ( bool useSystematics)

Definition at line 53 of file BTaggingTruthTaggingTool.cxx.

53 {
54 ATH_MSG_DEBUG("setting the use of systematics to: " <<useSystematics);
55 m_useSys = useSystematics;
56 ATH_MSG_DEBUG(" m_useSys = " << m_useSys);
57}

◆ split()

std::vector< std::string > BTaggingTruthTaggingTool::split ( const std::string & str,
char token )
private

Definition at line 1113 of file BTaggingTruthTaggingTool.cxx.

1113 {
1114 std::vector<std::string> result;
1115 if (str.size() > 0) {
1116 std::string::size_type end;
1117 std::string tmp(str);
1118 do {
1119 end = tmp.find(token);
1120 std::string entry = trim(tmp.substr(0,end));
1121 if (entry.size() > 0) result.push_back(entry);
1122 if (end != std::string::npos) tmp = tmp.substr(end+1);
1123 } while (end != std::string::npos);
1124 }
1125 return result;
1126}
string trim(string s)

◆ sysInitialize()

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

Perform system initialization for an algorithm.

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

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

◆ sysStart()

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

Handle START transition.

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

◆ trfWeight()

float BTaggingTruthTaggingTool::trfWeight ( TRFinfo & trfinf,
const std::vector< bool > & tags )
private

Definition at line 663 of file BTaggingTruthTaggingTool.cxx.

663 {
664
665 float weight = 1;
666 for (unsigned int t=0; t<tags.size();t++) {
667 float trf = 0.;
668
669 //sum of the efficiencies in the tagged bins
670 for (int bin : m_OperatingBins){
671
672 trf += trfinf.effMC_allBins[bin][t];
673
674 }
675 if(trf>1.) {
676 ATH_MSG_WARNING("Truth Tagging weight > 1. --> setting it to 1. check maps!");
677 trf = 1.;
678 }
679 if(tags.at(t)) weight *= trf;
680 else weight *= (1.-trf);
681 ATH_MSG_DEBUG("weight " <<weight);
682 } // end loop over jets
683 return weight;
684}

◆ updateVHKA()

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

Definition at line 308 of file AthCommonDataStore.h.

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

Member Data Documentation

◆ m_availableOP_fixCut

std::vector<std::string> BTaggingTruthTaggingTool::m_availableOP_fixCut = {"FixedCutBEff_85", "FixedCutBEff_77","FixedCutBEff_70","FixedCutBEff_60"}
private

Definition at line 181 of file BTaggingTruthTaggingTool.h.

181{"FixedCutBEff_85", "FixedCutBEff_77","FixedCutBEff_70","FixedCutBEff_60"};

◆ m_coneFlavourLabel

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

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

Definition at line 251 of file BTaggingTruthTaggingTool.h.

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

◆ m_continuous

bool BTaggingTruthTaggingTool::m_continuous {}
private

Definition at line 275 of file BTaggingTruthTaggingTool.h.

275{};

◆ m_continuous2D

bool BTaggingTruthTaggingTool::m_continuous2D {}
private

Definition at line 276 of file BTaggingTruthTaggingTool.h.

276{};

◆ m_cutBenchmark

Gaudi::Property<std::string> BTaggingTruthTaggingTool::m_cutBenchmark {this, "CutBenchmark", "1,2", "if you want to run in continuous you need to fix a benchmark - it does something only if running in Continuous OP"}
private

operating point when running in Continuous

Definition at line 243 of file BTaggingTruthTaggingTool.h.

243{this, "CutBenchmark", "1,2", "if you want to run in continuous you need to fix a benchmark - it does something only if running in Continuous OP"};

◆ m_cuts

std::vector<TagBin> BTaggingTruthTaggingTool::m_cuts
private

Definition at line 186 of file BTaggingTruthTaggingTool.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_doDirectTag

Gaudi::Property<bool> BTaggingTruthTaggingTool::m_doDirectTag {this, "doDirectTagging", false , "If set to true it also computes and stores the direct tagging choice and the related SFs for each jet"}
private

possibility to compute the direct tagging SFs map directly from the TruthTaggingTool

Definition at line 256 of file BTaggingTruthTaggingTool.h.

256{this, "doDirectTagging", false , "If set to true it also computes and stores the direct tagging choice and the related SFs for each jet"};

◆ m_doOnlyUpVariations

Gaudi::Property<bool> BTaggingTruthTaggingTool::m_doOnlyUpVariations {this, "StoreOnlyUpVariations", false , "If set to true it processes only the __1up b-tagging variations. It speeds up the computation in case of symmetric variations."}
private

Definition at line 273 of file BTaggingTruthTaggingTool.h.

273{this, "StoreOnlyUpVariations", false , "If set to true it processes only the __1up b-tagging variations. It speeds up the computation in case of symmetric variations."};

◆ m_eff_syst

std::vector<CP::SystematicSet> BTaggingTruthTaggingTool::m_eff_syst
private

Definition at line 197 of file BTaggingTruthTaggingTool.h.

◆ m_EffBName

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

semicolon-separated list of MC efficiency parametrisation names for b jets

Definition at line 229 of file BTaggingTruthTaggingTool.h.

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

◆ m_EffCName

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

semicolon-separated list of MC efficiency parametrisation names for charm jets

Definition at line 231 of file BTaggingTruthTaggingTool.h.

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

◆ m_EffFile

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

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

Definition at line 213 of file BTaggingTruthTaggingTool.h.

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

◆ m_EffLightName

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

semicolon-separated list of MC efficiency parametrisation names for light-flavour jets

Definition at line 235 of file BTaggingTruthTaggingTool.h.

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

◆ m_EffTName

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

semicolon-separated list of MC efficiency parametrisation names for tau jets

Definition at line 233 of file BTaggingTruthTaggingTool.h.

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

◆ m_effTool

asg::AnaToolHandle<IBTaggingEfficiencyTool> BTaggingTruthTaggingTool::m_effTool
private

Definition at line 294 of file BTaggingTruthTaggingTool.h.

◆ m_effTool_allBins

std::map<int, asg::AnaToolHandle<IBTaggingEfficiencyTool> > BTaggingTruthTaggingTool::m_effTool_allBins
private

Definition at line 291 of file BTaggingTruthTaggingTool.h.

◆ m_EVReductionB

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

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

Definition at line 223 of file BTaggingTruthTaggingTool.h.

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

◆ m_EVReductionC

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

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

Definition at line 225 of file BTaggingTruthTaggingTool.h.

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

◆ m_EVReductionLight

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

specification of the eigenvector reduction strategy for light-flavour jets (if eigenvectors are used)

Definition at line 227 of file BTaggingTruthTaggingTool.h.

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

◆ m_evtStore

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

Pointer to StoreGate (event store by default)

Definition at line 390 of file AthCommonDataStore.h.

◆ m_excludeEV

Gaudi::Property<std::string> BTaggingTruthTaggingTool::m_excludeEV {this, "ExcludeSpecificEigens", "" , "(semicolon-separated) names of Eigens you want to exclude. in case of continuous some eigenvectors can be ignored to make the computation faster"}
private

in case of continuous WP you can choose to ignore some of the eigenvectors

Definition at line 254 of file BTaggingTruthTaggingTool.h.

254{this, "ExcludeSpecificEigens", "" , "(semicolon-separated) names of Eigens you want to exclude. in case of continuous some eigenvectors can be ignored to make the computation faster"};

◆ m_excludeFromEV

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

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

Definition at line 237 of file BTaggingTruthTaggingTool.h.

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

◆ m_ignoreSF

Gaudi::Property<bool> BTaggingTruthTaggingTool::m_ignoreSF {this, "IgnoreScaleFactors", true, "ignore scale factors in computation of TRF weight"}
private

Definition at line 279 of file BTaggingTruthTaggingTool.h.

279{this, "IgnoreScaleFactors", true, "ignore scale factors in computation of TRF weight"};

◆ m_inf

TFile* BTaggingTruthTaggingTool::m_inf {}
private

Definition at line 183 of file BTaggingTruthTaggingTool.h.

183{}; //file for reading the cut values from the CDI.

◆ m_initialised

bool BTaggingTruthTaggingTool::m_initialised {}
private

Definition at line 188 of file BTaggingTruthTaggingTool.h.

188{};

◆ m_jetAuthor

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

jet collection name

Definition at line 245 of file BTaggingTruthTaggingTool.h.

245{this, "JetAuthor", "AntiKt4EMTopoJets", "jet collection & JVF/JVT specification in CDI file"};

◆ m_maxEta

Gaudi::Property<float> BTaggingTruthTaggingTool::m_maxEta {this, "MaxEta", 2.5, "Maximum jet eta cut"}
private

Definition at line 269 of file BTaggingTruthTaggingTool.h.

269{this, "MaxEta", 2.5, "Maximum jet eta cut"};

◆ m_maxRangePt

Gaudi::Property<float> BTaggingTruthTaggingTool::m_maxRangePt {this, "MaxRangePt", 1000000 , "Max pT range (in MeV)"}
private

Definition at line 270 of file BTaggingTruthTaggingTool.h.

270{this, "MaxRangePt", 1000000 /*MeV*/, "Max pT range (in MeV)"};

◆ m_minPt

Gaudi::Property<float> BTaggingTruthTaggingTool::m_minPt {this, "MinPt", 20000 , "Minimum jet pT cut (in MeV)"}
private

Definition at line 268 of file BTaggingTruthTaggingTool.h.

268{this, "MinPt", 20000 /*MeV*/, "Minimum jet pT cut (in MeV)"};

◆ m_nbins

int BTaggingTruthTaggingTool::m_nbins {}
private

Definition at line 287 of file BTaggingTruthTaggingTool.h.

287{};

◆ m_nbtag

Gaudi::Property<int> BTaggingTruthTaggingTool::m_nbtag {this, "MaxNtagged", 2, "what is the maximal possible number of tagged jets"}
private

Definition at line 285 of file BTaggingTruthTaggingTool.h.

285{this, "MaxNtagged", 2, "what is the maximal possible number of tagged jets"};

◆ m_njetsTagStrategy

NjetsTagStrategy BTaggingTruthTaggingTool::m_njetsTagStrategy {AllJets}
private

Definition at line 263 of file BTaggingTruthTaggingTool.h.

263{AllJets};

◆ m_OP

Gaudi::Property<std::string> BTaggingTruthTaggingTool::m_OP {this, "OperatingPoint", "FixedCutBEff_77", "operating point as specified in CDI file"}
private

operating point

Definition at line 241 of file BTaggingTruthTaggingTool.h.

241{this, "OperatingPoint", "FixedCutBEff_77", "operating point as specified in CDI file"};

◆ m_OP_index_for_GNN

unsigned int BTaggingTruthTaggingTool::m_OP_index_for_GNN {}
private

Definition at line 289 of file BTaggingTruthTaggingTool.h.

289{};

◆ m_OperatingBins

std::vector<int> BTaggingTruthTaggingTool::m_OperatingBins
private

Definition at line 288 of file BTaggingTruthTaggingTool.h.

◆ m_pathToONNX

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

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

Definition at line 258 of file BTaggingTruthTaggingTool.h.

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

◆ m_selTool

asg::AnaToolHandle<IBTaggingSelectionTool> BTaggingTruthTaggingTool::m_selTool
private

Definition at line 295 of file BTaggingTruthTaggingTool.h.

◆ m_SFBName

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

name of the data/MC scale factor calibration for b jets

Definition at line 215 of file BTaggingTruthTaggingTool.h.

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

◆ m_SFCName

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

name of the data/MC scale factor calibration for charm jets

Definition at line 217 of file BTaggingTruthTaggingTool.h.

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

◆ m_SFFile

Gaudi::Property<std::string> BTaggingTruthTaggingTool::m_SFFile {this, "ScaleFactorFileName", "xAODBTaggingEfficiency/13TeV/2016-20_7-13TeV-MC15-CDI-July12_v1.root", "name of the official scale factor calibration CDI file (uses PathResolver)"}
private

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

Definition at line 211 of file BTaggingTruthTaggingTool.h.

211{this, "ScaleFactorFileName", "xAODBTaggingEfficiency/13TeV/2016-20_7-13TeV-MC15-CDI-July12_v1.root", "name of the official scale factor calibration CDI file (uses PathResolver)"};

◆ m_SFLightName

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

name of the data/MC scale factor calibration for light-flavour jets

Definition at line 221 of file BTaggingTruthTaggingTool.h.

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

◆ m_SFTName

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

name of the data/MC scale factor calibration for tau jets

Definition at line 219 of file BTaggingTruthTaggingTool.h.

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

◆ m_sys_name

std::vector<std::string> BTaggingTruthTaggingTool::m_sys_name
private

Definition at line 198 of file BTaggingTruthTaggingTool.h.

◆ m_systStrategy

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

systematics model to be used (current choices are "SFEigen" and "Envelope")

Definition at line 247 of file BTaggingTruthTaggingTool.h.

247{this, "SystematicsStrategy", "SFEigen", "name of systematics model; presently choose between 'SFEigen' and 'Envelope'"};

◆ m_taggerName

Gaudi::Property<std::string> BTaggingTruthTaggingTool::m_taggerName {this, "TaggerName", "MV2c10", "tagging algorithm name as specified in CDI file"}
private

tagger name

Definition at line 239 of file BTaggingTruthTaggingTool.h.

239{this, "TaggerName", "MV2c10", "tagging algorithm name as specified in CDI file"};

◆ m_taggingStrategy

Gaudi::Property<std::string> BTaggingTruthTaggingTool::m_taggingStrategy {this, "TaggingStrategy", "AllJets", "tagging strategy in the Analysis (eg. 'leading2SignalJets' in boosted VHbb). Required to do TT with GNN"}
private

tagging strategy is required to do TT with GNN, when we don't want to truth tag all the jets (eg. 'leading2SignalJets')

Definition at line 260 of file BTaggingTruthTaggingTool.h.

260{this, "TaggingStrategy", "AllJets", "tagging strategy in the Analysis (eg. 'leading2SignalJets' in boosted VHbb). Required to do TT with GNN"};

◆ m_useDevFile

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

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

Definition at line 249 of file BTaggingTruthTaggingTool.h.

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

◆ m_usePerm

Gaudi::Property<bool> BTaggingTruthTaggingTool::m_usePerm {this, "UsePermutations", true, "if the chosen permutation is used, a reweighting is applied to the TRF weight for systematics"}
private

Definition at line 280 of file BTaggingTruthTaggingTool.h.

280{this, "UsePermutations", true, "if the chosen permutation is used, a reweighting is applied to the TRF weight for systematics"};

◆ m_useQuantile

Gaudi::Property<bool> BTaggingTruthTaggingTool::m_useQuantile {this, "UseQuantile", true, "if the chosen quantile is used, a reweighting is applied to the TRF weight for systematics"}
private

Definition at line 281 of file BTaggingTruthTaggingTool.h.

281{this, "UseQuantile", true, "if the chosen quantile is used, a reweighting is applied to the TRF weight for systematics"};

◆ m_useSys

Gaudi::Property<bool> BTaggingTruthTaggingTool::m_useSys {this, "UseSystematics", false, "will the results contain all systematic variations, or just the nominal"}
private

Definition at line 282 of file BTaggingTruthTaggingTool.h.

282{this, "UseSystematics", false, "will the results contain all systematic variations, or just the nominal"};

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