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

#include <BTaggingToolUtil.h>

Collaboration diagram for BTaggingToolUtil:

Public Types

enum class  varType {
  unknown , pT , mass , eta ,
  abseta
}

Static Public Member Functions

static double MeVToGeV (const double x)
static float getExtendedFloat (const nlohmann::json &config)
static std::string getExtendedString (const nlohmann::json &config)
static bool approxEqual (const float a, const float b, const float eps)
static varType getVariableType (const std::string &varName)
static std::string getVariableName (const varType vType)

Detailed Description

Definition at line 11 of file BTaggingToolUtil.h.

Member Enumeration Documentation

◆ varType

enum class BTaggingToolUtil::varType
strong
Enumerator
unknown 
pT 
mass 
eta 
abseta 

Definition at line 22 of file BTaggingToolUtil.h.

22 {
23 unknown,
24 pT,
25 mass,
26 eta,
27 abseta
28 };
Scalar eta() const
pseudorapidity method

Member Function Documentation

◆ approxEqual()

bool BTaggingToolUtil::approxEqual ( const float a,
const float b,
const float eps )
static

Definition at line 25 of file BTaggingToolUtil.cxx.

25 {
26 // Exact equality also covers equal infinities e.g. two "inf" upper bounds
27 if (a == b) return true;
28 // An infinite value is never approximately equal to a different value
29 // otherwise |inf - x| <= eps * inf would be true for any finite x
30 if (!std::isfinite(a) || !std::isfinite(b)) return false;
31 return std::abs(a - b) <= eps * std::max(std::abs(a), std::abs(b));
32}
static Double_t a

◆ getExtendedFloat()

float BTaggingToolUtil::getExtendedFloat ( const nlohmann::json & config)
static

Definition at line 7 of file BTaggingToolUtil.cxx.

7 {
8 if (config.is_string() && config.get<std::string>() == "inf") {
9 return std::numeric_limits<float>::infinity();
10 } else if (config.is_string() && config.get<std::string>() == "-inf") {
11 return -std::numeric_limits<float>::infinity();
12 }
13
14 return config.get<float>();
15}

◆ getExtendedString()

std::string BTaggingToolUtil::getExtendedString ( const nlohmann::json & config)
static

Definition at line 17 of file BTaggingToolUtil.cxx.

17 {
18 if (config.is_string()){
19 return config.get<std::string>();
20 }
21
22 return config.dump();
23}

◆ getVariableName()

std::string BTaggingToolUtil::getVariableName ( const varType vType)
static

Definition at line 51 of file BTaggingToolUtil.cxx.

52{
53 if (vType == varType::pT) {
54 return "pT";
55 } else if (vType == varType::mass) {
56 return "mass";
57 } else if (vType == varType::eta) {
58 return "eta";
59 } else if (vType == varType::abseta) {
60 return "abseta";
61 } else {
62 throw std::runtime_error("Variable type " + std::to_string(static_cast<int>(vType)) + " not defined in BTaggingToolUtil.");
63 return "unknown";
64 }
65}

◆ getVariableType()

BTaggingToolUtil::varType BTaggingToolUtil::getVariableType ( const std::string & varName)
static

Definition at line 35 of file BTaggingToolUtil.cxx.

36{
37 if (varName == "pT") {
38 return varType::pT;
39 } else if (varName == "mass") {
40 return varType::mass;
41 } else if (varName == "eta") {
42 return varType::eta;
43 } else if (varName == "abseta") {
44 return varType::abseta;
45 } else {
46 throw std::runtime_error("Variable '" + varName + "' not defined in BTaggingToolUtil.");
47 return varType::unknown;
48 }
49}

◆ MeVToGeV()

double BTaggingToolUtil::MeVToGeV ( const double x)
inlinestatic

Definition at line 15 of file BTaggingToolUtil.h.

15{ return x/1000.;}
#define x

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