2626#include < CommonConstants/PhysicsConstants.h>
2727#include < Framework/AnalysisDataModel.h>
2828#include < Framework/DataTypes.h>
29+ #include < ReconstructionDataFormats/DecayNBodyIndex.h>
2930
3031#include < array>
3132#include < cmath>
@@ -709,11 +710,38 @@ DECLARE_SOA_DYNAMIC_COLUMN(PFracNeg, pfracneg,
709710
710711// Calculated on the fly with mass assumption + dynamic tables
711712DECLARE_SOA_DYNAMIC_COLUMN (MLambda, mLambda , // ! mass under lambda hypothesis
712- [](float pxpos, float pypos, float pzpos, float pxneg, float pyneg, float pzneg) -> float { return RecoDecay::m (std::array{std::array{pxpos, pypos, pzpos}, std::array{pxneg, pyneg, pzneg}}, std::array{o2::constants::physics::MassProton, o2::constants::physics::MassPionCharged}); });
713+ [](int v0type, float pxpos, float pypos, float pzpos, float pxneg, float pyneg, float pzneg) -> float {
714+ if ((v0type & (0x1 << o2::dataformats::V0Index::kPhotonOnly )) != 0 ) {
715+ return 0 .0f ; // provide mass only if NOT a photon with TPC-only tracks (special handling)
716+ };
717+ return RecoDecay::m (std::array{std::array{pxpos, pypos, pzpos}, std::array{pxneg, pyneg, pzneg}}, std::array{o2::constants::physics::MassProton, o2::constants::physics::MassPionCharged});
718+ });
713719DECLARE_SOA_DYNAMIC_COLUMN (MAntiLambda, mAntiLambda , // ! mass under antilambda hypothesis
714- [](float pxpos, float pypos, float pzpos, float pxneg, float pyneg, float pzneg) -> float { return RecoDecay::m (std::array{std::array{pxpos, pypos, pzpos}, std::array{pxneg, pyneg, pzneg}}, std::array{o2::constants::physics::MassPionCharged, o2::constants::physics::MassProton}); });
720+ [](int v0type, float pxpos, float pypos, float pzpos, float pxneg, float pyneg, float pzneg) -> float {
721+ if ((v0type & (0x1 << o2::dataformats::V0Index::kPhotonOnly )) != 0 ) {
722+ return 0 .0f ; // provide mass only if NOT a photon with TPC-only tracks (special handling)
723+ };
724+ return RecoDecay::m (std::array{std::array{pxpos, pypos, pzpos}, std::array{pxneg, pyneg, pzneg}}, std::array{o2::constants::physics::MassPionCharged, o2::constants::physics::MassProton});
725+ });
715726DECLARE_SOA_DYNAMIC_COLUMN (MK0Short, mK0Short , // ! mass under K0short hypothesis
716- [](float pxpos, float pypos, float pzpos, float pxneg, float pyneg, float pzneg) -> float { return RecoDecay::m (std::array{std::array{pxpos, pypos, pzpos}, std::array{pxneg, pyneg, pzneg}}, std::array{o2::constants::physics::MassPionCharged, o2::constants::physics::MassPionCharged}); });
727+ [](int v0type, float pxpos, float pypos, float pzpos, float pxneg, float pyneg, float pzneg) -> float {
728+ if ((v0type & (0x1 << o2::dataformats::V0Index::kPhotonOnly )) != 0 ) {
729+ return 0 .0f ; // provide mass only if NOT a photon with TPC-only tracks (special handling)
730+ };
731+ return RecoDecay::m (std::array{std::array{pxpos, pypos, pzpos}, std::array{pxneg, pyneg, pzneg}}, std::array{o2::constants::physics::MassPionCharged, o2::constants::physics::MassPionCharged});
732+ });
733+ DECLARE_SOA_DYNAMIC_COLUMN (MLambda_unchecked, mLambda_unchecked , // ! mass under lambda hypothesis without v0 type check (will include TPC only and potentially duplicates! use with care)
734+ [](float pxpos, float pypos, float pzpos, float pxneg, float pyneg, float pzneg) -> float {
735+ return RecoDecay::m (std::array{std::array{pxpos, pypos, pzpos}, std::array{pxneg, pyneg, pzneg}}, std::array{o2::constants::physics::MassProton, o2::constants::physics::MassPionCharged});
736+ });
737+ DECLARE_SOA_DYNAMIC_COLUMN (MAntiLambda_unchecked, mAntiLambda_unchecked , // ! mass under antilambda hypothesis without v0 type check (will include TPC only and potentially duplicates! use with care)
738+ [](float pxpos, float pypos, float pzpos, float pxneg, float pyneg, float pzneg) -> float {
739+ return RecoDecay::m (std::array{std::array{pxpos, pypos, pzpos}, std::array{pxneg, pyneg, pzneg}}, std::array{o2::constants::physics::MassPionCharged, o2::constants::physics::MassProton});
740+ });
741+ DECLARE_SOA_DYNAMIC_COLUMN (MK0Short_unchecked, mK0Short_unchecked , // ! mass under K0short hypothesis without v0 type check (will include TPC only and potentially duplicates! use with care)
742+ [](float pxpos, float pypos, float pzpos, float pxneg, float pyneg, float pzneg) -> float {
743+ return RecoDecay::m (std::array{std::array{pxpos, pypos, pzpos}, std::array{pxneg, pyneg, pzneg}}, std::array{o2::constants::physics::MassPionCharged, o2::constants::physics::MassPionCharged});
744+ });
717745DECLARE_SOA_DYNAMIC_COLUMN (MGamma, mGamma , // ! mass under gamma hypothesis
718746 [](float pxpos, float pypos, float pzpos, float pxneg, float pyneg, float pzneg) -> float { return RecoDecay::m (std::array{std::array{pxpos, pypos, pzpos}, std::array{pxneg, pyneg, pzneg}}, std::array{o2::constants::physics::MassElectron, o2::constants::physics::MassElectron}); });
719747// Account for rigidity in case of hypertriton
@@ -772,12 +800,12 @@ DECLARE_SOA_DYNAMIC_COLUMN(PositiveEta, positiveeta, //! positive daughter eta
772800DECLARE_SOA_DYNAMIC_COLUMN (PositivePhi, positivephi, // ! positive daughter phi
773801 [](float PxPos, float PyPos) -> float { return RecoDecay::phi (PxPos, PyPos); });
774802
775- DECLARE_SOA_DYNAMIC_COLUMN (IsStandardV0, isStandardV0, // ! is standard V0
776- [](uint8_t V0Type) -> bool { return V0Type == 1 ; });
803+ DECLARE_SOA_DYNAMIC_COLUMN (IsStandardV0, isStandardV0, // ! is standard V0 - note: photons excluded via '=='
804+ [](uint8_t V0Type) -> bool { return V0Type == o2::dataformats::V0Index:: kStandaloneV0 ; });
777805DECLARE_SOA_DYNAMIC_COLUMN (IsPhotonTPConly, isPhotonTPConly, // ! is tpc-only photon V0
778- [](uint8_t V0Type) -> bool { return V0Type & (1 << 1 ); });
806+ [](uint8_t V0Type) -> bool { return V0Type & (1 << o2::dataformats::V0Index:: kPhotonOnly ); });
779807DECLARE_SOA_DYNAMIC_COLUMN (IsCollinear, isCollinear, // ! is collinear V0
780- [](uint8_t V0Type) -> bool { return V0Type & (1 << 2 ); });
808+ [](uint8_t V0Type) -> bool { return V0Type & (1 << o2::dataformats::V0Index:: kCollinear ); });
781809
782810DECLARE_SOA_DYNAMIC_COLUMN (RapidityMC, rapidityMC, // ! rapidity (0:K0, 1:L, 2:Lbar)
783811 [](float PxMC, float PyMC, float PzMC, int value) -> float {
@@ -794,6 +822,24 @@ DECLARE_SOA_DYNAMIC_COLUMN(PositivePtMC, positiveptMC, //! positive daughter pT
794822 [](float pxposMC, float pyposMC) -> float { return RecoDecay::sqrtSumOfSquares (pxposMC, pyposMC); });
795823DECLARE_SOA_DYNAMIC_COLUMN (PtMC, ptMC, // ! V0 pT
796824 [](float pxMC, float pyMC) -> float { return RecoDecay::sqrtSumOfSquares (pxMC, pyMC); });
825+
826+ // declare legacy mass getters in v0data legacy name space
827+ // caution: these do not have intrinsic protection against photon candidates
828+ namespace legacy
829+ {
830+ DECLARE_SOA_DYNAMIC_COLUMN (MLambda, mLambda , // ! mass under lambda hypothesis without v0 type check (will include TPC only and potentially duplicates! use with care)
831+ [](float pxpos, float pypos, float pzpos, float pxneg, float pyneg, float pzneg) -> float {
832+ return RecoDecay::m (std::array{std::array{pxpos, pypos, pzpos}, std::array{pxneg, pyneg, pzneg}}, std::array{o2::constants::physics::MassProton, o2::constants::physics::MassPionCharged});
833+ });
834+ DECLARE_SOA_DYNAMIC_COLUMN (MAntiLambda, mAntiLambda , // ! mass under antilambda hypothesis without v0 type check (will include TPC only and potentially duplicates! use with care)
835+ [](float pxpos, float pypos, float pzpos, float pxneg, float pyneg, float pzneg) -> float {
836+ return RecoDecay::m (std::array{std::array{pxpos, pypos, pzpos}, std::array{pxneg, pyneg, pzneg}}, std::array{o2::constants::physics::MassPionCharged, o2::constants::physics::MassProton});
837+ });
838+ DECLARE_SOA_DYNAMIC_COLUMN (MK0Short, mK0Short , // ! mass under K0short hypothesis without v0 type check (will include TPC only and potentially duplicates! use with care)
839+ [](float pxpos, float pypos, float pzpos, float pxneg, float pyneg, float pzneg) -> float {
840+ return RecoDecay::m (std::array{std::array{pxpos, pypos, pzpos}, std::array{pxneg, pyneg, pzneg}}, std::array{o2::constants::physics::MassPionCharged, o2::constants::physics::MassPionCharged});
841+ });
842+ } // namespace legacy
797843} // namespace v0data
798844
799845DECLARE_SOA_TABLE (V0Indices, " AOD" , " V0INDEX" , // ! index table when using AO2Ds
@@ -835,9 +881,12 @@ DECLARE_SOA_TABLE_STAGED(V0CoresBase, "V0CORE", //! core information about decay
835881 v0data::PFracNeg<v0data::PxPos, v0data::PyPos, v0data::PzPos, v0data::PxNeg, v0data::PyNeg, v0data::PzNeg>, // 24
836882
837883 // Invariant masses
838- v0data::MLambda<v0data::PxPos, v0data::PyPos, v0data::PzPos, v0data::PxNeg, v0data::PyNeg, v0data::PzNeg>,
839- v0data::MAntiLambda<v0data::PxPos, v0data::PyPos, v0data::PzPos, v0data::PxNeg, v0data::PyNeg, v0data::PzNeg>,
840- v0data::MK0Short<v0data::PxPos, v0data::PyPos, v0data::PzPos, v0data::PxNeg, v0data::PyNeg, v0data::PzNeg>,
884+ v0data::MLambda<v0data::V0Type, v0data::PxPos, v0data::PyPos, v0data::PzPos, v0data::PxNeg, v0data::PyNeg, v0data::PzNeg>,
885+ v0data::MAntiLambda<v0data::V0Type, v0data::PxPos, v0data::PyPos, v0data::PzPos, v0data::PxNeg, v0data::PyNeg, v0data::PzNeg>,
886+ v0data::MK0Short<v0data::V0Type, v0data::PxPos, v0data::PyPos, v0data::PzPos, v0data::PxNeg, v0data::PyNeg, v0data::PzNeg>,
887+ v0data::MLambda_unchecked<v0data::PxPos, v0data::PyPos, v0data::PzPos, v0data::PxNeg, v0data::PyNeg, v0data::PzNeg>,
888+ v0data::MAntiLambda_unchecked<v0data::PxPos, v0data::PyPos, v0data::PzPos, v0data::PxNeg, v0data::PyNeg, v0data::PzNeg>,
889+ v0data::MK0Short_unchecked<v0data::PxPos, v0data::PyPos, v0data::PzPos, v0data::PxNeg, v0data::PyNeg, v0data::PzNeg>,
841890 v0data::MGamma<v0data::PxPos, v0data::PyPos, v0data::PzPos, v0data::PxNeg, v0data::PyNeg, v0data::PzNeg>,
842891 v0data::MHypertriton<v0data::PxPos, v0data::PyPos, v0data::PzPos, v0data::PxNeg, v0data::PyNeg, v0data::PzNeg>,
843892 v0data::MAntiHypertriton<v0data::PxPos, v0data::PyPos, v0data::PzPos, v0data::PxNeg, v0data::PyNeg, v0data::PzNeg>,
@@ -916,9 +965,9 @@ DECLARE_SOA_TABLE_FULL(StoredV0fCCores, "V0fCCores", "AOD", "V0FCCORE", //! core
916965 v0data::PFracNeg<v0data::PxPos, v0data::PyPos, v0data::PzPos, v0data::PxNeg, v0data::PyNeg, v0data::PzNeg>, // 24
917966
918967 // Invariant masses
919- v0data::MLambda<v0data::PxPos, v0data::PyPos, v0data::PzPos, v0data::PxNeg, v0data::PyNeg, v0data::PzNeg>,
920- v0data::MAntiLambda<v0data::PxPos, v0data::PyPos, v0data::PzPos, v0data::PxNeg, v0data::PyNeg, v0data::PzNeg>,
921- v0data::MK0Short<v0data::PxPos, v0data::PyPos, v0data::PzPos, v0data::PxNeg, v0data::PyNeg, v0data::PzNeg>,
968+ v0data::MLambda<v0data::V0Type, v0data:: PxPos, v0data::PyPos, v0data::PzPos, v0data::PxNeg, v0data::PyNeg, v0data::PzNeg>,
969+ v0data::MAntiLambda<v0data::V0Type, v0data:: PxPos, v0data::PyPos, v0data::PzPos, v0data::PxNeg, v0data::PyNeg, v0data::PzNeg>,
970+ v0data::MK0Short<v0data::V0Type, v0data:: PxPos, v0data::PyPos, v0data::PzPos, v0data::PxNeg, v0data::PyNeg, v0data::PzNeg>,
922971 v0data::MGamma<v0data::PxPos, v0data::PyPos, v0data::PzPos, v0data::PxNeg, v0data::PyNeg, v0data::PzNeg>,
923972 v0data::MHypertriton<v0data::PxPos, v0data::PyPos, v0data::PzPos, v0data::PxNeg, v0data::PyNeg, v0data::PzNeg>,
924973 v0data::MAntiHypertriton<v0data::PxPos, v0data::PyPos, v0data::PzPos, v0data::PxNeg, v0data::PyNeg, v0data::PzNeg>,
0 commit comments