#include using namespace std; #define NLAYERS_BCAL 10 double BCAL_TimeWalkUp(double fADC, int layer) { double tw_par[NLAYERS_BCAL][4] ={ {36.5184, 5.06523, 0.269083, -2.00186}, // layer 1 {37.5427, 6.05679, 0.359198, -2.8002}, // layer 2 {40.0922, 8.90128e+07, 4.58373, 4.61816e+06}, // layer 3 {30.8009, 1.53167e+07, 3.54897, 1.38732e+06}, // layer 4 {40, 24000, 2.5, 375}, // layer 5 {40, 24000, 2.5, 375}, // layer 6 {40, 24000, 2.5, 375}, // layer 7 {40, 24000, 2.5, 375}, // layer 8 {40, 24000, 2.5, 375}, // layer 9 {40, 24000, 2.5, 375} // layer 10 }; 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] ={ {16.8618, 0.415163, 0.0546921, -1.17307}, // layer 1 {16.7584, 0.438319, 0.0569545, -1.17939}, // layer 2 {16.7669, 0.546915, 0.0751966, -1.26297}, // layer 3 {18.2186, 1217.57, 1.34551, -36.066}, // layer 4 {17, 4.7, 0.25, -2}, // layer 5 {17, 4.7, 0.25, -2}, // layer 6 {17, 4.7, 0.25, -2}, // layer 7 {17, 4.7, 0.25, -2}, // layer 8 {17, 4.7, 0.25, -2}, // layer 9 {17, 4.7, 0.25, -2} // layer 10 }; 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]); }