#include using namespace std; #define NLAYERS_BCAL 10 double BCAL_TimeWalkUp(double fADC, int layer) { double tw_par[NLAYERS_BCAL][4] ={ {37.0636, 5.53491, 0.339966, -2.65583}, // layer 1 {39.8662, 3.73026e+07, 4.29863, 2.29535e+06}, // layer 2 {33.789, 1.06663e+08, 4.30645, 1.11738e+07}, // layer 3 {40, 24000, 2.5, 375}, // 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.8045, 0.507659, 0.065997, -1.22006}, // layer 1 {16.6952, 0.510511, 0.0688357, -1.23532}, // layer 2 {18.2092, 1575.21, 1.40341, -36.2449}, // layer 3 {17, 4.7, 0.25, -2}, // 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]); }