#include using namespace std; #define NLAYERS_BCAL 5 double BCAL_TimeWalkUp(double fADC, int layer) { double tw_par[NLAYERS_BCAL][4] ={ {9.65381, 0.0258323, 0.00443389, -1.0163}, // layer 1 {9.74938, 0.0198744, 0.00328255, -1.01189}, // layer 2 {9.79242, 0.0226038, 0.00350956, -1.01244}, // layer 3 {9.98953, 0.0224963, 0.00362168, -1.01291}, // layer 4 {10.2742, 0.0212644, 0.00374239, -1.01367} // layer 5 }; 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.4118, 0.0425575, 0.00811069, -1.02984}, // layer 1 {27.3729, 0.0306514, 0.00544836, -1.01965}, // layer 2 {27.5122, 0.0852309, 0.0144357, -1.05256}, // layer 3 {27.6738, 0.0337138, 0.00600266, -1.02154}, // layer 4 {28.0879, 0.0221867, 0.0046761, -1.01731} // layer 5 }; 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]); }