#include using namespace std; #define NLAYERS_BCAL 10 double BCAL_TimeWalkUp(double fADC, int layer) { double tw_par[NLAYERS_BCAL][4] ={ {11.1946, 4786.42, 1.62437, 63.4151}, // layer 1 {11.0453, 159.002, 0.930911, -12.5888}, // layer 2 {11.4604, 892.532, 1.28378, -23.5435}, // layer 3 {11, 11.3, 0.51, -5.15}, // layer 4 {11, 11.3, 0.51, -5.15}, // layer 5 {11, 11.3, 0.51, -5.15}, // layer 6 {11, 11.3, 0.51, -5.15}, // layer 7 {11, 11.3, 0.51, -5.15}, // layer 8 {11, 11.3, 0.51, -5.15}, // layer 9 {11, 11.3, 0.51, -5.15} // 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] ={ {27.7668, 2.5128, 0.248961, -2.17681}, // layer 1 {27.9117, 2.37798, 0.240417, -2.10372}, // layer 2 {28.5872, 35.6823, 0.712564, -8.66016}, // layer 3 {29, 34, 0.66, -5}, // layer 4 {29, 34, 0.66, -5}, // layer 5 {29, 34, 0.66, -5}, // layer 6 {29, 34, 0.66, -5}, // layer 7 {29, 34, 0.66, -5}, // layer 8 {29, 34, 0.66, -5}, // layer 9 {29, 34, 0.66, -5} // 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]); }