#include using namespace std; #define NLAYERS_BCAL 3 double BCAL_TimeWalkUp(double fADC, int layer) { double tw_par[NLAYERS_BCAL][4] ={ {9.64781, 0.0294374, 0.00503192, -1.01853}, // layer 1 {9.88054, 0.0373344, 0.00623505, -1.02279}, // layer 2 {10.0452, 0.0233865, 0.0037682, -1.01347} // 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] ={ {27.4121, 0.0206579, 0.0040136, -1.01465}, // layer 1 {27.54, 0.0304341, 0.00573342, -1.02098}, // layer 2 {27.7684, 0.0276486, 0.00515008, -1.0187} // 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]); }