#include using namespace std; #define NLAYERS_BCAL 3 double BCAL_TimeWalkUp(double fADC, int layer) { double tw_par[NLAYERS_BCAL][4] ={ {36.7003, 0.0386841, 0.00659231, -1.02387}, // layer 1 {38.5017, 0.0119025, 0.00371049, -1.01422}, // layer 2 {38.015, 0.039604, 0.00103445, -0.999958} // 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] ={ {16.9523, 0.0273598, 0.00455017, -1.01636}, // layer 1 {16.9227, 0.0191912, 0.00336486, -1.01217}, // layer 2 {17.5284, 0.00955799, 0.00226256, -1.00859} // 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]); }