|
15 | 15 | /// \author Fabio Catalano <fabio.catalano@cern.ch>, University of Houston |
16 | 16 | /// \author Maria Fernanda Torres Cabrera <maria.fernanda.torres.cabrera@cern.ch>, University of Houston |
17 | 17 |
|
18 | | -#include "PWGHF/Core/HfMlResponseOmegacToOmegaPi.h" |
| 18 | +#include "PWGHF/Core/HfMlResponseOmegacToOmegaPiQa.h" |
19 | 19 | #include "PWGHF/Core/SelectorCuts.h" |
20 | 20 | #include "PWGHF/DataModel/AliasTables.h" |
21 | 21 | #include "PWGHF/DataModel/CandidateReconstructionTables.h" |
|
71 | 71 | struct HfCandidateSelectorToOmegaPiQa { |
72 | 72 | // DCAFitter and KFParticle |
73 | 73 | Produces<aod::HfSelToOmegaPi> hfSelToOmegaPi; |
74 | | - // ML selection - currently filled only for KFParticle |
| 74 | + // ML selection - filled for both DCAFitter and KFParticle |
75 | 75 | Produces<aod::HfMlSelOmegacToOmegaPi> hfMlSelToOmegaPi; |
76 | 76 |
|
77 | 77 | // cuts from SelectorCuts.h - pT dependent cuts |
@@ -176,7 +176,9 @@ struct HfCandidateSelectorToOmegaPiQa { |
176 | 176 | Configurable<int> nClustersItsInnBarrMin{"nClustersItsInnBarrMin", 1, "Minimum number of ITS clusters in inner barrel requirement for pi <- charm baryon"}; |
177 | 177 | Configurable<float> itsChi2PerClusterMax{"itsChi2PerClusterMax", 36, "Maximum value of chi2 fit over ITS clusters for pi <- charm baryon"}; |
178 | 178 |
|
179 | | - o2::analysis::HfMlResponseOmegacToOmegaPi<float> hfMlResponse; |
| 179 | + // o2::analysis::HfMlResponseOmegacToOmegaPi<float> hfMlResponse; |
| 180 | + o2::analysis::HfMlResponseOmegacToOmegaPi<float, aod::hf_cand_casc_lf::ConstructMethod::DcaFitter> hfMlResponseDca; |
| 181 | + o2::analysis::HfMlResponseOmegacToOmegaPi<float, aod::hf_cand_casc_lf::ConstructMethod::KfParticle> hfMlResponseKf; |
180 | 182 | std::vector<float> outputMlOmegac = {}; |
181 | 183 | o2::ccdb::CcdbApi ccdbApi; |
182 | 184 |
|
@@ -391,19 +393,27 @@ struct HfCandidateSelectorToOmegaPiQa { |
391 | 393 | // HfMlResponse initialization |
392 | 394 | if (applyMl) { |
393 | 395 | if (doprocessOmegac0SelectorWithKFParticle) { |
394 | | - registry.add("hBDTScoreTest1", "hBDTScoreTest1", {HistType::kTH1D, {{100, 0.0f, 1.0f, "score"}}}); |
395 | | - hfMlResponse.configure(binsPtMl, cutsMl, cutDirMl, nClassesMl); |
| 396 | + registry.add("hBDTScoreKF", "hBDTScoreKF", {HistType::kTH1D, {{100, 0.0f, 1.0f, "score"}}}); |
| 397 | + hfMlResponseKf.configure(binsPtMl, cutsMl, cutDirMl, nClassesMl); |
396 | 398 | if (loadModelsFromCCDB) { |
397 | 399 | ccdbApi.init(ccdbUrl); |
398 | | - hfMlResponse.setModelPathsCCDB(onnxFileNames, ccdbApi, modelPathsCCDB, timestampCCDB); |
| 400 | + hfMlResponseKf.setModelPathsCCDB(onnxFileNames, ccdbApi, modelPathsCCDB, timestampCCDB); |
399 | 401 | } else { |
400 | | - hfMlResponse.setModelPathsLocal(onnxFileNames); |
| 402 | + hfMlResponseKf.setModelPathsLocal(onnxFileNames); |
401 | 403 | } |
402 | | - hfMlResponse.cacheInputFeaturesIndices(namesInputFeatures); |
403 | | - hfMlResponse.init(); |
404 | | - } else { |
405 | | - // DCAFitter: ML is not yet implemented |
406 | | - LOGP(warning, "ML selection is currently only supported for KFParticle."); |
| 404 | + hfMlResponseKf.cacheInputFeaturesIndices(namesInputFeatures); |
| 405 | + hfMlResponseKf.init(); |
| 406 | + } else if (doprocessOmegac0SelectorWithDCAFitter) { |
| 407 | + registry.add("hBDTScoreDCA", "hBDTScoreDCA", {HistType::kTH1D, {{100, 0.0f, 1.0f, "score"}}}); |
| 408 | + hfMlResponseDca.configure(binsPtMl, cutsMl, cutDirMl, nClassesMl); |
| 409 | + if (loadModelsFromCCDB) { |
| 410 | + ccdbApi.init(ccdbUrl); |
| 411 | + hfMlResponseDca.setModelPathsCCDB(onnxFileNames, ccdbApi, modelPathsCCDB, timestampCCDB); |
| 412 | + } else { |
| 413 | + hfMlResponseDca.setModelPathsLocal(onnxFileNames); |
| 414 | + } |
| 415 | + hfMlResponseDca.cacheInputFeaturesIndices(namesInputFeatures); |
| 416 | + hfMlResponseDca.init(); |
407 | 417 | } |
408 | 418 | } |
409 | 419 | } |
@@ -1122,19 +1132,30 @@ struct HfCandidateSelectorToOmegaPiQa { |
1122 | 1132 | statusInvMassCharmBaryon = true; |
1123 | 1133 | } |
1124 | 1134 |
|
1125 | | - // ML BDT selection - curently only for KFParticle |
1126 | | - if constexpr (svReco == doKfParticle) { |
1127 | | - if (applyMl) { |
1128 | | - bool isSelectedMlOmegac = false; |
1129 | | - std::vector<float> inputFeaturesOmegaC = hfMlResponse.getInputFeatures(candidate, trackPiFromLam, trackKaFromCasc, trackPiFromCharm); |
1130 | | - isSelectedMlOmegac = hfMlResponse.isSelectedMl(inputFeaturesOmegaC, ptCandOmegac, outputMlOmegac); |
| 1135 | + // ML BDT selection |
| 1136 | + if (applyMl) { |
| 1137 | + bool isSelectedMlOmegac = false; |
| 1138 | + std::vector<float> inputFeaturesOmegaC = {}; |
| 1139 | + |
| 1140 | + if constexpr (svReco == doKfParticle) { |
| 1141 | + inputFeaturesOmegaC = hfMlResponseKf.getInputFeatures(candidate, trackPiFromLam, trackKaFromCasc, trackPiFromCharm); |
| 1142 | + isSelectedMlOmegac = hfMlResponseKf.isSelectedMl(inputFeaturesOmegaC, ptCandOmegac, outputMlOmegac); |
1131 | 1143 | if (isSelectedMlOmegac) { |
1132 | | - registry.fill(HIST("hBDTScoreTest1"), outputMlOmegac[0]); |
| 1144 | + registry.fill(HIST("hBDTScoreKF"), outputMlOmegac[0]); |
| 1145 | + } else { |
| 1146 | + resultSelections = false; |
| 1147 | + } |
| 1148 | + } else if constexpr (svReco == doDcaFitter) { |
| 1149 | + inputFeaturesOmegaC = hfMlResponseDca.getInputFeatures(candidate, trackPiFromLam, trackKaFromCasc, trackPiFromCharm); |
| 1150 | + isSelectedMlOmegac = hfMlResponseDca.isSelectedMl(inputFeaturesOmegaC, ptCandOmegac, outputMlOmegac); |
| 1151 | + if (isSelectedMlOmegac) { |
| 1152 | + registry.fill(HIST("hBDTScoreDCA"), outputMlOmegac[0]); |
1133 | 1153 | } else { |
1134 | 1154 | resultSelections = false; |
1135 | 1155 | } |
1136 | | - hfMlSelToOmegaPi(outputMlOmegac); |
1137 | 1156 | } |
| 1157 | + |
| 1158 | + hfMlSelToOmegaPi(outputMlOmegac); |
1138 | 1159 | } |
1139 | 1160 |
|
1140 | 1161 | // Fill in selection result |
|
0 commit comments