38 {
40 if (dc){dc->collect(*this, "start");}
41
42
43
44 auto in =
46 ctx);
48
49 ATH_MSG_DEBUG(
"read in " << (*in).size() <<
" neighborhoods");
50
51 SG::WriteHandle<std::vector<float> > h_BDTScore(
m_BDTScoreKey, ctx);
52 CHECK(h_BDTScore.record(std::make_unique<std::vector<float> >()));
53
54
55 auto eEmEg1BDTTOBs = std::make_unique<IOBitwise::eEmEg1BDTTOBContainer>();
56
57 for (const auto nbhdTOB : *in) {
59 if (c_phi.empty()) {continue;}
61
63 ap_int<BDT_ouput_width>* c_input = &
input[0];
64
66
67
68 bdt.decision_function(c_input, scores);
69 if (msgLevel() <= MSG::DEBUG) {
72 for (
const auto& i : input) {
ss <<
i <<
' ';}
74 }
75
76 if (msgLevel() <= MSG::DEBUG) {
78 ss <<
"C BDT output: ";
79 for (
const auto& i : scores) {
ss <<
i <<
' ';}
81 }
82
83
84 std::bitset<BDT_ouput_width> BDT_bits;
85 for (
int i=0;
i<scores[0].length();
i++){
86 BDT_bits[
i] = scores[0][
i];
87 }
89
90
91 std::bitset<eEmEg1BDTTOB::s_eGamma1BDT_width>
result;
92
95
96 if(BDT_int >= 128) {
97
98 result = std::bitset<eEmEg1BDTTOB::s_eGamma1BDT_width>{0xFF};
99 } else if (BDT_int < -128) {
100
101 result = std::bitset<eEmEg1BDTTOB::s_eGamma1BDT_width>{0x00};
102 } else {
103
104
108 }
109 }
110
113
114
115 h_BDTScore->push_back(
result.to_ulong());
116 eEmEg1BDTTOBs->push_back(std::make_unique<IOBitwise::eEmEg1BDTTOB>(*nbhdTOB, result));
117 }
118
119
121 CHECK(h_eEmEg1BDTTOBs.record(std::move(eEmEg1BDTTOBs)));
122
123 if (dc){dc->collect(*this, "end");}
124
125 return StatusCode::SUCCESS;
126 }
static const std::size_t s_eGamma1BDT_width
constexpr int fn_classes(int n_classes)
static const BDT::BDT< n_trees, n_classes, input_arr_t, score_t, threshold_t > bdt
static const int n_features
ap_fixed< 10, 5 > score_t
static const int n_classes
static std::vector< ap_int< 10 > > digitize10(const std::vector< double > &v)