Skip to content

Commit 27e64a4

Browse files
author
Henrik Fribert
committed
SigmaPlusPcm: BDT score in a separate table, score selection in d2d and pair task, MC labels via the proton for background
1 parent 985f4a4 commit 27e64a4

7 files changed

Lines changed: 57 additions & 104 deletions

File tree

‎PWGCF/Femto/Core/kinkBuilder.h‎

Lines changed: 28 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ struct ConfKinkFilters : o2::framework::ConfigurableGroup {
5959
o2::framework::Configurable<float> massMaxSigmaPlus{"massMaxSigmaPlus", 1.3f, "Maximum mass for SigmaPlus hypothesis"};
6060
o2::framework::Configurable<float> massMinSigmaPlusPcm{"massMinSigmaPlusPcm", 1.1f, "Minimum mass for SigmaPlus (PCM) hypothesis"};
6161
o2::framework::Configurable<float> massMaxSigmaPlusPcm{"massMaxSigmaPlusPcm", 1.3f, "Maximum mass for SigmaPlus (PCM) hypothesis"};
62+
o2::framework::Configurable<float> mlScoreMinSigmaPlusPcm{"mlScoreMinSigmaPlusPcm", -1.f, "Minimum BDT score for SigmaPlus (PCM) (-1: no cut)"};
6263
};
6364

