Skip to content

Commit 7f91527

Browse files
authored
Update candidateSelectorOmegac0Xic0ToOmegaKa.cxx
1 parent a45fe72 commit 7f91527

File tree

1 file changed

+35
-94
lines changed

1 file changed

+35
-94
lines changed

PWGHF/TableProducer/candidateSelectorOmegac0Xic0ToOmegaKa.cxx

Lines changed: 35 additions & 94 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,10 @@ struct HfCandidateSelectorToOmegaKa {
6060
Configurable<float> cascadeMassWindow{"cascadeMassWindow", 0.01, "Cascade mass window"};
6161
Configurable<bool> applyTrkSelLf{"applyTrkSelLf", true, "Apply track selection for LF daughters"};
6262

63+
// topological cuts
64+
Configurable<std::vector<double>> binsPt{"binsPt", std::vector<double>{hf_cuts_omegacxic_to_omega_ka::vecBinsPt}, "pT bin limits"};
65+
Configurable<LabeledArray<double>> cuts{"cuts", {hf_cuts_omegacxic_to_omega_ka::Cuts[0], hf_cuts_omegacxic_to_omega_ka::NBinsPt, hf_cuts_omegacxic_to_omega_ka::NCutVars, hf_cuts_omegacxic_to_omega_ka::labelsPt, hf_cuts_omegacxic_to_omega_ka::labelsCutVar}, "OmegaC0 candidate selection per pT bin"};
66+
6367
// limit charm baryon invariant mass spectrum
6468
Configurable<double> invMassCharmBaryonMin{"invMassCharmBaryonMin", 2.0, "Lower limit invariant mass spectrum charm baryon"}; // Xic0:2.470 Omegac0:2.695
6569
Configurable<double> invMassCharmBaryonMax{"invMassCharmBaryonMax", 3.1, "Upper limit invariant mass spectrum charm baryon"};
@@ -156,27 +160,6 @@ struct HfCandidateSelectorToOmegaKa {
156160
Configurable<float> cosPaV0ToCascMin{"cosPaV0ToCascMin", 0.99, "Minimum cosPA of V0<-cascade"};
157161
} KfconfigurableGroup;
158162

159-
// topological cuts
160-
// Configurable<std::vector<double>> binsPt{"binsPt", std::vector<double>{hf_cuts_omegaKa_to_omega_pi::vecBinsPt}, "pT bin limits"};
161-
// Configurable<LabeledArray<double>> cuts{"cuts", {hf_cuts_omegaKa_to_omega_pi::Cuts[0], hf_cuts_omegaKa_to_omega_pi::NBinsPt, hf_cuts_omegaKa_to_omega_pi::NCutVars, hf_cuts_omegaKa_to_omega_pi::labelsPt, hf_cuts_omegaKa_to_omega_pi::labelsCutVar}, "OmegaKa candidate selection per pT bin"};
162-
// ML inference
163-
// Configurable<bool> applyMl{"applyMl", false, "Flag to apply ML selections"};
164-
// Configurable<std::vector<double>> binsPtMl{"binsPtMl", std::vector<double>{hf_cuts_ml::vecBinsPt}, "pT bin limits for ML application"};
165-
// Configurable<std::vector<int>> cutDirMl{"cutDirMl", std::vector<int>{hf_cuts_ml::vecCutDir}, "Whether to reject score values greater or smaller than the threshold"};
166-
// Configurable<LabeledArray<double>> 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"};
167-
// Configurable<int> nClassesMl{"nClassesMl", static_cast<int>(hf_cuts_ml::NCutScores), "Number of classes in ML model"};
168-
// Configurable<std::vector<std::string>> namesInputFeatures{"namesInputFeatures", std::vector<std::string>{"feature1", "feature2"}, "Names of ML model input features"};
169-
// CCDB configuration
170-
// Configurable<std::string> ccdbUrl{"ccdbUrl", "http://alice-ccdb.cern.ch", "url of the ccdb repository"};
171-
// Configurable<std::vector<std::string>> modelPathsCCDB{"modelPathsCCDB", std::vector<std::string>{"EventFiltering/PWGHF/BDTOmegaKa"}, "Paths of models on CCDB"};
172-
// Configurable<std::vector<std::string>> onnxFileNames{"onnxFileNames", std::vector<std::string>{"ModelHandler_onnx_OmegaKaToOmegaKa.onnx"}, "ONNX file names for each pT bin (if not from CCDB full path)"};
173-
// Configurable<int64_t> timestampCCDB{"timestampCCDB", -1, "timestamp of the ONNX file for ML model used to query in CCDB"};
174-
// Configurable<bool> loadModelsFromCCDB{"loadModelsFromCCDB", false, "Flag to enable or disable the loading of models from CCDB"};
175-
176-
// o2::analysis::HfMlResponseOmegaKaToOmegaKa<float> hfMlResponse;
177-
// std::vector<float> outputMlOmegaKa = {};
178-
// o2::ccdb::CcdbApi ccdbApi;
179-
180163
TrackSelectorPi selectorPion;
181164
TrackSelectorPr selectorProton;
182165
TrackSelectorKa selectorKaon;
@@ -261,48 +244,38 @@ struct HfCandidateSelectorToOmegaKa {
261244
registry.add("hSeldecayLenOmegaKa_Casc_V0", "hSeldecayLenOmegaKa_Casc_V0;status;entries", {HistType::kTH1D, {axisSel}});
262245
registry.add("hSelcosPaCascToOmegaKa_V0ToCasc", "hSelcosPaCascToOmegaKa_V0ToCasc;status;entries", {HistType::kTH1D, {axisSel}});
263246
registry.add("hInvMassXiMinus_rej_cut", "hInvMassXiMinus_rej_cut", kTH1D, {{1000, 1.25f, 1.65f}});
264-
265-
// if (applyMl) {
266-
// registry.add("hBDTScoreTest1", "hBDTScoreTest1", {HistType::kTH1D, {{100, 0.0f, 1.0f, "score"}}});
267-
// hfMlResponse.configure(binsPtMl, cutsMl, cutDirMl, nClassesMl);
268-
// if (loadModelsFromCCDB) {
269-
// ccdbApi.init(ccdbUrl);
270-
// hfMlResponse.setModelPathsCCDB(onnxFileNames, ccdbApi, modelPathsCCDB, timestampCCDB);
271-
// } else {
272-
// hfMlResponse.setModelPathsLocal(onnxFileNames);
273-
// }
274-
// hfMlResponse.cacheInputFeaturesIndices(namesInputFeatures);
275-
// hfMlResponse.init();
276-
// }
277247
}
278248
// for pT-dependent cuts (other selections will move into this in futrue)
279249
// \param hfCandOmegaKa is candidate
280250
// return true if candidate passes all cuts
281-
// template <typename T1>
282-
// bool selectionTopol(const T1& hfCandOmegaKa)
283-
//{
284-
// auto candpT = hfCandOmegaKa.ptCharmBaryon();
285-
// auto KaPtFromOmegaKa = hfCandOmegaKa.ptKaFromCharmBaryon();
286-
// int pTBin = findBin(binsPt, candpT);
287-
// if (pTBin == -1) {
288-
// return false;
289-
// }
290-
291-
// check that the candidate pT is within the analysis range
292-
// if (candpT <= ptCandMin || candpT >= ptCandMax) {
293-
// return false;
294-
// }
295-
296-
// check that the candidate pT is within the analysis range
297-
// if (pionPtFromOmegaKa < cuts->get(pTBin, "pT pi from OmegaKa")) {
298-
// registry.fill(HIST("hSelPtKaFromCharm"), 0);
299-
// return false;
300-
// } else {
301-
// registry.fill(HIST("hSelPtKaFromCharm"), 1);
302-
// }
303-
304-
// return true;
305-
//} // end template
251+
template <typename T1>
252+
bool selectionTopol(const T1& hfCandOmegaKa)
253+
{
254+
auto candpT = hfCandOmegaKa.kfPtOmegaKa();
255+
auto KaPtFromOmegaKa = hfCandOmegaKa.kfPtKaFromOmegaKa();
256+
int pTBin = findBin(binsPt, candpT);
257+
if (pTBin == -1) {
258+
return false;
259+
}
260+
261+
// check that the candidate pT is within the analysis range
262+
if (candpT <= ptCandMin || candpT >= ptCandMax) {
263+
registry.fill(HIST("hSelPtOmegaKa"), 0);
264+
return false;
265+
} else {
266+
registry.fill(HIST("hSelPtOmegaKa"), 1);
267+
}
268+
269+
// check that the candidate pT is within the analysis range
270+
if (KaPtFromOmegaKa < cuts->get(pTBin, "pT ka from OmegaKa")) {
271+
registry.fill(HIST("hSelPtKaFromCharm"), 0);
272+
return false;
273+
} else {
274+
registry.fill(HIST("hSelPtKaFromCharm"), 1);
275+
}
276+
277+
return true;
278+
} // end template
306279

307280
void process(aod::HfCandToOmegaKaKf const& candidates,
308281
TracksSel const& tracks,
@@ -347,18 +320,9 @@ struct HfCandidateSelectorToOmegaKa {
347320
}
348321

349322
// pt-dependent selection
350-
// if (!selectionTopol(candidate)) {
351-
// resultSelections = false;
352-
// hfSelToOmegaKa(statusPidLambda, statusPidCascade, statusPidCharmBaryon, statusInvMassLambda, statusInvMassCascade, statusInvMassCharmBaryon, resultSelections, infoTpcStored, infoTofStored,
353-
// trackKaFromCharm.tpcNSigmaPi(), trackKaFromCasc.tpcNSigmaKa(), trackPiFromLam.tpcNSigmaPi(), trackPrFromLam.tpcNSigmaPr(),
354-
// trackKaFromCharm.tofNSigmaPi(), trackKaFromCasc.tofNSigmaKa(), trackPiFromLam.tofNSigmaPi(), trackPrFromLam.tofNSigmaPr());
355-
// if constexpr (ConstructMethod == hf_cand_casc_lf::ConstructMethod::KfParticle) {
356-
// if (applyMl) {
357-
// hfMlSelToOmegaKa(outputMlOmegaKa);
358-
// }
359-
// }
360-
// continue;
361-
//}
323+
if (!selectionTopol(candidate)) {
324+
resultSelections = false;
325+
}
362326

363327
// eta selection
364328
double etaV0DauPr = candidate.etaV0DauPr();
@@ -466,9 +430,6 @@ struct HfCandidateSelectorToOmegaKa {
466430
}
467431
if (std::abs(candidate.kfPtKaFromOmegaKa()) < ptKaFromCharmBaryonMin) {
468432
resultSelections = false;
469-
registry.fill(HIST("hSelPtKaFromCharm"), 0);
470-
} else {
471-
registry.fill(HIST("hSelPtKaFromCharm"), 1);
472433
}
473434

474435
// Competing Ξ rejection(KF) Try to reject cases in which the candidate has a an inv. mass compatibler to Xi (bachelor pion) instead of Omega (bachelor kaon)
@@ -482,14 +443,6 @@ struct HfCandidateSelectorToOmegaKa {
482443
}
483444
}
484445

485-
// OmegaKa Pt selection
486-
if (std::abs(candidate.kfPtOmegaKa()) < ptCandMin || std::abs(candidate.kfPtOmegaKa()) > ptCandMax) {
487-
resultSelections = false;
488-
registry.fill(HIST("hSelPtOmegaKa"), 0);
489-
} else {
490-
registry.fill(HIST("hSelPtOmegaKa"), 1);
491-
}
492-
493446
// v0&Casc&OmegaKa ldl selection
494447
if ((candidate.v0ldl() < KfconfigurableGroup.v0LdlMin) || (candidate.cascldl() < KfconfigurableGroup.cascLdlMin) || (candidate.omegaKaldl() > KfconfigurableGroup.omegaKaLdlMax)) {
495448
resultSelections = false;
@@ -690,18 +643,6 @@ struct HfCandidateSelectorToOmegaKa {
690643
registry.fill(HIST("hSelMassCharmBaryon"), 0);
691644
resultSelections = false;
692645
}
693-
// ML selections
694-
// if constexpr (ConstructMethod == hf_cand_casc_lf::ConstructMethod::KfParticle) {
695-
// if (applyMl) {
696-
// bool isSelectedMlOmegaKa = false;
697-
// std::vector<float> inputFeaturesOmegaKa = hfMlResponse.getInputFeatures(candidate, trackPiFromLam, trackKaFromCasc, trackKaFromCharm);
698-
// isSelectedMlOmegaKa = hfMlResponse.isSelectedMl(inputFeaturesOmegaKa, ptCand, outputMlOmegaKa);
699-
// if (isSelectedMlOmegaKa) {
700-
// registry.fill(HIST("hBDTScoreTest1"), outputMlOmegaKa[0]);
701-
// }
702-
// hfMlSelToOmegaKa(outputMlOmegaKa);
703-
// }
704-
//}
705646

706647
hfSelToOmegaKaKf(statusPidLambda, statusPidCascade, statusPidCharmBaryon, statusInvMassLambda, statusInvMassCascade, statusInvMassCharmBaryon, resultSelections, infoTpcStored, infoTofStored,
707648
trackKaFromCharm.tpcNSigmaKa(), trackKaFromCasc.tpcNSigmaKa(), trackPiFromLam.tpcNSigmaPi(), trackPrFromLam.tpcNSigmaPr(),

0 commit comments

Comments
 (0)