#include using namespace std; #define NLAYERS_BCAL 10 double BCAL_TimeWalkUp(double fADC, int layer) { double tw_par[NLAYERS_BCAL][4] ={ {24.9978, 12.9224, 0.410701, -3.01358}, // layer 1 {25.3149, 7.12172, 0.326903, -2.43924}, // layer 2 {25.8454, 2.88556, 0.235646, -1.99432}, // layer 3 {26.6995, 2.1137, 0.237364, -2.08052}, // layer 4 {27.7576, 4.2009, 0.403228, -3.66665}, // layer 5 {29.5249, 15545.3, 2.37524, -2507.17}, // layer 6 {28.9497, 3849.67, 1.81686, -68.4972}, // layer 7 {-75.0752, 4788.09, 0.522376, 37.0781}, // layer 8 {32.0835, -92.0283, 1.4429, -199.777}, // layer 9 {28.3976, 224.659, 1.20233, -40.8375} // 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.6374, 0.0697919, 0.0127029, -1.03853}, // layer 1 {20.2067, 0.0922178, 0.0124181, -1.03328}, // layer 2 {20.0788, 0.0780835, 0.0105665, -1.0288}, // layer 3 {20.2435, 0.0802441, 0.0127714, -1.03746}, // layer 4 {20.326, 0.112896, 0.0190354, -1.05771}, // layer 5 {21.1374, 0.873838, 0.139924, -1.54674}, // layer 6 {20.7951, 0.749539, 0.121523, -1.46832}, // layer 7 {18.9052, 1.41643, 0.117301, -1.38763}, // layer 8 {15.0846, 1.46933, 0.0601381, -1.13666}, // layer 9 {17.4052, 0.489829, 0.0596903, -1.20679} // 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]); }