#include using namespace std; #define NLAYERS_BCAL 5 double BCAL_TimeWalkUp(double fADC, int layer) { double tw_par[NLAYERS_BCAL][4] ={ {36.5756, 0.0341107, 0.0052416, -1.01855}, // layer 1 {37.8791, 0.0233642, 0.0057794, -1.02186}, // layer 2 {39.1838, 0.00925113, 0.00361395, -1.01414}, // layer 3 {38.2581, 0.015628, 0.00421797, -1.01617}, // layer 4 {38.2161, 0.0407042, 0.00133598, -1.00013} // 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] ={ {16.856, 0.0256693, 0.00408124, -1.01465}, // layer 1 {16.7658, 0.0275068, 0.00442635, -1.01597}, // layer 2 {16.9599, 0.021068, 0.00388385, -1.01445}, // layer 3 {17.1513, 0.0177614, 0.0034624, -1.01301}, // layer 4 {16.2306, 0.0210733, 0.00296787, -1.01076} // 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]); }