6465
// selections bits for all kinks
@@ -104,7 +105,6 @@ struct ConfSigmaPlusBits : o2::framework::ConfigurableGroup {
104105
struct ConfSigmaPlusPcmBits : o2::framework::ConfigurableGroup {
105106
std::string prefix = std::string("SigmaPlusPcmBits");
106107
o2::framework::Configurable<bool> passThrough{"passThrough", false, "If true, all SigmaPlusPcm are passed through. Bits for all selections are stored."};
107-
o2::framework::Configurable<std::vector<float>> mlScoreMin{"mlScoreMin", {0.35f, 0.63f, 0.77f}, "Minimum BDT score"};
108108
o2::framework::Configurable<std::vector<float>> flightDirTiltMax{"flightDirTiltMax", {0.05f}, "Maximum tilt of the flight direction (rad)"};
109109
o2::framework::Configurable<std::vector<float>> mothDcaPvMax{"mothDcaPvMax", {1.0f}, "Maximum DCA of mother from primary vertex (cm)"};
110110
o2::framework::Configurable<std::vector<float>> chaDauDcaZMax{"chaDauDcaZMax", {0.3f}, "Maximum |DCAz| of charged daughter from primary vertex (cm)"};
@@ -151,15 +151,7 @@ struct ConfSigmaPlusPcmSelection : o2::framework::ConfigurableGroup {
151151
std::string prefix = Prefix;
152152
KINK_DEFAULT_SELECTIONS(1.1, 1.3, 3222)
153153
o2::framework::Configurable<int> sign{"sign", 1, "Sign of the Sigma candidate (e.g. +1 for Sigma+ or -1 for AntiSigma+)"};
154-
};
155-
156-
// base selection for analysis task for sigma plus reconstructed with a PCM photon, with a cut on the BDT score
157-
template <auto& Prefix>
158-
struct ConfSigmaPlusPcmMlSelection : o2::framework::ConfigurableGroup {
159-
std::string prefix = Prefix;
160-
KINK_DEFAULT_SELECTIONS(1.1, 1.3, 3222)
161-
o2::framework::Configurable<int> sign{"sign", 1, "Sign of the Sigma candidate (e.g. +1 for Sigma+ or -1 for AntiSigma+)"};
162-
o2::framework::Configurable<float> mlScoreMin{"mlScoreMin", 0.f, "Minimum BDT score"};
154+
o2::framework::Configurable<float> mlScoreMin{"mlScoreMin", -1.f, "Minimum BDT score (-1: no cut)"};
163155
};
164156

165157
#undef KINK_DEFAULT_SELECTIONS
@@ -176,10 +168,6 @@ constexpr const char PrefixSigmaPlusPcmSelection1[] = "SigmaPlusPcmSelection1";
176168
constexpr const char PrefixSigmaPlusPcmSelection2[] = "SigmaPlusPcmSelection2";
177169
using ConfSigmaPlusPcmSelection1 = ConfSigmaPlusPcmSelection<PrefixSigmaPlusPcmSelection1>;
178170
using ConfSigmaPlusPcmSelection2 = ConfSigmaPlusPcmSelection<PrefixSigmaPlusPcmSelection2>;
179-
constexpr const char PrefixSigmaPlusPcmMlSelection1[] = "SigmaPlusPcmMlSelection1";
180-
constexpr const char PrefixSigmaPlusPcmMlSelection2[] = "SigmaPlusPcmMlSelection2";
181-
using ConfSigmaPlusPcmMlSelection1 = ConfSigmaPlusPcmMlSelection<PrefixSigmaPlusPcmMlSelection1>;
182-
using ConfSigmaPlusPcmMlSelection2 = ConfSigmaPlusPcmMlSelection<PrefixSigmaPlusPcmMlSelection2>;
183171

184172
/// The different selections for kinks
185173
enum KinkSeles {
@@ -204,7 +192,6 @@ enum KinkSeles {
204192
kPtOriginalMin,
205193
kPtOriginalMax,
206194

207-
kMlScoreMin,
208195
kFlightDirTiltMax,
209196
kChaDauDcaZMax,
210197
kPhotonDcaZMax,
@@ -233,7 +220,6 @@ const std::unordered_map<KinkSeles, std::string> kinkSelectionNames = {
233220
{kCosPointingAngleMin, "cosPointingAngleMin"},
234221
{kPtOriginalMin, "ptOriginalMin"},
235222
{kPtOriginalMax, "ptOriginalMax"},
236-
{kMlScoreMin, "mlScoreMin"},
237223
{kFlightDirTiltMax, "flightDirTiltMax"},
238224
{kChaDauDcaZMax, "chaDauDcaZMax"},
239225
{kPhotonDcaZMax, "photonDcaZMax"}};
@@ -248,6 +234,7 @@ enum KinkFilters {
248234
kPhiMax,
249235
kMassMin,
250236
kMassMax,
237+
kMlScoreMin,
251238
kKinkFiltersMax
252239
};
253240

@@ -262,7 +249,8 @@ const std::unordered_map<KinkFilters, std::string> kinkFilterNames = {
262249
{kPhiMin, "phiMin"},
263250
{kPhiMax, "phiMax"},
264251
{kMassMin, "massMin"},
265-
{kMassMax, "massMax"}};
252+
{kMassMax, "massMax"},
253+
{kMlScoreMin, "mlScoreMin"}};
266254

267255
/// \class KinkCuts
268256
/// \brief Cut class to contain and execute all cuts applied to kinks
@@ -557,6 +545,7 @@ struct KinkBuilderProducts : o2::framework::ProducesGroup {
557545
o2::framework::Produces<o2::aod::FSigmaPlusPcm> producedSigmaPlusPcm;
558546
o2::framework::Produces<o2::aod::FLiteSigmaPlusPcm> producedLiteSigmaPlusPcm;
559547
o2::framework::Produces<o2::aod::FSigmaPlusPcmMasks> producedSigmaPlusPcmMasks;
548+
o2::framework::Produces<o2::aod::FSigmaPlusPcmMlScores> producedSigmaPlusPcmMlScores;
560549
o2::framework::Produces<o2::aod::FSigmaPlusPcmExtras> producedSigmaPlusPcmExtras;
561550
};
562551

@@ -573,6 +562,7 @@ struct ConfKinkTables : o2::framework::ConfigurableGroup {
573562
o2::framework::Configurable<int> produceSigmaPlusPcm{"produceSigmaPlusPcm", -1, "Produce SigmaPlusPcm (-1: auto; 0 off; 1 on)"};
574563
o2::framework::Configurable<int> produceLiteSigmaPlusPcm{"produceLiteSigmaPlusPcm", -1, "Produce LiteSigmaPlusPcm (-1: auto; 0 off; 1 on)"};
575564
o2::framework::Configurable<int> produceSigmaPlusPcmMasks{"produceSigmaPlusPcmMasks", -1, "Produce SigmaPlusPcmMasks (-1: auto; 0 off; 1 on)"};
565+
o2::framework::Configurable<int> produceSigmaPlusPcmMlScores{"produceSigmaPlusPcmMlScores", -1, "Produce SigmaPlusPcmMlScores (-1: auto; 0 off; 1 on)"};
576566
o2::framework::Configurable<int> produceSigmaPlusPcmExtras{"produceSigmaPlusPcmExtras", -1, "Produce SigmaPlusPcmExtras (-1: auto; 0 off; 1 on)"};
577567
};
578568

@@ -839,9 +829,9 @@ class SigmaPlusPcmSelection : public baseselection::BaseSelection<float, o2::ana
839829
mPhiMax = filter.phiMax.value;
840830
mMassLowerLimit = filter.massMinSigmaPlusPcm.value;
841831
mMassUpperLimit = filter.massMaxSigmaPlusPcm.value;
832+
mMlScoreMin = filter.mlScoreMinSigmaPlusPcm.value;
842833
mKeepTracksWithoutTof = config.keepTracksWithoutTof.value;
843834

844-
this->addSelection(kMlScoreMin, kinkSelectionNames.at(kMlScoreMin), config.mlScoreMin.value, limits::kLowerLimit, true, true, false);
845835
this->addSelection(kFlightDirTiltMax, kinkSelectionNames.at(kFlightDirTiltMax), config.flightDirTiltMax.value, limits::kUpperLimit, true, true, false);
846836
this->addSelection(kMothDcaPvMax, kinkSelectionNames.at(kMothDcaPvMax), config.mothDcaPvMax.value, limits::kUpperLimit, true, true, false);
847837
this->addSelection(kChaDauDcaZMax, kinkSelectionNames.at(kChaDauDcaZMax), config.chaDauDcaZMax.value, limits::kAbsUpperLimit, true, true, false);
@@ -862,6 +852,7 @@ class SigmaPlusPcmSelection : public baseselection::BaseSelection<float, o2::ana
862852
{kinkFilterNames.at(kPhiMax), mPhiMax},
863853
{kinkFilterNames.at(kMassMin), mMassLowerLimit},
864854
{kinkFilterNames.at(kMassMax), mMassUpperLimit},
855+
{kinkFilterNames.at(kMlScoreMin), mMlScoreMin},
865856
});
866857
};
867858

