#include using namespace std; #define NLAYERS_BCAL 10 double BCAL_TimeWalkUp(double fADC, int layer) { double tw_par[NLAYERS_BCAL][4] ={ {10.1172, 1.82854, 0.198757, -1.89158}, // layer 1 {10.1775, 2.85964, 0.24389, -2.13199}, // layer 2 {10.086, 2.03212, 0.19359, -1.79723}, // layer 3 {10.0985, 1.43913, 0.155989, -1.60085}, // layer 4 {10.1455, 1.36528, 0.149454, -1.56404}, // layer 5 {10.1691, 1.12085, 0.130817, -1.48032}, // layer 6 {10.2414, 0.978607, 0.119714, -1.43158}, // layer 7 {10.3375, 1.25541, 0.140295, -1.51838}, // layer 8 {10.4489, 1.17512, 0.137106, -1.51061}, // layer 9 {10.543, 1.26088, 0.144237, -1.54656} // 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] ={ {27.9403, 1.88635, 0.217694, -1.94835}, // layer 1 {27.6237, 0.763919, 0.113472, -1.4134}, // layer 2 {27.6211, 0.588422, 0.0907458, -1.31506}, // layer 3 {27.7273, 0.719674, 0.107197, -1.38471}, // layer 4 {27.7934, 0.761169, 0.111145, -1.40092}, // layer 5 {27.8896, 0.730487, 0.109118, -1.39196}, // layer 6 {27.8943, 0.743788, 0.10684, -1.37843}, // layer 7 {27.9955, 0.629636, 0.0968801, -1.34164}, // layer 8 {28.222, 0.859258, 0.126483, -1.47169}, // layer 9 {28.4412, 0.856501, 0.133802, -1.51418} // 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]); }