#include using namespace std; #define NLAYERS_BCAL 3 double BCAL_TimeWalkUp(double fADC, int layer) { double tw_par[NLAYERS_BCAL][4] ={ {24.9459, 0.0237115, 0.00367467, -1.01336}, // layer 1 {25.4554, 0.0237187, 0.00392254, -1.01422}, // layer 2 {27.1829, 0.0139095, 0.00372372, -1.01428} // 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.5429, 0.0240381, 0.00445533, -1.01635}, // layer 1 {20.4596, 0.0330435, 0.00602718, -1.02215}, // layer 2 {20.9139, 0.0118498, 0.00285693, -1.01089} // 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]); }