diff --git a/src/algorithms/pid_lut/PIDLookup.cc b/src/algorithms/pid_lut/PIDLookup.cc index b0b35d50e8..205206f9e5 100644 --- a/src/algorithms/pid_lut/PIDLookup.cc +++ b/src/algorithms/pid_lut/PIDLookup.cc @@ -81,7 +81,11 @@ void PIDLookup::process(const Input& input, const Output& output) const { int identified_pdg = 0; // unknown - if ((entry != nullptr) && ((entry->prob_electron != 0.) || (entry->prob_pion != 0.) || (entry->prob_kaon != 0.) || (entry->prob_electron != 0.))) { + bool entry_found = entry != nullptr; + bool entry_valid = (entry->prob_electron != 0.) || (entry->prob_pion != 0.) || (entry->prob_kaon != 0.) || (entry->prob_electron != 0.); + bool momentum_cut_pass = (momentum >= m_cfg.momentum_cut_min) && (momentum < m_cfg.momentum_cut_max); + + if (entry_found && entry_valid && momentum_cut_pass) { double random_unit_interval = m_dist(m_gen); trace("entry with e:pi:K:P={}:{}:{}:{}", entry->prob_electron, entry->prob_pion, entry->prob_kaon, entry->prob_proton); diff --git a/src/algorithms/pid_lut/PIDLookupConfig.h b/src/algorithms/pid_lut/PIDLookupConfig.h index 2d8e93ddab..e3f0350f93 100644 --- a/src/algorithms/pid_lut/PIDLookupConfig.h +++ b/src/algorithms/pid_lut/PIDLookupConfig.h @@ -4,6 +4,7 @@ #pragma once #include +#include namespace eicrecon { @@ -15,6 +16,8 @@ struct PIDLookupConfig { std::vector momentum_edges; std::vector polar_edges; std::vector azimuthal_binning; + double momentum_cut_max = std::numeric_limits::infinity(); + double momentum_cut_min = -std::numeric_limits::infinity(); bool azimuthal_bin_centers_in_lut {false}; bool momentum_bin_centers_in_lut {false}; bool polar_bin_centers_in_lut {false}; diff --git a/src/detectors/BTOF/BTOF.cc b/src/detectors/BTOF/BTOF.cc index ef0ba38593..5683d00107 100644 --- a/src/detectors/BTOF/BTOF.cc +++ b/src/detectors/BTOF/BTOF.cc @@ -86,6 +86,7 @@ void InitPlugin(JApplication *app) { .azimuthal_binning={0., 360., 360.}, // lower, upper, step .momentum_bin_centers_in_lut=true, .polar_bin_centers_in_lut=true, + .momentum_cut_max=2.5*edm4eic::unit::GeV, }, app )); diff --git a/src/detectors/DIRC/DIRC.cc b/src/detectors/DIRC/DIRC.cc index 5d0a98567f..2005e53b2d 100644 --- a/src/detectors/DIRC/DIRC.cc +++ b/src/detectors/DIRC/DIRC.cc @@ -111,6 +111,7 @@ extern "C" { .momentum_edges={0.2, 0.4, 0.6, 0.8, 1.0, 1.2, 1.4, 1.6, 1.8, 2.0, 2.2, 2.4, 2.6, 2.8, 3.0, 3.2, 3.4, 3.6, 3.8, 4.0, 4.2, 4.4, 4.6, 4.8, 5.0, 5.2, 5.4, 5.6, 5.8, 6.0, 6.2, 6.4, 6.6, 6.8, 7.0, 7.2, 7.4, 7.6, 7.8, 8.0, 8.2, 8.4, 8.6, 8.8, 9.0, 9.2, 9.4, 9.6, 9.8, 10.0, 10.2}, .polar_edges={25.0, 26.0, 27.0, 28.0, 29.0, 30.0, 31.0, 32.0, 33.0, 34.0, 35.0, 36.0, 37.0, 38.0, 39.0, 40.0, 41.0, 42.0, 43.0, 44.0, 45.0, 46.0, 47.0, 48.0, 49.0, 50.0, 51.0, 52.0, 53.0, 54.0, 55.0, 56.0, 57.0, 58.0, 59.0, 60.0, 61.0, 62.0, 63.0, 64.0, 65.0, 66.0, 67.0, 68.0, 69.0, 70.0, 71.0, 72.0, 73.0, 74.0, 75.0, 76.0, 77.0, 78.0, 79.0, 80.0, 81.0, 82.0, 83.0, 84.0, 85.0, 86.0, 87.0, 88.0, 89.0, 90.0, 91.0, 92.0, 93.0, 94.0, 95.0, 96.0, 97.0, 98.0, 99.0, 100.0, 101.0, 102.0, 103.0, 104.0, 105.0, 106.0, 107.0, 108.0, 109.0, 110.0, 111.0, 112.0, 113.0, 114.0, 115.0, 116.0, 117.0, 118.0, 119.0, 120.0, 121.0, 122.0, 123.0, 124.0, 125.0, 126.0, 127.0, 128.0, 129.0, 130.0, 131.0, 132.0, 133.0, 134.0, 135.0, 136.0, 137.0, 138.0, 139.0, 140.0, 141.0, 142.0, 143.0, 144.0, 145.0, 146.0, 147.0, 148.0, 149.0, 150.0, 151.0, 152.0, 153.0, 154.0, 155.0, 156.0, 157.0, 158.0, 159.0, 160.0}, .azimuthal_binning={0.0, 30.5, 0.5}, // lower, upper, step + .momentum_cut_min=2.5*edm4eic::unit::GeV, }, app ));