33 {
35
36
37
38 auto in =
40 ctx);
42
43 ATH_MSG_DEBUG(
"read in " << (*in).size() <<
" neighborhoods");
44
45 ap_int<16> peak = 0;
46 ap_int<16> secondMax = 0;
47
48 SG::WriteHandle<IOBitwise::eEmEg1eRatioTOBContainer> h_eRatioResult(
m_eRatioResultKey, ctx);
49 CHECK(h_eRatioResult.record(std::make_unique<IOBitwise::eEmEg1eRatioTOBContainer>()));
50 SG::WriteHandle<std::vector<int> > h_eRatio(
m_eRatioKey, ctx);
51 CHECK(h_eRatio.record(std::make_unique<std::vector<int> >()));
53 CHECK(h_eRatioSimple.record(std::make_unique<std::vector<float> >()));
54
55 for (const auto nbhdTOB : *in) {
57 if (msgLevel() <= MSG::DEBUG) {
59 ss <<
"eRatio input: ";
60 for (
const auto& i : c_phi) {
ss <<
i <<
' ';}
62 }
63
65
66
67
68 if (msgLevel() <= MSG::DEBUG) {
70 ss <<
"eRatio input: ";
71 for (
const auto& i : input) {
ss <<
i <<
' ';}
73 }
74
75
78
79
80
81 std::vector<ap_int<16>> secondPeak;
82 secondPeak.resize(6);
83
84
85 int noiseMargin = 1;
86
88
90
92
94
96
98
99 auto result = std::max_element(secondPeak.begin(), secondPeak.end());
101 << std::distance(secondPeak.begin(), result)
102 << " has value " << *result);
103
106
107
108 if(peak > 0 || secondMax > 0){
109 auto eRatio = static_cast< float >(peak - secondMax)/static_cast< float >(peak + secondMax);
110
112
113 auto eRatioSimple = static_cast< float >(secondMax)/static_cast< float >(peak);
114 h_eRatioSimple->push_back(eRatioSimple);
116
117
118 std::bitset<IOBitwise::IeEmEg1eRatioTOB::s_eGamma1eRatio_width>
result = 0;
119
120 if(eRatio >= 0. && eRatio <= 1.0){
121
123 h_eRatio->push_back((int)(eRatio*eRatioPower));
125 } else {
127 }
128 h_eRatioResult->push_back(std::make_unique<IOBitwise::eEmEg1eRatioTOB>(*nbhdTOB, result));
129 }
130 }
131
132 return StatusCode::SUCCESS;
133 }
static const std::size_t s_eGamma1eRatio_width
Count: Size of output bits of the eGamma1 eRatio algorithm.
static std::vector< ap_int< 16 > > digitize16(const std::vector< double > &v)