#include using namespace std; #define NLAYERS_BCAL 4 double BCAL_TimeWalkUp(double fADC, int layer) { double tw_par[NLAYERS_BCAL][4] ={ {28.7737, 0.0618055, 0.00809098, -1.02909}, // layer 1 {29.4638, 0.0371665, 0.00575915, -1.02078}, // layer 2 {31.5526, 0.0124447, 0.00396212, -1.0153}, // layer 3 {31.4233, 0.00450244, 0.00122798, -1.00468} // 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] ={ {19.3248, 0.0165597, 0.00345868, -1.01287}, // layer 1 {19.2826, 0.0211806, 0.00414567, -1.01511}, // layer 2 {19.4307, 0.0151905, 0.00336141, -1.01253}, // layer 3 {19.914, 0.0104227, 0.00296497, -1.01142} // 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]); }