#include using namespace std; #define NLAYERS_BCAL 3 double BCAL_TimeWalkUp(double fADC, int layer) { double tw_par[NLAYERS_BCAL][4] ={ {9.87369, 0.0307811, 0.0057402, -1.02128}, // layer 1 {10.0291, 0.0164001, 0.00296131, -1.01067}, // layer 2 {10.1566, 0.0226507, 0.00384716, -1.01374} // 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] ={ {27.5196, 0.0594688, 0.0114483, -1.04237}, // layer 1 {27.6946, 0.0305788, 0.00598835, -1.0218}, // layer 2 {27.9953, 0.022819, 0.00474423, -1.01742} // 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]); }