#include using namespace std; #define NLAYERS_BCAL 5 double BCAL_TimeWalkUp(double fADC, int layer) { double tw_par[NLAYERS_BCAL][4] ={ {24.9805, 0.0278666, 0.00453338, -1.01661}, // layer 1 {25.5246, 0.0235166, 0.00410265, -1.0149}, // layer 2 {27.2357, 0.0127395, 0.00411697, -1.01598}, // layer 3 {28.2421, 0.00587997, 0.0023515, -1.0092}, // layer 4 {26.0585, 0.0400372, 0.00102134, -1} // layer 5 }; 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.7664, 0.0212994, 0.00449106, -1.01672}, // layer 1 {20.4616, 0.0390584, 0.00683871, -1.02466}, // layer 2 {20.8035, 0.0146417, 0.00331052, -1.0124}, // layer 3 {21.5083, 0.0114673, 0.00362492, -1.01408}, // layer 4 {21.0726, 0.0382568, 0.00118437, -0.999816} // layer 5 }; 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]); }