#include using namespace std; #define NLAYERS_BCAL 3 double BCAL_TimeWalkUp(double fADC, int layer) { double tw_par[NLAYERS_BCAL][4] ={ {9.66661, 0.0270568, 0.00453532, -1.0167}, // layer 1 {9.88835, 0.0206107, 0.00344111, -1.01237}, // layer 2 {10.0915, 0.0227255, 0.00377523, -1.01361} // 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] ={ {27.4501, 0.0493826, 0.00948627, -1.03531}, // layer 1 {27.5846, 0.035414, 0.00660355, -1.02403}, // layer 2 {27.8192, 0.028656, 0.00551971, -1.02023} // 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]); }