Skip to content

Commit 6ef0aef

Browse files
ikantakIsabel Kantak
andauthored
[PWGEM] Add new ML features and add optional alpha meson cut (#15323)
Co-authored-by: Isabel Kantak <kantak@physi.uni-heidelberg.de>
1 parent 929b130 commit 6ef0aef

File tree

5 files changed

+275
-26
lines changed

5 files changed

+275
-26
lines changed

PWGEM/PhotonMeson/Core/EmMlResponsePCM.h

Lines changed: 84 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,20 +53,47 @@ namespace o2::analysis
5353
{
5454

5555
enum class InputFeaturesPCM : uint8_t {
56+
v0PhotonCandidatefVx,
57+
v0PhotonCandidatefVy,
58+
v0PhotonCandidatefVz,
5659
v0PhotonCandidatefDCAxyToPV,
5760
v0PhotonCandidatefDCAzToPV,
5861
v0PhotonCandidatefPCA,
5962
v0PhotonCandidatefAlpha,
6063
v0PhotonCandidatefQtArm,
6164
v0PhotonCandidatefChiSquareNDF,
65+
v0PhotonCandidatefCosPARZ,
66+
v0PhotonCandidatefCosPAXY,
6267
v0PhotonCandidatefCosPA,
68+
v0PhotonCandidatefPsiPair,
69+
v0PhotonCandidatefPhiV,
70+
posV0LegfDCAXY,
71+
posV0LegfDCAZ,
72+
posV0LegfEta,
73+
posV0LegfTPCNClsShared,
74+
posV0LegfTPCNClsFindable,
75+
posV0LegfTPCNClsFindableMinusFound,
76+
posV0LegfTPCNClsFindableMinusCrossedRows,
77+
posV0LegfTPCChi2NCl,
78+
posV0LegfTPCSignal,
6379
posV0LegfTPCNSigmaEl,
6480
posV0LegfTPCNSigmaPi,
81+
posV0LegfITSClusterSizes,
82+
negV0LegfDCAXY,
83+
negV0LegfDCAZ,
84+
negV0LegfEta,
85+
negV0LegfTPCNClsShared,
86+
negV0LegfTPCNClsFindable,
87+
negV0LegfTPCNClsFindableMinusFound,
88+
negV0LegfTPCNClsFindableMinusCrossedRows,
89+
negV0LegfTPCChi2NCl,
90+
negV0LegfTPCSignal,
6591
negV0LegfTPCNSigmaEl,
66-
negV0LegfTPCNSigmaPi
92+
negV0LegfTPCNSigmaPi,
93+
negV0LegfITSClusterSizes
6794
};
6895

69-
template <typename TypeOutputScore = float>
96+
template <std::floating_point TypeOutputScore = float>
7097
class EmMlResponsePCM : public EmMlResponse<TypeOutputScore>
7198
{
7299
public:
@@ -85,17 +112,44 @@ class EmMlResponsePCM : public EmMlResponse<TypeOutputScore>
85112

86113
for (const auto& idx : MlResponse<TypeOutputScore>::mCachedIndices) {
87114
switch (idx) {
115+
CHECK_AND_FILL_VEC_PCM_FULL(candidate, v0PhotonCandidatefVx, getConversionPointX);
116+
CHECK_AND_FILL_VEC_PCM_FULL(candidate, v0PhotonCandidatefVy, getConversionPointY);
117+
CHECK_AND_FILL_VEC_PCM_FULL(candidate, v0PhotonCandidatefVz, getConversionPointZ);
88118
CHECK_AND_FILL_VEC_PCM_FULL(candidate, v0PhotonCandidatefDCAxyToPV, getDcaXYToPV);
89119
CHECK_AND_FILL_VEC_PCM_FULL(candidate, v0PhotonCandidatefDCAzToPV, getDcaZToPV);
90120
CHECK_AND_FILL_VEC_PCM_FULL(candidate, v0PhotonCandidatefPCA, getPCA);
91121
CHECK_AND_FILL_VEC_PCM_FULL(candidate, v0PhotonCandidatefAlpha, getAlpha);
92122
CHECK_AND_FILL_VEC_PCM_FULL(candidate, v0PhotonCandidatefQtArm, getQt);
93123
CHECK_AND_FILL_VEC_PCM_FULL(candidate, v0PhotonCandidatefChiSquareNDF, getChi2NDF);
124+
CHECK_AND_FILL_VEC_PCM_FULL(candidate, v0PhotonCandidatefCosPARZ, getCosPARZ);
125+
CHECK_AND_FILL_VEC_PCM_FULL(candidate, v0PhotonCandidatefCosPAXY, getCosPAXY);
94126
CHECK_AND_FILL_VEC_PCM_FULL(candidate, v0PhotonCandidatefCosPA, getCosPA);
127+
CHECK_AND_FILL_VEC_PCM_FULL(candidate, v0PhotonCandidatefPsiPair, getPsiPair);
128+
CHECK_AND_FILL_VEC_PCM_FULL(candidate, v0PhotonCandidatefPhiV, getPhiV);
129+
CHECK_AND_FILL_VEC_PCM_FULL(candidate, posV0LegfDCAXY, getPosDcaXY);
130+
CHECK_AND_FILL_VEC_PCM_FULL(candidate, posV0LegfDCAZ, getPosDcaZ);
131+
CHECK_AND_FILL_VEC_PCM_FULL(candidate, posV0LegfEta, getPosEta);
132+
CHECK_AND_FILL_VEC_PCM_FULL(candidate, posV0LegfTPCNClsShared, getPosTPCNClsShared);
133+
CHECK_AND_FILL_VEC_PCM_FULL(candidate, posV0LegfTPCNClsFindable, getPosTPCNClsFindable);
134+
CHECK_AND_FILL_VEC_PCM_FULL(candidate, posV0LegfTPCNClsFindableMinusFound, getPosTPCNClsFindableMinusShared);
135+
CHECK_AND_FILL_VEC_PCM_FULL(candidate, posV0LegfTPCNClsFindableMinusCrossedRows, getPosTPCNClsFindableMinusCrossedRows);
136+
CHECK_AND_FILL_VEC_PCM_FULL(candidate, posV0LegfTPCChi2NCl, getPosTPCChi2NCl);
137+
CHECK_AND_FILL_VEC_PCM_FULL(candidate, posV0LegfTPCSignal, getPosTPCSignal);
95138
CHECK_AND_FILL_VEC_PCM_FULL(posLeg, posV0LegfTPCNSigmaEl, tpcNSigmaEl);
96139
CHECK_AND_FILL_VEC_PCM_FULL(posLeg, posV0LegfTPCNSigmaPi, tpcNSigmaPi);
140+
CHECK_AND_FILL_VEC_PCM_FULL(candidate, posV0LegfITSClusterSizes, getPosITSClusterSizes);
141+
CHECK_AND_FILL_VEC_PCM_FULL(candidate, negV0LegfDCAXY, getEleDcaXY);
142+
CHECK_AND_FILL_VEC_PCM_FULL(candidate, negV0LegfDCAZ, getEleDcaZ);
143+
CHECK_AND_FILL_VEC_PCM_FULL(candidate, negV0LegfEta, getEleEta);
144+
CHECK_AND_FILL_VEC_PCM_FULL(candidate, negV0LegfTPCNClsShared, getEleTPCNClsShared);
145+
CHECK_AND_FILL_VEC_PCM_FULL(candidate, negV0LegfTPCNClsFindable, getEleTPCNClsFindable);
146+
CHECK_AND_FILL_VEC_PCM_FULL(candidate, negV0LegfTPCNClsFindableMinusFound, getEleTPCNClsFindableMinusShared);
147+
CHECK_AND_FILL_VEC_PCM_FULL(candidate, negV0LegfTPCNClsFindableMinusCrossedRows, getEleTPCNClsFindableMinusCrossedRows);
148+
CHECK_AND_FILL_VEC_PCM_FULL(candidate, negV0LegfTPCChi2NCl, getEleTPCChi2NCl);
149+
CHECK_AND_FILL_VEC_PCM_FULL(candidate, negV0LegfTPCSignal, getEleTPCSignal);
97150
CHECK_AND_FILL_VEC_PCM_FULL(negLeg, negV0LegfTPCNSigmaEl, tpcNSigmaEl);
98151
CHECK_AND_FILL_VEC_PCM_FULL(negLeg, negV0LegfTPCNSigmaPi, tpcNSigmaPi);
152+
CHECK_AND_FILL_VEC_PCM_FULL(candidate, negV0LegfITSClusterSizes, getEleITSClusterSizes);
99153
}
100154
}
101155
return inputFeatures;
@@ -106,17 +160,44 @@ class EmMlResponsePCM : public EmMlResponse<TypeOutputScore>
106160
void setAvailableInputFeatures()
107161
{
108162
MlResponse<TypeOutputScore>::mAvailableInputFeatures = {
163+
FILL_MAP_PCM(v0PhotonCandidatefVx),
164+
FILL_MAP_PCM(v0PhotonCandidatefVy),
165+
FILL_MAP_PCM(v0PhotonCandidatefVz),
109166
FILL_MAP_PCM(v0PhotonCandidatefDCAxyToPV),
110167
FILL_MAP_PCM(v0PhotonCandidatefDCAzToPV),
111168
FILL_MAP_PCM(v0PhotonCandidatefPCA),
112169
FILL_MAP_PCM(v0PhotonCandidatefAlpha),
113170
FILL_MAP_PCM(v0PhotonCandidatefQtArm),
114171
FILL_MAP_PCM(v0PhotonCandidatefChiSquareNDF),
172+
FILL_MAP_PCM(v0PhotonCandidatefCosPARZ),
173+
FILL_MAP_PCM(v0PhotonCandidatefCosPAXY),
115174
FILL_MAP_PCM(v0PhotonCandidatefCosPA),
175+
FILL_MAP_PCM(v0PhotonCandidatefPsiPair),
176+
FILL_MAP_PCM(v0PhotonCandidatefPhiV),
177+
FILL_MAP_PCM(posV0LegfDCAXY),
178+
FILL_MAP_PCM(posV0LegfDCAZ),
179+
FILL_MAP_PCM(posV0LegfEta),
180+
FILL_MAP_PCM(posV0LegfTPCNClsShared),
181+
FILL_MAP_PCM(posV0LegfTPCNClsFindable),
182+
FILL_MAP_PCM(posV0LegfTPCNClsFindableMinusFound),
183+
FILL_MAP_PCM(posV0LegfTPCNClsFindableMinusCrossedRows),
184+
FILL_MAP_PCM(posV0LegfTPCChi2NCl),
185+
FILL_MAP_PCM(posV0LegfTPCSignal),
116186
FILL_MAP_PCM(posV0LegfTPCNSigmaEl),
117187
FILL_MAP_PCM(posV0LegfTPCNSigmaPi),
188+
FILL_MAP_PCM(posV0LegfITSClusterSizes),
189+
FILL_MAP_PCM(negV0LegfDCAXY),
190+
FILL_MAP_PCM(negV0LegfDCAZ),
191+
FILL_MAP_PCM(negV0LegfEta),
192+
FILL_MAP_PCM(negV0LegfTPCNClsShared),
193+
FILL_MAP_PCM(negV0LegfTPCNClsFindable),
194+
FILL_MAP_PCM(negV0LegfTPCNClsFindableMinusFound),
195+
FILL_MAP_PCM(negV0LegfTPCNClsFindableMinusCrossedRows),
196+
FILL_MAP_PCM(negV0LegfTPCChi2NCl),
197+
FILL_MAP_PCM(negV0LegfTPCSignal),
118198
FILL_MAP_PCM(negV0LegfTPCNSigmaEl),
119-
FILL_MAP_PCM(negV0LegfTPCNSigmaPi)};
199+
FILL_MAP_PCM(negV0LegfTPCNSigmaPi),
200+
FILL_MAP_PCM(negV0LegfITSClusterSizes)};
120201
}
121202
};
122203

PWGEM/PhotonMeson/Core/Pi0EtaToGammaGamma.h

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,12 @@
7070
#include <utility>
7171
#include <vector>
7272

73+
enum AlphaMesonCutOption {
74+
Off = 0,
75+
SpecificValue = 1,
76+
PTDependent = 2
77+
};
78+
7379
template <o2::aod::pwgem::photonmeson::photonpair::PairType pairtype, o2::soa::is_table... Types>
7480
struct Pi0EtaToGammaGamma {
7581
o2::framework::Configurable<std::string> ccdburl{"ccdb-url", "http://alice-ccdb.cern.ch", "url of the ccdb repository"};
@@ -92,6 +98,11 @@ struct Pi0EtaToGammaGamma {
9298
o2::framework::ConfigurableAxis ConfEPBins{"ConfEPBins", {o2::framework::VARIABLE_WIDTH, -o2::constants::math::PIHalf, -o2::constants::math::PIQuarter, 0.0f, +o2::constants::math::PIQuarter, +o2::constants::math::PIHalf}, "Mixing bins - event plane angle"};
9399
o2::framework::ConfigurableAxis ConfOccupancyBins{"ConfOccupancyBins", {o2::framework::VARIABLE_WIDTH, -1, 1e+10}, "Mixing bins - occupancy"};
94100

101+
o2::framework::Configurable<int> cfgAlphaMesonCut{"cfgAlphaMesonCut", 0, "flag for photon energy asymmetry distribution cut: 0: no cut, 1: cut specific value, 2: cut depending on pT"};
102+
o2::framework::Configurable<float> cfgAlphaMeson{"cfgAlphaMeson", 0.65, "photon energy asymmetry distribution parameter for specific value cut"};
103+
o2::framework::Configurable<float> cfgAlphaMesonA{"cfgAlphaMesonA", 0.65, "photon energy asymmetry distribution parameter A for pT dependent cut (A * tanh(B*pT))"};
104+
o2::framework::Configurable<float> cfgAlphaMesonB{"cfgAlphaMesonB", 1.2, "photon energy asymmetry distribution parameter B for pT dependent cut (A * tanh(B*pT))"};
105+
95106
EMPhotonEventCut fEMEventCut;
96107
struct : o2::framework::ConfigurableGroup {
97108
std::string prefix = "eventcut_group";
@@ -880,6 +891,25 @@ struct Pi0EtaToGammaGamma {
880891
continue;
881892
}
882893

894+
float alphaMeson = std::fabs(g1.e() - g2.e()) / (g1.e() + g2.e());
895+
float alphaCut = 999.f;
896+
switch (static_cast<AlphaMesonCutOption>(cfgAlphaMesonCut.value)) {
897+
case AlphaMesonCutOption::Off:
898+
break;
899+
case AlphaMesonCutOption::SpecificValue:
900+
alphaCut = cfgAlphaMeson;
901+
break;
902+
case AlphaMesonCutOption::PTDependent: {
903+
alphaCut = cfgAlphaMesonA * std::tanh(cfgAlphaMesonB * v12.pt());
904+
break;
905+
}
906+
default:
907+
LOGF(error, "Invalid option for alpha meson cut. No alpha cut will be applied.");
908+
}
909+
if (alphaMeson > alphaCut) {
910+
continue;
911+
}
912+
883913
fRegistry.fill(HIST("Pair/same/hs"), v12.M(), v12.Pt(), weight);
884914

885915
if (std::find(used_photonIds_per_col.begin(), used_photonIds_per_col.end(), g1.globalIndex()) == used_photonIds_per_col.end()) {

PWGEM/PhotonMeson/Core/Pi0EtaToGammaGammaMC.h

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,12 @@
6565
#include <type_traits>
6666
#include <vector>
6767

68+
enum AlphaMesonCutOption {
69+
Off = 0,
70+
SpecificValue = 1,
71+
PTDependent = 2
72+
};
73+
6874
template <o2::aod::pwgem::photonmeson::photonpair::PairType pairtype, o2::soa::is_table... Types>
6975
struct Pi0EtaToGammaGammaMC {
7076
o2::framework::Configurable<std::string> ccdburl{"ccdb-url", "http://alice-ccdb.cern.ch", "url of the ccdb repository"};
@@ -81,6 +87,11 @@ struct Pi0EtaToGammaGammaMC {
8187
o2::framework::Configurable<std::string> fd_k0s_to_pi0{"fd_k0s_pi0", "1.0", "feed down correction to pi0"};
8288
o2::framework::Configurable<bool> cfgRequireTrueAssociation{"cfgRequireTrueAssociation", false, "flag to require true mc collision association"};
8389

90+
o2::framework::Configurable<int> cfgAlphaMesonCut{"cfgAlphaMesonCut", 0, "flag for photon energy asymmetry distribution cut: 0: no cut, 1: cut specific value, 2: cut depending on pT"};
91+
o2::framework::Configurable<float> cfgAlphaMeson{"cfgAlphaMeson", 0.65, "photon energy asymmetry distribution parameter for specific value cut"};
92+
o2::framework::Configurable<float> cfgAlphaMesonA{"cfgAlphaMesonA", 0.65, "photon energy asymmetry distribution parameter A for pT dependent cut (A * tanh(B*pT))"};
93+
o2::framework::Configurable<float> cfgAlphaMesonB{"cfgAlphaMesonB", 1.2, "photon energy asymmetry distribution parameter B for pT dependent cut (A * tanh(B*pT))"};
94+
8495
EMPhotonEventCut fEMEventCut;
8596
struct : o2::framework::ConfigurableGroup {
8697
std::string prefix = "eventcut_group";
@@ -672,6 +683,25 @@ struct Pi0EtaToGammaGammaMC {
672683
continue;
673684
}
674685

686+
float alphaMeson = std::fabs(g1.e() - g2.e()) / (g1.e() + g2.e());
687+
float alphaCut = 999.f;
688+
switch (static_cast<AlphaMesonCutOption>(cfgAlphaMesonCut.value)) {
689+
case AlphaMesonCutOption::Off:
690+
break;
691+
case AlphaMesonCutOption::SpecificValue:
692+
alphaCut = cfgAlphaMeson;
693+
break;
694+
case AlphaMesonCutOption::PTDependent: {
695+
alphaCut = cfgAlphaMesonA * std::tanh(cfgAlphaMesonB * v12.pt());
696+
break;
697+
}
698+
default:
699+
LOGF(error, "Invalid option for alpha meson cut. No alpha cut will be applied.");
700+
}
701+
if (alphaMeson > alphaCut) {
702+
continue;
703+
}
704+
675705
if (pairtype == o2::aod::pwgem::photonmeson::photonpair::PairType::kEMCEMC) {
676706
float openingAngle = std::acos(v1.Vect().Dot(v2.Vect()) / (v1.P() * v2.P()));
677707
if (openingAngle < emccuts.minOpenAngle) {

0 commit comments

Comments
 (0)