#include using namespace std; #define NLAYERS_BCAL 3 double BCAL_TimeWalkUp(double fADC, int layer) { double tw_par[NLAYERS_BCAL][4] ={ {29.1631, 0.0994015, 0.013593, -1.04954}, // layer 1 {30.412, 0.0152017, 0.00327698, -1.01229}, // layer 2 {30.3793, 0.00771573, 0.00138566, -1.00508} // 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] ={ {19.1133, 0.0260322, 0.00476933, -1.01745}, // layer 1 {19.2175, 0.0200729, 0.00390537, -1.01432}, // layer 2 {19.9392, 0.00753978, 0.00215082, -1.00826} // 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]); }