#include using namespace std; #define NLAYERS_BCAL 4 double BCAL_TimeWalkUp(double fADC, int layer) { double tw_par[NLAYERS_BCAL][4] ={ {9.86295, 0.0198954, 0.00372985, -1.01378}, // layer 1 {10.0456, 0.0195591, 0.0035496, -1.01283}, // layer 2 {10.06, 0.0216301, 0.00358318, -1.01271}, // layer 3 {10.4443, 0.0335468, 0.00628372, -1.02303} // 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.4787, 0.0496359, 0.00939063, -1.03449}, // layer 1 {27.6885, 0.030683, 0.0060016, -1.02186}, // layer 2 {27.8095, 0.0348242, 0.00647549, -1.0233}, // layer 3 {28.3713, 0.0147482, 0.00352998, -1.01317} // 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]); }