#include using namespace std; #define NLAYERS_BCAL 10 double BCAL_tdiff(double geometric_mean, int layer) { double tw_par[NLAYERS_BCAL][7] ={ {-59.9499, 25.3377, -1.37663, -0.487454, 0.0102125, 0.0115594, -0.000863533}, // layer 1 {1700.73, -1903.47, 869.882, -208.133, 27.5439, -1.91434, 0.0546596}, // layer 2 {1939.6, -2161.72, 983.762, -234.426, 30.9031, -2.13981, 0.0608745}, // layer 3 {0, 0, 0, 0, 0, 0, 0}, // layer 4 {0, 0, 0, 0, 0, 0, 0}, // 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]))))); }