@@ -873,6 +864,7 @@ class SigmaPlusPcmSelection : public baseselection::BaseSelection<float, o2::ana
873864
mEta = RecoDecay::eta(momMother);
874865
mPhi = RecoDecay::phi(momMother);
875866
mMass = sigmaPlusPcmCand.massSigmaPlus();
867+
mMlScore = sigmaPlusPcmCand.mlScore();
876868
}
877869

878870
template <typename T>
@@ -913,6 +905,10 @@ class SigmaPlusPcmSelection : public baseselection::BaseSelection<float, o2::ana
913905
this->template fillFilter<FilterHistName>(kMassMax, p);
914906
pass &= p;
915907

908+
p = mMlScore >= mMlScoreMin;
909+
this->template fillFilter<FilterHistName>(kMlScoreMin, p);
910+
pass &= p;
911+
916912
this->template fillFilterSummary<FilterHistName>(pass);
917913

918914
return this->isPassThrough() || pass;
@@ -922,7 +918,6 @@ class SigmaPlusPcmSelection : public baseselection::BaseSelection<float, o2::ana
922918
void applySelections(T1 const& sigmaPlusPcmCand, T2 const& /*tracks*/)
923919
{
924920
this->reset();
925-
this->evaluateObservable(kMlScoreMin, sigmaPlusPcmCand.mlScore());
926921
this->evaluateObservable(kFlightDirTiltMax, sigmaPlusPcmCand.flightDirTilt());
927922
this->evaluateObservable(kMothDcaPvMax, sigmaPlusPcmCand.candDcaToPV());
928923
this->evaluateObservable(kChaDauDcaZMax, sigmaPlusPcmCand.protonDcaZ());
@@ -947,6 +942,7 @@ class SigmaPlusPcmSelection : public baseselection::BaseSelection<float, o2::ana
947942
private:
948943
float mMassLowerLimit = 1.1f;
949944
float mMassUpperLimit = 1.3f;
945+
float mMlScoreMin = -1.f;
950946
bool mKeepTracksWithoutTof = true;
951947

952948
// kinematic filters
@@ -962,6 +958,7 @@ class SigmaPlusPcmSelection : public baseselection::BaseSelection<float, o2::ana
962958
float mEta = 0.f;
963959
float mPhi = 0.f;
964960
float mMass = 0.f;
961+
float mMlScore = 0.f;
965962
};
966963

