#include using namespace std; #define NLAYERS_BCAL 10 double BCAL_TimeWalkUp(double fADC, int layer) { double tw_par[NLAYERS_BCAL][4] ={ {24.4689, 0.118559, 0.0161874, -1.05968}, // layer 1 {25.0052, 0.0335211, 0.00553042, -1.0201}, // layer 2 {25.7607, 0.0162579, 0.00333448, -1.01227}, // layer 3 {26.888, 0.0133322, 0.00399747, -1.01526}, // layer 4 {27.7949, 0.00952864, 0.00375866, -1.01462}, // layer 5 {28.9035, 0.00432531, 0.00234555, -1.00924}, // layer 6 {25.8774, 0.039189, 0.00105767, -0.999917}, // layer 7 {25.7297, 0.0386587, 0.000941064, -0.999886}, // layer 8 {25.1295, 0.0365014, 0.000773588, -0.999785}, // layer 9 {25.9805, 0.0406005, 0.0012117, -1.00062} // 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.9389, 0.0197898, 0.00460424, -1.01732}, // layer 1 {20.9476, 0.0151238, 0.00345841, -1.01282}, // layer 2 {20.8246, 0.0237932, 0.0050572, -1.01859}, // layer 3 {21.0077, 0.0130383, 0.00314812, -1.01171}, // layer 4 {21.5006, 0.0114112, 0.00364366, -1.014}, // layer 5 {21.7593, 0.00847169, 0.00308719, -1.01196}, // layer 6 {22.4214, 0.0061373, 0.00287527, -1.01131}, // layer 7 {21.2021, 0.0388823, 0.00129348, -0.999864}, // layer 8 {21.6673, 0.0417512, 0.00154022, -1.00057}, // layer 9 {21.4763, 0.0409826, 0.00131145, -1.00041} // 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]); }