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