#include using namespace std; #define NLAYERS_BCAL 5 double BCAL_TimeWalkUp(double fADC, int layer) { double tw_par[NLAYERS_BCAL][4] ={ {29.1503, 0.0503318, 0.00705432, -1.02543}, // layer 1 {30.0891, 0.0301068, 0.00552091, -1.0204}, // layer 2 {31.7565, 0.0116445, 0.00369844, -1.01428}, // layer 3 {31.1233, 0.0048962, 0.00109378, -1.00409}, // layer 4 {29.6703, 0.0364783, 0.000821644, -0.999779} // layer 5 }; 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] ={ {19.1031, 0.0267735, 0.00486405, -1.01776}, // layer 1 {19.1671, 0.0283443, 0.00531206, -1.01938}, // layer 2 {19.5196, 0.0142667, 0.00337469, -1.01276}, // layer 3 {19.7244, 0.0120488, 0.00316577, -1.01213}, // layer 4 {19.7206, 0.00673414, 0.00164472, -1.00623} // layer 5 }; 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]); }