#include using namespace std; #define NLAYERS_BCAL 10 double BCAL_TimeWalkUp(double fADC, int layer) { double tw_par[NLAYERS_BCAL][4] ={ {9.27437, 0.0371704, 0.00513824, -1.0139}, // layer 1 {9.29403, 0.165502, 0.0206394, -1.05583}, // layer 2 {9.50575, 0.0219698, 0.00343656, -1.00993}, // layer 3 {9.64297, 0.020189, 0.00327287, -1.00951}, // layer 4 {9.70173, 0.0206935, 0.00333799, -1.00968}, // layer 5 {9.74168, 0.0181827, 0.00286799, -1.0082}, // layer 6 {9.87972, 0.0168899, 0.00282895, -1.00832}, // layer 7 {10.0064, 0.0178638, 0.00306367, -1.00906}, // layer 8 {10.0441, 0.0200881, 0.003309, -1.00959}, // layer 9 {10.2399, 0.0203378, 0.0036442, -1.01087} // 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.0398, 0.0781729, 0.0113346, -1.03076}, // layer 1 {27.1438, 0.0535678, 0.00890273, -1.02617}, // layer 2 {27.214, 0.0481906, 0.00805379, -1.02374}, // layer 3 {26.7094, 0.0903681, 0.00982054, -1.02359}, // layer 4 {27.4081, 0.0443443, 0.00778323, -1.0232}, // layer 5 {27.5498, 0.0399654, 0.00740475, -1.02232}, // layer 6 {27.1021, 0.0773475, 0.00959287, -1.02484}, // layer 7 {27.8555, 0.0388154, 0.00795765, -1.02461}, // layer 8 {27.3685, 0.074721, 0.00986627, -1.02614}, // layer 9 {28.2112, 0.0356618, 0.00815502, -1.02567} // 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]); }