Loading [MathJax]/extensions/tex2jax.js
ATLAS Offline Software
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
Classes | Functions | Variables
JetPileupTag Namespace Reference

Classes

class  JetVertexNNTagger
 
struct  NNJvtBinning
 Helper struct to hold the bin edges for the NN Jvt cut maps. More...
 
struct  NNJvtCutMap
 The NNJvt cut maps. More...
 

Functions

template<typename T >
std::string vectorToString (const std::vector< T > &vec)
 
void to_json (nlohmann::json &j, const NNJvtBinning &binning)
 
void from_json (const nlohmann::json &j, NNJvtBinning &binning)
 
void to_json (nlohmann::json &j, const NNJvtCutMap &cutMap)
 
void from_json (const nlohmann::json &j, NNJvtCutMap &cutMap)
 

Variables

constexpr float GeV =1e3
 

Function Documentation

◆ from_json() [1/2]

void JetPileupTag::from_json ( const nlohmann::json j,
NNJvtBinning binning 
)

Definition at line 24 of file NNJvtBinning.cxx.

24  {
25  j.at("ptbin_edges").get_to(binning.ptEdges);
26  j.at("etabin_edges").get_to(binning.etaEdges);
27  // pT values are stored in GeV but we should use CLHEP values wherever possible
28  for (float &value : binning.ptEdges)
29  value *= GeV;
30  }

◆ from_json() [2/2]

void JetPileupTag::from_json ( const nlohmann::json j,
NNJvtCutMap cutMap 
)

Definition at line 42 of file NNJvtBinning.cxx.

42  {
43  j.get_to(cutMap.edges);
44  cutMap.cutMap.resize(cutMap.edges.ptEdges.size() - 1);
45  for (auto &v : cutMap.cutMap)
46  v.resize(cutMap.edges.etaEdges.size() - 1);
47  std::regex expr(R"(\‍((\d+),\s*(\d+)\))");
48  for (const auto &[bin, cut] : j["cuts"].get<std::map<std::string, float>>()) {
49  std::smatch sm;
50  if (!std::regex_match(bin, sm, expr))
51  throw std::invalid_argument("Invalid bin descriptor: " + bin);
52  cutMap.cutMap.at(std::stoi(sm[1])).at(std::stoi(sm[2])) = cut;
53  }
54  }

◆ to_json() [1/2]

void JetPileupTag::to_json ( nlohmann::json j,
const NNJvtBinning binning 
)

Definition at line 20 of file NNJvtBinning.cxx.

20  {
21  j = nlohmann::json{{"ptbin_edges", binning.ptEdges}, {"etabin_edges", binning.etaEdges}};
22  }

◆ to_json() [2/2]

void JetPileupTag::to_json ( nlohmann::json j,
const NNJvtCutMap cutMap 
)

Definition at line 32 of file NNJvtBinning.cxx.

32  {
33  to_json(j, cutMap.edges);
34  std::map<std::string, float> cuts;
35  for (std::size_t ptIdx = 0; ptIdx < cutMap.cutMap.size(); ++ptIdx)
36  for (std::size_t etaIdx = 0; etaIdx < cutMap.cutMap.at(ptIdx).size(); ++etaIdx)
37  cuts["(" + std::to_string(ptIdx) + ", " + std::to_string(etaIdx) + ")"] =
38  cutMap.cutMap.at(ptIdx).at(etaIdx);
39  j["cuts"] = cutMap;
40  }

◆ vectorToString()

template<typename T >
std::string JetPileupTag::vectorToString ( const std::vector< T > &  vec)

Definition at line 305 of file JetVertexNNTagger.cxx.

305  {
306  std::ostringstream oss;
307  for (const auto& val : vec) {
308  oss << val << " ";
309  }
310  return oss.str();
311  }

Variable Documentation

◆ GeV

constexpr float JetPileupTag::GeV =1e3
constexpr

Definition at line 44 of file JetVertexNNTagger.h.

GeV
#define GeV
Definition: PhysicsAnalysis/TauID/TauAnalysisTools/Root/HelperFunctions.cxx:17
AddEmptyComponent.binning
binning
Definition: AddEmptyComponent.py:34
json
nlohmann::json json
Definition: HistogramDef.cxx:9
bin
Definition: BinsDiffFromStripMedian.h:43
athena.value
value
Definition: athena.py:124
vec
std::vector< size_t > vec
Definition: CombinationsGeneratorTest.cxx:9
PrepareReferenceFile.regex
regex
Definition: PrepareReferenceFile.py:43
python.setupRTTAlg.size
int size
Definition: setupRTTAlg.py:39
JetPileupTag::to_json
void to_json(nlohmann::json &j, const NNJvtCutMap &cutMap)
Definition: NNJvtBinning.cxx:32
BindingsTest.cut
cut
This script demonstrates how to call a C++ class from Python Also how to use PyROOT is shown.
Definition: BindingsTest.py:13
plotBeamSpotVert.cuts
string cuts
Definition: plotBeamSpotVert.py:93
ActsTrk::to_string
std::string to_string(const DetectorType &type)
Definition: GeometryDefs.h:34
python.PyAthena.v
v
Definition: PyAthena.py:154
Pythia8_RapidityOrderMPI.val
val
Definition: Pythia8_RapidityOrderMPI.py:14
get
T * get(TKey *tobj)
get a TObject* from a TKey* (why can't a TObject be a TKey?)
Definition: hcg.cxx:127