#include using namespace std; #define NLAYERS_BCAL 4 double BCAL_TimeWalkUp(double fADC, int layer) { double tw_par[NLAYERS_BCAL][4] ={ {36.4987, 0.0379478, 0.00560828, -1.01967}, // layer 1 {39.5775, 0.00796625, 0.00356127, -1.01396}, // layer 2 {38.003, 0.0395248, 0.00110436, -0.999948}, // layer 3 {37.9406, 0.0392609, 0.0010617, -0.999925} // layer 4 }; 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.8955, 0.0277086, 0.0045146, -1.01619}, // layer 1 {17.2042, 0.0165858, 0.0034465, -1.01281}, // layer 2 {17.6629, 0.0118067, 0.00295763, -1.01131}, // layer 3 {18.5301, 0.00313733, 0.000998734, -1.00387} // layer 4 }; 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]); }