#include using namespace std; #define NLAYERS_BCAL 3 double BCAL_TimeWalkUp(double fADC, int layer) { double tw_par[NLAYERS_BCAL][4] ={ {25.0195, 0.0305004, 0.00499449, -1.01834}, // layer 1 {25.6194, 0.0172814, 0.00311105, -1.01136}, // layer 2 {28.0328, 0.00621244, 0.00209345, -1.00808} // 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] ={ {20.8196, 0.023406, 0.00505778, -1.0189}, // layer 1 {20.6247, 0.0358543, 0.00696419, -1.02567}, // layer 2 {21.2709, 0.0109331, 0.00313579, -1.01207} // 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]); }