#include using namespace std; #define NLAYERS_BCAL 10 double BCAL_TimeWalkUp(double fADC, int layer) { double tw_par[NLAYERS_BCAL][4] ={ {36.5371, 0.0475503, 0.00771993, -1.02783}, // layer 1 {37.0064, 0.0385828, 0.00690121, -1.025}, // layer 2 {38.3659, 0.0117093, 0.00349999, -1.01331}, // layer 3 {39.2483, 0.00958733, 0.00372093, -1.01441}, // layer 4 {39.8467, 0.00412063, 0.00199659, -1.00781}, // layer 5 {40.2148, 0.00307443, 0.00141196, -1.00547}, // layer 6 {33.0521, 0.026405, 0.00187266, -1.006}, // layer 7 {37.917, 0.0391193, 0.00108019, -0.99991}, // layer 8 {37.8886, 0.0389313, 0.00105168, -0.999888}, // layer 9 {37.8271, 0.0369422, 0.000674362, -0.998634} // 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] ={ {16.9641, 0.0224831, 0.00375796, -1.01363}, // layer 1 {16.9371, 0.0259452, 0.00433685, -1.01544}, // layer 2 {16.8847, 0.0239139, 0.00401486, -1.01428}, // layer 3 {17.1731, 0.0200211, 0.00404331, -1.0149}, // layer 4 {17.4341, 0.0160336, 0.0037029, -1.01389}, // layer 5 {17.587, 0.0149643, 0.00361491, -1.01361}, // layer 6 {17.9464, 0.0129019, 0.00357548, -1.01363}, // layer 7 {18.39, 0.010753, 0.00345087, -1.0133}, // layer 8 {18.9087, 0.00707049, 0.00233052, -1.00893}, // layer 9 {19.2897, 0.00542829, 0.00172874, -1.00658} // 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]); }