#include using namespace std; #define NLAYERS_BCAL 10 double BCAL_TimeWalkUp(double fADC, int layer) { double tw_par[NLAYERS_BCAL][4] ={ {18.9481, 0.394631, 0.0747397, -1.26256}, // layer 1 {18.8913, 0.0792789, 0.0171958, -1.05491}, // layer 2 {18.5248, 0.666298, 0.0718911, -1.20172}, // layer 3 {19.3237, 0.38947, 0.0734877, -1.2575}, // layer 4 {18.9397, 0.260441, 0.0366492, -1.10454}, // layer 5 {19.3164, 0.0756342, 0.0163968, -1.05227}, // layer 6 {19.8672, 0.0983631, 0.0266604, -1.08922}, // layer 7 {40, 0.8, 0.064, -1.2}, // layer 8 {40, 0.8, 0.064, -1.2}, // layer 9 {40, 0.8, 0.064, -1.2} // layer 10 }; 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] ={ {18.8394, 0.0170437, 0.00413264, -1.01302}, // layer 1 {18.1125, 0.04527, 0.00560642, -1.01415}, // layer 2 {18.3564, 0.0487526, 0.00652681, -1.0172}, // layer 3 {19.1427, 0.0199204, 0.00452909, -1.0142}, // layer 4 {19.8346, 0.0338277, 0.0104048, -1.03418}, // layer 5 {18.6599, 0.0481108, 0.00645093, -1.01704}, // layer 6 {20.2037, 0.0935863, 0.0301207, -1.10329}, // layer 7 {17, 0.2, 0.034, -1.1}, // layer 8 {17, 0.2, 0.034, -1.1}, // layer 9 {17, 0.2, 0.034, -1.1} // layer 10 }; 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]); }