#include using namespace std; #define NLAYERS_BCAL 7 double BCAL_TimeWalkUp(double fADC, int layer) { double tw_par[NLAYERS_BCAL][4] ={ {20.9021, 0.00454688, 0.00260145, -1.01276}, // layer 1 {20.0284, 0.00993051, 0.00372622, -1.01795}, // layer 2 {19.9806, 0.00856608, 0.00305253, -1.01464}, // layer 3 {20.0414, 0.0105297, 0.00370099, -1.01776}, // layer 4 {20.2575, 0.0110683, 0.00420794, -1.02032}, // layer 5 {20.5417, 0.00916202, 0.00389577, -1.01893}, // layer 6 {20.5805, 0.00850503, 0.00355415, -1.01724} // layer 7 }; 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.9262, 0.00468308, 0.00263345, -1.0129}, // layer 1 {19.9622, 0.0106813, 0.00387404, -1.01863}, // layer 2 {19.9228, 0.00663133, 0.00230232, -1.011}, // layer 3 {20.0525, 0.0105329, 0.00372706, -1.01789}, // layer 4 {20.3419, 0.00989419, 0.00392362, -1.01898}, // layer 5 {20.4898, 0.0103703, 0.00429341, -1.02085}, // layer 6 {20.7409, 0.0298875, 0.0127798, -1.06358} // layer 7 }; 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]); }