#include using namespace std; #define NLAYERS_BCAL 4 double BCAL_TimeWalkUp(double fADC, int layer) { double tw_par[NLAYERS_BCAL][4] ={ {25.2445, 0.02264, 0.00385779, -1.01424}, // layer 1 {26.2548, 0.0173752, 0.00385392, -1.01446}, // layer 2 {27.3361, 0.0135785, 0.00393796, -1.01518}, // layer 3 {27.1969, 0.0093487, 0.0022872, -1.00867} // layer 4 }; 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.3689, 0.0304933, 0.00515825, -1.01864}, // layer 1 {20.4055, 0.0314284, 0.00558774, -1.02033}, // layer 2 {20.8372, 0.0134143, 0.00310882, -1.01179}, // layer 3 {20.8103, 0.0147297, 0.00335407, -1.01276} // layer 4 }; 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]); }