#include using namespace std; #define NLAYERS_BCAL 10 double BCAL_tdiff(double geometric_mean, int layer) { double tw_par[NLAYERS_BCAL][7] ={ {62.7149, -44.9404, 10.5769, -0.490791, -0.16016, 0.0238154, -0.000965775}, // layer 1 {-31.4525, 28.022, -7.92631, 0.504649, 0.134489, -0.023983, 0.00111193}, // layer 2 {-256.247, 205.174, -49.4403, -0.472875, 1.92289, -0.279913, 0.0126826}, // layer 3 {-637.12, 466.139, -95.1555, -7.23285, 5.22544, -0.683632, 0.0294245}, // layer 4 {-132.17, 57.7749, 0.847114, -2.34057, -0.194183, 0.122118, -0.00925161}, // layer 5 {0, 0, 0, 0, 0, 0, 0}, // layer 6 {0, 0, 0, 0, 0, 0, 0}, // layer 7 {0, 0, 0, 0, 0, 0, 0}, // layer 8 {0, 0, 0, 0, 0, 0, 0}, // layer 9 {0, 0, 0, 0, 0, 0, 0} // layer 10 }; layer = layer<1 ? 1:layer>NLAYERS_BCAL ? NLAYERS_BCAL:layer; double *p = tw_par[layer-1]; double x = log(geometric_mean); return p[0]+x*(p[1]+x*(p[2]+x*(p[3]+x*(p[4]+x*(p[5]+x*p[6]))))); }