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

#include <BTaggingSelectionJsonTool.h>

Inheritance diagram for BTaggingSelectionJsonTool:
Collaboration diagram for BTaggingSelectionJsonTool:

Classes

struct  BinConfig
struct  FractionAccessor

Public Member Functions

 BTaggingSelectionJsonTool (const std::string &name)
StatusCode initialize () override
 Dummy implementation of the initialisation function.
virtual int accept (const xAOD::Jet &jet) const override
virtual int acceptOnlyForXbbCalibrationUsage (double pt, double eta, double mass, double tagger_discriminant) const override
virtual double getTaggerDiscriminant (const xAOD::Jet &jet) const override
virtual double getVetoDiscriminant (const xAOD::Jet &jet) const
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

typedef ServiceHandle< StoreGateSvcStoreGateSvc_t

Private Member Functions

StatusCode loadBinConfig (const json &pT_mass_2d_cutvalue, BinConfig &config) const
std::vector< FractionAccessorloadFractionValues (const json &meta) const
double getTaggerDiscriminantInternal (const xAOD::Jet &jet, const std::vector< FractionAccessor > &fractionAccessors) const
int findBin (const std::vector< float > &bins, float value) const
float getJetMass (const xAOD::Jet &jet) const
float getJetPt (const xAOD::Jet &jet) const
Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T, V, H > &hndl, const SG::VarHandleKeyType &)
 specialization for handling Gaudi::Property<SG::VarHandleKey>

Private Attributes

bool m_initialised = false
Gaudi::Property< float > m_minPt {this, "MinPt", -1 , "Minimum jet pT cut (in MeV)"}
Gaudi::Property< float > m_maxEta {this, "MaxEta", 2.5, "Maximum jet eta cut"}
Gaudi::Property< std::string > m_outputName {this, "OutputName", "", "output name of the tagger"}
Gaudi::Property< std::string > m_jetAuthor {this, "JetAuthor", "", "jet collection"}
Gaudi::Property< std::string > m_OP {this, "OperatingPoint", "", "operating point"}
Gaudi::Property< std::string > m_json_config_path {this, "JsonConfigFile", "", "Path to JSON config file"}
std::unique_ptr< SG::AuxElement::ConstAccessor< float > > m_massAcc
std::unique_ptr< SG::AuxElement::ConstAccessor< float > > m_ptAcc
json m_json_config
BinConfig m_BinConfig
BinConfig m_VetoBinConfig
std::vector< FractionAccessorm_fractionAccessors
std::vector< FractionAccessorm_vetoFractionAccessors
bool m_veto = false
std::string m_vetoTagger
std::string m_vetoOP
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

Definition at line 14 of file BTaggingSelectionJsonTool.h.

Member Typedef Documentation

◆ StoreGateSvc_t

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

Definition at line 388 of file AthCommonDataStore.h.

Constructor & Destructor Documentation

◆ BTaggingSelectionJsonTool()

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

Definition at line 14 of file BTaggingSelectionJsonTool.cxx.

15 : asg::AsgTool(name)
16{
17 m_initialised = false;
18}

Member Function Documentation

◆ accept()

int BTaggingSelectionJsonTool::accept ( const xAOD::Jet & jet) const
overridevirtual

Implements IBTaggingSelectionJsonTool.

Definition at line 201 of file BTaggingSelectionJsonTool.cxx.

