#include using namespace std; #define NLAYERS_BCAL 4 double BCAL_TimeWalkUp(double fADC, int layer) { double tw_par[NLAYERS_BCAL][4] ={ {9.69006, 0.0296209, 0.0050044, -1.01845}, // layer 1 {9.88397, 0.0212018, 0.0035157, -1.01261}, // layer 2 {10.0147, 0.0219069, 0.00359382, -1.01289}, // layer 3 {10.2701, 0.0225262, 0.00395293, -1.01444} // 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] ={ {27.4665, 0.0548, 0.010536, -1.03924}, // layer 1 {27.5833, 0.0351545, 0.0065435, -1.02381}, // layer 2 {27.7025, 0.0334751, 0.00608453, -1.02198}, // layer 3 {28.0897, 0.0201333, 0.00424648, -1.01569} // 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]); }