Skip to content

Commit 45132e4

Browse files
authored
[PWGHF,PWGJE] derivedDataCreatorDstarToD0Pi: Correct error in mass assignment. Add more columns. (#12089)
1 parent 37876dc commit 45132e4

File tree

4 files changed

+47
-18
lines changed

4 files changed

+47
-18
lines changed

PWGHF/DataModel/DerivedTables.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -928,7 +928,11 @@ DECLARE_SOA_TABLE_STAGED(HfDstarMls, "HFDSTML", //! Table with candidate selecti
928928

929929
DECLARE_SOA_TABLE_STAGED(HfDstarMcs, "HFDSTMC", //! Table with MC candidate info
930930
hf_cand_mc::FlagMcMatchRec,
931+
hf_cand_mc_charm::FlagMcMatchRecCharm,
931932
hf_cand_mc::OriginMcRec,
933+
hf_cand::PtBhadMotherPart,
934+
hf_cand::PdgBhadMotherPart,
935+
hf_cand::NTracksDecayed,
932936
o2::soa::Marker<MarkerDstar>);
933937

934938
// ----------------

PWGHF/HFJ/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,4 @@
77
#
88
# In applying this license CERN does not waive the privileges and immunities
99
# granted to it by virtue of its status as an Intergovernmental Organization
10-
# or submit itself to any jurisdiction.
10+
# or submit itself to any jurisdiction.

PWGHF/TableProducer/derivedDataCreatorDstarToD0Pi.cxx

Lines changed: 35 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ struct HfDerivedDataCreatorDstarToD0Pi {
8484
Configurable<float> ptMaxForDownSample{"ptMaxForDownSample", 10., "Maximum pt for the application of the downsampling factor"};
8585

8686
SliceCache cache;
87-
static constexpr double mass{o2::constants::physics::MassDStar};
87+
static constexpr double Mass{o2::constants::physics::MassDStar};
8888

8989
using CollisionsWCentMult = soa::Join<aod::Collisions, aod::CentFV0As, aod::CentFT0Ms, aod::CentFT0As, aod::CentFT0Cs, aod::PVMultZeqs>;
9090
using CollisionsWMcCentMult = soa::Join<aod::Collisions, aod::McCollisionLabels, aod::CentFV0As, aod::CentFT0Ms, aod::CentFT0As, aod::CentFT0Cs, aod::PVMultZeqs>;
@@ -126,8 +126,8 @@ struct HfDerivedDataCreatorDstarToD0Pi {
126126
}
127127

128128
template <typename T, typename U>
129-
void fillTablesCandidate(const T& candidate, const U& prong0, const U& prong1, const U& prongSoftPi, int candFlag, double invMass,
130-
double y, int8_t flagMc, int8_t origin, const std::vector<float>& mlScores)
129+
void fillTablesCandidate(const T& candidate, const U& prong0, const U& prong1, const U& prongSoftPi, int candFlag, double invMass, double invMassD0,
130+
double y, int8_t flagMc, int8_t flagMcD0, int8_t origin, int8_t nTracksDecayed, double ptBhad, int pdgBhad, const std::vector<float>& mlScores)
131131
{
132132
rowsCommon.fillTablesCandidate(candidate, invMass, y);
133133
if (fillCandidatePar) {
@@ -160,7 +160,7 @@ struct HfDerivedDataCreatorDstarToD0Pi {
160160
candidate.pxProng1(),
161161
candidate.pyProng1(),
162162
candidate.pzProng1(),
163-
candidate.invMassD0(),
163+
invMassD0,
164164
candidate.impactParameter0(),
165165
candidate.impactParameter1(),
166166
candidate.impactParameterNormalised0(),
@@ -196,7 +196,11 @@ struct HfDerivedDataCreatorDstarToD0Pi {
196196
if (fillCandidateMc) {
197197
rowCandidateMc(
198198
flagMc,
199-
origin);
199+
flagMcD0,
200+
origin,
201+
ptBhad,
202+
pdgBhad,
203+
nTracksDecayed);
200204
}
201205
}
202206

@@ -242,7 +246,9 @@ struct HfDerivedDataCreatorDstarToD0Pi {
242246
if constexpr (isMc) {
243247
reserveTable(rowCandidateMc, fillCandidateMc, sizeTableCand);
244248
}
245-
int8_t flagMcRec = 0, origin = 0;
249+
int8_t flagMcRec = 0, flagMcRecD0 = 0, origin = 0, nTracksDecayed = 0;
250+
double ptBhadMotherPart = 0;
251+
int pdgBhadMotherPart = 0;
246252
for (const auto& candidate : candidatesThisColl) {
247253
if constexpr (isMl) {
248254
if (!TESTBIT(candidate.isSelDstarToD0Pi(), aod::SelectionStep::RecoMl)) {
@@ -251,7 +257,11 @@ struct HfDerivedDataCreatorDstarToD0Pi {
251257
}
252258
if constexpr (isMc) {
253259
flagMcRec = candidate.flagMcMatchRec();
260+
flagMcRecD0 = candidate.flagMcMatchRecD0();
254261
origin = candidate.originMcRec();
262+
nTracksDecayed = candidate.nTracksDecayed();
263+
ptBhadMotherPart = candidate.ptBhadMotherPart();
264+
pdgBhadMotherPart = candidate.pdgBhadMotherPart();
255265
if constexpr (onlyBkg) {
256266
if (std::abs(flagMcRec) == hf_decay::hf_cand_dstar::DecayChannelMain::DstarToPiKPi) {
257267
continue;
@@ -273,13 +283,22 @@ struct HfDerivedDataCreatorDstarToD0Pi {
273283
auto prong1 = candidate.template prong1_as<TracksWPid>();
274284
auto prongSoftPi = candidate.template prongPi_as<TracksWPid>();
275285
double y = candidate.y(o2::constants::physics::MassDStar);
276-
double massDstar = candidate.invMassDstar();
286+
int flagSign = -1;
287+
double massDstar = 0, invMassD0 = 0;
277288
std::vector<float> mlScoresDstarToD0Pi;
278-
bool isD0 = prongSoftPi.sign() < 0;
279289
if constexpr (isMl) {
280290
std::copy(candidate.mlProbDstarToD0Pi().begin(), candidate.mlProbDstarToD0Pi().end(), std::back_inserter(mlScoresDstarToD0Pi));
281291
}
282-
fillTablesCandidate(candidate, prong0, prong1, prongSoftPi, isD0 ? 0 : 1, y, massDstar, flagMcRec, origin, mlScoresDstarToD0Pi);
292+
if (candidate.signSoftPi() > 0) {
293+
massDstar = candidate.invMassDstar();
294+
invMassD0 = candidate.invMassD0();
295+
flagSign = 0;
296+
} else {
297+
massDstar = candidate.invMassAntiDstar();
298+
invMassD0 = candidate.invMassD0Bar();
299+
flagSign = 1;
300+
}
301+
fillTablesCandidate(candidate, prong0, prong1, prongSoftPi, flagSign, massDstar, invMassD0, y, flagMcRec, flagMcRecD0, origin, nTracksDecayed, ptBhadMotherPart, pdgBhadMotherPart, mlScoresDstarToD0Pi);
283302
}
284303
}
285304
}
@@ -302,7 +321,7 @@ struct HfDerivedDataCreatorDstarToD0Pi {
302321
{
303322
rowsCommon.preProcessMcCollisions(mcCollisions, mcParticlesPerMcCollision, mcParticles);
304323
processCandidates<false, true, false, true>(collisions, candidatesMcSig, tracks, bcs);
305-
rowsCommon.processMcParticles(mcCollisions, mcParticlesPerMcCollision, mcParticles, mass);
324+
rowsCommon.processMcParticles(mcCollisions, mcParticlesPerMcCollision, mcParticles, Mass);
306325
}
307326
PROCESS_SWITCH(HfDerivedDataCreatorDstarToD0Pi, processMcSig, "Process MC only for signals", false);
308327

@@ -315,7 +334,7 @@ struct HfDerivedDataCreatorDstarToD0Pi {
315334
{
316335
rowsCommon.preProcessMcCollisions(mcCollisions, mcParticlesPerMcCollision, mcParticles);
317336
processCandidates<false, true, true, false>(collisions, candidatesMcBkg, tracks, bcs);
318-
rowsCommon.processMcParticles(mcCollisions, mcParticlesPerMcCollision, mcParticles, mass);
337+
rowsCommon.processMcParticles(mcCollisions, mcParticlesPerMcCollision, mcParticles, Mass);
319338
}
320339
PROCESS_SWITCH(HfDerivedDataCreatorDstarToD0Pi, processMcBkg, "Process MC only for background", false);
321340

@@ -328,7 +347,7 @@ struct HfDerivedDataCreatorDstarToD0Pi {
328347
{
329348
rowsCommon.preProcessMcCollisions(mcCollisions, mcParticlesPerMcCollision, mcParticles);
330349
processCandidates<false, true, false, false>(collisions, candidatesMcAll, tracks, bcs);
331-
rowsCommon.processMcParticles(mcCollisions, mcParticlesPerMcCollision, mcParticles, mass);
350+
rowsCommon.processMcParticles(mcCollisions, mcParticlesPerMcCollision, mcParticles, Mass);
332351
}
333352
PROCESS_SWITCH(HfDerivedDataCreatorDstarToD0Pi, processMcAll, "Process MC", false);
334353

@@ -352,7 +371,7 @@ struct HfDerivedDataCreatorDstarToD0Pi {
352371
{
353372
rowsCommon.preProcessMcCollisions(mcCollisions, mcParticlesPerMcCollision, mcParticles);
354373
processCandidates<true, true, false, true>(collisions, candidatesMcMlSig, tracks, bcs);
355-
rowsCommon.processMcParticles(mcCollisions, mcParticlesPerMcCollision, mcParticles, mass);
374+
rowsCommon.processMcParticles(mcCollisions, mcParticlesPerMcCollision, mcParticles, Mass);
356375
}
357376
PROCESS_SWITCH(HfDerivedDataCreatorDstarToD0Pi, processMcMlSig, "Process MC with ML only for signals", false);
358377

@@ -365,7 +384,7 @@ struct HfDerivedDataCreatorDstarToD0Pi {
365384
{
366385
rowsCommon.preProcessMcCollisions(mcCollisions, mcParticlesPerMcCollision, mcParticles);
367386
processCandidates<true, true, true, false>(collisions, candidatesMcMlBkg, tracks, bcs);
368-
rowsCommon.processMcParticles(mcCollisions, mcParticlesPerMcCollision, mcParticles, mass);
387+
rowsCommon.processMcParticles(mcCollisions, mcParticlesPerMcCollision, mcParticles, Mass);
369388
}
370389
PROCESS_SWITCH(HfDerivedDataCreatorDstarToD0Pi, processMcMlBkg, "Process MC with ML only for background", false);
371390

@@ -378,14 +397,14 @@ struct HfDerivedDataCreatorDstarToD0Pi {
378397
{
379398
rowsCommon.preProcessMcCollisions(mcCollisions, mcParticlesPerMcCollision, mcParticles);
380399
processCandidates<true, true, false, false>(collisions, candidatesMcMlAll, tracks, bcs);
381-
rowsCommon.processMcParticles(mcCollisions, mcParticlesPerMcCollision, mcParticles, mass);
400+
rowsCommon.processMcParticles(mcCollisions, mcParticlesPerMcCollision, mcParticles, Mass);
382401
}
383402
PROCESS_SWITCH(HfDerivedDataCreatorDstarToD0Pi, processMcMlAll, "Process MC with ML", false);
384403

385404
void processMcGenOnly(TypeMcCollisions const& mcCollisions,
386405
MatchedGenCandidatesMc const& mcParticles)
387406
{
388-
rowsCommon.processMcParticles(mcCollisions, mcParticlesPerMcCollision, mcParticles, mass);
407+
rowsCommon.processMcParticles(mcCollisions, mcParticlesPerMcCollision, mcParticles, Mass);
389408
}
390409
PROCESS_SWITCH(HfDerivedDataCreatorDstarToD0Pi, processMcGenOnly, "Process MC gen. only", false);
391410
};

PWGJE/Core/JetHFUtilities.h

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -885,7 +885,13 @@ void fillDstarCandidateTable(T const& candidate, U& DstarParTable, V& DstarParDa
885885
DstarMlTable(mlScoresVector);
886886

887887
if constexpr (isMc) {
888-
DstarMCDTable(candidate.flagMcMatchRec(), candidate.originMcRec());
888+
DstarMCDTable(
889+
candidate.flagMcMatchRec(),
890+
candidate.flagMcMatchRecCharm(),
891+
candidate.originMcRec(),
892+
candidate.ptBhadMotherPart(),
893+
candidate.pdgBhadMotherPart(),
894+
candidate.nTracksDecayed());
889895
}
890896
}
891897

0 commit comments

Comments
 (0)