Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
94 commits
Select commit Hold shift + click to select a range
939a202
Add files via upload
zhangbiao-phy Apr 23, 2025
c24685c
Update HfHelper.h
zhangbiao-phy Apr 24, 2025
40f2ad9
Update ReducedDataModel.h
zhangbiao-phy Apr 24, 2025
06a3044
Update CandidateSelectionTables.h
zhangbiao-phy Apr 24, 2025
79ae5cd
Update CandidateReconstructionTables.h
zhangbiao-phy Apr 24, 2025
35d9e71
Update CMakeLists.txt
zhangbiao-phy Apr 24, 2025
7ba146e
Update CMakeLists.txt
zhangbiao-phy Apr 24, 2025
80c9c9f
Add files via upload
zhangbiao-phy Apr 24, 2025
8ac973e
Add files via upload
zhangbiao-phy Apr 24, 2025
44eccd3
Update candidateCreatorLbReduced.cxx
zhangbiao-phy Apr 24, 2025
6cf18de
Update taskLbReduced.cxx
zhangbiao-phy Apr 24, 2025
2f0b63f
Update candidateCreatorLbReduced.cxx
zhangbiao-phy Apr 24, 2025
04fbe34
Update candidateCreatorLbReduced.cxx
zhangbiao-phy Apr 24, 2025
5beba24
Update candidateSelectorLbToLcPiReduced.cxx
zhangbiao-phy Apr 24, 2025
9565916
Update taskLbReduced.cxx
zhangbiao-phy Apr 24, 2025
dc63ad6
Update dataCreatorCharmHadPiReduced.cxx
zhangbiao-phy Apr 24, 2025
af29198
Please consider the following formatting changes
alibuild Apr 24, 2025
5108a3f
Merge pull request #24 from alibuild/alibot-cleanup-10978
zhangbiao-phy Apr 24, 2025
29dc5e9
Update HfMlResponseLbToLcPi.h
zhangbiao-phy Apr 24, 2025
e16aa2a
Update CMakeLists.txt
zhangbiao-phy Apr 24, 2025
4372de1
Update PWGHF/D2H/TableProducer/candidateCreatorLbReduced.cxx
zhangbiao-phy Apr 25, 2025
5f4d82c
Update PWGHF/D2H/TableProducer/candidateCreatorLbReduced.cxx
zhangbiao-phy Apr 25, 2025
24851f1
Update PWGHF/D2H/TableProducer/candidateCreatorLbReduced.cxx
zhangbiao-phy Apr 25, 2025
f2867b4
Update PWGHF/D2H/TableProducer/candidateCreatorLbReduced.cxx
zhangbiao-phy Apr 25, 2025
6434ab1
Update PWGHF/D2H/TableProducer/dataCreatorCharmHadPiReduced.cxx
zhangbiao-phy Apr 25, 2025
9e418a2
Update PWGHF/D2H/TableProducer/dataCreatorCharmHadPiReduced.cxx
zhangbiao-phy Apr 25, 2025
f58f9f0
Update PWGHF/D2H/Tasks/taskLbReduced.cxx
zhangbiao-phy Apr 25, 2025
5bb7b33
Update PWGHF/D2H/TableProducer/candidateCreatorLbReduced.cxx
zhangbiao-phy Apr 25, 2025
5782536
Update PWGHF/D2H/TableProducer/dataCreatorCharmHadPiReduced.cxx
zhangbiao-phy Apr 25, 2025
d225303
Update dataCreatorCharmHadPiReduced.cxx
zhangbiao-phy Apr 25, 2025
8af882f
Update PWGHF/D2H/TableProducer/candidateCreatorLbReduced.cxx
zhangbiao-phy Apr 25, 2025
8032c02
Update PWGHF/D2H/TableProducer/dataCreatorCharmHadPiReduced.cxx
zhangbiao-phy Apr 25, 2025
90de737
Update PWGHF/D2H/TableProducer/dataCreatorCharmHadPiReduced.cxx
zhangbiao-phy Apr 25, 2025
deb11a2
Update PWGHF/D2H/TableProducer/dataCreatorCharmHadPiReduced.cxx
zhangbiao-phy Apr 25, 2025
ca09fa2
Update candidateCreatorLbReduced.cxx
zhangbiao-phy Apr 25, 2025
0d52e4e
Update candidateSelectorLbToLcPiReduced.cxx
zhangbiao-phy Apr 25, 2025
75cdded
Update taskLbReduced.cxx
zhangbiao-phy Apr 25, 2025
e2f2f14
Please consider the following formatting changes
alibuild Apr 25, 2025
f703375
Merge pull request #25 from alibuild/alibot-cleanup-10978
zhangbiao-phy Apr 25, 2025
ca0d218
Update ReducedDataModel.h
zhangbiao-phy Apr 28, 2025
298088f
Update CMakeLists.txt
zhangbiao-phy Apr 28, 2025
b762e44
Create converterReducedHadronDausPid.cxx
zhangbiao-phy Apr 28, 2025
c83d1fe
Please consider the following formatting changes
alibuild Apr 28, 2025
947ff6f
Merge pull request #26 from alibuild/alibot-cleanup-10978
zhangbiao-phy Apr 28, 2025
5addcbb
Merge branch 'master' into lb_reduced
zhangbiao-phy Apr 28, 2025
05d8bc1
Update candidateCreatorLbReduced.cxx
zhangbiao-phy Apr 30, 2025
ea1387c
Update HfMlResponseLbToLcPi.h
zhangbiao-phy Apr 30, 2025
de0e35d
Update CMakeLists.txt
zhangbiao-phy Apr 30, 2025
9cbd8ab
Update dataCreatorCharmHadPiReduced.cxx
zhangbiao-phy Apr 30, 2025
27a4c6b
Update PWGHF/D2H/TableProducer/converterReducedHadronDausPid.cxx
zhangbiao-phy Apr 30, 2025
4e5e1a1
Update converterReducedHadronDausPid.cxx
zhangbiao-phy Apr 30, 2025
97117af
Update candidateSelectorLbToLcPiReduced.cxx
zhangbiao-phy Apr 30, 2025
40c0607
Please consider the following formatting changes
alibuild Apr 30, 2025
a3df623
Update candidateCreatorLbReduced.cxx
zhangbiao-phy Apr 30, 2025
b89eec8
Merge pull request #27 from alibuild/alibot-cleanup-10978
zhangbiao-phy Apr 30, 2025
ef315b0
Update CMakeLists.txt
zhangbiao-phy Apr 30, 2025
7555776
Update candidateCreatorLbReduced.cxx
zhangbiao-phy Apr 30, 2025
15d4e8f
fix Megalinter
zhangbiao-phy Apr 30, 2025
88cf939
Merge branch 'master' into lb_reduced
zhangbiao-phy May 4, 2025
e163347
Update dataCreatorCharmHadPiReduced.cxx
zhangbiao-phy May 4, 2025
76452b4
Update dataCreatorCharmHadPiReduced.cxx
zhangbiao-phy May 5, 2025
39bdbdc
Update converterReducedHadronDausPid.cxx
zhangbiao-phy May 5, 2025
8709fed
Update dataCreatorCharmHadPiReduced.cxx
zhangbiao-phy May 5, 2025
340af3e
Update candidateSelectorLbToLcPiReduced.cxx
zhangbiao-phy May 5, 2025
99cdf02
Update dataCreatorCharmHadPiReduced.cxx
zhangbiao-phy May 5, 2025
a59eabd
re-trigger the alibuild complie
zhangbiao-phy May 5, 2025
84e34b6
Update HfMlResponseLbToLcPi.h
zhangbiao-phy May 5, 2025
6cd4ecc
Update candidateCreatorLbReduced.cxx
zhangbiao-phy May 5, 2025
5cbd0a4
Update dataCreatorCharmHadPiReduced.cxx
zhangbiao-phy May 5, 2025
54f4335
Update dataCreatorCharmHadPiReduced.cxx
zhangbiao-phy May 5, 2025
3ff0bc2
Please consider the following formatting changes
alibuild May 5, 2025
323f3bf
Merge pull request #29 from alibuild/alibot-cleanup-10978
zhangbiao-phy May 5, 2025
4eee2c2
Update dataCreatorCharmHadPiReduced.cxx
zhangbiao-phy May 5, 2025
e7c8429
Update candidateCreatorLbReduced.cxx
zhangbiao-phy May 5, 2025
2151e73
Please consider the following formatting changes
alibuild May 5, 2025
651f673
Merge pull request #30 from alibuild/alibot-cleanup-10978
zhangbiao-phy May 5, 2025
f35afc0
Update candidateCreatorLbReduced.cxx
zhangbiao-phy May 5, 2025
6099103
fix linter warning
zhangbiao-phy May 5, 2025
c789ba0
fix linter warning
zhangbiao-phy May 5, 2025
7aa380a
Update dataCreatorCharmHadPiReduced.cxx
zhangbiao-phy May 5, 2025
d3d6fa0
Please consider the following formatting changes
alibuild May 5, 2025
a6f2ffa
Merge pull request #31 from alibuild/alibot-cleanup-10978
zhangbiao-phy May 5, 2025
e2e62ce
Update dataCreatorCharmHadPiReduced.cxx
zhangbiao-phy May 5, 2025
317391d
fix the PidMethod configuration
zhangbiao-phy May 5, 2025
ffe7318
Update candidateCreatorLbReduced.cxx
zhangbiao-phy May 5, 2025
a59227f
fix linter warning
zhangbiao-phy May 5, 2025
8c68ba2
fix a typo
zhangbiao-phy May 5, 2025
51cee7b
fix a typo
zhangbiao-phy May 6, 2025
519a410
Update HfHelper.h based on vit's comment
zhangbiao-phy May 6, 2025
178ee31
remove unnecessary lines
zhangbiao-phy May 6, 2025
80185a5
Update converterReducedHadronDausPid.cxx
zhangbiao-phy May 8, 2025
4a97f56
Update converterReducedHadronDausPid.cxx
zhangbiao-phy May 8, 2025
6dcf700
Update converterReducedHadronDausPid.cxx
zhangbiao-phy May 8, 2025
aa38d27
Update PWGHF/D2H/TableProducer/converterReducedHadronDausPid.cxx
zhangbiao-phy May 8, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
81 changes: 81 additions & 0 deletions PWGHF/Core/HfHelper.h
Original file line number Diff line number Diff line change
Expand Up @@ -958,6 +958,87 @@ class HfHelper
return true;
}