967964
template <auto& SelectionHistName, auto& FilterHistName>
@@ -978,6 +975,7 @@ class SigmaPlusPcmBuilder
978975
mProduceSigmaPlusPcm = utils::enableTable("FSigmaPlusPcm_001", table.produceSigmaPlusPcm.value, initContext);
979976
mProduceLiteSigmaPlusPcm = utils::enableTable("FLiteSigmaPlusPcm_001", table.produceLiteSigmaPlusPcm.value, initContext);
980977
mProduceSigmaPlusPcmMasks = utils::enableTable("FSigmaPlusPcmMasks_001", table.produceSigmaPlusPcmMasks.value, initContext);
978+
mProduceSigmaPlusPcmMlScores = utils::enableTable("FSigmaPlusPcmMlScores_001", table.produceSigmaPlusPcmMlScores.value, initContext);
981979
mProduceSigmaPlusPcmExtras = utils::enableTable("FSigmaPlusPcmExtras_001", table.produceSigmaPlusPcmExtras.value, initContext);
982980

983981
if (mProduceSigmaPlusPcm && mProduceLiteSigmaPlusPcm) {
@@ -996,7 +994,7 @@ class SigmaPlusPcmBuilder
996994
<< "or switch to FSigmaPlusPcm if TrackTables.produceTracks is enabled instead.";
997995
}
998996

999-
if (mProduceSigmaPlusPcm || mProduceLiteSigmaPlusPcm || mProduceSigmaPlusPcmMasks || mProduceSigmaPlusPcmExtras) {
997+
if (mProduceSigmaPlusPcm || mProduceLiteSigmaPlusPcm || mProduceSigmaPlusPcmMasks || mProduceSigmaPlusPcmMlScores || mProduceSigmaPlusPcmExtras) {
1000998
mFillAnyTable = true;
1001999
} else {
10021000
LOG(info) << "No tables configured, Selection object will not be configured...";
@@ -1057,7 +1055,7 @@ class SigmaPlusPcmBuilder
10571055
auto daughter = sigmaPlusPcm.template protonTrack_as<T8>();
10581056
daughterIndex = trackBuilder.template getDaughterIndex<system, modes::Track::kKinkDaughter>(daughter, trackProducts, mcCols, collisionBuilder, mcParticles, mcBuilder, mcProducts);
10591057
fillSigmaPlusPcm(collisionBuilder, kinkProducts, sigmaPlusPcm, daughterIndex);
1060-
mcBuilder.template fillMcSigmaPlusPcmWithLabel<system>(sigmaPlusPcm, mcParticles, mcCols, mcProducts);
1058+
mcBuilder.template fillMcSigmaPlusPcmWithLabel<system>(sigmaPlusPcm, daughter, mcParticles, mcCols, mcProducts);
10611059
}
10621060
}
10631061

