#include using namespace std; #define NLAYERS_BCAL 4 double BCAL_TimeWalkUp(double fADC, int layer) { double tw_par[NLAYERS_BCAL][4] ={ {36.494, 0.0320915, 0.00519163, -1.01861}, // layer 1 {36.9479, 0.0306831, 0.00517913, -1.01853}, // layer 2 {38.9688, 0.011156, 0.00396802, -1.01536}, // layer 3 {38.1193, 0.00701985, 0.001751, -1.00661} // 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] ={ {16.9687, 0.0215658, 0.00361433, -1.01311}, // layer 1 {16.8941, 0.0266854, 0.00443075, -1.01587}, // layer 2 {16.8853, 0.0198293, 0.0034725, -1.01268}, // layer 3 {16.9538, 0.0195157, 0.00349877, -1.01301} // 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]); }