202{
203 if (!m_initialised) throw std::runtime_error("BTaggingSelectionJsonTool has not been initialised.");
204
205 double pt = getJetPt(jet);
206 double eta = jet.eta();
207 double mass = getJetMass(jet);
208 double tagger_discriminant = getTaggerDiscriminant(jet);
209 int index = 0;
210
211 if (std::abs(eta) > m_maxEta || pt < m_minPt) return index;
212
213 int pt_bin_index = findBin(m_BinConfig.pTbins, pt / 1000.);
214 if (pt_bin_index == -1) return index;
215
216 int mass_bin_index = findBin(m_BinConfig.massbins[pt_bin_index], mass / 1000.);
217 if (mass_bin_index == -1) return index;
218
219 float cutvalue = m_BinConfig.OPCutValues[pt_bin_index][mass_bin_index];
220
221 // Check if 1D or 2D boosted flavour tagging is needed
222 if (!m_veto) {
223 index = (tagger_discriminant > cutvalue) ? 1 : 0;
224 } else {
225 // If jet fails tagging requirement
226 // there is no need to check against veto requirement
227 if (tagger_discriminant <= cutvalue) {
228 return index;
229 }
230
231 // Check if the jet does not pass the veto requirement
232 double veto_discriminant = getVetoDiscriminant(jet);
233
234 int pt_veto_bin_index = findBin(m_VetoBinConfig.pTbins, pt / 1000.);
235 if (pt_veto_bin_index == -1) return index;
236
237 int mass_veto_bin_index = findBin(m_VetoBinConfig.massbins[pt_veto_bin_index], mass / 1000.);
238 if (mass_veto_bin_index == -1) return index;
239
240 float veto_cutvalue = m_VetoBinConfig.OPCutValues[pt_veto_bin_index][mass_veto_bin_index];
241
242 index = (veto_discriminant < veto_cutvalue) ? 1 : 0;
243 }
244
245 return index;
246}
Scalar eta() const
pseudorapidity method
Gaudi::Property< float > m_maxEta
float getJetMass(const xAOD::Jet &jet) const
virtual double getTaggerDiscriminant(const xAOD::Jet &jet) const override
Gaudi::Property< float > m_minPt
int findBin(const std::vector< float > &bins, float value) const
float getJetPt(const xAOD::Jet &jet) const
virtual double getVetoDiscriminant(const xAOD::Jet &jet) const
virtual double eta() const
The pseudorapidity ( ) of the particle.
Definition Jet_v1.cxx:49
str index
Definition DeMoScan.py:362

◆ acceptOnlyForXbbCalibrationUsage()

int BTaggingSelectionJsonTool::acceptOnlyForXbbCalibrationUsage ( double pt,
double eta,
double mass,
double tagger_discriminant ) const
overridevirtual

Implements IBTaggingSelectionJsonTool.

Definition at line 249 of file BTaggingSelectionJsonTool.cxx.

250{
251 if (!m_initialised) throw std::runtime_error("BTaggingSelectionJsonTool has not been initialised.");
252
253 int index = 0;
254 if (std::abs(eta) > m_maxEta || pt < m_minPt) return index;
255
256 int pt_bin_index = findBin(m_BinConfig.pTbins, pt / 1000.);
257 if (pt_bin_index == -1) return index;
258
259 int mass_bin_index = findBin(m_BinConfig.massbins[pt_bin_index], mass / 1000.);
260 if (mass_bin_index == -1) return index;
261
262 float cutvalue = m_BinConfig.OPCutValues[pt_bin_index][mass_bin_index];
263 index = (tagger_discriminant > cutvalue) ? 1 : 0;
264
265 return index;
266}

◆ declareGaudiProperty()

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

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

Definition at line 156 of file AthCommonDataStore.h.

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

◆ declareProperty()

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

Definition at line 145 of file AthCommonDataStore.h.

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

◆ detStore()

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

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

Definition at line 95 of file AthCommonDataStore.h.

◆ evtStore()

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

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

Definition at line 85 of file AthCommonDataStore.h.

◆ extraDeps_update_handler()

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

Add StoreName to extra input/output deps as needed.

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

◆ findBin()

int BTaggingSelectionJsonTool::findBin ( const std::vector< float > & bins,
float value ) const
private

Definition at line 268 of file BTaggingSelectionJsonTool.cxx.

269{
270 for (size_t i = 0; i < bins.size() - 1; i++) {
271 if ((std::min(bins[i], bins[i + 1]) <= value && value < std::max(bins[i], bins[i + 1]))) {
272 return i;
273 }
274 }
275 return -1;
276}
static const std::vector< std::string > bins

◆ getJetMass()

float BTaggingSelectionJsonTool::getJetMass ( const xAOD::Jet & jet) const
private

