#include using namespace std; #define NLAYERS_BCAL 3 double BCAL_TimeWalkUp(double fADC, int layer) { double tw_par[NLAYERS_BCAL][4] ={ {36.5649, 0.050818, 0.00770588, -1.02733}, // layer 1 {39.5863, 0.00853177, 0.00379728, -1.01489}, // layer 2 {38.2077, 0.0405644, 0.00121696, -1.00009} // 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] ={ {16.8907, 0.0295571, 0.00479479, -1.01719}, // layer 1 {17.1764, 0.0168749, 0.00343874, -1.01272}, // layer 2 {17.4783, 0.0490611, 0.010832, -1.0416} // 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]); }