18 {
20 "/eos/atlas/atlascerngroupdisk/data-art/large-input/trig-val/GlobalSimTest";
21
22 auto tv_fn =
path +
"/Egamma1BDT_testVecs.txt";
23
24
25
26 auto get_test_vectors =
27 [&tv_fn]()->std::optional<std::vector<std::vector<double>>> {
28 std::ifstream ifs(tv_fn);
29
30
31 if(!ifs) {
32 return std::optional<std::vector<std::vector<double>>>();
33 }
34
35 auto line = std::string();
36 std::string tok;
37
38 std::vector<std::vector<double>>
inputs;
39
40 while (std::getline(ifs, line)) {
41 auto ss = std::stringstream(line);
42 std::vector<double>
input;
43
44 while (std::getline(
ss, tok,
',')) {
45 input.push_back(std::stod(tok));
46 }
47
48 constexpr int exp_size{18};
49 if (
input.size() != exp_size) {
50 return std::optional<std::vector<std::vector<double>>>();
51 }
52
54 }
55
56 return std::optional(inputs);
57
58 };
59
60 auto test_vectors_opt = get_test_vectors();
61
62 EXPECT_EQ(test_vectors_opt.has_value(), true);
63
64
65 auto test_vectors = *test_vectors_opt;
66
67 std::string fn_exp =
path +
"/Egamma1BDT_testExps_hls.txt";
68
69
70 auto get_expectations =
71 [&fn_exp]() -> std::optional<std::vector<double>> {
72
73 std::ifstream ifs(fn_exp);
74 if(!ifs) {
75 return std::optional<std::vector<double>>();
76 }
77
78 auto line = std::string();
79 std::string tok;
80 std::vector<double> exps;
81
82 while (std::getline(ifs, line)) {
83 auto ss = std::stringstream(line);
84 while (std::getline(
ss, tok)) {
85 exps.push_back(std::stod(tok));
86 }
87 }
88
89 return exps;
90
91 };
92
93
94 auto expectations_opt = get_expectations();
95
96 EXPECT_EQ(expectations_opt.has_value(), true);
97
98 auto expectations = *expectations_opt;
99
100 EXPECT_EQ(test_vectors.size(), expectations.size());
101
102 const auto tv_sz = test_vectors.size();
104 std::size_t i_vec{0};
105 for (std::size_t i_test = 0; i_test != tv_sz; ++i_test) {
106 const auto& tv = test_vectors[i_test];
107 const auto&
exp = expectations[i_test];
108
109 auto tv_size = tv.size();
110 for(std::size_t j = 0; j != tv_size; ++j) {
112 }
113
115
116
118
119 EXPECT_EQ(score[0], exp);
120 ++i_vec;
121 }
122
123 EXPECT_EQ(i_vec, 32602u);
124}
score_t score_arr_t[n_classes]
static const BDT::BDT< n_trees, n_classes, input_arr_t, score_t, threshold_t > bdt
input_t input_arr_t[n_features]
path
python interpreter configuration --------------------------------------—