#include using namespace std; #define NLAYERS_BCAL 10 double BCAL_TimeWalkUp(double fADC, int layer) { double tw_par[NLAYERS_BCAL][4] ={ {9.98413, 0.0205812, 0.00419023, -1.01538}, // layer 1 {9.86295, 0.0233207, 0.00433429, -1.0157}, // layer 2 {9.89395, 0.0263883, 0.00477998, -1.01717}, // layer 3 {10.0215, 0.0190213, 0.00356491, -1.01282}, // layer 4 {10.1667, 0.0176422, 0.00344343, -1.01245}, // layer 5 {10.2009, 0.0190283, 0.00363464, -1.01308}, // layer 6 {10.2851, 0.0195602, 0.00373171, -1.01341}, // layer 7 {10.4845, 0.0187261, 0.00381697, -1.01388}, // layer 8 {10.8565, 0.0167025, 0.00401602, -1.01498}, // layer 9 {11.0428, 0.0162796, 0.00410116, -1.01538} // 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.57, 0.0090836, 0.00316849, -1.01221}, // layer 1 {27.7452, 0.0307062, 0.0066563, -1.02444}, // layer 2 {27.6398, 0.0303963, 0.00600153, -1.02171}, // layer 3 {27.6774, 0.0327748, 0.00638702, -1.02307}, // layer 4 {27.8177, 0.02442, 0.00500633, -1.01818}, // layer 5 {28.0429, 0.0204891, 0.00455911, -1.01673}, // layer 6 {28.2462, 0.0155486, 0.0037538, -1.01393}, // layer 7 {28.5336, 0.0122681, 0.00332713, -1.01251}, // layer 8 {29.0989, 0.0103157, 0.0035509, -1.01366}, // layer 9 {29.3884, 0.00936595, 0.00354795, -1.01375} // 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]); }