From 47b69c1a9710b2058ab936bfe8cd0d6ec2c112c2 Mon Sep 17 00:00:00 2001 From: jesgum Date: Tue, 13 Oct 2026 13:04:59 +0200 Subject: [PATCH] Correctly handle response for short lived particles --- ALICE3/DataModel/OTFTOF.h | 7 ++++ ALICE3/TableProducer/OTF/onTheFlyTofPid.cxx | 44 ++++++++++++++++++--- 2 files changed, 46 insertions(+), 5 deletions(-) diff --git a/ALICE3/DataModel/OTFTOF.h b/ALICE3/DataModel/OTFTOF.h index 8643abc959c..621e878a1e7 100644 --- a/ALICE3/DataModel/OTFTOF.h +++ b/ALICE3/DataModel/OTFTOF.h @@ -79,6 +79,8 @@ DECLARE_SOA_COLUMN(OuterTOFExpectedTimeDe, outerTOFExpectedTimeDe, float); //! DECLARE_SOA_COLUMN(OuterTOFExpectedTimeTr, outerTOFExpectedTimeTr, float); //! Reconstructed expected time at the OuterTOF for the Triton mass hypotheses DECLARE_SOA_COLUMN(OuterTOFExpectedTimeHe3, outerTOFExpectedTimeHe3, float); //! Reconstructed expected time at the OuterTOF for the Helium3 mass hypotheses DECLARE_SOA_COLUMN(OuterTOFExpectedTimeAl, outerTOFExpectedTimeAl, float); //! Reconstructed expected time at the OuterTOF for the Alpha mass hypotheses +DECLARE_SOA_COLUMN(HasInnerTOF, hasInnerTOF, bool); //! InnerTOF short-lived values are filled (false if dummy) +DECLARE_SOA_COLUMN(HasOuterTOF, hasOuterTOF, bool); //! OuterTOF short-lived values are filled (false if dummy) DECLARE_SOA_DYNAMIC_COLUMN(NSigmaInnerTOF, nSigmaInnerTOF, //! General function to get the nSigma for the InnerTOF [](const float el, const float mu, @@ -260,10 +262,15 @@ DECLARE_SOA_TABLE(UpgradeTofShortLiveds, "AOD", "UPGRTOFSHRTLVD", upgrade_tof::OuterTOFExpectedTimeXi, upgrade_tof::OuterTOFExpectedTimeOm); +DECLARE_SOA_TABLE(UpgradeTofShortLivedSignals, "AOD", "UPGRTOFSLSIGNAL", + upgrade_tof::HasInnerTOF, + upgrade_tof::HasOuterTOF); + using UpgradeTofMC = UpgradeTofMCs::iterator; using UpgradeTof = UpgradeTofs::iterator; using UpgradeTofExpectedTime = UpgradeTofExpectedTimes::iterator; using UpgradeTofShortLived = UpgradeTofShortLiveds::iterator; +using UpgradeTofShortLivedSignal = UpgradeTofShortLivedSignals::iterator; } // namespace o2::aod diff --git a/ALICE3/TableProducer/OTF/onTheFlyTofPid.cxx b/ALICE3/TableProducer/OTF/onTheFlyTofPid.cxx index 9bfc03a70a2..f1ba29ab1d4 100644 --- a/ALICE3/TableProducer/OTF/onTheFlyTofPid.cxx +++ b/ALICE3/TableProducer/OTF/onTheFlyTofPid.cxx @@ -30,6 +30,7 @@ #include "ALICE3/Core/TrackUtilities.h" #include "ALICE3/DataModel/OTFCollision.h" #include "ALICE3/DataModel/OTFTOF.h" +#include "ALICE3/DataModel/tracksAlice3.h" #include "Common/Core/trackUtilities.h" #include @@ -77,6 +78,7 @@ struct OnTheFlyTofPid { Produces upgradeTof; Produces upgradeTofExpectedTime; Produces upgradeTofShortLived; + Produces upgradeTofShortLivedSignal; // necessary for particle charges Service pdgDatabase{}; @@ -103,6 +105,7 @@ struct OnTheFlyTofPid { Configurable multiplicityEtaRange{"multiplicityEtaRange", 0.800000012, "eta range to compute the multiplicity"}; Configurable flagIncludeTrackTimeRes{"flagIncludeTrackTimeRes", true, "flag to include or exclude track time resolution"}; Configurable flagTOFLoadDelphesLUTs{"flagTOFLoadDelphesLUTs", false, "flag to load Delphes LUTs for tracking correction (use recoTrack parameters if false)"}; + Configurable shortLivedRadiusTolerance{"shortLivedRadiusTolerance", 0.1f, "tolerance (cm) when checking if a TOF layer is within the innermost and outermost track update of short-lived particles"}; } simConfig; struct : ConfigurableGroup { @@ -211,6 +214,39 @@ struct OnTheFlyTofPid { particleHe, particleAl}; + template + void fillShortLivedTables(const TTrack& track, + std::array nSigmaInnerTOF, + std::array nSigmaOuterTOF, + std::array expectedTimeInnerTOF, + std::array expectedTimeOuterTOF, + const std::pair& trackLengthInnerTOF, + const std::pair& trackLengthOuterTOF) + { + const auto isWithinTrackUpdates = [&](const float tofRadius) { + return (track.trackIU() - simConfig.shortLivedRadiusTolerance <= tofRadius) && (tofRadius <= track.trackOU() + simConfig.shortLivedRadiusTolerance); + }; + + const bool hasInnerTOF = isWithinTrackUpdates(simConfig.innerTOFRadius) && trackLengthInnerTOF.first > 0 && trackLengthInnerTOF.second > 0; + const bool hasOuterTOF = isWithinTrackUpdates(simConfig.outerTOFRadius) && trackLengthOuterTOF.first > 0 && trackLengthOuterTOF.second > 0; + static constexpr float DummyValue = -999.f; + for (const int ii : {Sp, Sm, Xi, Om}) { + if (!hasInnerTOF) { + nSigmaInnerTOF[ii] = DummyValue; + expectedTimeInnerTOF[ii] = DummyValue; + } + if (!hasOuterTOF) { + nSigmaOuterTOF[ii] = DummyValue; + expectedTimeOuterTOF[ii] = DummyValue; + } + } + upgradeTofShortLived(nSigmaInnerTOF[Sp], nSigmaInnerTOF[Sm], nSigmaInnerTOF[Xi], nSigmaInnerTOF[Om], + nSigmaOuterTOF[Sp], nSigmaOuterTOF[Sm], nSigmaOuterTOF[Xi], nSigmaOuterTOF[Om], + expectedTimeInnerTOF[Sp], expectedTimeInnerTOF[Sm], expectedTimeInnerTOF[Xi], expectedTimeInnerTOF[Om], + expectedTimeOuterTOF[Sp], expectedTimeOuterTOF[Sm], expectedTimeOuterTOF[Xi], expectedTimeOuterTOF[Om]); + upgradeTofShortLivedSignal(hasInnerTOF, hasOuterTOF); + } + bool doQaForParticle(const int pdgCode) { return std::find(plotsConfig.particlesForQa.value.begin(), plotsConfig.particlesForQa.value.end(), std::abs(pdgCode)) != plotsConfig.particlesForQa.value.end(); @@ -652,7 +688,7 @@ struct OnTheFlyTofPid { } void process(soa::Join::iterator const& collision, - soa::Join const& tracks, + soa::Join const& tracks, aod::McParticles const&, aod::McCollisions const&) { @@ -971,10 +1007,8 @@ struct OnTheFlyTofPid { measuredTimeOuterTOF, trackLengthRecoOuterTOF); upgradeTofExpectedTime(expectedTimeInnerTOF[El], expectedTimeInnerTOF[Mu], expectedTimeInnerTOF[Pi], expectedTimeInnerTOF[Ka], expectedTimeInnerTOF[Pr], expectedTimeInnerTOF[De], expectedTimeInnerTOF[Tr], expectedTimeInnerTOF[He], expectedTimeInnerTOF[Al], expectedTimeOuterTOF[El], expectedTimeOuterTOF[Mu], expectedTimeOuterTOF[Pi], expectedTimeOuterTOF[Ka], expectedTimeOuterTOF[Pr], expectedTimeOuterTOF[De], expectedTimeOuterTOF[Tr], expectedTimeOuterTOF[He], expectedTimeOuterTOF[Al]); - upgradeTofShortLived(nSigmaInnerTOF[Sp], nSigmaInnerTOF[Sm], nSigmaInnerTOF[Xi], nSigmaInnerTOF[Om], - nSigmaOuterTOF[Sp], nSigmaOuterTOF[Sm], nSigmaOuterTOF[Xi], nSigmaOuterTOF[Om], - expectedTimeInnerTOF[Sp], expectedTimeInnerTOF[Sm], expectedTimeInnerTOF[Xi], expectedTimeInnerTOF[Om], - expectedTimeOuterTOF[Sp], expectedTimeOuterTOF[Sm], expectedTimeOuterTOF[Xi], expectedTimeOuterTOF[Om]); + fillShortLivedTables(track, nSigmaInnerTOF, nSigmaOuterTOF, expectedTimeInnerTOF, expectedTimeOuterTOF, + trkWithTime.mTrackLengthInnerTOF, trkWithTime.mTrackLengthOuterTOF); } if (trackWithTimeIndex != tracks.size()) {