File indexing completed on 2024-04-06 11:58:05
0001 #include "CalibCalorimetry/HcalAlgos/interface/HcalAlgoUtils.h"
0002 #include <cmath>
0003
0004 void getLinearizedADC(const HcalQIEShape& shape, const HcalQIECoder* coder, int bins, int capid, float& lo, float& hi) {
0005 float low = coder->charge(shape, 0, capid);
0006 float high = coder->charge(shape, bins - 1, capid);
0007 float step = (high - low) / (bins - 1);
0008 low -= step / 2.0;
0009 high += step / 2.0;
0010 lo = low;
0011 hi = high;
0012 return;
0013 }
0014
0015 float maxDiff(float one, float two, float three, float four) {
0016 float max = -1000;
0017 float min = 1000;
0018 if (one > max)
0019 max = one;
0020 if (one < min)
0021 min = one;
0022 if (two > max)
0023 max = two;
0024 if (two < min)
0025 min = two;
0026 if (three > max)
0027 max = three;
0028 if (three < min)
0029 min = three;
0030 if (four > max)
0031 max = four;
0032 if (four < min)
0033 min = four;
0034 return fabs(max - min);
0035 }