#include using namespace std; #define NLAYERS_BCAL 4 double BCAL_TimeWalkUp(double fADC, int layer) { double tw_par[NLAYERS_BCAL][4] ={ {9.98611, 0.0205263, 0.00416631, -1.01527}, // layer 1 {9.88398, 0.0261046, 0.00482374, -1.01762}, // layer 2 {10.0152, 0.0192927, 0.00344671, -1.01241}, // layer 3 {10.1882, 0.0220517, 0.00382816, -1.01374} // layer 4 }; 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] ={ {28.5176, 0.009749, 0.00327635, -1.01257}, // layer 1 {27.4715, 0.0593885, 0.0107984, -1.03921}, // layer 2 {27.6613, 0.0311467, 0.00599936, -1.02179}, // layer 3 {27.9665, 0.0228308, 0.00465597, -1.01704} // layer 4 }; 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]); }