33 {
35
36 if (dc){dc->collect(*this, "start");}
37
38
39 auto in =
41 ctx);
43
44 ATH_MSG_DEBUG(
"read in " << (*in).size() <<
" neighborhoods");
45
46 ap_int<16> peak = 0;
47 ap_int<16> secondMax = 0;
48
49 SG::WriteHandle<std::vector<float> > h_eRatio(
m_eRatioKey, ctx);
50 CHECK(h_eRatio.record(std::make_unique<std::vector<float> >()));
52 CHECK(h_eRatioSimple.record(std::make_unique<std::vector<float> >()));
53
54 for (const auto nbhdTOB : *in) {
56 if (msgLevel() <= MSG::DEBUG) {
58 ss <<
"eRatio input: ";
59 for (
const auto& i : c_phi) {
ss <<
i <<
' ';}
61 }
62
64
65
66
67 if (msgLevel() <= MSG::DEBUG) {
69 ss <<
"eRatio input: ";
70 for (
const auto& i : input) {
ss <<
i <<
' ';}
72 }
73
74
75 if(
input.size() == 51){
76
79
80
81
82 std::vector<ap_int<16>> secondPeak;
83 secondPeak.resize(6);
84
85
86 int noiseMargin = 1;
87
89
91
93
95
97
99
100 auto result = std::max_element(secondPeak.begin(), secondPeak.end());
102 << std::distance(secondPeak.begin(), result)
103 << " has value " << *result);
104
107
108
109 if(peak > 0 || secondMax > 0){
110 auto eRatio = static_cast< float >(peak - secondMax)/static_cast< float >(peak + secondMax);
111 h_eRatio->push_back(eRatio);
113
114 auto eRatioSimple = static_cast< float >(secondMax)/static_cast< float >(peak);
115 h_eRatioSimple->push_back(eRatioSimple);
117 }
118 }
119 }
120
121 if (dc){dc->collect(*this, "end");}
122
123 return StatusCode::SUCCESS;
124 }
static std::vector< ap_int< 16 > > digitize16(const std::vector< double > &v)