#include using namespace std; #define NLAYERS_BCAL 4 double BCAL_TimeWalkUp(double fADC, int layer) { double tw_par[NLAYERS_BCAL][4] ={ {24.418, 0.0439023, 0.00600389, -1.02173}, // layer 1 {25.1295, 0.0305665, 0.00482155, -1.01741}, // layer 2 {26.251, 0.0174857, 0.00387268, -1.01454}, // layer 3 {27.3876, 0.0120925, 0.00352388, -1.01362} // 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.7199, 0.0266037, 0.0054439, -1.02033}, // layer 1 {20.5765, 0.0296908, 0.00556607, -1.02035}, // layer 2 {20.3715, 0.0269656, 0.00469808, -1.01696}, // layer 3 {20.893, 0.0132704, 0.00320896, -1.01227} // 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]); }