#include using namespace std; #define NLAYERS_BCAL 3 double BCAL_TimeWalkUp(double fADC, int layer) { double tw_par[NLAYERS_BCAL][4] ={ {25.2352, 0.0241375, 0.00409194, -1.01506}, // layer 1 {26.2326, 0.0176453, 0.00387275, -1.01453}, // layer 2 {27.4571, 0.011618, 0.00357485, -1.0139} // 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.4017, 0.0293925, 0.00509694, -1.01853}, // layer 1 {20.4327, 0.0285867, 0.00517625, -1.01887}, // layer 2 {20.8079, 0.0141238, 0.00327281, -1.01244} // 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]); }