File indexing completed on 2024-04-06 12:29:29
0001 #include <SimCalorimetry/EcalTrigPrimAlgos/interface/EcalFenixPeakFinder.h>
0002
0003 EcalFenixPeakFinder::EcalFenixPeakFinder() : inputsAlreadyIn_(0) {}
0004
0005 EcalFenixPeakFinder::~EcalFenixPeakFinder() {}
0006
0007 int EcalFenixPeakFinder::setInput(int input) {
0008 if (inputsAlreadyIn_ < 3) {
0009 buffer_[inputsAlreadyIn_] = input;
0010 inputsAlreadyIn_++;
0011 } else {
0012 for (int i = 0; i < 2; i++)
0013 buffer_[i] = buffer_[i + 1];
0014 buffer_[2] = input;
0015 }
0016 return 1;
0017 }
0018
0019 int EcalFenixPeakFinder::process() {
0020 if (inputsAlreadyIn_ < 3)
0021 return 0;
0022 if (buffer_[1] > buffer_[0] && buffer_[1] > buffer_[2])
0023 return 1;
0024 else
0025 return 0;
0026 }
0027
0028 std::vector<int> EcalFenixPeakFinder::process(std::vector<int> &filtout, std::vector<int> &output) {
0029
0030 inputsAlreadyIn_ = 0;
0031 for (unsigned int i = 0; i < 3; i++)
0032 buffer_[i] = 0;
0033
0034
0035
0036
0037 for (unsigned int i = 0; i < filtout.size(); i++) {
0038 setInput(filtout[i]);
0039 if (i > 0) {
0040
0041
0042 output[i - 1] = process();
0043 }
0044 }
0045
0046
0047 return output;
0048 }