Definition at line 278 of file BTaggingSelectionJsonTool.cxx.

279{
280 if (!m_massAcc) return jet.m();
281 if (!m_massAcc->isAvailable(jet)) {
282 ATH_MSG_ERROR("Decorated mass '" << SG::AuxTypeRegistry::instance().getName( m_massAcc->auxid() ) << "' not available on jet. Cannot proceed.");
283 throw std::runtime_error("Decorated mass not available on jet.");
284 }
285 return (*m_massAcc)(jet);
286}
#define ATH_MSG_ERROR(x)
std::unique_ptr< SG::AuxElement::ConstAccessor< float > > m_massAcc
static AuxTypeRegistry & instance()
Return the singleton registry instance.
const std::string & getName(const void *ptr) const
Get the name of an object that is / should be in the event store.
Definition AsgTool.cxx:106
virtual double m() const
The invariant mass of the particle.
Definition Jet_v1.cxx:59

◆ getJetPt()

float BTaggingSelectionJsonTool::getJetPt ( const xAOD::Jet & jet) const
private

Definition at line 288 of file BTaggingSelectionJsonTool.cxx.

289{
290 if (!m_ptAcc) return jet.pt();
291 if (!m_ptAcc->isAvailable(jet)) {
292 ATH_MSG_ERROR("Decorated pT '" << SG::AuxTypeRegistry::instance().getName( m_ptAcc->auxid() ) << "' not available on jet. Cannot proceed.");
293 throw std::runtime_error("Decorated pT not available on jet.");
294 }
295 return (*m_ptAcc)(jet);
296}
std::unique_ptr< SG::AuxElement::ConstAccessor< float > > m_ptAcc
virtual double pt() const
The transverse momentum ( ) of the particle.
Definition Jet_v1.cxx:44

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

◆ getTaggerDiscriminant()

double BTaggingSelectionJsonTool::getTaggerDiscriminant ( const xAOD::Jet & jet) const
overridevirtual

Implements IBTaggingSelectionJsonTool.

Definition at line 191 of file BTaggingSelectionJsonTool.cxx.

192{
194}
std::vector< FractionAccessor > m_fractionAccessors
double getTaggerDiscriminantInternal(const xAOD::Jet &jet, const std::vector< FractionAccessor > &fractionAccessors) const

◆ getTaggerDiscriminantInternal()

double BTaggingSelectionJsonTool::getTaggerDiscriminantInternal ( const xAOD::Jet & jet,
const std::vector< FractionAccessor > & fractionAccessors ) const
private

Definition at line 168 of file BTaggingSelectionJsonTool.cxx.

169{
170 float numerator = 0.;
171 float denominator = 0.;
172
173 for (const auto& frac : fractionAccessors) {
174 float p_output = frac.accessor(jet);
175 if (frac.isTarget) {
176 numerator += frac.fraction * p_output;
177 } else {
178 denominator += frac.fraction * p_output;
179 }
180 }
181
182 // Smallest positive normal float; below this, reciprocals may overflow.
183 const float ep = std::numeric_limits<float>::min();
184 //coverity[DIVIDE_BY_ZERO]
185 const float ratio = (std::abs(denominator) < ep ? std::numeric_limits<float>::infinity() : numerator / denominator);
186 const double tagger_discriminant = (std::abs(ratio) < ep ? -std::numeric_limits<double>::infinity() : std::log( ratio ));
187
188 return tagger_discriminant;
189}

◆ getVetoDiscriminant()

double BTaggingSelectionJsonTool::getVetoDiscriminant ( const xAOD::Jet & jet) const
virtual

Definition at line 196 of file BTaggingSelectionJsonTool.cxx.

197{
199}
std::vector< FractionAccessor > m_vetoFractionAccessors

◆ initialize()

StatusCode BTaggingSelectionJsonTool::initialize ( void )
overridevirtual

Dummy implementation of the initialisation function.

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

Reimplemented from asg::AsgTool.

Definition at line 20 of file BTaggingSelectionJsonTool.cxx.

