#include using namespace std; #define NLAYERS_BCAL 10 double BCAL_TimeWalkUp(double fADC, int layer) { double tw_par[NLAYERS_BCAL][4] ={ {11.1873, 4615.75, 1.61259, 73.7223}, // layer 1 {11.0432, 149.482, 0.920827, -12.8414}, // layer 2 {11.2175, 131.96, 0.903754, -14.96}, // layer 3 {11.5646, 667.881, 1.2344, -31.4375}, // layer 4 {11, 11.3, 0.51, -5.15}, // layer 5 {11, 11.3, 0.51, -5.15}, // layer 6 {11, 11.3, 0.51, -5.15}, // layer 7 {11, 11.3, 0.51, -5.15}, // layer 8 {11, 11.3, 0.51, -5.15}, // layer 9 {11, 11.3, 0.51, -5.15} // layer 10 }; 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.7512, 2.44751, 0.245848, -2.15778}, // layer 1 {27.8744, 2.34024, 0.23613, -2.0746}, // layer 2 {28.392, 12.7754, 0.518891, -4.97737}, // layer 3 {29.0504, 283.095, 1.1497, -27.0759}, // layer 4 {29, 34, 0.66, -5}, // layer 5 {29, 34, 0.66, -5}, // layer 6 {29, 34, 0.66, -5}, // layer 7 {29, 34, 0.66, -5}, // layer 8 {29, 34, 0.66, -5}, // layer 9 {29, 34, 0.66, -5} // layer 10 }; 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]); }