43 ATH_MSG_DEBUG(
"read in " << (*in).size() <<
" neighborhoods");
46 ap_int<16> secondMax = 0;
49 CHECK(h_eRatioResult.
record(std::make_unique<IOBitwise::eEmEg1eRatioTOBContainer>()));
51 CHECK(h_eRatio.
record(std::make_unique<std::vector<int> >()));
53 CHECK(h_eRatioSimple.
record(std::make_unique<std::vector<float> >()));
55 for (
const auto nbhdTOB : *in) {
57 if (msgLevel() <= MSG::DEBUG) {
59 ss <<
"eRatio input: ";
60 for (
const auto& i : c_phi) {
ss << i <<
' ';}
68 if (msgLevel() <= MSG::DEBUG) {
70 ss <<
"eRatio input: ";
71 for (
const auto& i : input) {
ss << i <<
' ';}
81 std::vector<ap_int<16>> secondPeak;
99 auto result = std::max_element(secondPeak.begin(), secondPeak.end());
101 << std::distance(secondPeak.begin(),
result)
102 <<
" has value " << *
result);
108 if(peak > 0 || secondMax > 0){
109 auto eRatio =
static_cast< float >(peak - secondMax)/
static_cast< float >(peak + secondMax);
113 auto eRatioSimple =
static_cast< float >(secondMax)/
static_cast< float >(peak);
114 h_eRatioSimple->push_back(eRatioSimple);
118 std::bitset<IOBitwise::eEmEg1eRatioTOB::s_eGamma1eRatio_width>
result = 0;
120 if(eRatio >= 0. && eRatio <= 1.0){
123 h_eRatio->push_back((
int)(eRatio*eRatioPower));
124 result = (int)(eRatio*eRatioPower);
128 h_eRatioResult->push_back(std::make_unique<IOBitwise::eEmEg1eRatioTOB>(*nbhdTOB,
result));
132 return StatusCode::SUCCESS;
136 const ap_int<16> peak,
139 const ap_int<16> noiseMargin)
const {
144 ap_int<16> lastEnergy = peak;
145 ap_int<16> secondPeak = 0;
149 if(startCell > endCell) {
156 for (
auto itr = input.begin() + startCell; itr != input.begin() + endCell + direction; itr+=direction){
158 ATH_MSG_DEBUG(
"Input is " << *itr <<
" last energy is " << lastEnergy);
159 if(ascending==0 && *itr>lastEnergy && *itr-lastEnergy > noiseMargin){
160 ATH_MSG_DEBUG(
"We are going up now " << *itr <<
" is more then " << lastEnergy);
164 }
else if(ascending==1 && lastEnergy>*itr && lastEnergy-*itr > noiseMargin){
165 ATH_MSG_DEBUG(
"We are past the top " << *itr <<
" is less than " << lastEnergy);
166 if(secondPeak<*itr) secondPeak = lastEnergy;