20 {
21 m_initialised = true;
22
23 std::string pathToJsonConfigFile = PathResolverFindCalibFile(m_json_config_path);
24 std::ifstream jsonFile(pathToJsonConfigFile);
25 if (!jsonFile.is_open()) {
26 ATH_MSG_ERROR("JSON file " + m_json_config_path + " does not exist. Please put the correct path of the file.");
27 return StatusCode::FAILURE;
28 }
29
30 m_json_config = json::parse(jsonFile);
31 jsonFile.close();
32
33 if (m_outputName.empty()) {
34 ATH_MSG_ERROR("Must specify the output name property for the tagger");
35 return StatusCode::FAILURE;
36 }
37
38 if (!m_json_config.contains(m_outputName)) {
39 ATH_MSG_ERROR("The output name " + m_outputName + " not found in JSON file: " + m_json_config_path);
40 return StatusCode::FAILURE;
41 }
42
43 if (m_jetAuthor.empty() || !m_json_config[m_outputName].contains(m_jetAuthor)) {
44 ATH_MSG_ERROR("Tagger: " + m_outputName + " and Jet Collection: " + m_jetAuthor +
45 " not found in JSON file: " + m_json_config_path);
46 return StatusCode::FAILURE;
47 }
48
49 if (m_OP.empty() || !m_json_config[m_outputName][m_jetAuthor].contains(m_OP)) {
50 ATH_MSG_ERROR("OP " + m_OP + " not available for " + m_outputName + " tagger.");
51 return StatusCode::FAILURE;
52 }
53
54 const json& meta = m_json_config[m_outputName][m_jetAuthor]["meta"];
56
57 // Pre-load cut values
58 json& pT_mass_2d_tagger_cutvalue = m_json_config[m_outputName][m_jetAuthor][m_OP]["pT_mass_2d_cutvalue"];
59 ATH_CHECK(loadBinConfig(pT_mass_2d_tagger_cutvalue, m_BinConfig));
60
61 // Get mass decorator if specified
62 if (meta.contains("Mass")) {
63 std::string massDecoratorName = meta["Mass"].get<std::string>();
64 if (massDecoratorName != "default") {
65 m_massAcc = std::make_unique<SG::AuxElement::ConstAccessor<float>>(massDecoratorName);
66 ATH_MSG_INFO("Using decorated mass '" << massDecoratorName << "' for Xbb FM WP.");
67 }
68 }
69
70 // Get pT decorator if specified
71 if (meta.contains("PT")) {
72 std::string ptDecoratorName = meta["PT"].get<std::string>();
73 if (ptDecoratorName != "default") {
74 m_ptAcc = std::make_unique<SG::AuxElement::ConstAccessor<float>>(ptDecoratorName);
75 ATH_MSG_INFO("Using decorated pT '" << ptDecoratorName << "' for Xbb FM WP.");
76 }
77 }
78
79 // Veto setup
80 m_veto = meta.contains("Veto");
81 if (m_veto) {
82 if (!meta["Veto"].contains("VetoTagger")) {
83 ATH_MSG_ERROR("Specific veto tagger not found in JSON file: " + m_json_config_path);
84 return StatusCode::FAILURE;
85 }
86 m_vetoTagger = meta["Veto"]["VetoTagger"];
87 if (!meta["Veto"].contains("OperatingPoint")) {
88 ATH_MSG_ERROR("Specific operating point not found in JSON file: " + m_json_config_path);
89 return StatusCode::FAILURE;
90 }
91 m_vetoOP = meta["Veto"]["OperatingPoint"];
92
93 if (!m_json_config.contains(m_vetoTagger) ||
96 ATH_MSG_ERROR("Veto tagger configuration missing in JSON: " + m_json_config_path);
97 return StatusCode::FAILURE;
98 }
99
100 const json& veto_meta = m_json_config[m_vetoTagger][m_jetAuthor]["meta"];
102
103 json& pT_mass_2d_veto_cutvalue = m_json_config[m_vetoTagger][m_jetAuthor][m_vetoOP]["pT_mass_2d_cutvalue"];
104 ATH_CHECK(loadBinConfig(pT_mass_2d_veto_cutvalue, m_VetoBinConfig));
105 }
106
107 return StatusCode::SUCCESS;
108}
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_INFO(x)
nlohmann::json json
std::string PathResolverFindCalibFile(const std::string &logical_file_name)
std::vector< FractionAccessor > loadFractionValues(const json &meta) const
Gaudi::Property< std::string > m_json_config_path
StatusCode loadBinConfig(const json &pT_mass_2d_cutvalue, BinConfig &config) const
Gaudi::Property< std::string > m_jetAuthor
Gaudi::Property< std::string > m_outputName
Gaudi::Property< std::string > m_OP
bool contains(const std::string &s, const std::string &regx)
does a string contain the substring
Definition hcg.cxx:114

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

