#include using namespace std; #define NLAYERS_BCAL 10 double BCAL_TimeWalkUp(double fADC, int layer) { double tw_par[NLAYERS_BCAL][4] ={ {25.025, 2.77243, 0.200195, -1.77852}, // layer 1 {26.2914, 31.9458, 0.632019, -5.83902}, // layer 2 {27.9062, 42289.8, 2.30407, 2013.39}, // layer 3 {28.9116, 9.56398e+06, 3.71514, 785500}, // layer 4 {28.2337, 17112.3, 2.05758, 368.839}, // layer 5 {29, 237, 1.2, -35}, // layer 6 {29, 237, 1.2, -35}, // layer 7 {29, 237, 1.2, -35}, // layer 8 {29, 237, 1.2, -35}, // layer 9 {29, 237, 1.2, -35} // 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] ={ {20.3251, 0.115638, 0.0192757, -1.05932}, // layer 1 {20.4387, 1.01679, 0.116816, -1.40072}, // layer 2 {20.253, 1.84596, 0.162245, -1.57278}, // layer 3 {20.6753, 6.24758, 0.339607, -2.71803}, // layer 4 {20.029, 1.85848, 0.172198, -1.69418}, // layer 5 {21, 0.4, 0.061, -1.2}, // layer 6 {21, 0.4, 0.061, -1.2}, // layer 7 {21, 0.4, 0.061, -1.2}, // layer 8 {21, 0.4, 0.061, -1.2}, // layer 9 {21, 0.4, 0.061, -1.2} // 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]); }