15#include <fairlogger/Logger.h>
25constexpr double kDeltaRayCut = 10000;
30constexpr double kXeEnergy[31] = {12.191, 12.589, 15.849, 19.953, 25.119, 31.623, 39.811, 50.119, 63.096, 79.433, 100, 125.89, 158.49, 199.53, 251.19, 316.23, 398.11, 501.19, 630.96, 794.33, 1000, 1258.9, 1584.9, 1995.3, 2511.9, 3162.3, 3981.1, 5011.9, 6309.6, 7943.3, 10000};
31constexpr double kXeCollisionsPerCm[31] = {3169.21, 2138.01, 1335.37, 766.94, 406.804, 206.947, 109.762, 67.1239, 50.0173, 44.2345, 43.3844, 44.6683, 46.8794, 49.5104, 52.2097, 54.4158, 56.0136, 57.159, 57.9521, 58.4512, 58.7541, 58.9436, 59.0677, 59.1368, 59.1718, 59.1889, 59.197, 59.2006, 59.2022, 59.2028, 59.2031};
32constexpr double kXeRestrictedDEdx[31] = {292507, 198636, 124651, 71843.3, 38210.5, 19478.9, 10347.8, 6336.06, 4726.44, 4184.25, 4107.61, 4232.18, 4443.12, 4690.79, 4951.45, 5208.33, 5454.25, 5685.98, 5897.58, 6085.11, 6249.98, 6391.66, 6508.87, 6591.46, 6645.77, 6680.04, 6700.21, 6710.87, 6715.9, 6718.08, 6718.98};
33constexpr float kXeFractionAbove[31][31] = {
34 {1, 0.97153, 0.72262, 0.52171, 0.40152, 0.33137, 0.2899, 0.26152, 0.23989, 0.21232, 0.15153, 0.093752, 0.07254, 0.060813, 0.050836, 0.0421, 0.034771, 0.028948, 0.024297, 0.018761, 0.014504, 0.01119, 0.0085655, 0.0065282, 0.0048584, 0.00352, 0.0024333, 0.0015685, 0.00095822, 0.00044041, 0},
35 {1, 0.97156, 0.72276, 0.52206, 0.40274, 0.33398, 0.29405, 0.26712, 0.24668, 0.21917, 0.15457, 0.092924, 0.072114, 0.061525, 0.052307, 0.043959, 0.036831, 0.03117, 0.026624, 0.019912, 0.014901, 0.011085, 0.0082296, 0.006147, 0.0045158, 0.003264, 0.0022793, 0.0015009, 0.00089382, 0.00040144, 0},
36 {1, 0.97158, 0.72286, 0.5223, 0.40363, 0.33586, 0.29706, 0.27117, 0.2516, 0.22413, 0.15676, 0.092324, 0.071805, 0.062039, 0.05337, 0.045303, 0.03832, 0.032775, 0.028305, 0.020743, 0.015187, 0.011008, 0.0079862, 0.0058711, 0.004268, 0.0030788, 0.002168, 0.0014519, 0.00084722, 0.00037325, 0},
37 {1, 0.9716, 0.72293, 0.52249, 0.40429, 0.33727, 0.29932, 0.27422, 0.25529, 0.22785, 0.15841, 0.091871, 0.071571, 0.062425, 0.054169, 0.046314, 0.039441, 0.033984, 0.029571, 0.021369, 0.015401, 0.01095, 0.0078025, 0.0056632, 0.0040812, 0.0029393, 0.0020841, 0.001415, 0.00081212, 0.00035202, 0},
38 {1, 0.97161, 0.72299, 0.52263, 0.40481, 0.33837, 0.30106, 0.27657, 0.25815, 0.23073, 0.15969, 0.091521, 0.071391, 0.062723, 0.054786, 0.047093, 0.040305, 0.034915, 0.030546, 0.021851, 0.015567, 0.010904, 0.0076608, 0.0055028, 0.0039372, 0.0028317, 0.0020194, 0.0013866, 0.00078504, 0.00033565, 0},
39 {1, 0.97162, 0.72303, 0.52274, 0.4052, 0.33921, 0.30241, 0.27839, 0.26036, 0.23296, 0.16067, 0.091249, 0.071251, 0.062953, 0.055263, 0.047698, 0.040974, 0.035637, 0.031302, 0.022224, 0.015695, 0.010869, 0.0075507, 0.0053783, 0.0038255, 0.0027482, 0.0019692, 0.0013645, 0.00076404, 0.00032296, 0},
40 {1, 0.97163, 0.72307, 0.52282, 0.40551, 0.33986, 0.30345, 0.27979, 0.26206, 0.23467, 0.16143, 0.09104, 0.071143, 0.063131, 0.055631, 0.048163, 0.04149, 0.036193, 0.031884, 0.022511, 0.015793, 0.010842, 0.0074659, 0.0052824, 0.0037395, 0.002684, 0.0019306, 0.0013475, 0.00074787, 0.00031318, 0},
41 {1, 0.97163, 0.72308, 0.52288, 0.40574, 0.34038, 0.30427, 0.2809, 0.2634, 0.23602, 0.16203, 0.090875, 0.071058, 0.06327, 0.05592, 0.048529, 0.041896, 0.036631, 0.032342, 0.022738, 0.01587, 0.01082, 0.0073991, 0.0052068, 0.0036717, 0.0026334, 0.0019001, 0.0013341, 0.00073512, 0.00030547, 0},
42 {1, 0.97163, 0.72308, 0.52292, 0.40595, 0.34082, 0.30498, 0.28186, 0.26457, 0.23721, 0.16255, 0.090729, 0.070982, 0.063392, 0.056173, 0.048849, 0.042251, 0.037014, 0.032744, 0.022936, 0.015938, 0.010801, 0.0073403, 0.0051404, 0.0036121, 0.0025889, 0.0018734, 0.0013223, 0.00072392, 0.00029871, 0},
43 {1, 0.97162, 0.72303, 0.52293, 0.40612, 0.34124, 0.30566, 0.28279, 0.26569, 0.23834, 0.16305, 0.090585, 0.070907, 0.063507, 0.056416, 0.049157, 0.042593, 0.037383, 0.03313, 0.023127, 0.016003, 0.010782, 0.0072834, 0.0050763, 0.0035547, 0.002546, 0.0018475, 0.0013109, 0.00071312, 0.00029219, 0},
44 {1, 0.97157, 0.72288, 0.52288, 0.40626, 0.34161, 0.30629, 0.28365, 0.26675, 0.23941, 0.16352, 0.090442, 0.070831, 0.063614, 0.056645, 0.049449, 0.042917, 0.037734, 0.033498, 0.023307, 0.016064, 0.010764, 0.0072286, 0.0050147, 0.0034995, 0.0025048, 0.0018227, 0.0013, 0.00070274, 0.00028593, 0},
45 {1, 0.97146, 0.7225, 0.52267, 0.40629, 0.3419, 0.30682, 0.28441, 0.26768, 0.24035, 0.16392, 0.090298, 0.070752, 0.063704, 0.056848, 0.049711, 0.04321, 0.038051, 0.033832, 0.023471, 0.016118, 0.010745, 0.0071772, 0.0049573, 0.0034482, 0.0024666, 0.0017997, 0.0012897, 0.00069309, 0.00028013, 0},
46 {1, 0.97115, 0.72156, 0.52212, 0.40612, 0.34202, 0.30719, 0.28498, 0.26843, 0.24112, 0.16421, 0.090136, 0.070658, 0.063765, 0.057013, 0.049931, 0.04346, 0.038325, 0.034122, 0.02361, 0.016161, 0.010725, 0.0071287, 0.0049041, 0.0034011, 0.0024314, 0.0017784, 0.0012801, 0.0006842, 0.00027482, 0},
47 {1, 0.97023, 0.71935, 0.52083, 0.40553, 0.34185, 0.30729, 0.2853, 0.26891, 0.24162, 0.16433, 0.08993, 0.07053, 0.063779, 0.057124, 0.050096, 0.043656, 0.038546, 0.034359, 0.02372, 0.01619, 0.010701, 0.007081, 0.0048537, 0.0033569, 0.0023985, 0.0017583, 0.0012707, 0.00067585, 0.00026992, 0},
48 {1, 0.96868, 0.71643, 0.5196, 0.40534, 0.34217, 0.30787, 0.28605, 0.26978, 0.24245, 0.16466, 0.089894, 0.070542, 0.063907, 0.057328, 0.050336, 0.043912, 0.038814, 0.034635, 0.023862, 0.016246, 0.010699, 0.0070516, 0.0048176, 0.0033236, 0.0023736, 0.0017435, 0.0012647, 0.00066964, 0.00026605, 0},
49 {1, 0.96816, 0.71678, 0.52191, 0.40853, 0.34563, 0.31137, 0.28953, 0.27321, 0.24554, 0.16646, 0.09075, 0.071274, 0.064679, 0.058103, 0.051072, 0.044597, 0.039459, 0.035243, 0.024238, 0.016464, 0.010807, 0.0070977, 0.0048346, 0.0033278, 0.0023756, 0.0017482, 0.0012723, 0.00067093, 0.00026528, 0},
50 {1, 0.96831, 0.7197, 0.52714, 0.4147, 0.352, 0.31766, 0.29567, 0.27915, 0.25075, 0.16957, 0.092488, 0.072744, 0.066121, 0.059476, 0.052333, 0.045739, 0.040505, 0.036208, 0.024861, 0.016854, 0.011031, 0.0072214, 0.0049055, 0.0033696, 0.0024044, 0.0017725, 0.0012939, 0.00067977, 0.00026758, 0},
51 {1, 0.96864, 0.72318, 0.533, 0.42166, 0.35932, 0.32497, 0.30283, 0.28605, 0.25657, 0.173, 0.094709, 0.074682, 0.067995, 0.061243, 0.053942, 0.047187, 0.041823, 0.037414, 0.025652, 0.01736, 0.011333, 0.0073974, 0.0050127, 0.0034367, 0.0024514, 0.00181, 0.0013249, 0.00069371, 0.00027195, 0},
52 {1, 0.96895, 0.72611, 0.53792, 0.42759, 0.36567, 0.33142, 0.30922, 0.29219, 0.2614, 0.17609, 0.097137, 0.076905, 0.070146, 0.063272, 0.055794, 0.048853, 0.043337, 0.038794, 0.026564, 0.01795, 0.011692, 0.0076122, 0.0051468, 0.0035226, 0.0025118, 0.0018574, 0.0013631, 0.00071145, 0.00027785, 0},
53 {1, 0.96917, 0.72811, 0.54127, 0.43167, 0.3701, 0.33597, 0.31377, 0.29655, 0.26482, 0.17875, 0.099594, 0.079256, 0.07244, 0.065454, 0.0578, 0.050671, 0.044992, 0.040301, 0.027563, 0.018604, 0.012096, 0.0078585, 0.0053031, 0.0036241, 0.0025835, 0.001913, 0.0014072, 0.00073238, 0.00028501, 0},
54 {1, 0.96931, 0.72937, 0.5434, 0.43428, 0.37295, 0.33892, 0.31675, 0.29944, 0.26728, 0.181, 0.10187, 0.081495, 0.074647, 0.067582, 0.05979, 0.0525, 0.046671, 0.041828, 0.028577, 0.019279, 0.012521, 0.0081222, 0.0054728, 0.0037355, 0.0026625, 0.0019741, 0.0014554, 0.00075542, 0.00029303, 0},
55 {1, 0.9694, 0.73019, 0.54478, 0.43597, 0.37481, 0.34086, 0.31872, 0.30138, 0.26907, 0.18281, 0.10376, 0.083399, 0.076539, 0.069434, 0.061557, 0.054159, 0.048215, 0.043219, 0.029509, 0.019917, 0.012936, 0.0083866, 0.0056463, 0.0038511, 0.0027451, 0.002038, 0.0015056, 0.00077961, 0.0003015, 0},
56 {1, 0.96946, 0.73073, 0.5457, 0.43711, 0.37606, 0.34217, 0.32006, 0.30272, 0.27038, 0.18419, 0.10525, 0.0849, 0.07804, 0.070919, 0.063004, 0.055548, 0.049536, 0.044355, 0.030253, 0.020452, 0.013303, 0.0086328, 0.0058136, 0.0039656, 0.0028281, 0.0021026, 0.0015564, 0.00080422, 0.00031018, 0},
57 {1, 0.9695, 0.73104, 0.54621, 0.43774, 0.37676, 0.34291, 0.32082, 0.30349, 0.27114, 0.18501, 0.10613, 0.085798, 0.07894, 0.071815, 0.063883, 0.056402, 0.050356, 0.045071, 0.030767, 0.020846, 0.013593, 0.0088419, 0.005964, 0.0040736, 0.0029086, 0.0021661, 0.0016065, 0.00082875, 0.00031893, 0},
58 {1, 0.96952, 0.7312, 0.54648, 0.43807, 0.37712, 0.34328, 0.3212, 0.30388, 0.27154, 0.18544, 0.1066, 0.08627, 0.079415, 0.072288, 0.064351, 0.05686, 0.050799, 0.045468, 0.031078, 0.0211, 0.013794, 0.0089988, 0.006085, 0.0041663, 0.0029809, 0.0022246, 0.0016531, 0.00085204, 0.00032738, 0},
59 {1, 0.96953, 0.73127, 0.5466, 0.43823, 0.3773, 0.34347, 0.32139, 0.30407, 0.27173, 0.18565, 0.10683, 0.086507, 0.079652, 0.072525, 0.064586, 0.057091, 0.051024, 0.045675, 0.03125, 0.021247, 0.013919, 0.0091022, 0.0061704, 0.0042361, 0.0030384, 0.0022728, 0.0016923, 0.00087224, 0.00033495, 0},
60 {1, 0.96953, 0.73131, 0.54667, 0.4383, 0.37738, 0.34356, 0.32148, 0.30416, 0.27183, 0.18575, 0.10694, 0.08662, 0.079766, 0.07264, 0.0647, 0.057204, 0.051134, 0.045777, 0.031338, 0.021326, 0.013988, 0.0091625, 0.0062227, 0.0042812, 0.0030772, 0.0023064, 0.0017202, 0.00088737, 0.00034092, 0},
61 {1, 0.96953, 0.73132, 0.54669, 0.43834, 0.37742, 0.34359, 0.32153, 0.30421, 0.27187, 0.1858, 0.10699, 0.086672, 0.079819, 0.072692, 0.064752, 0.057255, 0.051185, 0.045825, 0.031381, 0.021365, 0.014022, 0.0091936, 0.0062504, 0.0043058, 0.003099, 0.0023259, 0.0017366, 0.00089673, 0.00034483, 0},
62 {1, 0.96953, 0.73133, 0.5467, 0.43835, 0.37743, 0.34361, 0.32154, 0.30422, 0.27189, 0.18582, 0.10701, 0.086695, 0.079841, 0.072715, 0.064775, 0.057278, 0.051207, 0.045846, 0.0314, 0.021382, 0.014038, 0.009208, 0.0062634, 0.0043175, 0.0031096, 0.0023354, 0.0017447, 0.00090155, 0.00034693, 0},
63 {1, 0.96953, 0.73133, 0.54671, 0.43836, 0.37744, 0.34362, 0.32155, 0.30423, 0.2719, 0.18583, 0.10702, 0.086704, 0.079851, 0.072724, 0.064784, 0.057287, 0.051216, 0.045855, 0.031408, 0.021389, 0.014045, 0.0092141, 0.006269, 0.0043226, 0.0031142, 0.0023396, 0.0017483, 0.00090374, 0.00034791, 0},
64 {1, 0.96953, 0.73134, 0.54671, 0.43836, 0.37744, 0.34362, 0.32155, 0.30423, 0.2719, 0.18583, 0.10703, 0.086708, 0.079855, 0.072728, 0.064788, 0.057291, 0.05122, 0.045858, 0.031411, 0.021392, 0.014048, 0.0092167, 0.0062713, 0.0043247, 0.0031161, 0.0023413, 0.0017499, 0.00090466, 0.00034833, 0},
67constexpr double kArEnergy[30] = {13.688, 15.849, 19.953, 25.119, 31.623, 39.811, 50.119, 63.096, 79.433, 100, 125.89, 158.49, 199.53, 251.19, 316.23, 398.11, 501.19, 630.96, 794.33, 1000, 1258.9, 1584.9, 1995.3, 2511.9, 3162.3, 3981.1, 5011.9, 6309.6, 7943.3, 10000};
68constexpr double kArCollisionsPerCm[31] = {3724.53, 2226.97, 1197.5, 588.316, 276.252, 131.995, 68.6451, 41.8075, 31.1234, 27.5122, 26.973, 27.7608, 29.1231, 30.7457, 32.5214, 34.4369, 35.8399, 36.6344, 37.0882, 37.3632, 37.5381, 37.6497, 37.7155, 37.7489, 37.765, 37.7726, 37.7761, 37.7778, 37.7785, 37.7788, 37.7789};
69constexpr double kArRestrictedDEdx[31] = {293869, 169704, 88909.5, 42809.7, 19786.1, 9336.67, 4808.6, 2906.03, 2148.6, 1886.66, 1837.75, 1879.93, 1960.88, 2058.29, 2162.73, 2269.49, 2365.28, 2447.45, 2519.75, 2583.85, 2638.98, 2683.33, 2715.75, 2737.35, 2751.56, 2760.89, 2766.78, 2770.17, 2771.91, 2772.71, 2773.05};
70constexpr float kArFractionAbove[31][30] = {
71 {1, 0.98121, 0.75234, 0.51, 0.32696, 0.22817, 0.18328, 0.15014, 0.12279, 0.10098, 0.083992, 0.070972, 0.061105, 0.052883, 0.039929, 0.030061, 0.022953, 0.017544, 0.013418, 0.010354, 0.0079634, 0.0060835, 0.0045964, 0.0034072, 0.002458, 0.0017487, 0.0011717, 0.00069875, 0.00031243, 0},
72 {1, 0.98109, 0.74989, 0.50468, 0.31972, 0.2213, 0.17835, 0.14688, 0.1208, 0.099974, 0.083815, 0.071531, 0.062338, 0.054525, 0.04026, 0.029495, 0.021971, 0.016357, 0.012216, 0.0092777, 0.0070637, 0.0053708, 0.0040592, 0.0030256, 0.0022092, 0.0015475, 0.001024, 0.00060526, 0.00026891, 0},
73 {1, 0.981, 0.74811, 0.50081, 0.31446, 0.21632, 0.17477, 0.14451, 0.11936, 0.099244, 0.083684, 0.071935, 0.063231, 0.055714, 0.040498, 0.029082, 0.021258, 0.015496, 0.011343, 0.0084965, 0.0064107, 0.0048535, 0.0036693, 0.0027486, 0.0020286, 0.0014014, 0.00091679, 0.00053741, 0.00023732, 0},
74 {1, 0.98093, 0.74677, 0.4979, 0.31049, 0.21255, 0.17206, 0.14272, 0.11827, 0.098692, 0.083585, 0.072239, 0.063904, 0.056611, 0.040677, 0.02877, 0.020718, 0.014845, 0.010684, 0.0079066, 0.0059176, 0.0044628, 0.0033748, 0.0025394, 0.0018923, 0.0012912, 0.00083585, 0.00048617, 0.00021347, 0},
75 {1, 0.98088, 0.74574, 0.49564, 0.30742, 0.20964, 0.16997, 0.14134, 0.11742, 0.098265, 0.083507, 0.072473, 0.064423, 0.057304, 0.040815, 0.028528, 0.0203, 0.014342, 0.010174, 0.0074508, 0.0055366, 0.004161, 0.0031473, 0.0023777, 0.0017869, 0.001206, 0.0007733, 0.00044658, 0.00019504, 0},
76 {1, 0.98084, 0.74493, 0.49389, 0.30504, 0.20738, 0.16834, 0.14026, 0.11677, 0.097933, 0.083447, 0.072654, 0.064826, 0.057842, 0.040921, 0.028339, 0.019976, 0.013951, 0.0097788, 0.0070968, 0.0052406, 0.0039266, 0.0029706, 0.0022522, 0.001705, 0.0011398, 0.00072473, 0.00041584, 0.00018073, 0},
77 {1, 0.98081, 0.74431, 0.49254, 0.3032, 0.20564, 0.16709, 0.13943, 0.11626, 0.097676, 0.0834, 0.072794, 0.065137, 0.058256, 0.041003, 0.028194, 0.019725, 0.013649, 0.0094739, 0.0068239, 0.0050126, 0.0037459, 0.0028344, 0.0021554, 0.0016419, 0.0010888, 0.00068729, 0.00039214, 0.0001697, 0},
78 {1, 0.98079, 0.74381, 0.49147, 0.30175, 0.20426, 0.1661, 0.13878, 0.11586, 0.097474, 0.083363, 0.072904, 0.065381, 0.058582, 0.041068, 0.028079, 0.019528, 0.013411, 0.0092333, 0.0066087, 0.0048326, 0.0036034, 0.002727, 0.0020791, 0.0015921, 0.0010485, 0.00065776, 0.00037345, 0.000161, 0},
79 {1, 0.98076, 0.74337, 0.49052, 0.30047, 0.20305, 0.16523, 0.1382, 0.11551, 0.097295, 0.083329, 0.072999, 0.065595, 0.058868, 0.041124, 0.027978, 0.019354, 0.013202, 0.009022, 0.0064196, 0.0046746, 0.0034782, 0.0026326, 0.002012, 0.0015484, 0.0010132, 0.00063182, 0.00035704, 0.00015335, 0},
80 {1, 0.98074, 0.74291, 0.48958, 0.29923, 0.20188, 0.16439, 0.13764, 0.11517, 0.097121, 0.083295, 0.07309, 0.065801, 0.059143, 0.041177, 0.02788, 0.019186, 0.013001, 0.0088181, 0.0062372, 0.0045222, 0.0033574, 0.0025416, 0.0019473, 0.0015062, 0.0009791, 0.0006068, 0.0003412, 0.00014598, 0},
81 {1, 0.9807, 0.7424, 0.48862, 0.29801, 0.20075, 0.16358, 0.1371, 0.11484, 0.09695, 0.083259, 0.073174, 0.065994, 0.059403, 0.041226, 0.027785, 0.019025, 0.012807, 0.0086226, 0.0060623, 0.004376, 0.0032417, 0.0024543, 0.0018853, 0.0014658, 0.00094641, 0.00058282, 0.00032603, 0.00013892, 0},
82 {1, 0.98065, 0.74177, 0.48761, 0.29682, 0.19968, 0.16281, 0.13659, 0.11452, 0.096783, 0.083218, 0.073244, 0.066166, 0.059638, 0.041268, 0.027695, 0.018874, 0.012627, 0.0084416, 0.0059006, 0.004241, 0.0031347, 0.0023737, 0.001828, 0.0014284, 0.00091621, 0.00056067, 0.00031202, 0.0001324, 0},
83 {1, 0.98054, 0.74081, 0.48637, 0.2956, 0.19864, 0.16207, 0.13609, 0.1142, 0.096609, 0.08316, 0.07329, 0.066305, 0.059834, 0.041295, 0.027607, 0.018734, 0.012462, 0.0082767, 0.0057536, 0.0041184, 0.0030377, 0.0023006, 0.001776, 0.0013944, 0.00088882, 0.00054061, 0.00029934, 0.00012651, 0},
84 {1, 0.98028, 0.73893, 0.48448, 0.29413, 0.19755, 0.16129, 0.13556, 0.11385, 0.096392, 0.083058, 0.073286, 0.066389, 0.059973, 0.041294, 0.027512, 0.018598, 0.012308, 0.0081245, 0.005619, 0.0040065, 0.0029493, 0.002234, 0.0017285, 0.0013632, 0.00086383, 0.00052237, 0.00028784, 0.00012116, 0},
85 {1, 0.97927, 0.73454, 0.48092, 0.29193, 0.19616, 0.1603, 0.13484, 0.11334, 0.096043, 0.082834, 0.073167, 0.066359, 0.060002, 0.041228, 0.027384, 0.018447, 0.012151, 0.0079763, 0.0054903, 0.0039006, 0.002866, 0.0021711, 0.0016835, 0.0013333, 0.00084022, 0.00050531, 0.00027714, 0.00011622, 0},
86 {1, 0.97113, 0.72438, 0.47406, 0.28827, 0.19412, 0.15885, 0.13376, 0.11254, 0.095446, 0.082393, 0.07285, 0.066142, 0.059856, 0.041051, 0.027191, 0.018261, 0.011977, 0.0078218, 0.0053602, 0.0037953, 0.0027836, 0.002109, 0.0016387, 0.0013029, 0.00081682, 0.00048869, 0.00026683, 0.00011148, 0},
87 {1, 0.96445, 0.71843, 0.47112, 0.28776, 0.19466, 0.15964, 0.13463, 0.1134, 0.096277, 0.083191, 0.073626, 0.066914, 0.060598, 0.041491, 0.027416, 0.01836, 0.011996, 0.0077973, 0.0053216, 0.003756, 0.0027502, 0.0020839, 0.0016223, 0.0012946, 0.0008077, 0.00048086, 0.00026144, 0.00010884, 0},
88 {1, 0.96209, 0.71747, 0.47222, 0.29025, 0.19763, 0.16259, 0.13741, 0.11595, 0.098583, 0.085285, 0.075559, 0.068737, 0.062288, 0.042584, 0.02808, 0.018759, 0.012214, 0.0079049, 0.0053746, 0.0037822, 0.002765, 0.0020954, 0.0016342, 0.0013086, 0.00081272, 0.00048158, 0.00026077, 0.00010819, 0},
89 {1, 0.96132, 0.71807, 0.4744, 0.2935, 0.20125, 0.16619, 0.14087, 0.11917, 0.10152, 0.087973, 0.078041, 0.071066, 0.064431, 0.04399, 0.028961, 0.019309, 0.012533, 0.0080808, 0.0054752, 0.0038424, 0.0028049, 0.0021259, 0.0016608, 0.0013343, 0.0008251, 0.00048675, 0.00026254, 0.00010856, 0},
90 {1, 0.96111, 0.71901, 0.47655, 0.29649, 0.20459, 0.16958, 0.14419, 0.12235, 0.10452, 0.090767, 0.080653, 0.07353, 0.066682, 0.045478, 0.029915, 0.019918, 0.012898, 0.0082889, 0.005599, 0.0039195, 0.0028574, 0.0021659, 0.0016949, 0.0013658, 0.0008412, 0.00049416, 0.00026553, 0.00010945, 0},
91 {1, 0.9611, 0.71987, 0.47831, 0.29888, 0.20727, 0.17233, 0.14694, 0.12506, 0.10714, 0.093277, 0.083043, 0.075806, 0.068738, 0.046859, 0.030833, 0.020524, 0.013271, 0.0085089, 0.0057334, 0.0040051, 0.0029165, 0.0022111, 0.001733, 0.0014005, 0.00085932, 0.00050279, 0.0002692, 0.00011062, 0},
92 {1, 0.96114, 0.72052, 0.47958, 0.30061, 0.20921, 0.17434, 0.14898, 0.12709, 0.10914, 0.095234, 0.084941, 0.077636, 0.070309, 0.047964, 0.031612, 0.021066, 0.01362, 0.0087246, 0.0058698, 0.0040943, 0.0029791, 0.0022592, 0.0017734, 0.0014372, 0.00087868, 0.00051217, 0.00027329, 0.00011196, 0},
93 {1, 0.96117, 0.72094, 0.48038, 0.30169, 0.21043, 0.1756, 0.15026, 0.12839, 0.11044, 0.096516, 0.086199, 0.078862, 0.071305, 0.048715, 0.032182, 0.021489, 0.013912, 0.0089184, 0.0059994, 0.0041827, 0.0030427, 0.0023088, 0.0018151, 0.0014748, 0.00089878, 0.00052205, 0.00027766, 0.00011343, 0},
94 {1, 0.9612, 0.72115, 0.48079, 0.30225, 0.21107, 0.17626, 0.15094, 0.12907, 0.11112, 0.097195, 0.086869, 0.079517, 0.071861, 0.049162, 0.032544, 0.021776, 0.014127, 0.0090736, 0.0061114, 0.0042641, 0.003104, 0.0023577, 0.0018567, 0.0015123, 0.0009191, 0.00053218, 0.00028221, 0.00011498, 0},
95 {1, 0.96121, 0.72126, 0.481, 0.30253, 0.21138, 0.17658, 0.15127, 0.1294, 0.11146, 0.097531, 0.087202, 0.079845, 0.072148, 0.049405, 0.032751, 0.02195, 0.014267, 0.0091834, 0.0061975, 0.0043317, 0.0031581, 0.0024025, 0.0018956, 0.0015476, 0.00093862, 0.00054212, 0.00028674, 0.00011654, 0},
96 {1, 0.96121, 0.72131, 0.4811, 0.30266, 0.21152, 0.17674, 0.15142, 0.12956, 0.11162, 0.097693, 0.087363, 0.080004, 0.072291, 0.049531, 0.032863, 0.022048, 0.01435, 0.0092537, 0.0062567, 0.0043817, 0.0032006, 0.0024394, 0.0019285, 0.0015778, 0.00095596, 0.00055126, 0.00029102, 0.00011805, 0},
97 {1, 0.96122, 0.72134, 0.48114, 0.30272, 0.2116, 0.17681, 0.1515, 0.12964, 0.1117, 0.09777, 0.087441, 0.080081, 0.072361, 0.049594, 0.032921, 0.022101, 0.014397, 0.009295, 0.0062934, 0.0044142, 0.0032296, 0.0024656, 0.0019524, 0.0016001, 0.00096951, 0.00055882, 0.00029473, 0.00011941, 0},
98 {1, 0.96122, 0.72135, 0.48116, 0.30275, 0.21163, 0.17684, 0.15153, 0.12967, 0.11173, 0.097807, 0.087477, 0.080117, 0.072395, 0.049625, 0.03295, 0.022127, 0.014421, 0.0093171, 0.0063135, 0.0044326, 0.0032466, 0.0024813, 0.0019671, 0.0016139, 0.00097843, 0.00056414, 0.00029751, 0.00012048, 0},
99 {1, 0.96122, 0.72135, 0.48117, 0.30276, 0.21164, 0.17686, 0.15155, 0.12969, 0.11175, 0.097823, 0.087493, 0.080133, 0.07241, 0.049639, 0.032963, 0.02214, 0.014433, 0.0093278, 0.0063234, 0.0044418, 0.0032552, 0.0024894, 0.0019747, 0.0016211, 0.00098334, 0.00056724, 0.00029923, 0.00012118, 0},
100 {1, 0.96122, 0.72136, 0.48118, 0.30277, 0.21165, 0.17687, 0.15156, 0.1297, 0.11176, 0.09783, 0.0875, 0.08014, 0.072416, 0.049645, 0.032969, 0.022145, 0.014438, 0.0093325, 0.0063278, 0.004446, 0.0032591, 0.0024931, 0.0019782, 0.0016245, 0.00098568, 0.00056878, 0.00030012, 0.00012156, 0},
101 {1, 0.96122, 0.72136, 0.48118, 0.30277, 0.21165, 0.17687, 0.15156, 0.1297, 0.11176, 0.097832, 0.087502, 0.080143, 0.072419, 0.049648, 0.032971, 0.022148, 0.01444, 0.0093345, 0.0063297, 0.0044477, 0.0032607, 0.0024946, 0.0019797, 0.0016259, 0.0009867, 0.00056946, 0.00030053, 0.00012174, 0},
105inline void rowOf(
double betaGamma,
int&
row,
double& frac)
115 row =
static_cast<int>(
x);
121inline double interpolate(
const double* table,
int row,
double frac)
123 return std::exp((1. - frac) * std::log(table[
row]) + frac * std::log(table[
row + 1]));
135 mNEnergy = std::size(kXeEnergy);
137 mCollisions = kXeCollisionsPerCm;
138 mDEdx = kXeRestrictedDEdx;
139 mFractionAbove = &kXeFractionAbove[0][0];
141 mNEnergy = std::size(kArEnergy);
143 mCollisions = kArCollisionsPerCm;
144 mDEdx = kArRestrictedDEdx;
145 mFractionAbove = &kArFractionAbove[0][0];
147 LOG(fatal) <<
"TRD ionisation model: no collision tables for this gas mixture";
165 rowOf(betaGamma,
row, frac);
166 return interpolate(mCollisions,
row, frac);
173 rowOf(betaGamma,
row, frac);
174 return interpolate(mDEdx,
row, frac);
177double IonisationModel::sampleCollision(
int row,
double u)
const
180 const float*
f = mFractionAbove +
row * mNEnergy;
182 while (
j < mNEnergy - 1 &&
f[
j] > u) {
185 const double t = (
f[
j - 1] - u) / std::max(
f[
j - 1] -
f[
j], 1e-12f);
186 return mEnergy[
j - 1] * std::exp(
t * std::log(mEnergy[
j] / mEnergy[
j - 1]));
193 rowOf(betaGamma,
row, frac);
194 const int n = rnd.Poisson(
length * z2 * interpolate(mCollisions,
row, frac));
199 if (rnd.Rndm() < frac) {
203 for (
int i = 0;
i <
n; ++
i) {
204 energy += sampleCollision(
row, rnd.Rndm());
Timeframe settings Average distance in cm of events merged into Randomize distance around average distance of merged events Simulate correct bunch interactions instead of placing only the average number of events A value[n] sets TFlen for[n] collisions in Number of bunches per trainsort Number of bunch trains Instantaneous interaction rate Do not simulate border Total number of collisions to be placed in the interior of all time Do not select random but walk over array of events in stride steps h Event generator settings h configStandalone Use CPU for GPU Force usage of the specified GPU device no CPU fallback Continue processing after an error First event to Number of events to Number of iterations to Number of iterations to Number of initial iterations excluded from const char e
configStandalone Reconstruction rec_tpc multiplier for the combined cluster track error during track following area in cm for the search of for z only used if decrease removal by when above this local occupancy rowx Shift of TPC revert cluster flag edge bit distance to edge exceeds this ZOffset for secondary multiple of radius max P of electron K BB bands crossing max P of electron p BB bands crossing max P of electron d BB bands crossing max P of electron t BB bands crossing min accepted dEdxMaxTPC of the track Additive extra cluster error for Y2 if edge flag set Additive extra cluster error for Y2 if single set Additive extra cluster error for Y2 if or single set Additive extra cluster error for Z2 if or single set Extra errors to add to track when crossing depending on addErrorsCECrossing Inner portion of y range in sector that is not used in searching for extrapolated track candidates factor2YS for track merging factor2K for track merging Margin in cm of Y position when rejecting edge clusters based on uncorrected track Y Max fraction of shared clusters for tracklet Except pad from cluster finding if total number of charges in a fragment is above this Except pad from cluster finding if number of consecutive charges in a fragment is above this Threshold where a timebin is considered disabling the noisy pad check for that pad Treat signal above this minimum as saturated Smoothing factor for the exponential Highly Ionising Particle tail filter Number of timebins to use for the averaging Add additional custom track errors when crossing relative as fraction of Do N fit passes in final fit of< 0:reject at max -n hits") AddOptionRTC(rejectIFCLowRadiusCluster, uint8_t, 1, "", 0, "Reject clusters that get the IFC mask error during refit") AddOptionRTC(dEdxTruncLow, uint8_t, 2, "", 0, "Low truncation threshold, fraction of 128") AddOptionRTC(dEdxTruncHigh, uint8_t, 77, "", 0, "High truncation threshold, fraction of 128") AddOptionRTC(extrapolationTracking, int8_t, 1, "", 0, "Enable Extrapolation Tracking(prolong tracks to adjacent sectors to find short segments)") AddOptionRTC(disableRefitAttachment, uint8_t, 0, "", 0, "Bitmask to disable certain attachment steps during refit(1:attachment, 2:propagation, 4:loop following, 8:mirroring)") AddOptionRTC(rejectionStrategy, uint8_t, o2::gpu::GPUSettings::RejectionStrategyA, "", 0, "Enable rejection of TPC clusters for compression(0=no, 1=strategy A, 2=strategy B)") AddOptionRTC(mergeLoopersAfterburner, uint8_t, 1, "", 0, "Run afterburner for additional looper merging") AddOptionRTC(compressionTypeMask, uint8_t, o2::gpu::GPUSettings::CompressionFull, "", 0, "TPC Compression mode bits(1=truncate charge/width LSB, 2=differences, 4=track-model)") AddOptionRTC(compressionSortOrder, uint8_t, o2::gpu::GPUSettings::SortTime, "", 0, "Sort order of TPC compression(0=time, 1=pad, 2=Z-time-pad, 3=Z-pad-time, 4=no sorting(use incoming order))") AddOptionRTC(sigBitsCharge, uint8_t, 4, "", 0, "Number of significant bits for TPC cluster charge in compression mode 1") AddOptionRTC(sigBitsWidth, uint8_t, 3, "", 0, "Number of significant bits for TPC cluster width in compression mode 1") AddOptionRTC(dropLoopers, uint8_t, 0, "", 0, "Drop looping tracks starting from second loop") AddOptionRTC(mergerInterpolateErrors, uint8_t, 1, "", 0, "Use interpolation instead of extrapolation for chi2 based cluster rejection") AddOptionRTC(mergerInterpolateRejectAlsoOnCurrentPosition, uint8_t, 1, "", 0, "When using mergerInterpolateErrors, reject based on chi2 twice computed with interpolated and current track position starting from NDF > mergerNonInterpolateRejectMinNDF Merge tracks accross the central electrode Enable PID response Add sub threshold clusters in TPC dEdx computation OR mask of TPC flags that will reject the cluster in alternative dEdx Reject edge clusters based on uncorrected track Y during track fit Increase decrease removal by when on this number of pads from the edge h trd
double stepEnergy(double length, double betaGamma, double z2, TRandom &rnd) const
Energy (eV) lost in collisions along a step of length (cm) at beta*gamma, for a particle of charge sq...
static double minBetaGamma()
Lowest beta*gamma of the tables.
double restrictedDEdx(double betaGamma) const
Mean energy loss (eV/cm) below the delta-ray cut for unit charge, from the tables.
IonisationModel(SimParam::GasMixture gas)
double collisionsPerCm(double betaGamma) const
Mean number of collisions per cm for unit charge.
static double deltaRayCut()
Delta-ray production cut (eV) the tables were made for.
GLuint GLsizei GLsizei * length
constexpr double kLogBetaGammaStep
constexpr int kNBetaGamma
constexpr double kLogBetaGammaMin
a couple of static helper functions to create timestamp values for CCDB queries or override obsolete ...
LOG(info)<< "Compressed in "<< sw.CpuTime()<< " s"