#include using namespace std; #define NLAYERS_BCAL 3 double BCAL_TimeWalkUp(double fADC, int layer) { double tw_par[NLAYERS_BCAL][4] ={ {29.1575, 0.0403936, 0.00552058, -1.01972}, // layer 1 {31.5245, 0.012296, 0.00386766, -1.01494}, // layer 2 {32.2649, 0.0054366, 0.00174651, -1.00671} // 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] ={ {19.0909, 0.020981, 0.00381966, -1.01394}, // layer 1 {19.3839, 0.0151638, 0.00329776, -1.01227}, // layer 2 {19.8618, 0.00905704, 0.00259948, -1.01004} // 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]); }