File indexing completed on 2024-04-06 12:29:22
0001 #include <SimCalorimetry/EcalEBTrigPrimAlgos/interface/EcalEBFenixStripFormatEB.h>
0002 #include <CondFormats/EcalObjects/interface/EcalTPGSlidingWindow.h>
0003 #include "FWCore/MessageLogger/interface/MessageLogger.h"
0004
0005 EcalEBFenixStripFormatEB::EcalEBFenixStripFormatEB() : shift_(0) {}
0006
0007 EcalEBFenixStripFormatEB::~EcalEBFenixStripFormatEB() {}
0008
0009 int EcalEBFenixStripFormatEB::setInput(int input, int inputPeak, int inputsFGVB) {
0010 inputsFGVB_ = inputsFGVB;
0011 inputPeak_ = inputPeak;
0012 input_ = input;
0013 return 0;
0014 }
0015
0016 int EcalEBFenixStripFormatEB::process() {
0017
0018
0019 if (inputPeak_ == 0)
0020 return ((inputsFGVB_ & 0x1) << 12);
0021
0022 int output = input_ >> shift_;
0023
0024 if (output > 0XFFF)
0025 output = 0XFFF;
0026
0027 output |= ((inputsFGVB_ & 0x1) << 12);
0028
0029
0030 return output;
0031 }
0032
0033 void EcalEBFenixStripFormatEB::process(std::vector<int> &sFGVBout,
0034 std::vector<int> &peakout,
0035 std::vector<int> &filtout,
0036 std::vector<int> &output) {
0037 if (peakout.size() != filtout.size() || sFGVBout.size() != filtout.size()) {
0038 edm::LogWarning("EcalTPG")
0039 << " problem in EcalEBFenixStripFormatEB: sfgvb_out, peak_out and filt_out don't have the same size";
0040 }
0041
0042 for (unsigned int i = 0; i < filtout.size(); i++) {
0043
0044 setInput(filtout[i], peakout[i], sFGVBout[i]);
0045
0046 output[i] = process();
0047 }
0048 return;
0049 }
0050
0051 void EcalEBFenixStripFormatEB::setParameters(uint32_t &id, const EcalTPGSlidingWindow *&slWin) {
0052 const EcalTPGSlidingWindowMap &slwinmap = slWin->getMap();
0053 EcalTPGSlidingWindowMapIterator it = slwinmap.find(id);
0054 if (it != slwinmap.end())
0055 shift_ = (*it).second;
0056 else
0057 edm::LogWarning("EcalTPG") << " could not find EcalTPGSlidingWindowMap entry for " << id;
0058 }