diff --git a/PWGCF/Femto/Core/cascadeBuilder.h b/PWGCF/Femto/Core/cascadeBuilder.h index 4d82c2cdaa2..91c332421c2 100644 --- a/PWGCF/Femto/Core/cascadeBuilder.h +++ b/PWGCF/Femto/Core/cascadeBuilder.h @@ -72,7 +72,7 @@ struct ConfCascadeFilters : o2::framework::ConfigurableGroup { o2::framework::Configurable> lambdaTransRadMin{"lambdaTransRadMin", {0.9f}, "Minimum transverse radius (cm)"}; \ o2::framework::Configurable> lambdaDcaDauMax{"lambdaDcaDauMax", {0.5f}, "Maximum DCA between the daughters at decay vertex (cm)"}; \ o2::framework::Configurable> lambdaDcaToPvMin{"lambdaDcaToPvMin", {0.3f}, "Minimum DCA between the lambda and primary vertex"}; \ - o2::framework::Configurable> dauAbsEtaMax{"dauAbsEtaMax", {0.8f}, "Minimum DCA of the daughters from primary vertex (cm)"}; \ + o2::framework::Configurable> dauAbsEtaMax{"dauAbsEtaMax", {0.8f}, "Maximum |eta| of all daughters"}; \ o2::framework::Configurable> dauDcaMin{"dauDcaMin", {0.05f}, "Minimum DCA of the daughters from primary vertex (cm)"}; \ o2::framework::Configurable> dauTpcClustersMin{"dauTpcClustersMin", {80.f}, "Minimum number of TPC clusters for daughter tracks"}; \ o2::framework::Configurable> posDauTpc{"posDauTpc", {5.f}, "Maximum |nsimga_Pion/Proton| TPC for positive daughter tracks"}; \ @@ -639,5 +639,114 @@ class CascadeBuilder bool mProduceOmegaExtras = false; }; +struct ConfCascadeTablesDerivedToDerived : o2::framework::ConfigurableGroup { + std::string prefix = std::string("CascadeTables"); + o2::framework::Configurable limitXi{"limitXi", 1, "At least this many xi need to be in the collision"}; + o2::framework::Configurable limitOmega{"limitOmega", 0, "At least this many omega need to be in the collision"}; +}; + +struct CascadeBuilderDerivedToDerivedProducts : o2::framework::ProducesGroup { + o2::framework::Produces producedXis; + o2::framework::Produces producedXiMasks; + o2::framework::Produces producedOmegas; + o2::framework::Produces producedOmegaMasks; +}; + +class CascadeBuilderDerivedToDerived +{ + public: + CascadeBuilderDerivedToDerived() = default; + ~CascadeBuilderDerivedToDerived() = default; + + template + void init(T& config) + { + mLimitXi = config.limitXi.value; + mLimitOmega = config.limitOmega.value; + + if (mLimitXi == 0 && mLimitOmega == 0) { + LOG(fatal) << "Both xi limit and omega limit are 0. Breaking..."; + } + } + + template + bool collisionHasTooFewXis(T1 const& col, T2 const& /*xiTable*/, T3& partitionXi, T4& cache) + { + auto xiSlice = partitionXi->sliceByCached(o2::aod::femtobase::stored::fColId, col.globalIndex(), cache); + return xiSlice.size() < mLimitXi; + } + + template + bool collisionHasTooFewOmegas(T1 const& col, T2 const& /*omegaTable*/, T3& partitionOmega, T4& cache) + { + auto omegaSlice = partitionOmega->sliceByCached(o2::aod::femtobase::stored::fColId, col.globalIndex(), cache); + return omegaSlice.size() < mLimitOmega; + } + + template + void processXis(T1 const& col, T2 const& /*xiTable*/, T3 const& oldTrackTable, T4& partitionXi, T5& trackBuilder, T6& cache, T7& newXiTable, T8& newTrackTable, T9& newCollisionTable) + { + auto xiSlice = partitionXi->sliceByCached(o2::aod::femtobase::stored::fColId, col.globalIndex(), cache); + + for (auto const& xi : xiSlice) { + + // auto bachelor = xi.template bachelor_as(); + // auto posDaughter = xi.template posDau_as(); + // auto negDaughter = xi.template negDau_as(); + auto bachelor = oldTrackTable.rawIteratorAt(xi.bachelorId() - oldTrackTable.offset()); + auto posDaughter = oldTrackTable.rawIteratorAt(xi.posDauId() - oldTrackTable.offset()); + auto negDaughter = oldTrackTable.rawIteratorAt(xi.negDauId() - oldTrackTable.offset()); + + int bachelorIndex = trackBuilder.getDaughterIndex(bachelor, newTrackTable, newCollisionTable); + int posDaughterIndex = trackBuilder.getDaughterIndex(posDaughter, newTrackTable, newCollisionTable); + int negDaughterIndex = trackBuilder.getDaughterIndex(negDaughter, newTrackTable, newCollisionTable); + + newXiTable.producedXis(newCollisionTable.producedCollision.lastIndex(), + xi.signedPt(), + xi.eta(), + xi.phi(), + xi.mass(), + bachelorIndex, + posDaughterIndex, + negDaughterIndex); + newXiTable.producedXiMasks(xi.mask()); + } + } + + template + void processOmegas(T1 const& col, T2 const& /*omegaTable*/, T3 const& oldTrackTable, T4& partitionOmega, T5& trackBuilder, T6& cache, T7& newOmegaTable, T8& newTrackTable, T9& newCollisionTable) + { + auto omegaSlice = partitionOmega->sliceByCached(o2::aod::femtobase::stored::fColId, col.globalIndex(), cache); + + for (auto const& omega : omegaSlice) { + + // auto bachelor = omega.template bachelor_as(); + // auto posDaughter = omega.template posDau_as(); + // auto negDaughter = omega.template negDau_as(); + auto bachelor = oldTrackTable.rawIteratorAt(omega.bachelorId() - oldTrackTable.offset()); + auto posDaughter = oldTrackTable.rawIteratorAt(omega.posDauId() - oldTrackTable.offset()); + auto negDaughter = oldTrackTable.rawIteratorAt(omega.negDauId() - oldTrackTable.offset()); + + int bachelorIndex = trackBuilder.getDaughterIndex(bachelor, newTrackTable, newCollisionTable); + int posDaughterIndex = trackBuilder.getDaughterIndex(posDaughter, newTrackTable, newCollisionTable); + int negDaughterIndex = trackBuilder.getDaughterIndex(negDaughter, newTrackTable, newCollisionTable); + + newOmegaTable.producedOmegas(newCollisionTable.producedCollision.lastIndex(), + omega.signedPt(), + omega.eta(), + omega.phi(), + omega.mass(), + bachelorIndex, + posDaughterIndex, + negDaughterIndex); + newOmegaTable.producedOmegaMasks(omega.mask()); + } + } + + private: + int mLimitXi = 0; + int mLimitOmega = 0; +}; + } // namespace o2::analysis::femto::cascadebuilder #endif // PWGCF_FEMTO_CORE_CASCADEBUILDER_H_ diff --git a/PWGCF/Femto/Core/v0Builder.h b/PWGCF/Femto/Core/v0Builder.h index 0f5768d7058..ba19d2abc9b 100644 --- a/PWGCF/Femto/Core/v0Builder.h +++ b/PWGCF/Femto/Core/v0Builder.h @@ -101,10 +101,10 @@ struct ConfK0shortBits : o2::framework::ConfigurableGroup { o2::framework::Configurable ptMax{"ptMax", 999.f, "Maximum pT"}; \ o2::framework::Configurable etaMin{"etaMin", -10.f, "Minimum eta"}; \ o2::framework::Configurable etaMax{"etaMax", 10.f, "Maximum eta"}; \ - o2::framework::Configurable phiMin{"phiMin", 0.f, "Minimum eta"}; \ + o2::framework::Configurable phiMin{"phiMin", 0.f, "Minimum phi"}; \ o2::framework::Configurable phiMax{"phiMax", 1.f * o2::constants::math::TwoPI, "Maximum phi"}; \ - o2::framework::Configurable massMin{"massMin", (defaultMassMin), "Minimum invariant mass for Lambda"}; \ - o2::framework::Configurable massMax{"massMax", (defaultMassMax), "Maximum invariant mass for Lambda"}; \ + o2::framework::Configurable massMin{"massMin", (defaultMassMin), "Minimum invariant mass"}; \ + o2::framework::Configurable massMax{"massMax", (defaultMassMax), "Maximum invariant mass"}; \ o2::framework::Configurable mask{"mask", 0, "Bitmask for v0 selection"}; // base selection for analysis task for lambdas @@ -206,10 +206,10 @@ const std::unordered_map v0FilterNames = { {kPhiMax, "phiMax"}, {kRejectionK0shortMass, "rejectK0short"}, {kK0shortMassMin, "k0shortMassMin"}, - {kK0shortMassMax, "k0shortMassMin"}, + {kK0shortMassMax, "k0shortMassMax"}, {kRejectionLambdaMass, "rejectLambda"}, {kLambdaMassMin, "lambdaMassMin"}, - {kLambdaMassMax, "lambdaMassMin"}, + {kLambdaMassMax, "lambdaMassMax"}, }; /// \brief Cut class to contain and execute all cuts applied to v0s diff --git a/PWGCF/Femto/DataModel/FemtoTables.h b/PWGCF/Femto/DataModel/FemtoTables.h index b47bd33f9ca..04efa0a1712 100644 --- a/PWGCF/Femto/DataModel/FemtoTables.h +++ b/PWGCF/Femto/DataModel/FemtoTables.h @@ -653,10 +653,12 @@ DECLARE_SOA_TABLE_STAGED_VERSIONED(FXis_001, "FXI", 1, //! femto xis femtobase::dynamic::Pz, femtobase::dynamic::Theta); using FXis = FXis_001; +using StoredFXis = StoredFXis_001; DECLARE_SOA_TABLE_STAGED_VERSIONED(FXiMasks_001, "FXIMASK", 1, //! xi masks femtocascades::Mask); using FXiMasks = FXiMasks_001; +using StoredFXiMasks = StoredFXiMasks_001; DECLARE_SOA_TABLE_STAGED_VERSIONED(FXiExtras_001, "FXIEXTRA", 1, //! xi extra information femtocascades::MassOmega, @@ -687,10 +689,12 @@ DECLARE_SOA_TABLE_STAGED_VERSIONED(FOmegas_001, "FOMEGA", 1, //! femto omegas femtobase::dynamic::Pz, femtobase::dynamic::Theta); using FOmegas = FOmegas_001; +using StoredFOmegas = StoredFOmegas_001; DECLARE_SOA_TABLE_STAGED_VERSIONED(FOmegaMasks_001, "FOMEGAMASK", 1, //! omega masks femtocascades::Mask); using FOmegaMasks = FOmegaMasks_001; +using StoredFOmegaMasks = StoredFOmegaMasks_001; DECLARE_SOA_TABLE_STAGED_VERSIONED(FOmegaExtras_001, "FOMEGAEXTRA", 1, //! omega extra information femtocascades::MassXi, diff --git a/PWGCF/Femto/TableProducer/femtoProducerDerivedToDerived.cxx b/PWGCF/Femto/TableProducer/femtoProducerDerivedToDerived.cxx index 6b1d326ac32..735454b5504 100644 --- a/PWGCF/Femto/TableProducer/femtoProducerDerivedToDerived.cxx +++ b/PWGCF/Femto/TableProducer/femtoProducerDerivedToDerived.cxx @@ -13,6 +13,7 @@ /// \brief Tasks that produces the femto tables from derived data /// \author Anton Riedel, TU München, anton.riedel@tum.de +#include "PWGCF/Femto/Core/cascadeBuilder.h" #include "PWGCF/Femto/Core/collisionBuilder.h" #include "PWGCF/Femto/Core/kinkBuilder.h" #include "PWGCF/Femto/Core/partitions.h" @@ -33,17 +34,19 @@ using namespace o2::analysis::femto; struct FemtoProducerDerivedToDerived { // setup tables - using Collisions = o2::soa::Join; - using Collision = Collisions::iterator; + using FemtoCollisions = o2::soa::Join; + using FemtoCollision = FemtoCollisions::iterator; - using FilteredCollisions = o2::soa::Filtered; - using FilteredCollision = FilteredCollisions::iterator; + using FilteredFemtoCollisions = o2::soa::Filtered; + using FilteredFemtoCollision = FilteredFemtoCollisions::iterator; - using Tracks = o2::soa::Join; - using Lambdas = o2::soa::Join; - using K0shorts = o2::soa::Join; - using Sigma = o2::soa::Join; - using SigmaPlus = o2::soa::Join; + using FemtoTracks = o2::soa::Join; + using FemtoLambdas = o2::soa::Join; + using FemtoK0shorts = o2::soa::Join; + using FemtoXis = o2::soa::Join; + using FemtoOmegas = o2::soa::Join; + using FemtoSigma = o2::soa::Join; + using FemtoSigmaPlus = o2::soa::Join; o2::framework::SliceCache cache; @@ -60,9 +63,9 @@ struct FemtoProducerDerivedToDerived { trackbuilder::ConfTrackSelection1 trackSelections1; trackbuilder::ConfTrackSelection2 trackSelections2; - o2::framework::Partition trackPartition1 = MAKE_TRACK_PARTITION(trackSelections1); - o2::framework::Partition trackPartition2 = MAKE_TRACK_PARTITION(trackSelections2); - o2::framework::Preslice perColTracks = o2::aod::femtobase::stored::fColId; + o2::framework::Partition trackPartition1 = MAKE_TRACK_PARTITION(trackSelections1); + o2::framework::Partition trackPartition2 = MAKE_TRACK_PARTITION(trackSelections2); + o2::framework::Preslice perColTracks = o2::aod::femtobase::stored::fColId; // v0 builder v0builder::V0BuilderDerivedToDerived v0Builder; @@ -70,12 +73,12 @@ struct FemtoProducerDerivedToDerived { v0builder::ConfV0TablesDerivedToDerived confV0Builder; v0builder::ConfLambdaSelection1 lambdaSelection1; - o2::framework::Partition lambdaPartition = MAKE_LAMBDA_PARTITION(lambdaSelection1); - o2::framework::Preslice perColLambdas = o2::aod::femtobase::stored::fColId; + o2::framework::Partition lambdaPartition = MAKE_LAMBDA_PARTITION(lambdaSelection1); + o2::framework::Preslice perColLambdas = o2::aod::femtobase::stored::fColId; v0builder::ConfK0shortSelection1 k0shortSelection1; - o2::framework::Partition k0shortPartition = MAKE_K0SHORT_PARTITION(k0shortSelection1); - o2::framework::Preslice perColK0shorts = o2::aod::femtobase::stored::fColId; + o2::framework::Partition k0shortPartition = MAKE_K0SHORT_PARTITION(k0shortSelection1); + o2::framework::Preslice perColK0shorts = o2::aod::femtobase::stored::fColId; // kink builder kinkbuilder::KinkBuilderDerivedToDerived kinkBuilder; @@ -83,26 +86,40 @@ struct FemtoProducerDerivedToDerived { kinkbuilder::ConfKinkTablesDerivedToDerived confKinkBuilder; kinkbuilder::ConfSigmaSelection1 sigmaSelection1; - o2::framework::Partition sigmaPartition = MAKE_SIGMA_PARTITION(sigmaSelection1); - o2::framework::Preslice perColSigma = o2::aod::femtobase::stored::fColId; + o2::framework::Partition sigmaPartition = MAKE_SIGMA_PARTITION(sigmaSelection1); + o2::framework::Preslice perColSigma = o2::aod::femtobase::stored::fColId; kinkbuilder::ConfSigmaPlusSelection1 sigmaPlusSelection1; - o2::framework::Partition sigmaPlusPartition = MAKE_SIGMAPLUS_PARTITION(sigmaPlusSelection1); - o2::framework::Preslice perColSigmaPlus = o2::aod::femtobase::stored::fColId; + o2::framework::Partition sigmaPlusPartition = MAKE_SIGMAPLUS_PARTITION(sigmaPlusSelection1); + o2::framework::Preslice perColSigmaPlus = o2::aod::femtobase::stored::fColId; + + // cascade builder + cascadebuilder::CascadeBuilderDerivedToDerived cascadeBuilder; + cascadebuilder::CascadeBuilderDerivedToDerivedProducts cascadeBuilderProducts; + cascadebuilder::ConfCascadeTablesDerivedToDerived confCascadeBuilder; + + cascadebuilder::ConfXiSelection xiSelection; + o2::framework::Partition xiPartition = MAKE_CASCADE_PARTITION(xiSelection); + o2::framework::Preslice perColXis = o2::aod::femtobase::stored::fColId; + + cascadebuilder::ConfOmegaSelection omegaSelection; + o2::framework::Partition omegaPartition = MAKE_CASCADE_PARTITION(omegaSelection); + o2::framework::Preslice perColOmegas = o2::aod::femtobase::stored::fColId; void init(o2::framework::InitContext& /*context*/) { trackBuilder.init(confTrackBuilder); v0Builder.init(confV0Builder); + cascadeBuilder.init(confCascadeBuilder); kinkBuilder.init(confKinkBuilder); - if ((static_cast(doprocessTracks) + static_cast(doprocessTracksLambdas) + static_cast(doprocessTracksK0shorts) + static_cast(doprocessTracksSigma) + static_cast(doprocessTracksSigmaPlus)) > 1) { + if ((static_cast(doprocessTracks) + static_cast(doprocessTracksLambdas) + static_cast(doprocessLambdas) + static_cast(doprocessTracksXis) + static_cast(doprocessTracksOmegas) + static_cast(doprocessTracksK0shorts) + static_cast(doprocessTracksSigma) + static_cast(doprocessTracksSigmaPlus)) > 1) { LOG(fatal) << "Only one proccess function can be activated"; } } // proccess functions - void processTracks(FilteredCollision const& col, Tracks const& tracks) + void processTracks(FilteredFemtoCollision const& col, FemtoTracks const& tracks) { if (trackBuilder.collisionHasTooFewTracks(col, tracks, trackPartition1, trackPartition2, cache)) { return; @@ -112,7 +129,7 @@ struct FemtoProducerDerivedToDerived { } PROCESS_SWITCH(FemtoProducerDerivedToDerived, processTracks, "Process tracks", true); - void processTracksLambdas(FilteredCollision const& col, Tracks const& tracks, Lambdas const& lambdas) + void processTracksLambdas(FilteredFemtoCollision const& col, FemtoTracks const& tracks, FemtoLambdas const& lambdas) { if (trackBuilder.collisionHasTooFewTracks(col, tracks, trackPartition1, trackPartition2, cache) || v0Builder.collisionHasTooFewLambdas(col, lambdas, lambdaPartition, cache)) { return; @@ -123,7 +140,7 @@ struct FemtoProducerDerivedToDerived { } PROCESS_SWITCH(FemtoProducerDerivedToDerived, processTracksLambdas, "Process lambdas and tracks", false); - void processLambdas(FilteredCollision const& col, Tracks const& tracks, Lambdas const& lambdas) + void processLambdas(FilteredFemtoCollision const& col, FemtoTracks const& tracks, FemtoLambdas const& lambdas) { if (v0Builder.collisionHasTooFewLambdas(col, lambdas, lambdaPartition, cache)) { return; @@ -133,7 +150,29 @@ struct FemtoProducerDerivedToDerived { } PROCESS_SWITCH(FemtoProducerDerivedToDerived, processLambdas, "Process lambdas", false); - void processTracksK0shorts(FilteredCollision const& col, Tracks const& tracks, K0shorts const& k0shorts) + void processTracksXis(FilteredFemtoCollision const& col, FemtoTracks const& tracks, FemtoXis const& xis) + { + if (trackBuilder.collisionHasTooFewTracks(col, tracks, trackPartition1, trackPartition2, cache) || cascadeBuilder.collisionHasTooFewXis(col, xis, xiPartition, cache)) { + return; + } + collisionBuilder.processCollision(col, collisionBuilderProducts); + trackBuilder.processTracks(col, tracks, trackPartition1, trackPartition2, cache, trackBuilderProducts, collisionBuilderProducts); + cascadeBuilder.processXis(col, xis, tracks, xiPartition, trackBuilder, cache, cascadeBuilderProducts, trackBuilderProducts, collisionBuilderProducts); + } + PROCESS_SWITCH(FemtoProducerDerivedToDerived, processTracksXis, "Process tracks and xis", false); + + void processTracksOmegas(FilteredFemtoCollision const& col, FemtoTracks const& tracks, FemtoOmegas const& omegas) + { + if (trackBuilder.collisionHasTooFewTracks(col, tracks, trackPartition1, trackPartition2, cache) || cascadeBuilder.collisionHasTooFewOmegas(col, omegas, omegaPartition, cache)) { + return; + } + collisionBuilder.processCollision(col, collisionBuilderProducts); + trackBuilder.processTracks(col, tracks, trackPartition1, trackPartition2, cache, trackBuilderProducts, collisionBuilderProducts); + cascadeBuilder.processOmegas(col, omegas, tracks, omegaPartition, trackBuilder, cache, cascadeBuilderProducts, trackBuilderProducts, collisionBuilderProducts); + } + PROCESS_SWITCH(FemtoProducerDerivedToDerived, processTracksOmegas, "Process tracks and omegas", false); + + void processTracksK0shorts(FilteredFemtoCollision const& col, FemtoTracks const& tracks, FemtoK0shorts const& k0shorts) { if (trackBuilder.collisionHasTooFewTracks(col, tracks, trackPartition1, trackPartition2, cache) || v0Builder.collisionHasTooFewK0shorts(col, k0shorts, k0shortPartition, cache)) { return; @@ -144,7 +183,7 @@ struct FemtoProducerDerivedToDerived { } PROCESS_SWITCH(FemtoProducerDerivedToDerived, processTracksK0shorts, "Process k0short and tracks", false); - void processTracksSigma(FilteredCollision const& col, Tracks const& tracks, Sigma const& sigma) + void processTracksSigma(FilteredFemtoCollision const& col, FemtoTracks const& tracks, FemtoSigma const& sigma) { if (trackBuilder.collisionHasTooFewTracks(col, tracks, trackPartition1, trackPartition2, cache) || kinkBuilder.collisionHasTooFewSigma(col, sigma, sigmaPartition, cache)) { return; @@ -155,7 +194,7 @@ struct FemtoProducerDerivedToDerived { } PROCESS_SWITCH(FemtoProducerDerivedToDerived, processTracksSigma, "Process sigma and tracks", false); - void processTracksSigmaPlus(FilteredCollision const& col, Tracks const& tracks, SigmaPlus const& sigmaplus) + void processTracksSigmaPlus(FilteredFemtoCollision const& col, FemtoTracks const& tracks, FemtoSigmaPlus const& sigmaplus) { if (trackBuilder.collisionHasTooFewTracks(col, tracks, trackPartition1, trackPartition2, cache) || kinkBuilder.collisionHasTooFewSigmaPlus(col, sigmaplus, sigmaPlusPartition, cache)) { return;