#include using namespace std; #define NLAYERS_BCAL 5 double BCAL_TimeWalkUp(double fADC, int layer) { double tw_par[NLAYERS_BCAL][4] ={ {25.0139, 0.0233163, 0.00372652, -1.01362}, // layer 1 {25.4494, 0.0248077, 0.00429199, -1.01581}, // layer 2 {26.7068, 0.0164059, 0.00422589, -1.01614}, // layer 3 {27.3328, 0.0132024, 0.00386654, -1.01495}, // layer 4 {27.2971, 0.00727518, 0.00188702, -1.00722} // layer 5 }; 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.518, 0.037164, 0.00671366, -1.02463}, // layer 1 {20.45, 0.070081, 0.0121682, -1.04482}, // layer 2 {20.3658, 0.0263517, 0.00472942, -1.0173}, // layer 3 {20.9153, 0.0125614, 0.0030448, -1.01161}, // layer 4 {20.7956, 0.0117253, 0.00270069, -1.01027} // layer 5 }; 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]); }