#include using namespace std; #define NLAYERS_BCAL 10 double BCAL_TimeWalkUp(double fADC, int layer) { double tw_par[NLAYERS_BCAL][4] ={ {11.0961, 1659.48, 1.4189, -23.0861}, // layer 1 {11.0374, 365.837, 1.09202, -17.3824}, // layer 2 {11.0089, 92.0587, 0.8271, -11.5904}, // layer 3 {11.1505, 70.3012, 0.787021, -11.4355}, // layer 4 {11.5708, 697.024, 1.24344, -30.9211}, // layer 5 {11, 11.3, 0.51, -5.15}, // layer 6 {11, 11.3, 0.51, -5.15}, // layer 7 {11, 11.3, 0.51, -5.15}, // layer 8 {11, 11.3, 0.51, -5.15}, // layer 9 {11, 11.3, 0.51, -5.15} // layer 10 }; layer = layer<1 ? 1:layer>NLAYERS_BCAL ? NLAYERS_BCAL:layer; double *p = tw_par[layer-1]; return p[0]+p[1]/(pow(fADC,p[2])+p[3]); } double BCAL_TimeWalkDn(double fADC, int layer) { double tw_par[NLAYERS_BCAL][4] ={ {27.7121, 2.04677, 0.215558, -1.93511}, // layer 1 {28.268, 36.8224, 0.716623, -8.88489}, // layer 2 {28.2493, 16.4731, 0.557795, -5.54112}, // layer 3 {28.409, 20.968, 0.600811, -6.24107}, // layer 4 {29.007, 204.255, 1.08713, -25.2225}, // layer 5 {29, 34, 0.66, -5}, // layer 6 {29, 34, 0.66, -5}, // layer 7 {29, 34, 0.66, -5}, // layer 8 {29, 34, 0.66, -5}, // layer 9 {29, 34, 0.66, -5} // layer 10 }; layer = layer<1 ? 1:layer>NLAYERS_BCAL ? NLAYERS_BCAL:layer; double *p = tw_par[layer-1]; return p[0]+p[1]/(pow(fADC,p[2])+p[3]); }