#include using namespace std; #define NLAYERS_BCAL 10 double BCAL_TimeWalkUp(double fADC, int layer) { double tw_par[NLAYERS_BCAL][4] ={ {24.4992, 0.0595385, 0.00833341, -1.03044}, // layer 1 {25.0186, 0.0641313, 0.0101384, -1.03709}, // layer 2 {25.5399, 0.0386625, 0.00691445, -1.02524}, // layer 3 {26.3704, 0.0164984, 0.00388471, -1.01452}, // layer 4 {27.2667, 0.0129795, 0.0041768, -1.01607}, // layer 5 {27.7408, 0.0106349, 0.00382876, -1.01482}, // layer 6 {27.9701, 0.00538923, 0.00202122, -1.00782}, // layer 7 {28.1576, 0.00587672, 0.0021397, -1.00826}, // layer 8 {29.9928, 0.00215532, 0.00132704, -1.00521}, // layer 9 {24.4608, 0.0346624, 0.000681146, -0.999746} // 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] ={ {20.7259, 0.0183792, 0.00378948, -1.01409}, // layer 1 {20.7137, 0.0250503, 0.00494698, -1.01807}, // layer 2 {20.6169, 0.0274305, 0.00516399, -1.01867}, // layer 3 {20.624, 0.0271841, 0.00532753, -1.01945}, // layer 4 {20.7771, 0.0179584, 0.00392794, -1.01452}, // layer 5 {21.2523, 0.0116823, 0.00332822, -1.01268}, // layer 6 {21.3873, 0.0111478, 0.00328854, -1.01256}, // layer 7 {21.4318, 0.0069795, 0.00209737, -1.008}, // layer 8 {21.317, 0.0123209, 0.00334875, -1.01272}, // layer 9 {23.8478, 0.00310519, 0.00224828, -1.00897} // 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]); }