◆ loadBinConfig()

StatusCode BTaggingSelectionJsonTool::loadBinConfig ( const json & pT_mass_2d_cutvalue,
BinConfig & config ) const
private

Definition at line 110 of file BTaggingSelectionJsonTool.cxx.

111{
112 for (unsigned int ipT = 0; ipT < pT_mass_2d_cutvalue["pTbins"].size(); ++ipT) {
113 const json& pt = pT_mass_2d_cutvalue["pTbins"][ipT];
114 config.pTbins.push_back(BTaggingToolUtil::getExtendedFloat(pt));
115
116 if (ipT != pT_mass_2d_cutvalue["pTbins"].size() - 1) {
117 const json& ptUp = pT_mass_2d_cutvalue["pTbins"][ipT + 1];
118 std::string pT_key = "pT_" + BTaggingToolUtil::getExtendedString(pt) +
120
121 auto itr = pT_mass_2d_cutvalue.find(pT_key);
122 if (itr == pT_mass_2d_cutvalue.end()) {
123 ATH_MSG_ERROR("pT_key=" + pT_key + " not found in JSON file: " + m_json_config_path);
124 return StatusCode::FAILURE;
125 }
126
127 std::vector<float> mass_values;
128 for (const auto& m : itr->at("mass")) {
129 mass_values.push_back(BTaggingToolUtil::getExtendedFloat(m));
130 }
131 std::vector<float> cut_values = itr->at("cutvalues").get<std::vector<float>>();
132
133 config.massbins.push_back(std::move(mass_values));
134 config.OPCutValues.push_back(std::move(cut_values));
135 }
136 }
137
138 return StatusCode::SUCCESS;
139}
size_t size() const
Number of registered mappings.
static float getExtendedFloat(const nlohmann::json &pt)
static std::string getExtendedString(const nlohmann::json &pt)

◆ loadFractionValues()

std::vector< BTaggingSelectionJsonTool::FractionAccessor > BTaggingSelectionJsonTool::loadFractionValues ( const json & meta) const
private

Definition at line 142 of file BTaggingSelectionJsonTool.cxx.

143{
144 std::string taggerName;
145 if (meta.contains("TaggerName")) {
146 taggerName = meta["TaggerName"];
147 } else {
148 ATH_MSG_INFO("No 'TaggerName' section found in the meta data for " + m_outputName +
149 " tagger. Using " + m_outputName + " as the tagger name.");
150 taggerName = m_outputName;
151 }
152
153 std::string target = meta["TaggingTarget"];
154 std::vector<BTaggingSelectionJsonTool::FractionAccessor> fractionAccessors;
155
156 // Pre-load fraction values
157 for (const json& outclass : meta["categories"]) {
158 std::string outclassStr = std::string(outclass);
159 float fraction = meta["fraction_" + outclassStr].get<float>();
160 SG::AuxElement::ConstAccessor<float> accessor(taggerName + "_p" + outclassStr);
161 bool isTarget = (outclassStr == target);
162 fractionAccessors.emplace_back(fraction, accessor, isTarget);
163 }
164
165 return fractionAccessors;
166}
const AccessorWrapper< T > * accessor(xAOD::JetAttribute::AttributeID id)
Returns an attribute accessor corresponding to an AttributeID.

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

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

