#include using namespace std; #define NLAYERS_BCAL 7 double BCAL_TimeWalkUp(double fADC, int layer) { double tw_par[NLAYERS_BCAL][4] ={ {19.5649, 0.0144921, 0.00412302, -1.01886}, // layer 1 {19.4486, 0.0224753, 0.00567826, -1.02582}, // layer 2 {19.8961, 0.0129078, 0.00394053, -1.01818}, // layer 3 {-8.86426, 0.187964, 0.00122898, -1.001}, // layer 4 {19.2327, 0.0390805, 0.00130981, -1.00134}, // layer 5 {19.587, 0.0401941, 0.00117635, -1.00003}, // layer 6 {19.0621, 0.0376966, 0.000888297, -0.999802} // layer 7 }; 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] ={ {19.2028, 0.0158153, 0.00379168, -1.01705}, // layer 1 {19.4107, 0.0165982, 0.00412712, -1.01865}, // layer 2 {20.0347, 0.0117049, 0.00388157, -1.01806}, // layer 3 {-11.9585, 0.234983, 0.00120685, -1.00007}, // layer 4 {19.3463, 0.0388769, 0.00104411, -0.999872}, // layer 5 {19.6773, 0.0407898, 0.00116138, -1.00016}, // layer 6 {19.0662, 0.0376334, 0.000925213, -0.99979} // layer 7 }; 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]); }