#include using namespace std; #define NLAYERS_BCAL 10 double BCAL_TimeWalkUp(double fADC, int layer) { double tw_par[NLAYERS_BCAL][4] ={ {9.77506, 0.0248423, 0.00468726, -1.01733}, // layer 1 {9.82271, 0.0239426, 0.00440951, -1.0161}, // layer 2 {9.8671, 0.0239597, 0.00430626, -1.01556}, // layer 3 {9.97379, 0.0183545, 0.00336142, -1.01212}, // layer 4 {9.99824, 0.0192217, 0.00341854, -1.01223}, // layer 5 {10.0654, 0.0199042, 0.00352261, -1.01257}, // layer 6 {10.1, 0.0206224, 0.00354004, -1.01253}, // layer 7 {10.2542, 0.0211858, 0.00379478, -1.01354}, // layer 8 {10.4554, 0.0207255, 0.00397033, -1.01435}, // layer 9 {10.6118, 0.0191795, 0.00383877, -1.014} // 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] ={ {27.8803, 0.0229673, 0.00556915, -1.02082}, // layer 1 {27.4315, 0.0572202, 0.0103977, -1.0376}, // layer 2 {27.4645, 0.0346074, 0.00625382, -1.02234}, // layer 3 {27.4966, 0.0251332, 0.00449258, -1.01594}, // layer 4 {27.6614, 0.0322858, 0.00610766, -1.02202}, // layer 5 {27.7695, 0.0271855, 0.00523922, -1.01889}, // layer 6 {27.9088, 0.0390259, 0.00773503, -1.02821}, // layer 7 {28.1315, 0.0186358, 0.00404496, -1.0148}, // layer 8 {28.4263, 0.0130504, 0.00322035, -1.012}, // layer 9 {28.72, 0.0137252, 0.00378524, -1.01432} // 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]); }