◆ sysInitialize()

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

Perform system initialization for an algorithm.

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

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

◆ sysStart()

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

Handle START transition.

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

◆ updateVHKA()

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

Definition at line 308 of file AthCommonDataStore.h.

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

Member Data Documentation

◆ m_BinConfig

BinConfig BTaggingSelectionJsonTool::m_BinConfig
private

Definition at line 61 of file BTaggingSelectionJsonTool.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_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_fractionAccessors

std::vector<FractionAccessor> BTaggingSelectionJsonTool::m_fractionAccessors
private

Definition at line 64 of file BTaggingSelectionJsonTool.h.

◆ m_initialised

bool BTaggingSelectionJsonTool::m_initialised = false
private

Definition at line 31 of file BTaggingSelectionJsonTool.h.

◆ m_jetAuthor

Gaudi::Property<std::string> BTaggingSelectionJsonTool::m_jetAuthor {this, "JetAuthor", "", "jet collection"}
private

Definition at line 37 of file BTaggingSelectionJsonTool.h.

37{this, "JetAuthor", "", "jet collection"};

◆ m_json_config

json BTaggingSelectionJsonTool::m_json_config
private

Definition at line 44 of file BTaggingSelectionJsonTool.h.

◆ m_json_config_path

Gaudi::Property<std::string> BTaggingSelectionJsonTool::m_json_config_path {this, "JsonConfigFile", "", "Path to JSON config file"}
private

Definition at line 39 of file BTaggingSelectionJsonTool.h.

39{this, "JsonConfigFile", "", "Path to JSON config file"};

◆ m_massAcc

std::unique_ptr<SG::AuxElement::ConstAccessor<float> > BTaggingSelectionJsonTool::m_massAcc
private

Definition at line 41 of file BTaggingSelectionJsonTool.h.

◆ m_maxEta

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

Definition at line 33 of file BTaggingSelectionJsonTool.h.

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

◆ m_minPt

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

Definition at line 32 of file BTaggingSelectionJsonTool.h.

32{this, "MinPt", -1 /*MeV*/, "Minimum jet pT cut (in MeV)"};

◆ m_OP

Gaudi::Property<std::string> BTaggingSelectionJsonTool::m_OP {this, "OperatingPoint", "", "operating point"}
private

Definition at line 38 of file BTaggingSelectionJsonTool.h.

38{this, "OperatingPoint", "", "operating point"};

◆ m_outputName

Gaudi::Property<std::string> BTaggingSelectionJsonTool::m_outputName {this, "OutputName", "", "output name of the tagger"}
private

Definition at line 36 of file BTaggingSelectionJsonTool.h.

36{this, "OutputName", "", "output name of the tagger"};

◆ m_ptAcc

std::unique_ptr<SG::AuxElement::ConstAccessor<float> > BTaggingSelectionJsonTool::m_ptAcc
private

Definition at line 42 of file BTaggingSelectionJsonTool.h.

◆ m_varHandleArraysDeclared

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

Definition at line 399 of file AthCommonDataStore.h.

◆ m_veto

bool BTaggingSelectionJsonTool::m_veto = false
private

Definition at line 67 of file BTaggingSelectionJsonTool.h.

◆ m_VetoBinConfig

BinConfig BTaggingSelectionJsonTool::m_VetoBinConfig
private

Definition at line 62 of file BTaggingSelectionJsonTool.h.

◆ m_vetoFractionAccessors

std::vector<FractionAccessor> BTaggingSelectionJsonTool::m_vetoFractionAccessors
private

Definition at line 65 of file BTaggingSelectionJsonTool.h.

◆ m_vetoOP

std::string BTaggingSelectionJsonTool::m_vetoOP
private

Definition at line 70 of file BTaggingSelectionJsonTool.h.

◆ m_vetoTagger

std::string BTaggingSelectionJsonTool::m_vetoTagger
private

Definition at line 69 of file BTaggingSelectionJsonTool.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: