#include using namespace std; #define NLAYERS_BCAL 10 double BCAL_TimeWalkUp(double fADC, int layer) { double tw_par[NLAYERS_BCAL][4] ={ {36.7846, 3.69657, 0.24925, -1.9827}, // layer 1 {39.1531, -1.05249e+06, 3.09694, -9.12317e+06}, // layer 2 {39.169, 6.63954e+08, 5.07286, 5.46812e+07}, // layer 3 {34.9358, 1.1484e+08, 4.32796, 1.23476e+07}, // layer 4 {12.5058, 220374, 1.91536, 7777.92}, // 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.7336, 0.484488, 0.059192, -1.18507}, // layer 1 {16.7053, 0.461762, 0.0623289, -1.20992}, // layer 2 {17.8448, 50.175, 0.727138, -9.34008}, // layer 3 {18.3212, 437.618, 1.16909, -31.816}, // layer 4 {15.382, 155.889, 0.75294, -6.22477}, // 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]); }