#include using namespace std; #define NLAYERS_BCAL 3 double BCAL_TimeWalkUp(double fADC, int layer) { double tw_par[NLAYERS_BCAL][4] ={ {36.5415, 0.0286907, 0.00433069, -1.01521}, // layer 1 {38.0652, 0.0154384, 0.0040868, -1.01551}, // layer 2 {37.869, 0.0129382, 0.00305526, -1.01156} // 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] ={ {16.8493, 0.0247987, 0.00392484, -1.01406}, // layer 1 {16.7948, 0.0278814, 0.00459972, -1.01672}, // layer 2 {17.3228, 0.0170877, 0.00353428, -1.01335} // 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]); }