@@ -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