#include using namespace std; #define NLAYERS_BCAL 4 double BCAL_TimeWalkUp(double fADC, int layer) { double tw_par[NLAYERS_BCAL][4] ={ {25.0659, 0.0344802, 0.00543578, -1.0198}, // layer 1 {26.623, 0.0148139, 0.0038586, -1.01466}, // layer 2 {28.0255, 0.00750369, 0.00271591, -1.01056}, // layer 3 {25.4672, 0.0376334, 0.000874755, -0.999826} // layer 4 }; 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.5819, 0.0223503, 0.00425216, -1.01556}, // layer 1 {20.7984, 0.0300995, 0.00652537, -1.02437}, // layer 2 {21.5227, 0.0119622, 0.00379055, -1.01471}, // layer 3 {21.0196, 0.0379885, 0.00115654, -0.999796} // layer 4 }; 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]); }