#include using namespace std; #define NLAYERS_BCAL 4 double BCAL_TimeWalkUp(double fADC, int layer) { double tw_par[NLAYERS_BCAL][4] ={ {24.4796, 0.0761927, 0.0107871, -1.03953}, // layer 1 {25.1871, 0.0302862, 0.00508442, -1.01852}, // layer 2 {26.6367, 0.0133465, 0.00348262, -1.01321}, // layer 3 {28.5056, 0.00431522, 0.00178147, -1.00696} // 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] ={ {20.9312, 0.0179311, 0.00414623, -1.01557}, // layer 1 {20.7804, 0.0203428, 0.00426947, -1.01574}, // layer 2 {20.815, 0.0163846, 0.0036554, -1.01363}, // layer 3 {21.3466, 0.0144215, 0.00424265, -1.01641} // 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]); }