#include using namespace std; #define NLAYERS_BCAL 3 double BCAL_TimeWalkUp(double fADC, int layer) { double tw_par[NLAYERS_BCAL][4] ={ {9.81709, 0.023582, 0.00440776, -1.01624}, // layer 1 {9.96625, 0.0163841, 0.00290368, -1.0105}, // layer 2 {10.198, 0.0215599, 0.00375963, -1.01351} // layer 3 }; 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.5226, 0.0681523, 0.0128618, -1.04703}, // layer 1 {27.6907, 0.0301461, 0.0060872, -1.02241}, // layer 2 {28.0177, 0.0304435, 0.00638846, -1.02362} // layer 3 }; 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]); }