#include using namespace std; #define NLAYERS_BCAL 3 double BCAL_TimeWalkUp(double fADC, int layer) { double tw_par[NLAYERS_BCAL][4] ={ {36.6348, 0.0417877, 0.00632239, -1.02227}, // layer 1 {38.9487, 0.0106758, 0.00378992, -1.01469}, // layer 2 {36.7997, 0.0203829, 0.00356664, -1.01317} // layer 3 }; 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.7798, 0.0295731, 0.00457654, -1.01643}, // layer 1 {16.8929, 0.0198788, 0.00349888, -1.01279}, // layer 2 {17.405, 0.0190346, 0.00404882, -1.01537} // layer 3 }; 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]); }