Skip to content

Commit 13b12f7

Browse files
fmazzascFrancesco Mazzaschi
andauthored
[PWGLF] Add generated k* in sigmaproton task (#15095)
Co-authored-by: Francesco Mazzaschi <fmazzasc@alipap1.cern.ch>
1 parent eb30224 commit 13b12f7

File tree

2 files changed

+63
-9
lines changed

2 files changed

+63
-9
lines changed

PWGLF/DataModel/LFSigmaProtonTables.h

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,9 @@ DECLARE_SOA_COLUMN(NSigmaTOFPr, nSigmaTOFPr, float); //! Number of sigmas for th
4444
DECLARE_SOA_COLUMN(SigmaPDG, sigmaPDG, int); //! PDG code of the Sigma daughter
4545
DECLARE_SOA_COLUMN(DaughterPDG, daughterPDG, int); //! PDG code of the kink daughter
4646
DECLARE_SOA_COLUMN(PrPDG, prPDG, int); //! PDG code of the proton candidate
47+
DECLARE_SOA_COLUMN(SigmaGenPt, sigmaGenPt, float); //! Generated pT of the Sigma candidate
48+
DECLARE_SOA_COLUMN(PrGenPt, prGenPt, float); //! Generated pT of the proton candidate
49+
DECLARE_SOA_COLUMN(GenKStar, genKStar, float); //! Generated k* of the Sigma-Proton pair
4750

4851
} // namespace sigmaproton
4952

@@ -60,7 +63,8 @@ DECLARE_SOA_TABLE(SigmaProtonMCCands, "AOD", "SIGMAPROTONMCCANDS",
6063
kinkcand::PxDaug, kinkcand::PyDaug, kinkcand::PzDaug, sigmaproton::SigmaDecRad, sigmaproton::SigmaCosPA,
6164
sigmaproton::ChargePr, sigmaproton::PxPr, sigmaproton::PyPr, sigmaproton::PzPr,
6265
sigmaproton::NSigmaTPCPr, sigmaproton::NSigmaTOFPr,
63-
sigmaproton::SigmaPDG, sigmaproton::DaughterPDG, sigmaproton::PrPDG);
66+
sigmaproton::SigmaPDG, sigmaproton::DaughterPDG, sigmaproton::PrPDG,
67+
sigmaproton::SigmaGenPt, sigmaproton::PrGenPt, sigmaproton::GenKStar);
6468

6569
} // namespace o2::aod
6670

PWGLF/TableProducer/Strangeness/sigmaProtonCorr.cxx

Lines changed: 58 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,26 @@ struct sigmaProtonCorrTask {
180180
return 0.5 * trackRelK.P();
181181
}
182182

