#include using namespace std; #define NLAYERS_BCAL 5 double BCAL_TimeWalkUp(double fADC, int layer) { double tw_par[NLAYERS_BCAL][4] ={ {9.82391, 0.0223491, 0.00419281, -1.01544}, // layer 1 {9.83952, 0.0188533, 0.00328287, -1.01187}, // layer 2 {9.8681, 0.0271904, 0.00434974, -1.01536}, // layer 3 {10.0427, 0.0227358, 0.00372313, -1.01318}, // layer 4 {10.4045, 0.0203515, 0.00376414, -1.01367} // 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] ={ {27.5879, 0.0832746, 0.0162511, -1.06055}, // layer 1 {27.5695, 0.0287589, 0.00565581, -1.02071}, // layer 2 {27.6598, 0.0326282, 0.00620311, -1.02253}, // layer 3 {27.8572, 0.0399421, 0.00765852, -1.02785}, // layer 4 {28.4901, 0.0172305, 0.00440097, -1.01661} // 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]); }