#include using namespace std; #define NLAYERS_BCAL 4 double BCAL_TimeWalkUp(double fADC, int layer) { double tw_par[NLAYERS_BCAL][4] ={ {29.1663, 0.0321106, 0.00355008, -1.01143}, // layer 1 {31.5451, 0.0234379, 0.00733698, -1.02851}, // layer 2 {31.4205, 0.00818546, 0.00216114, -1.00823}, // layer 3 {30.214, 0.0384257, 0.000939981, -0.999869} // layer 4 }; 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] ={ {19.0958, 0.0267195, 0.0048418, -1.01767}, // layer 1 {19.354, 0.0150016, 0.00321645, -1.01194}, // layer 2 {20.0843, 0.0201077, 0.00605752, -1.02361}, // layer 3 {20.1563, 0.00916562, 0.00281002, -1.01091} // layer 4 }; 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]); }