#include using namespace std; #define NLAYERS_BCAL 4 double BCAL_TimeWalkUp(double fADC, int layer) { double tw_par[NLAYERS_BCAL][4] ={ {36.4729, 0.0373262, 0.00624633, -1.02254}, // layer 1 {37.1409, 0.0497018, 0.00919092, -1.03363}, // layer 2 {39.4919, 0.00864987, 0.00367477, -1.01436}, // layer 3 {37.9684, 0.0394009, 0.00104382, -0.99994} // 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] ={ {17.1473, 0.0185433, 0.00344567, -1.01262}, // layer 1 {16.987, 0.0190695, 0.00330388, -1.01178}, // layer 2 {17.224, 0.0166637, 0.00348716, -1.01297}, // layer 3 {17.6308, 0.0118973, 0.00297283, -1.01136} // 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]); }