#include using namespace std; #define NLAYERS_BCAL 10 double BCAL_TimeWalkUp(double fADC, int layer) { double tw_par[NLAYERS_BCAL][4] ={ {36.9478, 3.90739, 0.276941, -2.17029}, // layer 1 {40.0757, 1.67702e+08, 4.72429, 1.23801e+07}, // layer 2 {33.3996, 27421, 2.18601, 877.951}, // layer 3 {-31.0274, 3.82879e+07, 2.57796, 551346}, // 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.8072, 0.494706, 0.0650147, -1.21696}, // layer 1 {16.7208, 0.486494, 0.0674743, -1.2318}, // layer 2 {18.1759, 563.462, 1.1974, -29.0828}, // layer 3 {16.8357, 435.351, 1.02232, -13.0026}, // 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]); }