#include using namespace std; #define NLAYERS_BCAL 4 double BCAL_TimeWalkUp(double fADC, int layer) { double tw_par[NLAYERS_BCAL][4] ={ {9.77113, 0.0275914, 0.00515706, -1.01902}, // layer 1 {9.76183, 0.026563, 0.00455652, -1.01654}, // layer 2 {9.8881, 0.0210289, 0.00350459, -1.01259}, // layer 3 {10.0719, 0.0226921, 0.00372609, -1.01339} // 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] ={ {27.9314, 0.0253628, 0.0063378, -1.02388}, // layer 1 {27.4395, 0.0188497, 0.00357689, -1.01295}, // layer 2 {27.6009, 0.0363821, 0.00684778, -1.02498}, // layer 3 {27.7658, 0.0271163, 0.00503098, -1.01825} // 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]); }