@@ -1084,9 +1082,11 @@ class SigmaPlusPcmBuilder
10841082
if (mProduceSigmaPlusPcmMasks) {
10851083
kinkProducts.producedSigmaPlusPcmMasks(mSigmaPlusPcmSelection.getBitmask());
10861084
}
1085+
if (mProduceSigmaPlusPcmMlScores) {
1086+
kinkProducts.producedSigmaPlusPcmMlScores(sigmaPlusPcm.mlScore());
1087+
}
10871088
if (mProduceSigmaPlusPcmExtras) {
10881089
kinkProducts.producedSigmaPlusPcmExtras(
1089-
sigmaPlusPcm.mlScore(),
10901090
sigmaPlusPcm.flightDirTilt(),
10911091
sigmaPlusPcm.candDcaToPV(),
10921092
sigmaPlusPcm.protonDcaXY(),
@@ -1112,6 +1112,7 @@ class SigmaPlusPcmBuilder
11121112
bool mProduceSigmaPlusPcm = false;
11131113
bool mProduceLiteSigmaPlusPcm = false;
11141114
bool mProduceSigmaPlusPcmMasks = false;
1115+
bool mProduceSigmaPlusPcmMlScores = false;
11151116
bool mProduceSigmaPlusPcmExtras = false;
11161117
};
11171118

@@ -1130,6 +1131,7 @@ struct KinkBuilderDerivedToDerivedProducts : o2::framework::ProducesGroup {
11301131
o2::framework::Produces<o2::aod::StoredFSigmaPlusExtras> producedSigmaPlusExtras;
11311132
o2::framework::Produces<o2::aod::StoredFSigmaPlusPcm> producedSigmaPlusPcms;
11321133
o2::framework::Produces<o2::aod::StoredFSigmaPlusPcmMasks> producedSigmaPlusPcmMasks;
1134+
o2::framework::Produces<o2::aod::StoredFSigmaPlusPcmMlScores> producedSigmaPlusPcmMlScores;
11331135
o2::framework::Produces<o2::aod::StoredFSigmaPlusPcmExtras> producedSigmaPlusPcmExtras;
11341136
};
11351137

@@ -1360,8 +1362,10 @@ class KinkBuilderDerivedToDerived
13601362
void fillSigmaPlusPcmExtensions(T1 const& sigmaPlusPcm, T2& newSigmaPlusPcmTable)
13611363
{
13621364
if constexpr (requires(T1 t) { t.mlScore(); }) {
1363-
newSigmaPlusPcmTable.producedSigmaPlusPcmExtras(sigmaPlusPcm.mlScore(),
1364-
sigmaPlusPcm.flightDirTilt(),
1365+
newSigmaPlusPcmTable.producedSigmaPlusPcmMlScores(sigmaPlusPcm.mlScore());
1366+
}
1367+
if constexpr (requires(T1 t) { t.photonConvRadius(); }) {
1368+
newSigmaPlusPcmTable.producedSigmaPlusPcmExtras(sigmaPlusPcm.flightDirTilt(),
13651369
sigmaPlusPcm.dcaMothToPV(),
13661370
sigmaPlusPcm.dauDcaXY(),
13671371
sigmaPlusPcm.dauDcaZ(),

‎PWGCF/Femto/Core/mcBuilder.h‎

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -429,14 +429,19 @@ class McBuilder
429429
fillMcLabelGeneric<system>(sigmaPlusDaughter, mcParticles, mcCols, mcProducts, [](auto& prod, int64_t p) { prod.producedSigmaPlusLabels(p); }, true);
430430
}
431431

432-
template <modes::System system, typename T1, typename T2, typename T3, typename T4>
433-
void fillMcSigmaPlusPcmWithLabel(T1 const& sigmaPlusPcm, T2 const& mcParticles, T3 const& mcCols, T4& mcProducts)
432+
template <modes::System system, typename T1, typename T2, typename T3, typename T4, typename T5>
433+
void fillMcSigmaPlusPcmWithLabel(T1 const& sigmaPlusPcm, T2 const& chaDaughter, T3 const& mcParticles, T4 const& mcCols, T5& mcProducts)
434434
{
435435
if (!mProduceSigmaPlusPcmLabels) {
436436
mcProducts.producedSigmaPlusPcmLabels(-1);
437437
return;
438438
}
439-
fillMcLabelGeneric<system>(sigmaPlusPcm, mcParticles, mcCols, mcProducts, [](auto& prod, int64_t p) { prod.producedSigmaPlusPcmLabels(p); });
439+
// true sigma plus (proton and photon from it): label of the sigma plus, otherwise label of the proton, its mother gives the origin of the background
440+
if (sigmaPlusPcm.has_mcParticle()) {
441+
fillMcLabelGeneric<system>(sigmaPlusPcm, mcParticles, mcCols, mcProducts, [](auto& prod, int64_t p) { prod.producedSigmaPlusPcmLabels(p); });
442+
} else {
443+
fillMcLabelGeneric<system>(chaDaughter, mcParticles, mcCols, mcProducts, [](auto& prod, int64_t p) { prod.producedSigmaPlusPcmLabels(p); });
444+
}
440445
}
441446

442447
template <modes::System system, typename T1, typename T2, typename T3, typename T4>

‎PWGCF/Femto/Core/partitions.h‎

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -256,21 +256,7 @@
256256
(o2::aod::femtobase::stored::phi < (selection).phiMax) && \
257257
(o2::aod::femtobase::stored::mass > (selection).massMin) && \
258258
(o2::aod::femtobase::stored::mass < (selection).massMax) && \
259-
ncheckbit(o2::aod::femtokinks::mask, (selection).mask)
260-
261-
// NOLINTNEXTLINE(cppcoreguidelines-macro-usage)
262-
#define MAKE_SIGMAPLUSPCM_ML_PARTITION(selection) \
263-
ifnode((selection).sign.node() != 0, \
264-
ifnode((selection).sign.node() > 0, o2::aod::femtobase::stored::signedPt > 0.f, o2::aod::femtobase::stored::signedPt < 0.f), true) && \
265-
(nabs(o2::aod::femtobase::stored::signedPt) > (selection).ptMin) && \
266-
(nabs(o2::aod::femtobase::stored::signedPt) < (selection).ptMax) && \
267-
(o2::aod::femtobase::stored::eta > (selection).etaMin) && \
268-
(o2::aod::femtobase::stored::eta < (selection).etaMax) && \
269-
(o2::aod::femtobase::stored::phi > (selection).phiMin) && \
270-
(o2::aod::femtobase::stored::phi < (selection).phiMax) && \
271-
(o2::aod::femtobase::stored::mass > (selection).massMin) && \
272-
(o2::aod::femtobase::stored::mass < (selection).massMax) && \
273-
(o2::aod::femtokinks::mlScore > (selection).mlScoreMin) && \
259+
(o2::aod::femtokinks::mlScore >= (selection).mlScoreMin) && \
274260
ncheckbit(o2::aod::femtokinks::mask, (selection).mask)
275261

276262
// partition for D0

‎PWGCF/Femto/DataModel/FemtoTables.h‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1322,8 +1322,12 @@ DECLARE_SOA_TABLE_STAGED_VERSIONED(FSigmaPlusPcmMasks_001, "FSIGMAPCMMASKS", 1,
13221322
using FSigmaPlusPcmMasks = FSigmaPlusPcmMasks_001;
13231323
using StoredFSigmaPlusPcmMasks = StoredFSigmaPlusPcmMasks_001;
13241324

1325+
DECLARE_SOA_TABLE_STAGED_VERSIONED(FSigmaPlusPcmMlScores_001, "FSIGMAPCMML", 1,
1326+
femtokinks::MlScore);
1327+
using FSigmaPlusPcmMlScores = FSigmaPlusPcmMlScores_001;
1328+
using StoredFSigmaPlusPcmMlScores = StoredFSigmaPlusPcmMlScores_001;
1329+
13251330
DECLARE_SOA_TABLE_STAGED_VERSIONED(FSigmaPlusPcmExtras_001, "FSIGMAPCMEXTRA", 1,
1326-
femtokinks::MlScore,
13271331
femtokinks::FlightDirTilt,
13281332
femtokinks::DcaMothToPV,
13291333
femtokinks::DauDcaXY,

0 commit comments

Comments
 (0)