183+
float getKStar(float sigmaPx, float sigmaPy, float sigmaPz, float pxPr, float pyPr, float pzPr)
184+
{
185+
TLorentzVector part1; // Sigma
186+
TLorentzVector part2; // Proton
187+
part1.SetXYZM(sigmaPx, sigmaPy, sigmaPz, o2::constants::physics::MassSigmaMinus);
188+
part2.SetXYZM(pxPr, pyPr, pzPr, o2::constants::physics::MassProton);
189+
trackSum = part1 + part2;
190+
const float beta = trackSum.Beta();
191+
const float betax = beta * std::cos(trackSum.Phi()) * std::sin(trackSum.Theta());
192+
const float betay = beta * std::sin(trackSum.Phi()) * std::sin(trackSum.Theta());
193+
const float betaz = beta * std::cos(trackSum.Theta());
194+
PartOneCMS.SetXYZM(part1.Px(), part1.Py(), part1.Pz(), part1.M());
195+
PartTwoCMS.SetXYZM(part2.Px(), part2.Py(), part2.Pz(), part2.M());
196+
const ROOT::Math::Boost boostPRF = ROOT::Math::Boost(-betax, -betay, -betaz);
197+
PartOneCMS = boostPRF(PartOneCMS);
198+
PartTwoCMS = boostPRF(PartTwoCMS);
199+
trackRelK = PartOneCMS - PartTwoCMS;
200+
return 0.5 * trackRelK.P();
201+
}
202+
183203
template <typename Ttrack>
184204
bool selectPrTrack(const Ttrack& candidate)
185205
{
@@ -410,9 +430,22 @@ struct sigmaProtonCorrTask {
410430
auto mcLabelSigma = tracks.rawIteratorAt(candidate.sigmaID);
411431
auto mcLabelSigmaDau = tracks.rawIteratorAt(candidate.kinkDauID);
412432
auto mcLabelPr = tracks.rawIteratorAt(candidate.prID);
413-
auto pdgSigma = mcLabelSigma.has_mcParticle() ? mcLabelSigma.mcParticle_as<aod::McParticles>().pdgCode() : -999;
414-
auto pdgSigmaDau = mcLabelSigmaDau.has_mcParticle() ? mcLabelSigmaDau.mcParticle_as<aod::McParticles>().pdgCode() : -999;
415-
auto pdgPr = mcLabelPr.has_mcParticle() ? mcLabelPr.mcParticle_as<aod::McParticles>().pdgCode() : -999;
433+
434+
if (!mcLabelSigma.has_mcParticle() || !mcLabelSigmaDau.has_mcParticle() || !mcLabelPr.has_mcParticle()) {
435+
continue; // Skip candidates where MC truth is not available
436+
}
437+
438+
auto mcPartSigma = mcLabelSigma.mcParticle_as<aod::McParticles>();
439+
auto mcPartSigmaDau = mcLabelSigmaDau.mcParticle_as<aod::McParticles>();
440+
auto mcPartPr = mcLabelPr.mcParticle_as<aod::McParticles>();
441+
auto pdgSigma = mcPartSigma.pdgCode();
442+
auto pdgSigmaDau = mcLabelSigmaDau.has_mcParticle() ? mcPartSigmaDau.pdgCode() : -999;
443+
auto pdgPr = mcLabelPr.has_mcParticle() ? mcPartPr.pdgCode() : -999;
444+
445+
float sigmaPtGen = std::hypot(mcPartSigma.px(), mcPartSigma.py());
446+
float prPtGen = std::hypot(mcPartPr.px(), mcPartPr.py());
447+
float kStarGen = getKStar(mcPartSigma.px(), mcPartSigma.py(), mcPartSigma.pz(), mcPartPr.px(), mcPartPr.py(), mcPartPr.pz());
448+
416449
outputDataTableMC(candidate.sigmaCharge,
417450
candidate.sigmaPx,
418451
candidate.sigmaPy,
@@ -430,7 +463,10 @@ struct sigmaProtonCorrTask {
430463
candidate.nSigmaTOFPr,
431464
pdgSigma,
432465
pdgSigmaDau,
433-
pdgPr);
466+
pdgPr,
467+
sigmaPtGen,
468+
prPtGen,
469+
kStarGen);
434470
}
435471
}
436472
}
@@ -462,9 +498,20 @@ struct sigmaProtonCorrTask {
462498
auto mcLabelSigma = tracks.rawIteratorAt(candidate.sigmaID);
463499
auto mcLabelSigmaDau = tracks.rawIteratorAt(candidate.kinkDauID);
464500
auto mcLabelPr = tracks.rawIteratorAt(candidate.prID);
465-
auto pdgSigma = mcLabelSigma.has_mcParticle() ? mcLabelSigma.mcParticle_as<aod::McParticles>().pdgCode() : -999;
466-
auto pdgSigmaDau = mcLabelSigmaDau.has_mcParticle() ? mcLabelSigmaDau.mcParticle_as<aod::McParticles>().pdgCode() : -999;
467-
auto pdgPr = mcLabelPr.has_mcParticle() ? mcLabelPr.mcParticle_as<aod::McParticles>().pdgCode() : -999;
501+
502+
if (!mcLabelSigma.has_mcParticle() || !mcLabelSigmaDau.has_mcParticle() || !mcLabelPr.has_mcParticle()) {
503+
continue; // Skip candidates where MC truth is not available
504+
}
505+
506+
auto mcPartSigma = mcLabelSigma.mcParticle_as<aod::McParticles>();
507+
auto mcPartSigmaDau = mcLabelSigmaDau.mcParticle_as<aod::McParticles>();
508+
auto mcPartPr = mcLabelPr.mcParticle_as<aod::McParticles>();
509+
auto pdgSigma = mcPartSigma.pdgCode();
510+
auto pdgSigmaDau = mcLabelSigmaDau.has_mcParticle() ? mcPartSigmaDau.pdgCode() : -999;
511+
auto pdgPr = mcLabelPr.has_mcParticle() ? mcPartPr.pdgCode() : -999;
512+
float sigmaPtGen = std::hypot(mcPartSigma.px(), mcPartSigma.py());
513+
float prPtGen = std::hypot(mcPartPr.px(), mcPartPr.py());
514+
float kStarGen = getKStar(mcPartSigma.px(), mcPartSigma.py(), mcPartSigma.pz(), mcPartPr.px(), mcPartPr.py(), mcPartPr.pz());
468515
outputDataTableMC(candidate.sigmaCharge,
469516
candidate.sigmaPx,
470517
candidate.sigmaPy,
@@ -482,7 +529,10 @@ struct sigmaProtonCorrTask {
482529
candidate.nSigmaTOFPr,
483530
pdgSigma,
484531
pdgSigmaDau,
485-
pdgPr);
532+
pdgPr,
533+
sigmaPtGen,
534+
prPtGen,
535+
kStarGen);
486536
}
487537
}
488538
}

0 commit comments

Comments
 (0)