#include using namespace std; #define NLAYERS_BCAL 3 double BCAL_TimeWalkUp(double fADC, int layer) { double tw_par[NLAYERS_BCAL][4] ={ {25.1729, 0.0410343, 0.00676393, -1.02491}, // layer 1 {26.6281, 0.00858286, 0.00224322, -1.00849}, // layer 2 {27.761, 0.00476148, 0.001471, -1.00564} // 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.6283, 0.0216179, 0.00422257, -1.01553}, // layer 1 {20.7583, 0.018085, 0.00388715, -1.01441}, // layer 2 {21.2642, 0.017442, 0.00503932, -1.01952} // 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]); }