#include using namespace std; #define NLAYERS_BCAL 5 double BCAL_TimeWalkUp(double fADC, int layer) { double tw_par[NLAYERS_BCAL][4] ={ {36.6389, 0.0358026, 0.00589994, -1.02118}, // layer 1 {38.2763, 0.0117231, 0.00337076, -1.01281}, // layer 2 {39.4686, 0.00855224, 0.00349735, -1.01365}, // layer 3 {38.1528, 0.0402638, 0.00120245, -1.00004}, // layer 4 {37.9778, 0.0393833, 0.00114341, -0.999931} // layer 5 }; 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.9404, 0.02763, 0.00455547, -1.01633}, // layer 1 {16.7701, 0.0293884, 0.00463866, -1.01644}, // layer 2 {17.4801, 0.015859, 0.00375818, -1.01428}, // layer 3 {17.9483, 0.0245255, 0.0067941, -1.02636}, // layer 4 {17.2706, 0.00938214, 0.0018212, -1.00676} // layer 5 }; 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]); }