/// Apply topological cuts as defined in SelectorCuts.h
/// \param candLb Lb candidate
/// \param cuts Lb candidate selection per pT bin"
/// \param binsPt pT bin limits
/// \return true if candidate passes all selections
template <typename T1, typename T2, typename T3>
bool selectionLbToLcPiTopol(const T1& candLb, const T2& cuts, const T3& binsPt)
Comment on lines +966 to +967
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The function is used only once. Where else do you plan to use it?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This can be in principle used in the non-reduced version of the Lb selector (https://github.com/AliceO2Group/O2Physics/blob/master/PWGHF/TableProducer/candidateSelectorLbToLcPi.cxx), as it is for the other B hadrons in order to have a common code for the selection. I would anyway suggest to implement it in the candidateSelectorLbToLcPi.cxx in a second PR since this one is already very long

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sync the reduced and the standard workflows in the next PR soon.

{
auto ptCandLb = candLb.pt();
auto ptLc = candLb.ptProng0();
auto ptPi = candLb.ptProng1();

int pTBin = o2::analysis::findBin(binsPt, ptCandLb);
if (pTBin == -1) {
return false;
}

// Lb mass cut
if (std::abs(invMassLbToLcPi(candLb) - o2::constants::physics::MassLambdaB0) > cuts->get(pTBin, "m")) {
return false;
}

// pion pt
if (ptPi < cuts->get(pTBin, "pT Pi")) {
return false;
}

// Lc pt
if (ptLc < cuts->get(pTBin, "pT Lc")) {
return false;
}

// Lb Decay length
if (candLb.decayLength() < cuts->get(pTBin, "Lb decLen")) {
return false;
}

// Lb Decay length XY
if (candLb.decayLengthXY() < cuts->get(pTBin, "Lb decLenXY")) {
return false;
}

// Lb chi2PCA cut
if (candLb.chi2PCA() > cuts->get(pTBin, "Chi2PCA")) {
return false;
}

// Lb CPA cut
if (candLb.cpa() < cuts->get(pTBin, "CPA")) {
return false;
}

// d0 of pi
if (std::abs(candLb.impactParameter1()) < cuts->get(pTBin, "d0 Pi")) {
return false;
}

// d0 of Lc
if (std::abs(candLb.impactParameter0()) < cuts->get(pTBin, "d0 Lc")) {
return false;
}

return true;
}

/// \param pidTrackPi PID status of trackPi (prong1 of Lb candidate)
/// \param acceptPIDNotApplicable switch to accept Status::NotApplicable
/// \return true if prong1 of Lb candidate passes all selections
template <typename T1 = int, typename T2 = bool>
bool selectionLbToLcPiPid(const T1& pidTrackPi, const T2& acceptPIDNotApplicable)
{
if (!acceptPIDNotApplicable && pidTrackPi != TrackSelectorPID::Accepted) {
return false;
}
if (acceptPIDNotApplicable && pidTrackPi == TrackSelectorPID::Rejected) {
return false;
}

return true;
}

/// Apply selection on ML scores for charm-hadron daughter in b-hadron decays (common for all the beauty channels)
/// \param cuts ML score selection per bin of charm-hadron pT
/// \param binsPtC pT bin limits of charm hadron
Expand Down
197 changes: 197 additions & 0 deletions PWGHF/Core/HfMlResponseLbToLcPi.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,197 @@
// Copyright 2019-2020 CERN and copyright holders of ALICE O2.
// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
// All rights not expressly granted are reserved.
//
// This software is distributed under the terms of the GNU General Public
// License v3 (GPL Version 3), copied verbatim in the file "COPYING".
//
// In applying this license CERN does not waive the privileges and immunities
// granted to it by virtue of its status as an Intergovernmental Organization
// or submit itself to any jurisdiction.

/// \file HfMlResponseLbToLcPi.h
/// \brief Class to compute the ML response for Lb → Lc∓ π± analysis selections
/// \author Biao Zhang <biao.zhang@cern.ch>, Heidelberg University

#ifndef PWGHF_CORE_HFMLRESPONSELBTOLCPI_H_
#define PWGHF_CORE_HFMLRESPONSELBTOLCPI_H_

#include <map>
#include <string>
#include <vector>

#include "PWGHF/Core/HfMlResponse.h"
#include "PWGHF/D2H/Utils/utilsRedDataFormat.h"

// Fill the map of available input features
// the key is the feature's name (std::string)
// the value is the corresponding value in EnumInputFeatures
#define FILL_MAP_LB(FEATURE) \
{ \
#FEATURE, static_cast<uint8_t>(InputFeaturesLbToLcPi::FEATURE) \
}

// Check if the index of mCachedIndices (index associated to a FEATURE)
// matches the entry in EnumInputFeatures associated to this FEATURE
// if so, the inputFeatures vector is filled with the FEATURE's value
// by calling the corresponding GETTER from OBJECT
#define CHECK_AND_FILL_VEC_LB_FULL(OBJECT, FEATURE, GETTER) \
case static_cast<uint8_t>(InputFeaturesLbToLcPi::FEATURE): { \
inputFeatures.emplace_back(OBJECT.GETTER()); \
break; \
}

// Check if the index of mCachedIndices (index associated to a FEATURE)
// matches the entry in EnumInputFeatures associated to this FEATURE
// if so, the inputFeatures vector is filled with the FEATURE's value
// by calling the GETTER function taking OBJECT in argument
#define CHECK_AND_FILL_VEC_LB_FUNC(OBJECT, FEATURE, GETTER) \
case static_cast<uint8_t>(InputFeaturesLbToLcPi::FEATURE): { \
inputFeatures.emplace_back(GETTER(OBJECT)); \
break; \
}

// Specific case of (OBJECT, FEATURE, GETTER)
// where OBJECT is named candidate and FEATURE = GETTER
#define CHECK_AND_FILL_VEC_LB(GETTER) \
case static_cast<uint8_t>(InputFeaturesLbToLcPi::GETTER): { \
inputFeatures.emplace_back(candidate.GETTER()); \
break; \
}

namespace o2::analysis
{

enum class InputFeaturesLbToLcPi : uint8_t {
ptProng0 = 0,
ptProng1,
impactParameter0,
impactParameter1,
impactParameterProduct,
chi2PCA,
decayLength,
decayLengthXY,
decayLengthNormalised,
decayLengthXYNormalised,
cpa,
cpaXY,
maxNormalisedDeltaIP,
prong0MlScoreBkg,
prong0MlScorePrompt,
prong0MlScoreNonprompt,
tpcNSigmaPi1,
tofNSigmaPi1,
tpcTofNSigmaPi1
};

template <typename TypeOutputScore = float>
class HfMlResponseLbToLcPi : public HfMlResponse<TypeOutputScore>
{
public:
/// Default constructor
HfMlResponseLbToLcPi() = default;
/// Default destructor
virtual ~HfMlResponseLbToLcPi() = default;

/// Method to get the input features vector needed for ML inference
/// \param candidate is the Lb candidate
/// \param prong1 is the candidate's prong1
/// \return inputFeatures vector
template <bool withDmesMl, typename T1, typename T2>
std::vector<float> getInputFeatures(T1 const& candidate,
T2 const& prong1)
{
std::vector<float> inputFeatures;

for (const auto& idx : MlResponse<TypeOutputScore>::mCachedIndices) {
if constexpr (withDmesMl) {
switch (idx) {
CHECK_AND_FILL_VEC_LB(ptProng0);
CHECK_AND_FILL_VEC_LB(ptProng1);
CHECK_AND_FILL_VEC_LB(impactParameter0);
CHECK_AND_FILL_VEC_LB(impactParameter1);
CHECK_AND_FILL_VEC_LB(impactParameterProduct);
CHECK_AND_FILL_VEC_LB(chi2PCA);
CHECK_AND_FILL_VEC_LB(decayLength);
CHECK_AND_FILL_VEC_LB(decayLengthXY);
CHECK_AND_FILL_VEC_LB(decayLengthNormalised);
CHECK_AND_FILL_VEC_LB(decayLengthXYNormalised);
CHECK_AND_FILL_VEC_LB(cpa);
CHECK_AND_FILL_VEC_LB(cpaXY);
CHECK_AND_FILL_VEC_LB(maxNormalisedDeltaIP);
CHECK_AND_FILL_VEC_LB(prong0MlScoreBkg);
CHECK_AND_FILL_VEC_LB(prong0MlScorePrompt);
CHECK_AND_FILL_VEC_LB(prong0MlScoreNonprompt);
// TPC PID variable
CHECK_AND_FILL_VEC_LB_FULL(prong1, tpcNSigmaPi1, tpcNSigmaPi);
// TOF PID variable
CHECK_AND_FILL_VEC_LB_FULL(prong1, tofNSigmaPi1, tofNSigmaPi);
// Combined PID variables
CHECK_AND_FILL_VEC_LB_FUNC(prong1, tpcTofNSigmaPi1, o2::pid_tpc_tof_utils::getTpcTofNSigmaPi1);
}
} else {
switch (idx) {
CHECK_AND_FILL_VEC_LB(ptProng0);
CHECK_AND_FILL_VEC_LB(ptProng1);
CHECK_AND_FILL_VEC_LB(impactParameter0);
CHECK_AND_FILL_VEC_LB(impactParameter1);
CHECK_AND_FILL_VEC_LB(impactParameterProduct);
CHECK_AND_FILL_VEC_LB(chi2PCA);
CHECK_AND_FILL_VEC_LB(decayLength);
CHECK_AND_FILL_VEC_LB(decayLengthXY);
CHECK_AND_FILL_VEC_LB(decayLengthNormalised);
CHECK_AND_FILL_VEC_LB(decayLengthXYNormalised);
CHECK_AND_FILL_VEC_LB(cpa);
CHECK_AND_FILL_VEC_LB(cpaXY);
CHECK_AND_FILL_VEC_LB(maxNormalisedDeltaIP);
// TPC PID variable
CHECK_AND_FILL_VEC_LB_FULL(prong1, tpcNSigmaPi1, tpcNSigmaPi);
// TOF PID variable
CHECK_AND_FILL_VEC_LB_FULL(prong1, tofNSigmaPi1, tofNSigmaPi);
// Combined PID variables
CHECK_AND_FILL_VEC_LB_FUNC(prong1, tpcTofNSigmaPi1, o2::pid_tpc_tof_utils::getTpcTofNSigmaPi1);
}
}
}

return inputFeatures;
}

protected:
/// Method to fill the map of available input features
void setAvailableInputFeatures()
{
MlResponse<TypeOutputScore>::mAvailableInputFeatures = {
FILL_MAP_LB(ptProng0),
FILL_MAP_LB(ptProng1),
FILL_MAP_LB(impactParameter0),
FILL_MAP_LB(impactParameter1),
FILL_MAP_LB(impactParameterProduct),
FILL_MAP_LB(chi2PCA),
FILL_MAP_LB(decayLength),
FILL_MAP_LB(decayLengthXY),
FILL_MAP_LB(decayLengthNormalised),
FILL_MAP_LB(decayLengthXYNormalised),
FILL_MAP_LB(cpa),
FILL_MAP_LB(cpaXY),
FILL_MAP_LB(maxNormalisedDeltaIP),
FILL_MAP_LB(prong0MlScoreBkg),
FILL_MAP_LB(prong0MlScorePrompt),
FILL_MAP_LB(prong0MlScoreNonprompt),
// TPC PID variable
FILL_MAP_LB(tpcNSigmaPi1),
// TOF PID variable
FILL_MAP_LB(tofNSigmaPi1),
// Combined PID variable
FILL_MAP_LB(tpcTofNSigmaPi1)};
}
};

} // namespace o2::analysis

#undef FILL_MAP_LB
#undef CHECK_AND_FILL_VEC_LB_FULL
#undef CHECK_AND_FILL_VEC_LB_FUNC
#undef CHECK_AND_FILL_VEC_LB

#endif // PWGHF_CORE_HFMLRESPONSELBTOLCPI_H_
Loading
Loading