#include using namespace std; #define NLAYERS_BCAL 10 double BCAL_TimeWalkUp(double fADC, int layer) { double tw_par[NLAYERS_BCAL][4] ={ {10.0851, 1.29172, 0.163115, -1.69151}, // layer 1 {11.0043, 351.912, 1.09929, -19.1154}, // layer 2 {11.0865, 198.806, 0.979135, -14.7781}, // layer 3 {11.4258, 512.472, 1.17834, -28.8209}, // 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] ={ {28.077, 1.33366, 0.191635, -1.82478}, // layer 1 {27.6471, 1.21771, 0.155424, -1.61142}, // layer 2 {27.8288, 1.88331, 0.207251, -1.89798}, // layer 3 {28.5891, 33.5282, 0.701724, -8.52232}, // 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]); }