ATLAS Offline Software
Loading...
Searching...
No Matches
eFEXBDT.h
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
3*/
4
5//***************************************************************************
6// eFEXBDT .h
7// -------------------
8// begin : 14 07 2022
9// email : david.reikher@cern.ch
10// **************************************************************************
11
13#include "nlohmann/json.hpp"
14#include <fstream>
15
17 std::string m_name;
18 std::vector<std::vector<int>> m_scells;
19
20public:
21 friend void from_json(const nlohmann::json &j, BDTVariable &o) {
22 j.at("name").get_to(o.m_name);
23 j.at("scells").get_to(o.m_scells);
24 }
25};
26
27class eFEXBDT {
28
29private:
30 std::vector<BDTVariable> m_variables;
31 std::vector<std::vector<int>> m_et_scells;
32 std::vector<std::vector<int>> m_em_et_scells;
33 std::vector<std::vector<int>> m_had_et_scells;
34 std::vector<std::vector<std::vector<int>>> m_towers_scells;
37
38public:
39 // Define how to read this class to/from JSON
40 friend void from_json(const nlohmann::json &j, eFEXBDT &o) {
41 j.at("variables").get_to(o.m_variables);
42 j.at("et_scells").get_to(o.m_et_scells);
43 j.at("em_et_scells").get_to(o.m_em_et_scells);
44 j.at("had_et_scells").get_to(o.m_had_et_scells);
45 j.at("towers_scells").get_to(o.m_towers_scells);
46 j.at("score_precision").get_to(o.m_score_precision);
47 j.at("bdt").get_to(o.m_bdt);
48 }
49
50 eFEXBDT(std::string filename) {
51 /* Construct the BDT from conifer cpp backend JSON file */
52 std::ifstream ifs(filename);
53 nlohmann::json j = nlohmann::json::parse(ifs);
54 from_json(j, *this);
55 m_bdt.init();
56 }
57
58 const std::vector<BDTVariable> &getVariables() const { return m_variables; }
59
60 const std::vector<std::vector<int>> &getETSCells() const {
61 return m_et_scells;
62 }
63
64 const std::vector<std::vector<int>> &getEMETSCells() const {
65 return m_em_et_scells;
66 }
67
68 const std::vector<std::vector<int>> &getHADETSCells() const {
69 return m_had_et_scells;
70 }
71
73 return m_bdt;
74 }
75
76 const std::vector<std::vector<int>> &getTowerSCells(int towerIndex) const {
77 return m_towers_scells[towerIndex];
78 }
79
80 int getNTowers() const { return m_towers_scells.size(); }
81
82 int getScorePrecision() const { return m_score_precision; }
83};
const std::vector< std::vector< int > > & getHADETSCells() const
Definition eFEXBDT.h:68
friend void from_json(const nlohmann::json &j, eFEXBDT &o)
Definition eFEXBDT.h:40
std::vector< std::vector< int > > m_et_scells
Definition eFEXBDT.h:31
std::vector< std::vector< std::vector< int > > > m_towers_scells
Definition eFEXBDT.h:34
std::vector< BDTVariable > m_variables
Definition eFEXBDT.h:30
int getScorePrecision() const
Definition eFEXBDT.h:82
int m_score_precision
Definition eFEXBDT.h:36
std::vector< std::vector< int > > m_had_et_scells
Definition eFEXBDT.h:33
int getNTowers() const
Definition eFEXBDT.h:80
const conifer::BDT< unsigned int, unsigned int > & getBDT() const
Definition eFEXBDT.h:72
const std::vector< std::vector< int > > & getTowerSCells(int towerIndex) const
Definition eFEXBDT.h:76
const std::vector< std::vector< int > > & getETSCells() const
Definition eFEXBDT.h:60
const std::vector< std::vector< int > > & getEMETSCells() const
Definition eFEXBDT.h:64
eFEXBDT(std::string filename)
Definition eFEXBDT.h:50
std::vector< std::vector< int > > m_em_et_scells
Definition eFEXBDT.h:32
const std::vector< BDTVariable > & getVariables() const
Definition eFEXBDT.h:58
conifer::BDT< unsigned int, unsigned int > m_bdt
Definition eFEXBDT.h:35
friend void from_json(const nlohmann::json &j, BDTVariable &o)
Definition eFEXBDT.h:21
std::vector< std::vector< int > > m_scells
Definition eFEXBDT.h:18
std::string m_name
Definition eFEXBDT.h:17