diff --git a/PWGHF/Core/HfMlResponseDstarToD0Pi.h b/PWGHF/Core/HfMlResponseDstarToD0Pi.h index af0351b2a73..c7e43065495 100644 --- a/PWGHF/Core/HfMlResponseDstarToD0Pi.h +++ b/PWGHF/Core/HfMlResponseDstarToD0Pi.h @@ -221,28 +221,6 @@ class HfMlResponseDstarToD0Pi : public HfMlResponse return inputFeatures; } - /// Method to get the input features used for D0 in HF triggers - /// \param candidate is the D* candidate - /// \return inputFeatures vector - template - std::vector getInputFeaturesTrigger(T1 const& candidate) - { - std::vector inputFeatures; - - for (const auto& idx : MlResponse::mCachedIndices) { - switch (idx) { - CHECK_AND_FILL_VEC_DSTAR(ptProng0); - CHECK_AND_FILL_VEC_DSTAR_GETTER(impactParameterXY0, impactParameter0); - CHECK_AND_FILL_VEC_DSTAR(impactParameterZ0); - CHECK_AND_FILL_VEC_DSTAR(ptProng1); - CHECK_AND_FILL_VEC_DSTAR_GETTER(impactParameterXY1, impactParameter1); - CHECK_AND_FILL_VEC_DSTAR(impactParameterZ1); - } - } - - return inputFeatures; - } - protected: /// Method to fill the map of available input features void setAvailableInputFeatures() diff --git a/PWGHF/DataModel/CandidateReconstructionTables.h b/PWGHF/DataModel/CandidateReconstructionTables.h index c24c9badbc3..37c96d5627a 100644 --- a/PWGHF/DataModel/CandidateReconstructionTables.h +++ b/PWGHF/DataModel/CandidateReconstructionTables.h @@ -982,8 +982,6 @@ enum DecayType { DplusToPiKPi = 0, XicToPKPi, N3ProngDecays }; // always keep N3ProngDecays at the end -static constexpr int DstarToPiKPiBkg = DecayType::N3ProngDecays; - // Ds± → K± K∓ π± or D± → K± K∓ π± enum DecayChannelDToKKPi { diff --git a/PWGHF/TableProducer/candidateSelectorDstarToD0Pi.cxx b/PWGHF/TableProducer/candidateSelectorDstarToD0Pi.cxx index bd3cb47b28f..c0c02b6eed6 100644 --- a/PWGHF/TableProducer/candidateSelectorDstarToD0Pi.cxx +++ b/PWGHF/TableProducer/candidateSelectorDstarToD0Pi.cxx @@ -97,38 +97,23 @@ struct HfCandidateSelectorDstarToD0Pi { Configurable> cutsMl{"cutsMl", {hf_cuts_ml::Cuts[0], hf_cuts_ml::NBinsPt, hf_cuts_ml::NCutScores, hf_cuts_ml::labelsPt, hf_cuts_ml::labelsCutScore}, "ML selections per pT bin"}; Configurable nClassesMl{"nClassesMl", static_cast(hf_cuts_ml::NCutScores), "Number of classes in ML model"}; Configurable> namesInputFeatures{"namesInputFeatures", std::vector{"feature1", "feature2"}, "Names of ML model input features"}; - // ML inference D0 - Configurable applyMlD0Daug{"applyMlD0Daug", false, "Flag to apply ML selections on D0 daughter"}; - Configurable> binsPtMlD0Daug{"binsPtMlD0Daug", std::vector{hf_cuts_ml::vecBinsPt}, "pT bin limits for ML application on D0 daughter"}; - Configurable> cutDirMlD0Daug{"cutDirMlD0Daug", std::vector{hf_cuts_ml::vecCutDir}, "Whether to reject score values greater or smaller than the threshold on D0 daughter"}; - Configurable> cutsMlD0Daug{"cutsMlD0Daug", {hf_cuts_ml::Cuts[0], hf_cuts_ml::NBinsPt, hf_cuts_ml::NCutScores, hf_cuts_ml::labelsPt, hf_cuts_ml::labelsCutScore}, "ML selections per pT bin on D0 daughter"}; - Configurable nClassesMlD0Daug{"nClassesMlD0Daug", static_cast(hf_cuts_ml::NCutScores), "Number of classes in ML model on D0 daughter"}; - Configurable> namesInputFeaturesD0Daug{"namesInputFeaturesD0Daug", std::vector{"feature1", "feature2"}, "Names of ML model input features on D0 daughter"}; // CCDB configuration Configurable ccdbUrl{"ccdbUrl", "http://alice-ccdb.cern.ch", "url of the ccdb repository"}; Configurable> modelPathsCCDB{"modelPathsCCDB", std::vector{""}, "Paths of models on CCDB"}; - Configurable> modelPathsCCDBD0Daug{"modelPathsCCDBD0Daug", std::vector{""}, "Paths of models on CCDB for D0 daughter"}; Configurable> onnxFileNames{"onnxFileNames", std::vector{"Model.onnx"}, "ONNX file names for each pT bin (if not from CCDB full path)"}; - Configurable> onnxFileNamesD0Daug{"onnxFileNamesD0Daug", std::vector{"Model.onnx"}, "ONNX file names for each pT bin (if not from CCDB full path) for D0 daughter"}; Configurable timestampCCDB{"timestampCCDB", -1, "timestamp of the ONNX file for ML model used to query in CCDB"}; Configurable loadModelsFromCCDB{"loadModelsFromCCDB", false, "Flag to enable or disable the loading of models from CCDB"}; - // PDG mass for kaon, pion and D0 - double massD0, massPi, massK; - HfHelper hfHelper; o2::analysis::HfMlResponseDstarToD0Pi hfMlResponse; - o2::analysis::HfMlResponseDstarToD0Pi hfMlResponseD0Daughter; std::vector outputMlDstarToD0Pi = {}; - std::vector outputMlD0ToKPi = {}; o2::ccdb::CcdbApi ccdbApi; TrackSelectorPi selectorPion; TrackSelectorKa selectorKaon; using TracksSel = soa::Join; - // using TracksSel = soa::Join; using HfFullDstarCandidate = soa::Join; AxisSpec axisBdtScore{100, 0.f, 1.f}; @@ -139,9 +124,6 @@ struct HfCandidateSelectorDstarToD0Pi { void init(InitContext&) { - massPi = MassPiPlus; - massK = MassKPlus; - massD0 = MassD0; selectorPion.setRangePtTpc(ptPidTpcMin, ptPidTpcMax); selectorPion.setRangeNSigmaTpc(-nSigmaTpcMax, nSigmaTpcMax); @@ -183,18 +165,6 @@ struct HfCandidateSelectorDstarToD0Pi { hfMlResponse.cacheInputFeaturesIndices(namesInputFeatures); hfMlResponse.init(); } - - if (applyMlD0Daug) { - hfMlResponseD0Daughter.configure(binsPtMlD0Daug, cutsMlD0Daug, cutDirMlD0Daug, nClassesMlD0Daug); - if (loadModelsFromCCDB) { - ccdbApi.init(ccdbUrl); - hfMlResponseD0Daughter.setModelPathsCCDB(onnxFileNamesD0Daug, ccdbApi, modelPathsCCDBD0Daug, timestampCCDB); - } else { - hfMlResponseD0Daughter.setModelPathsLocal(onnxFileNamesD0Daug); - } - hfMlResponseD0Daughter.cacheInputFeaturesIndices(namesInputFeaturesD0Daug); - hfMlResponseD0Daughter.init(); - } } /// Conjugate-independent topological cuts on D0 @@ -258,14 +228,6 @@ struct HfCandidateSelectorDstarToD0Pi { return false; } - if (applyMlD0Daug) { - outputMlD0ToKPi.clear(); - std::vector inputFeaturesD0 = hfMlResponseD0Daughter.getInputFeaturesTrigger(candidate); - bool isSelectedMlD0 = hfMlResponseD0Daughter.isSelectedMl(inputFeaturesD0, candpT, outputMlD0ToKPi); - if (!isSelectedMlD0) { - return false; - } - } return true; } @@ -323,10 +285,10 @@ struct HfCandidateSelectorDstarToD0Pi { if (prongSoftPi.sign() > 0.) { // Selection of D*+ mInvDstar = candidate.invMassDstar(); mInvD0 = candidate.invMassD0(); - if (std::abs(mInvD0 - massD0) > cutsD0->get(binPt, "m")) { + if (std::abs(mInvD0 - MassD0) > cutsD0->get(binPt, "m")) { return false; } - if (useTriggerMassCut && !isCandidateInMassRange(mInvD0, massD0, candidate.ptD0(), hfTriggerCuts)) { + if (useTriggerMassCut && !isCandidateInMassRange(mInvD0, MassD0, candidate.ptD0(), hfTriggerCuts)) { return false; } // cut on daughter pT @@ -351,10 +313,10 @@ struct HfCandidateSelectorDstarToD0Pi { } else if (prongSoftPi.sign() < 0.) { // Selection of D*- mInvAntiDstar = candidate.invMassAntiDstar(); mInvD0Bar = candidate.invMassD0Bar(); - if (std::abs(mInvD0Bar - massD0) > cutsD0->get(binPt, "m")) { + if (std::abs(mInvD0Bar - MassD0) > cutsD0->get(binPt, "m")) { return false; } - if (useTriggerMassCut && !isCandidateInMassRange(mInvD0Bar, massD0, candidate.ptD0(), hfTriggerCuts)) { + if (useTriggerMassCut && !isCandidateInMassRange(mInvD0Bar, MassD0, candidate.ptD0(), hfTriggerCuts)) { return false; } // cut on daughter pT @@ -379,11 +341,11 @@ struct HfCandidateSelectorDstarToD0Pi { // in case only sideband candidates have to be stored, additional invariant-mass cut if (keepOnlySidebandCandidates && prongSoftPi.sign() > 0.) { - if (std::abs((mInvDstar - mInvD0) - massPi) < distanceFromDeltaMassForSidebands) { + if (std::abs((mInvDstar - mInvD0) - MassPiPlus) < distanceFromDeltaMassForSidebands) { return false; } } else if (keepOnlySidebandCandidates && prongSoftPi.sign() < 0.) { - if (std::abs((mInvAntiDstar - mInvD0Bar) - massPi) < distanceFromDeltaMassForSidebands) { + if (std::abs((mInvAntiDstar - mInvD0Bar) - MassPiPlus) < distanceFromDeltaMassForSidebands) { return false; } } @@ -499,7 +461,6 @@ struct HfCandidateSelectorDstarToD0Pi { if (applyMl) { // ML selections bool isSelectedMlDstar = false; - std::vector inputFeatures = hfMlResponse.getInputFeatures(candDstar); isSelectedMlDstar = hfMlResponse.isSelectedMl(inputFeatures, ptCand, outputMlDstarToD0Pi);