#include using namespace std; #define NLAYERS_BCAL 10 double BCAL_TimeWalkUp(double fADC, int layer) { double tw_par[NLAYERS_BCAL][4] ={ {36.4444, 0.0381321, 0.00629641, -1.0227}, // layer 1 {37.2042, 0.025988, 0.00521347, -1.01906}, // layer 2 {38.7627, 0.0102807, 0.0036066, -1.01386}, // layer 3 {40.3244, 0.00440868, 0.00286515, -1.01141}, // layer 4 {41.1359, 0.00384634, 0.00256204, -1.01012}, // layer 5 {37.9996, 0.039517, 0.00103958, -0.999948}, // layer 6 {38.1643, 0.04031, 0.00118202, -1.00004}, // layer 7 {38.1027, 0.04, 0.006, -1}, // layer 8 {38.1027, 0.04, 0.006, -1}, // layer 9 {38.1027, 0.04, 0.006, -1} // 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] ={ {17.1173, 0.0207821, 0.00377935, -1.0138}, // layer 1 {17.0885, 0.0178659, 0.00325623, -1.01168}, // layer 2 {17.1326, 0.0178585, 0.00347, -1.0126}, // layer 3 {17.4067, 0.015701, 0.00365152, -1.01366}, // layer 4 {17.9421, 0.0115269, 0.00343261, -1.01314}, // layer 5 {18.2769, 0.00806304, 0.00268966, -1.01035}, // layer 6 {17.8223, 0.00745, 0.00204795, -1.00778}, // layer 7 {19.028, 0.0047825, 0.00183842, -1.00709}, // layer 8 {13.516, 0.0338265, 0.00288335, -1.00963}, // layer 9 {17.5305, 0.0400813, 0.00126726, -1.00001} // 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]); }