#include using namespace std; #define NLAYERS_BCAL 3 double BCAL_TimeWalkUp(double fADC, int layer) { double tw_par[NLAYERS_BCAL][4] ={ {13.9463, 0.0228292, 0.00414297, -1.01537}, // layer 1 {14.2548, 0.021419, 0.00355376, -1.01265}, // layer 2 {15.1572, 0.0192831, 0.00402928, -1.01493} // layer 3 }; 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] ={ {24.861, 0.0289386, 0.00609678, -1.02268}, // layer 1 {24.8072, 0.0265533, 0.00528122, -1.01925}, // layer 2 {25.0407, 0.0213277, 0.00493116, -1.01848} // layer 3 }; 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]); }