diff --git a/PWGCF/Femto/Core/cascadeBuilder.h b/PWGCF/Femto/Core/cascadeBuilder.h index b38e76c83a6..9437d850390 100644 --- a/PWGCF/Femto/Core/cascadeBuilder.h +++ b/PWGCF/Femto/Core/cascadeBuilder.h @@ -863,6 +863,44 @@ class CascadeBuilderDerivedToDerived } } + /// Same as processXis, but also resolves the daughters' MC labels (via the + /// MC-aware trackBuilder.getDaughterIndex overload) and writes the xi's own + /// FXiLabels row. xiTable must be joined with FXiLabels upstream. + template + void processXisWithMc(T1 const& col, T2 const& /*xiTable*/, T3 const& oldTrackTable, T4& partitionXi, T5& trackBuilder, T6& cache, T7& newXiTable, T8& newTrackTable, T9& newCollisionTable, + T10& mcBuilder, T11 const& mcCols, T12 const& mcParticles, T13 const& mcMothers, T14 const& mcPartonicMothers, auto& mcProducts) + { + if (mLimitXi == 0) { // xis disabled + return; + } + + auto xiSlice = partitionXi->sliceByCached(o2::aod::femtobase::stored::fColId, col.globalIndex(), cache); + + for (auto const& xi : xiSlice) { + auto bachelor = oldTrackTable.rawIteratorAt(utils::daughterRow(xi.bachelorId(), oldTrackTable)); + auto posDaughter = oldTrackTable.rawIteratorAt(utils::daughterRow(xi.posDauId(), oldTrackTable)); + auto negDaughter = oldTrackTable.rawIteratorAt(utils::daughterRow(xi.negDauId(), oldTrackTable)); + + int64_t bachelorIndex = trackBuilder.getDaughterIndex(bachelor, newTrackTable, newCollisionTable, mcBuilder, mcCols, mcParticles, mcMothers, mcPartonicMothers, mcProducts); + int64_t posDaughterIndex = trackBuilder.getDaughterIndex(posDaughter, newTrackTable, newCollisionTable, mcBuilder, mcCols, mcParticles, mcMothers, mcPartonicMothers, mcProducts); + int64_t negDaughterIndex = trackBuilder.getDaughterIndex(negDaughter, newTrackTable, newCollisionTable, mcBuilder, mcCols, mcParticles, mcMothers, mcPartonicMothers, mcProducts); + + newXiTable.producedXis(newCollisionTable.producedCollision.lastIndex(), + xi.signedPt(), + xi.eta(), + xi.phi(), + xi.mass(), + bachelorIndex, + posDaughterIndex, + negDaughterIndex); + newXiTable.producedXiMasks(xi.mask()); + if constexpr (utils::HasCascadeCosPa) { + newXiTable.producedXiFrac(xi.cascadeCosPa()); + } + mcBuilder.fillXiWithLabel(xi, mcCols, mcParticles, mcMothers, mcPartonicMothers, mcProducts); + } + } + template void processOmegas(T1 const& col, T2 const& /*omegaTable*/, T3 const& oldTrackTable, T4& partitionOmega, T5& trackBuilder, T6& cache, T7& newOmegaTable, T8& newTrackTable, T9& newCollisionTable) { diff --git a/PWGCF/Femto/Core/collisionBuilder.h b/PWGCF/Femto/Core/collisionBuilder.h index 03bda34b671..b1bdcd721b5 100644 --- a/PWGCF/Femto/Core/collisionBuilder.h +++ b/PWGCF/Femto/Core/collisionBuilder.h @@ -82,6 +82,7 @@ struct ConfCollisionBits : o2::framework::ConfigurableGroup { o2::framework::Configurable> sphericityMin{"sphericityMin", {}, "Minimum sphericity"}; o2::framework::Configurable> sphericityMax{"sphericityMax", {}, "Maximum sphericity"}; o2::framework::Configurable> triggers{"triggers", {}, "List of all triggers to be used"}; + o2::framework::Configurable triggerBcTolerance{"triggerBcTolerance", 100, "Tolerance for +-(bc range) around triggered collisions"}; o2::framework::Configurable eventPlaneAngleDetector{"eventPlaneAngleDetector", 0, "Detector used to estimate the event plane angle: 0 -> FT0C, 1 -> FT0A"}; o2::framework::Configurable qvecDetector{"qvecDetector", 0, "Detector used to estimate the Q-vector: 0 -> FT0C, 1 -> FT0A"}; o2::framework::Configurable qvecHarmonic{"qvecHarmonic", 2, "Harmonic n of the Q-vector and event plane angle Psi_n: 2 -> elliptic, 3 -> triangular"}; @@ -235,6 +236,7 @@ class CollisionSelection : public baseselection::BaseSelection producedSigmaLabels; o2::framework::Produces producedSigmaPlusLabels; o2::framework::Produces producedSigmaPlusPcmLabels; + o2::framework::Produces producedLambdaLabels; + o2::framework::Produces producedXiLabels; }; struct ConfMcTablesDerivedToDerived : o2::framework::ConfigurableGroup { @@ -876,6 +878,32 @@ class McBuilderDerivedToDerived this->getOrCreateMcParticleRow(mcParticle, mcCols, mcMothers, mcPartonicMothers, mcProducts)); } + /// Write one FLambdaLabels row. lambda must be joined with FLambdaLabels upstream. + template + void fillLambdaWithLabel(T1 const& lambda, T2 const& mcCols, T3 const& /*mcParticles*/, T4 const& mcMothers, T5 const& mcPartonicMothers, T6& mcProducts) + { + if (!lambda.has_fMcParticle()) { + mcProducts.producedLambdaLabels(-1); + return; + } + auto mcParticle = lambda.template fMcParticle_as(); + mcProducts.producedLambdaLabels( + this->getOrCreateMcParticleRow(mcParticle, mcCols, mcMothers, mcPartonicMothers, mcProducts)); + } + + /// Write one FXiLabels row. xi must be joined with FXiLabels upstream. + template + void fillXiWithLabel(T1 const& xi, T2 const& mcCols, T3 const& /*mcParticles*/, T4 const& mcMothers, T5 const& mcPartonicMothers, T6& mcProducts) + { + if (!xi.has_fMcParticle()) { + mcProducts.producedXiLabels(-1); + return; + } + auto mcParticle = xi.template fMcParticle_as(); + mcProducts.producedXiLabels( + this->getOrCreateMcParticleRow(mcParticle, mcCols, mcMothers, mcPartonicMothers, mcProducts)); + } + template void reset(T1 const& mcCols, T2 const& mcParticles) { diff --git a/PWGCF/Femto/Core/v0Builder.h b/PWGCF/Femto/Core/v0Builder.h index 0650c44d478..97d0d6bfc88 100644 --- a/PWGCF/Femto/Core/v0Builder.h +++ b/PWGCF/Femto/Core/v0Builder.h @@ -870,6 +870,41 @@ class V0BuilderDerivedToDerived } } + /// Same as processLambdas, but also resolves the daughters' MC labels (via the + /// MC-aware trackBuilder.getDaughterIndex overload) and writes the lambda's own + /// FLambdaLabels row. lambdaTable must be joined with FLambdaLabels upstream. + template + void processLambdasWithMc(T1 const& col, T2 const& /*lambdaTable*/, T3 const& oldTrackTable, T4& partitionLambda, T5& trackBuilder, T6& cache, T7& newLambdaTable, T8& newTrackTable, T9& newCollisionTable, + T10& mcBuilder, T11 const& mcCols, T12 const& mcParticles, T13 const& mcMothers, T14 const& mcPartonicMothers, auto& mcProducts) + { + if (mLimitLambda == 0) { // lambdas disabled + return; + } + + auto lambdaSlice = partitionLambda->sliceByCached(o2::aod::femtobase::stored::fColId, col.globalIndex(), cache); + + for (auto const& lambda : lambdaSlice) { + auto posDaughter = oldTrackTable.rawIteratorAt(utils::daughterRow(lambda.posDauId(), oldTrackTable)); + auto negDaughter = oldTrackTable.rawIteratorAt(utils::daughterRow(lambda.negDauId(), oldTrackTable)); + + int64_t posDaughterIndex = trackBuilder.getDaughterIndex(posDaughter, newTrackTable, newCollisionTable, mcBuilder, mcCols, mcParticles, mcMothers, mcPartonicMothers, mcProducts); + int64_t negDaughterIndex = trackBuilder.getDaughterIndex(negDaughter, newTrackTable, newCollisionTable, mcBuilder, mcCols, mcParticles, mcMothers, mcPartonicMothers, mcProducts); + + newLambdaTable.producedLambdas(newCollisionTable.producedCollision.lastIndex(), + lambda.signedPt(), + lambda.eta(), + lambda.phi(), + lambda.mass(), + posDaughterIndex, + negDaughterIndex); + newLambdaTable.producedLambdaMasks(lambda.mask()); + if constexpr (utils::HasCosPa) { + newLambdaTable.producedLambdaFrac(lambda.cosPa()); + } + mcBuilder.fillLambdaWithLabel(lambda, mcCols, mcParticles, mcMothers, mcPartonicMothers, mcProducts); + } + } + template void processK0shorts(T1 const& col, T2 const& /*k0shortTable*/, T3 const& oldTrackTable, T4& partitionK0short, T5& trackBuilder, T6& cache, T7& newK0shortTable, T8& newTrackTable, T9& newCollisionTable) { diff --git a/PWGCF/Femto/TableProducer/femtoProducerDerivedToDerived.cxx b/PWGCF/Femto/TableProducer/femtoProducerDerivedToDerived.cxx index 7c50a5b4c6c..4e01dce2e38 100644 --- a/PWGCF/Femto/TableProducer/femtoProducerDerivedToDerived.cxx +++ b/PWGCF/Femto/TableProducer/femtoProducerDerivedToDerived.cxx @@ -74,6 +74,11 @@ using FemtoSigmaPlusPcm = o2::soa::Join; using FemtoMcTracks = o2::soa::Join; +// opt-in: carries the packed purity tables and FTrackDcas through to the re-written MC output -- +// needs the upstream producer's TrackTables.produceItsPurity/produceTpcPurity/produceTofPurity/produceTrackDcas enabled +using FemtoMcTracksWithFitVars = o2::soa::Join; +using FemtoMcLambdas = o2::soa::Join; +using FemtoMcXis = o2::soa::Join; using FemtoMcSigma = o2::soa::Join; using FemtoMcSigmaPlus = o2::soa::Join; using FemtoMcSigmaPlusExtended = o2::soa::Join; @@ -106,6 +111,9 @@ struct FemtoProducerDerivedToDerived { o2::framework::Preslice perColOmegas = o2::aod::femtobase::stored::fColId; o2::framework::Preslice perColOmegasWithFitVars = o2::aod::femtobase::stored::fColId; o2::framework::Preslice perColMcTracks = o2::aod::femtobase::stored::fColId; + o2::framework::Preslice perColMcTracksWithFitVars = o2::aod::femtobase::stored::fColId; + o2::framework::Preslice perColMcLambdas = o2::aod::femtobase::stored::fColId; + o2::framework::Preslice perColMcXis = o2::aod::femtobase::stored::fColId; o2::framework::Preslice perColMcSigma = o2::aod::femtobase::stored::fColId; o2::framework::Preslice perColMcSigmaPlus = o2::aod::femtobase::stored::fColId; o2::framework::Preslice perColMcSigmaPlusExtended = o2::aod::femtobase::stored::fColId; @@ -200,6 +208,12 @@ struct FemtoProducerDerivedToDerived { o2::framework::Partition mcTrackPartition1 = MAKE_TRACK_PARTITION(trackSelections1); o2::framework::Partition mcTrackPartition2 = MAKE_TRACK_PARTITION(trackSelections2); + o2::framework::Partition mcTrackWithFitVarsPartition1 = MAKE_TRACK_PARTITION(trackSelections1); + o2::framework::Partition mcTrackWithFitVarsPartition2 = MAKE_TRACK_PARTITION(trackSelections2); + + o2::framework::Partition mcLambdaPartition = MAKE_LAMBDA_PARTITION(lambdaSelection1); + o2::framework::Partition mcXiPartition = MAKE_CASCADE_PARTITION(xiSelection); + o2::framework::Partition mcSigmaPartition = MAKE_SIGMA_PARTITION(sigmaSelection1); o2::framework::Partition mcSigmaPlusPartition = MAKE_SIGMAPLUS_PARTITION(sigmaPlusSelection1); @@ -221,9 +235,11 @@ struct FemtoProducerDerivedToDerived { static_cast(doprocessTracksSigmaPlusPcm) + static_cast(doprocessTracksSigmaPlusPcmExtended) + static_cast(doprocessTracksRho0) + static_cast(doprocessTracksPhi) + static_cast(doprocessLambdasXis) + static_cast(doprocessLambdasXisWithFitVars) + - static_cast(doprocessTracksMc) + static_cast(doprocessTracksSigmaMc) + + static_cast(doprocessTracksMcWithFitVars) + static_cast(doprocessTracksSigmaMc) + static_cast(doprocessTracksSigmaPlusMc) + static_cast(doprocessTracksSigmaPlusExtendedMc) + - static_cast(doprocessTracksSigmaPlusPcmMc) + static_cast(doprocessTracksSigmaPlusPcmExtendedMc); + static_cast(doprocessTracksSigmaPlusPcmMc) + static_cast(doprocessTracksSigmaPlusPcmExtendedMc) + + static_cast(doprocessLambdasMcWithFitVars) + static_cast(doprocessTracksLambdasMcWithFitVars) + + static_cast(doprocessTracksXisMcWithFitVars) + static_cast(doprocessLambdasXisMcWithFitVars); if (activeProcesses != 1) { LOG(fatal) << "Exactly one process function must be activated (got " << activeProcesses << ")."; } @@ -240,19 +256,22 @@ struct FemtoProducerDerivedToDerived { doprocessTracksSigma || doprocessTracksSigmaPlus || doprocessTracksSigmaPlusExtended || doprocessTracksSigmaPlusPcm || doprocessTracksSigmaPlusPcmExtended || doprocessTracksRho0 || doprocessTracksPhi || - doprocessTracksMc || doprocessTracksSigmaMc || doprocessTracksSigmaPlusMc || - doprocessTracksSigmaPlusExtendedMc || doprocessTracksSigmaPlusPcmMc || doprocessTracksSigmaPlusPcmExtendedMc; + doprocessTracksMcWithFitVars || doprocessTracksSigmaMc || doprocessTracksSigmaPlusMc || + doprocessTracksSigmaPlusExtendedMc || doprocessTracksSigmaPlusPcmMc || doprocessTracksSigmaPlusPcmExtendedMc || + doprocessTracksLambdasMcWithFitVars || doprocessTracksXisMcWithFitVars; const bool needsV0Builder = doprocessTracksLambdas || doprocessTracksWithMassLambdas || doprocessTracksLambdasWithFitVars || doprocessLambdas || doprocessTracksK0shorts || doprocessTracksK0shortsWithFitVars || - doprocessLambdasXis || doprocessLambdasXisWithFitVars; + doprocessLambdasXis || doprocessLambdasXisWithFitVars || + doprocessLambdasMcWithFitVars || doprocessTracksLambdasMcWithFitVars || doprocessLambdasXisMcWithFitVars; const bool needsCascadeBuilder = doprocessTracksXis || doprocessTracksXisWithFitVars || doprocessTracksOmegas || doprocessTracksOmegasWithFitVars || - doprocessLambdasXis || doprocessLambdasXisWithFitVars; + doprocessLambdasXis || doprocessLambdasXisWithFitVars || + doprocessTracksXisMcWithFitVars || doprocessLambdasXisMcWithFitVars; const bool needsKinkBuilder = doprocessTracksSigma || doprocessTracksSigmaPlus || doprocessTracksSigmaPlusExtended || @@ -263,8 +282,9 @@ struct FemtoProducerDerivedToDerived { const bool needsResonanceBuilder = doprocessTracksRho0 || doprocessTracksPhi; const bool needsMcBuilder = - doprocessTracksMc || doprocessTracksSigmaMc || doprocessTracksSigmaPlusMc || - doprocessTracksSigmaPlusExtendedMc || doprocessTracksSigmaPlusPcmMc || doprocessTracksSigmaPlusPcmExtendedMc; + doprocessTracksMcWithFitVars || doprocessTracksSigmaMc || doprocessTracksSigmaPlusMc || + doprocessTracksSigmaPlusExtendedMc || doprocessTracksSigmaPlusPcmMc || doprocessTracksSigmaPlusPcmExtendedMc || + doprocessLambdasMcWithFitVars || doprocessTracksLambdasMcWithFitVars || doprocessTracksXisMcWithFitVars || doprocessLambdasXisMcWithFitVars; // skip init() entirely for builders the active process doesn't touch: their limit // members default to 0 and are only ever read by the collisionHasTooFew*/process* @@ -597,29 +617,129 @@ struct FemtoProducerDerivedToDerived { PROCESS_SWITCH(FemtoProducerDerivedToDerived, processLambdasXisWithFitVars, "Process lambdas and xis, carrying through their fraction-extraction tables", false); // mc processing - void processTracksMc(femtotables::FilteredFemtoMcCollisions const& cols, - femtotables::FemtoMcTracks const& tracks, - o2::aod::FMcCols const& mcCols, - femtotables::FemtoMcParticles const& mcParticles, - o2::aod::FMcMothers const& mcMothers, - o2::aod::FMcPartMoths const& mcPartonicMothers) + void processTracksMcWithFitVars(femtotables::FilteredFemtoMcCollisions const& cols, + femtotables::FemtoMcTracksWithFitVars const& tracks, + o2::aod::FMcCols const& mcCols, + femtotables::FemtoMcParticles const& mcParticles, + o2::aod::FMcMothers const& mcMothers, + o2::aod::FMcPartMoths const& mcPartonicMothers) { // once per dataframe builders.mcBuilder.reset(mcCols, mcParticles); builders.trackBuilder.reset(tracks); for (auto const& col : cols) { - if (builders.trackBuilder.collisionHasTooFewTracks(col, tracks, mcTrackPartition1, mcTrackPartition2, cache)) { + if (builders.trackBuilder.collisionHasTooFewTracks(col, tracks, mcTrackWithFitVarsPartition1, mcTrackWithFitVarsPartition2, cache)) { continue; } builders.collisionBuilder.processCollision(col, collisionBuilderProducts); builders.mcBuilder.fillCollisionWithLabel(col, mcCols, mcBuilderProducts); - builders.trackBuilder.processTracksWithMc(col, tracks, mcTrackPartition1, mcTrackPartition2, cache, + builders.trackBuilder.processTracksWithMc(col, tracks, mcTrackWithFitVarsPartition1, mcTrackWithFitVarsPartition2, cache, trackBuilderProducts, collisionBuilderProducts, builders.mcBuilder, mcCols, mcParticles, mcMothers, mcPartonicMothers, mcBuilderProducts); } } - PROCESS_SWITCH(FemtoProducerDerivedToDerived, processTracksMc, "Process tracks with MC information", false); + PROCESS_SWITCH(FemtoProducerDerivedToDerived, processTracksMcWithFitVars, "Process tracks with MC information, carrying through their purity and DCA (fraction-extraction) tables", false); + + void processLambdasMcWithFitVars(femtotables::FilteredFemtoMcCollisions const& cols, + femtotables::FemtoMcTracks const& tracks, + femtotables::FemtoMcLambdas const& lambdas, + o2::aod::FMcCols const& mcCols, + femtotables::FemtoMcParticles const& mcParticles, + o2::aod::FMcMothers const& mcMothers, + o2::aod::FMcPartMoths const& mcPartonicMothers) + { + builders.mcBuilder.reset(mcCols, mcParticles); + builders.trackBuilder.reset(tracks); + for (auto const& col : cols) { + if (builders.v0Builder.collisionHasTooFewLambdas(col, lambdas, mcLambdaPartition, cache)) { + continue; + } + builders.collisionBuilder.processCollision(col, collisionBuilderProducts); + builders.mcBuilder.fillCollisionWithLabel(col, mcCols, mcBuilderProducts); + builders.v0Builder.processLambdasWithMc(col, lambdas, tracks, mcLambdaPartition, builders.trackBuilder, cache, v0BuilderProducts, trackBuilderProducts, collisionBuilderProducts, + builders.mcBuilder, mcCols, mcParticles, mcMothers, mcPartonicMothers, mcBuilderProducts); + } + } + PROCESS_SWITCH(FemtoProducerDerivedToDerived, processLambdasMcWithFitVars, "Process lambdas only with MC information, carrying through their fraction-extraction table (produced track table contains daughters only)", false); + + void processTracksLambdasMcWithFitVars(femtotables::FilteredFemtoMcCollisions const& cols, + femtotables::FemtoMcTracksWithFitVars const& tracks, + femtotables::FemtoMcLambdas const& lambdas, + o2::aod::FMcCols const& mcCols, + femtotables::FemtoMcParticles const& mcParticles, + o2::aod::FMcMothers const& mcMothers, + o2::aod::FMcPartMoths const& mcPartonicMothers) + { + builders.mcBuilder.reset(mcCols, mcParticles); + builders.trackBuilder.reset(tracks); + for (auto const& col : cols) { + if (builders.trackBuilder.collisionHasTooFewTracks(col, tracks, mcTrackWithFitVarsPartition1, mcTrackWithFitVarsPartition2, cache) || + builders.v0Builder.collisionHasTooFewLambdas(col, lambdas, mcLambdaPartition, cache)) { + continue; + } + builders.collisionBuilder.processCollision(col, collisionBuilderProducts); + builders.mcBuilder.fillCollisionWithLabel(col, mcCols, mcBuilderProducts); + builders.trackBuilder.processTracksWithMc(col, tracks, mcTrackWithFitVarsPartition1, mcTrackWithFitVarsPartition2, cache, + trackBuilderProducts, collisionBuilderProducts, + builders.mcBuilder, mcCols, mcParticles, mcMothers, mcPartonicMothers, mcBuilderProducts); + builders.v0Builder.processLambdasWithMc(col, lambdas, tracks, mcLambdaPartition, builders.trackBuilder, cache, v0BuilderProducts, trackBuilderProducts, collisionBuilderProducts, + builders.mcBuilder, mcCols, mcParticles, mcMothers, mcPartonicMothers, mcBuilderProducts); + } + } + PROCESS_SWITCH(FemtoProducerDerivedToDerived, processTracksLambdasMcWithFitVars, "Process lambdas and tracks with MC information, carrying through the tracks' purity/DCA tables and the lambdas' fraction-extraction table", false); + + void processTracksXisMcWithFitVars(femtotables::FilteredFemtoMcCollisions const& cols, + femtotables::FemtoMcTracksWithFitVars const& tracks, + femtotables::FemtoMcXis const& xis, + o2::aod::FMcCols const& mcCols, + femtotables::FemtoMcParticles const& mcParticles, + o2::aod::FMcMothers const& mcMothers, + o2::aod::FMcPartMoths const& mcPartonicMothers) + { + builders.mcBuilder.reset(mcCols, mcParticles); + builders.trackBuilder.reset(tracks); + for (auto const& col : cols) { + if (builders.trackBuilder.collisionHasTooFewTracks(col, tracks, mcTrackWithFitVarsPartition1, mcTrackWithFitVarsPartition2, cache) || + builders.cascadeBuilder.collisionHasTooFewXis(col, xis, mcXiPartition, cache)) { + continue; + } + builders.collisionBuilder.processCollision(col, collisionBuilderProducts); + builders.mcBuilder.fillCollisionWithLabel(col, mcCols, mcBuilderProducts); + builders.trackBuilder.processTracksWithMc(col, tracks, mcTrackWithFitVarsPartition1, mcTrackWithFitVarsPartition2, cache, + trackBuilderProducts, collisionBuilderProducts, + builders.mcBuilder, mcCols, mcParticles, mcMothers, mcPartonicMothers, mcBuilderProducts); + builders.cascadeBuilder.processXisWithMc(col, xis, tracks, mcXiPartition, builders.trackBuilder, cache, cascadeBuilderProducts, trackBuilderProducts, collisionBuilderProducts, + builders.mcBuilder, mcCols, mcParticles, mcMothers, mcPartonicMothers, mcBuilderProducts); + } + } + PROCESS_SWITCH(FemtoProducerDerivedToDerived, processTracksXisMcWithFitVars, "Process tracks and xis with MC information, carrying through the tracks' purity/DCA tables and the xis' fraction-extraction table", false); + + void processLambdasXisMcWithFitVars(femtotables::FilteredFemtoMcCollisions const& cols, + femtotables::FemtoMcTracks const& tracks, + femtotables::FemtoMcLambdas const& lambdas, + femtotables::FemtoMcXis const& xis, + o2::aod::FMcCols const& mcCols, + femtotables::FemtoMcParticles const& mcParticles, + o2::aod::FMcMothers const& mcMothers, + o2::aod::FMcPartMoths const& mcPartonicMothers) + { + builders.mcBuilder.reset(mcCols, mcParticles); + builders.trackBuilder.reset(tracks); + for (auto const& col : cols) { + if (builders.v0Builder.collisionHasTooFewLambdas(col, lambdas, mcLambdaPartition, cache) || + builders.cascadeBuilder.collisionHasTooFewXis(col, xis, mcXiPartition, cache)) { + continue; + } + builders.collisionBuilder.processCollision(col, collisionBuilderProducts); + builders.mcBuilder.fillCollisionWithLabel(col, mcCols, mcBuilderProducts); + builders.v0Builder.processLambdasWithMc(col, lambdas, tracks, mcLambdaPartition, builders.trackBuilder, cache, v0BuilderProducts, trackBuilderProducts, collisionBuilderProducts, + builders.mcBuilder, mcCols, mcParticles, mcMothers, mcPartonicMothers, mcBuilderProducts); + builders.cascadeBuilder.processXisWithMc(col, xis, tracks, mcXiPartition, builders.trackBuilder, cache, cascadeBuilderProducts, trackBuilderProducts, collisionBuilderProducts, + builders.mcBuilder, mcCols, mcParticles, mcMothers, mcPartonicMothers, mcBuilderProducts); + } + } + PROCESS_SWITCH(FemtoProducerDerivedToDerived, processLambdasXisMcWithFitVars, "Process lambdas and xis with MC information, carrying through their fraction-extraction tables", false); void processTracksSigmaMc(femtotables::FilteredFemtoMcCollisions const& cols, femtotables::FemtoMcTracks const& tracks, diff --git a/PWGCF/Femto/Tasks/femtoPairTrackCascade.cxx b/PWGCF/Femto/Tasks/femtoPairTrackCascade.cxx index 290d910e1aa..ea73588ead1 100644 --- a/PWGCF/Femto/Tasks/femtoPairTrackCascade.cxx +++ b/PWGCF/Femto/Tasks/femtoPairTrackCascade.cxx @@ -64,6 +64,11 @@ struct FemtoPairTrackCascade { using FemtoCollisionsWithTags = o2::soa::Join; using FilteredFemtoCollisionsWithTags = o2::soa::Filtered; + // opt-in: carries both FColLabels and FColTags, for the processXxxMixedEventMcWithTagging + // functions below -- same collisionFilter auto-apply reasoning as FemtoCollisionsWithTags above. + using FemtoCollisionsWithLabelAndTags = o2::soa::Join; + using FilteredFemtoCollisionsWithLabelAndTags = o2::soa::Filtered; + using FemtoTracks = o2::soa::Join; using FemtoXis = o2::soa::Join; using FemtoOmegas = o2::soa::Join; @@ -202,33 +207,33 @@ struct FemtoPairTrackCascade { { bool processData = doprocessXiSameEvent || doprocessXiMixedEvent || doprocessOmegaSameEvent || doprocessOmegaMixedEvent || doprocessXiMixedEventWithTagging || doprocessOmegaMixedEventWithTagging; bool processFitVars = doprocessXiSameEventWithFitVars || doprocessXiMixedEventWithFitVars || doprocessOmegaSameEventWithFitVars || doprocessOmegaMixedEventWithFitVars; - bool processMc = doprocessXiSameEventMc || doprocessXiMixedEventMc || doprocessOmegaSameEventMc || doprocessOmegaMixedEventMc; + bool processMc = doprocessXiSameEventMc || doprocessXiMixedEventMc || doprocessOmegaSameEventMc || doprocessOmegaMixedEventMc || doprocessXiMixedEventMcWithTagging || doprocessOmegaMixedEventMcWithTagging; if (static_cast(processData) + static_cast(processFitVars) + static_cast(processMc) > 1) { LOG(fatal) << "More than one of data, FitVars or mc processing is activated. Breaking..."; } - bool processXi = doprocessXiSameEvent || doprocessXiSameEventWithFitVars || doprocessXiSameEventMc || doprocessXiMixedEvent || doprocessXiMixedEventWithFitVars || doprocessXiMixedEventMc || doprocessXiMixedEventWithTagging; - bool processOmega = doprocessOmegaSameEvent || doprocessOmegaSameEventWithFitVars || doprocessOmegaSameEventMc || doprocessOmegaMixedEvent || doprocessOmegaMixedEventWithFitVars || doprocessOmegaMixedEventMc || doprocessOmegaMixedEventWithTagging; + bool processXi = doprocessXiSameEvent || doprocessXiSameEventWithFitVars || doprocessXiSameEventMc || doprocessXiMixedEvent || doprocessXiMixedEventWithFitVars || doprocessXiMixedEventMc || doprocessXiMixedEventWithTagging || doprocessXiMixedEventMcWithTagging; + bool processOmega = doprocessOmegaSameEvent || doprocessOmegaSameEventWithFitVars || doprocessOmegaSameEventMc || doprocessOmegaMixedEvent || doprocessOmegaMixedEventWithFitVars || doprocessOmegaMixedEventMc || doprocessOmegaMixedEventWithTagging || doprocessOmegaMixedEventMcWithTagging; // Each species discovers its own tag bit independently (see Core/collisionTagger.h). - if (doprocessXiMixedEventWithTagging || doprocessOmegaMixedEventWithTagging) { + if (doprocessXiMixedEventWithTagging || doprocessOmegaMixedEventWithTagging || doprocessXiMixedEventMcWithTagging || doprocessOmegaMixedEventMcWithTagging) { auto const& workflows = context.services().get(); auto const& ownDevice = context.services().get(); auto roles = collisiontagger::discoverTaggedRoles(workflows); - if (doprocessXiMixedEventWithTagging) { + if (doprocessXiMixedEventWithTagging || doprocessXiMixedEventMcWithTagging) { int bit = collisiontagger::findOwnBit(roles, ownDevice.name, confTaggingXi.Role); if (bit < 0) { - LOG(fatal) << "processXiMixedEventWithTagging is enabled, but no femto-collision-tagger device " + LOG(fatal) << "A processXiMixedEventWithTagging* function is enabled, but no femto-collision-tagger device " << "(with processTrackCascade enabled) tagging this device (" << ownDevice.name << ") was found in this workflow."; } confTaggingXi.internalTagMask.value = static_cast(1) << bit; LOG(info) << "Collision tagger bit for " << ownDevice.name << " (Xi): " << bit; } - if (doprocessOmegaMixedEventWithTagging) { + if (doprocessOmegaMixedEventWithTagging || doprocessOmegaMixedEventMcWithTagging) { int bit = collisiontagger::findOwnBit(roles, ownDevice.name, confTaggingOmega.Role); if (bit < 0) { - LOG(fatal) << "processOmegaMixedEventWithTagging is enabled, but no femto-collision-tagger device " + LOG(fatal) << "A processOmegaMixedEventWithTagging* function is enabled, but no femto-collision-tagger device " << "(with processTrackCascade enabled) tagging this device (" << ownDevice.name << ") was found in this workflow."; } confTaggingOmega.internalTagMask.value = static_cast(1) << bit; @@ -353,6 +358,16 @@ struct FemtoPairTrackCascade { } PROCESS_SWITCH(FemtoPairTrackCascade, processXiMixedEventWithFitVars, "Enable processing mixed event processing for tracks and xis, carrying through FitVars tables", false); + // Same tagging filter as processXiMixedEventWithTagging above, on a collision table that also + // carries FColLabels, and the MC-aware processMixedEvent overload (same as processXiMixedEventMc). + void processXiMixedEventMcWithTagging(FilteredFemtoCollisionsWithLabelAndTags const& cols, o2::aod::FMcCols const& mcCols, FemtoTracksWithLabel const& tracks, FemtoXisWithLabel const& /*xis*/, FemtoMcParticlesWithLabel const& mcParticles, o2::aod::FMcMothers const& mcMothers, o2::aod::FMcPartMoths const& mcPartonicMothers) + { + o2::framework::Partition taggedCollisions = ncheckbit(o2::aod::femtocollisions::collisionTag, confTaggingXi.internalTagMask); + taggedCollisions.bindTable(cols); + pairTrackXiBuilder.processMixedEvent(taggedCollisions, mcCols, tracks, trackWithLabelPartition, xiWithLabelPartition, mcParticles, mcMothers, mcPartonicMothers, cache, mixBinsVtxMult, mixBinsVtxCent, mixBinsVtxMultCent); + } + PROCESS_SWITCH(FemtoPairTrackCascade, processXiMixedEventMcWithTagging, "Enable processing mixed event processing for tracks and xis, pre-filtered using the collision tagger, with mc information", false); + void processOmegaSameEvent(FilteredFemtoCollision const& col, FemtoTracks const& tracks, FemtoOmegas const& omegas) { pairTrackOmegaBuilder.processSameEvent(col, tracks, trackPartition, omegas, omegaPartition, cache); @@ -397,6 +412,16 @@ struct FemtoPairTrackCascade { pairTrackOmegaBuilder.processMixedEvent(cols, tracks, trackWithFitVarsPartition, omegaWithFitVarsPartition, cache, mixBinsVtxMult, mixBinsVtxCent, mixBinsVtxMultCent); } PROCESS_SWITCH(FemtoPairTrackCascade, processOmegaMixedEventWithFitVars, "Enable processing mixed event processing for tracks and omegas, carrying through FitVars tables", false); + + // Same tagging filter as processOmegaMixedEventWithTagging above, on a collision table that + // also carries FColLabels, and the MC-aware processMixedEvent overload (same as processOmegaMixedEventMc). + void processOmegaMixedEventMcWithTagging(FilteredFemtoCollisionsWithLabelAndTags const& cols, o2::aod::FMcCols const& mcCols, FemtoTracksWithLabel const& tracks, FemtoOmegasWithLabel const& /*omegas*/, FemtoMcParticlesWithLabel const& mcParticles, o2::aod::FMcMothers const& mcMothers, o2::aod::FMcPartMoths const& mcPartonicMothers) + { + o2::framework::Partition taggedCollisions = ncheckbit(o2::aod::femtocollisions::collisionTag, confTaggingOmega.internalTagMask); + taggedCollisions.bindTable(cols); + pairTrackOmegaBuilder.processMixedEvent(taggedCollisions, mcCols, tracks, trackWithLabelPartition, omegaWithLabelPartition, mcParticles, mcMothers, mcPartonicMothers, cache, mixBinsVtxMult, mixBinsVtxCent, mixBinsVtxMultCent); + } + PROCESS_SWITCH(FemtoPairTrackCascade, processOmegaMixedEventMcWithTagging, "Enable processing mixed event processing for tracks and omegas, pre-filtered using the collision tagger, with mc information", false); }; o2::framework::WorkflowSpec defineDataProcessing(o2::framework::ConfigContext const& context) diff --git a/PWGCF/Femto/Tasks/femtoPairTrackTrack.cxx b/PWGCF/Femto/Tasks/femtoPairTrackTrack.cxx index 3bd8334ab7c..47b9930b658 100644 --- a/PWGCF/Femto/Tasks/femtoPairTrackTrack.cxx +++ b/PWGCF/Femto/Tasks/femtoPairTrackTrack.cxx @@ -79,6 +79,11 @@ struct FemtoPairTrackTrack { using FemtoCollisionsWithEventShapeAndTags = o2::soa::Join; using FilteredFemtoCollisionsWithEventShapeAndTags = o2::soa::Filtered; + // opt-in: carries both FColLabels and FColTags, for processMixedEventMcWithTagging -- same + // collisionFilter auto-apply reasoning as FemtoCollisionsWithTags above. + using FemtoCollisionsWithLabelAndTags = o2::soa::Join; + using FilteredFemtoCollisionsWithLabelAndTags = o2::soa::Filtered; + using FemtoTracks = o2::soa::Join; // for analysis which require particles at high pt, add tof mass so sidebands can be used @@ -166,11 +171,11 @@ struct FemtoPairTrackTrack { void init(o2::framework::InitContext& context) { if ((static_cast(doprocessSameEvent) + static_cast(doprocessSameEventWithMass) + static_cast(doprocessSameEventWithEventShape) + static_cast(doprocessSameEventWithFitVars) + static_cast(doprocessSameEventMc)) > 1 || - (static_cast(doprocessMixedEvent) + static_cast(doprocessMixedEventWithMass) + static_cast(doprocessMixedEventWithEventShape) + static_cast(doprocessMixedEventWithFitVars) + static_cast(doprocessMixedEventMc) + static_cast(doprocessMixedEventWithTagging) + static_cast(doprocessMixedEventWithTaggingAndMass) + static_cast(doprocessMixedEventWithTaggingAndEventShape) + static_cast(doprocessMixedEventWithTaggingAndFitVars)) > 1) { + (static_cast(doprocessMixedEvent) + static_cast(doprocessMixedEventWithMass) + static_cast(doprocessMixedEventWithEventShape) + static_cast(doprocessMixedEventWithFitVars) + static_cast(doprocessMixedEventMc) + static_cast(doprocessMixedEventWithTagging) + static_cast(doprocessMixedEventWithTaggingAndMass) + static_cast(doprocessMixedEventWithTaggingAndEventShape) + static_cast(doprocessMixedEventWithTaggingAndFitVars) + static_cast(doprocessMixedEventMcWithTagging)) > 1) { LOG(fatal) << "More than 1 same or mixed event process function is activated. Breaking..."; } - if (doprocessMixedEventWithTagging || doprocessMixedEventWithTaggingAndMass || doprocessMixedEventWithTaggingAndEventShape || doprocessMixedEventWithTaggingAndFitVars) { + if (doprocessMixedEventWithTagging || doprocessMixedEventWithTaggingAndMass || doprocessMixedEventWithTaggingAndEventShape || doprocessMixedEventWithTaggingAndFitVars || doprocessMixedEventMcWithTagging) { // discoverTaggedRoles() is the same canonical device-list walk femtoProducerCollisionTagger.cxx uses // to assign bits -- replaying it here (rather than asking the tagger directly, which has no // way to communicate a runtime-computed value back out through RunningWorkflowInfo) is how @@ -189,7 +194,7 @@ struct FemtoPairTrackTrack { } bool processData = doprocessSameEvent || doprocessMixedEvent || doprocessSameEventWithMass || doprocessMixedEventWithMass || doprocessSameEventWithEventShape || doprocessMixedEventWithEventShape || doprocessMixedEventWithTagging || doprocessMixedEventWithTaggingAndMass || doprocessMixedEventWithTaggingAndEventShape; bool processFitVars = doprocessSameEventWithFitVars || doprocessMixedEventWithFitVars || doprocessMixedEventWithTaggingAndFitVars; - bool processMc = doprocessSameEventMc || doprocessMixedEventMc; + bool processMc = doprocessSameEventMc || doprocessMixedEventMc || doprocessMixedEventMcWithTagging; if (static_cast(processData) + static_cast(processFitVars) + static_cast(processMc) > 1) { LOG(fatal) << "More than one of data, purity or mc processing is activated. Breaking..."; } @@ -310,6 +315,16 @@ struct FemtoPairTrackTrack { } PROCESS_SWITCH(FemtoPairTrackTrack, processMixedEventWithTaggingAndFitVars, "Enable processing mixed event processing, pre-filtered using the collision tagger (with FitVars tables)", false); + // Same tagging filter as processMixedEventWithTagging above, on a collision table that also + // carries FColLabels, and the MC-aware processMixedEvent overload (same as processMixedEventMc). + void processMixedEventMcWithTagging(FilteredFemtoCollisionsWithLabelAndTags const& cols, o2::aod::FMcCols const& mcCols, FemtoTracksWithLabel const& tracks, FemtoMcParticlesWithLabel const& mcParticles, o2::aod::FMcMothers const& mcMothers, o2::aod::FMcPartMoths const& mcPartonicMothers) + { + o2::framework::Partition taggedCollisions = ncheckbit(o2::aod::femtocollisions::collisionTag, confTagging.internalTagMask); + taggedCollisions.bindTable(cols); + pairTrackTrackBuilder.processMixedEvent(taggedCollisions, mcCols, tracks, trackWithLabelPartition1, trackWithLabelPartition2, mcParticles, mcMothers, mcPartonicMothers, cache, mixBinsVtxMult, mixBinsVtxCent, mixBinsVtxMultCent, mixBinsVtxCentEventPlaneAngle); + } + PROCESS_SWITCH(FemtoPairTrackTrack, processMixedEventMcWithTagging, "Enable processing mixed event processing, pre-filtered using the collision tagger, with mc information", false); + void processMixedEvent(FilteredFemtoCollisions const& cols, FemtoTracks const& tracks) { pairTrackTrackBuilder.processMixedEvent(cols, tracks, trackPartition1, trackPartition2, cache, mixBinsVtxMult, mixBinsVtxCent, mixBinsVtxMultCent, mixBinsVtxCentEventPlaneAngle); diff --git a/PWGCF/Femto/Tasks/femtoPairTrackV0.cxx b/PWGCF/Femto/Tasks/femtoPairTrackV0.cxx index d7af5e129dd..81ba0ea5458 100644 --- a/PWGCF/Femto/Tasks/femtoPairTrackV0.cxx +++ b/PWGCF/Femto/Tasks/femtoPairTrackV0.cxx @@ -66,6 +66,11 @@ struct FemtoPairTrackV0 { using FemtoCollisionsWithTags = o2::soa::Join; using FilteredFemtoCollisionsWithTags = o2::soa::Filtered; + // opt-in: carries both FColLabels and FColTags, for the processXxxMixedEventMcWithTagging + // functions below -- same collisionFilter auto-apply reasoning as FemtoCollisionsWithTags above. + using FemtoCollisionsWithLabelAndTags = o2::soa::Join; + using FilteredFemtoCollisionsWithLabelAndTags = o2::soa::Filtered; + using FemtoTracks = o2::soa::Join; using FemtoLambdas = o2::soa::Join; using FemtoK0shorts = o2::soa::Join; @@ -195,14 +200,14 @@ struct FemtoPairTrackV0 { { bool processData = doprocessLambdaSameEvent || doprocessLambdaMixedEvent || doprocessK0shortSameEvent || doprocessK0shortMixedEvent || doprocessLambdaMixedEventWithTagging || doprocessK0shortMixedEventWithTagging; bool processFitVars = doprocessLambdaSameEventWithFitVars || doprocessLambdaMixedEventWithFitVars || doprocessK0shortSameEventWithFitVars || doprocessK0shortMixedEventWithFitVars; - bool processMc = doprocessLambdaSameEventMc || doprocessLambdaMixedEventMc || doprocessK0shortSameEventMc || doprocessK0shortMixedEventMc; + bool processMc = doprocessLambdaSameEventMc || doprocessLambdaMixedEventMc || doprocessK0shortSameEventMc || doprocessK0shortMixedEventMc || doprocessLambdaMixedEventMcWithTagging || doprocessK0shortMixedEventMcWithTagging; if (static_cast(processData) + static_cast(processFitVars) + static_cast(processMc) > 1) { LOG(fatal) << "More than one of data, FitVars or mc processing is activated. Breaking..."; } - bool processLambda = doprocessLambdaSameEvent || doprocessLambdaSameEventWithFitVars || doprocessLambdaSameEventMc || doprocessLambdaMixedEvent || doprocessLambdaMixedEventWithFitVars || doprocessLambdaMixedEventMc || doprocessLambdaMixedEventWithTagging; - bool processK0short = doprocessK0shortSameEvent || doprocessK0shortSameEventWithFitVars || doprocessK0shortSameEventMc || doprocessK0shortMixedEvent || doprocessK0shortMixedEventWithFitVars || doprocessK0shortMixedEventMc || doprocessK0shortMixedEventWithTagging; + bool processLambda = doprocessLambdaSameEvent || doprocessLambdaSameEventWithFitVars || doprocessLambdaSameEventMc || doprocessLambdaMixedEvent || doprocessLambdaMixedEventWithFitVars || doprocessLambdaMixedEventMc || doprocessLambdaMixedEventWithTagging || doprocessLambdaMixedEventMcWithTagging; + bool processK0short = doprocessK0shortSameEvent || doprocessK0shortSameEventWithFitVars || doprocessK0shortSameEventMc || doprocessK0shortMixedEvent || doprocessK0shortMixedEventWithFitVars || doprocessK0shortMixedEventMc || doprocessK0shortMixedEventWithTagging || doprocessK0shortMixedEventMcWithTagging; if (processLambda && processK0short) { LOG(fatal) << "Both lambda-track and k0short-track processing is enabled. Breaking..."; @@ -211,24 +216,24 @@ struct FemtoPairTrackV0 { // Each species discovers its own tag bit independently (see Core/collisionTagger.h): // same-event-only for one species and tagged-mixed-event for the other is a legitimate // combination, so neither discovery is gated on the other's process switch. - if (doprocessLambdaMixedEventWithTagging || doprocessK0shortMixedEventWithTagging) { + if (doprocessLambdaMixedEventWithTagging || doprocessK0shortMixedEventWithTagging || doprocessLambdaMixedEventMcWithTagging || doprocessK0shortMixedEventMcWithTagging) { auto const& workflows = context.services().get(); auto const& ownDevice = context.services().get(); auto roles = collisiontagger::discoverTaggedRoles(workflows); - if (doprocessLambdaMixedEventWithTagging) { + if (doprocessLambdaMixedEventWithTagging || doprocessLambdaMixedEventMcWithTagging) { int bit = collisiontagger::findOwnBit(roles, ownDevice.name, confTaggingLambda.Role); if (bit < 0) { - LOG(fatal) << "processLambdaMixedEventWithTagging is enabled, but no femto-collision-tagger " + LOG(fatal) << "A processLambdaMixedEventWithTagging* function is enabled, but no femto-collision-tagger " << "device (with processTrackV0 enabled) tagging this device (" << ownDevice.name << ") was found in this workflow."; } confTaggingLambda.internalTagMask.value = static_cast(1) << bit; LOG(info) << "Collision tagger bit for " << ownDevice.name << " (Lambda): " << bit; } - if (doprocessK0shortMixedEventWithTagging) { + if (doprocessK0shortMixedEventWithTagging || doprocessK0shortMixedEventMcWithTagging) { int bit = collisiontagger::findOwnBit(roles, ownDevice.name, confTaggingK0short.Role); if (bit < 0) { - LOG(fatal) << "processK0shortMixedEventWithTagging is enabled, but no femto-collision-tagger " + LOG(fatal) << "A processK0shortMixedEventWithTagging* function is enabled, but no femto-collision-tagger " << "device (with processTrackV0 enabled) tagging this device (" << ownDevice.name << ") was found in this workflow."; } @@ -343,6 +348,16 @@ struct FemtoPairTrackV0 { } PROCESS_SWITCH(FemtoPairTrackV0, processLambdaMixedEventWithFitVars, "Enable processing mixed event processing for tracks and lambdas, carrying through FitVars tables", false); + // Same tagging filter as processLambdaMixedEventWithTagging above, on a collision table that + // also carries FColLabels, and the MC-aware processMixedEvent overload (same as processLambdaMixedEventMc). + void processLambdaMixedEventMcWithTagging(FilteredFemtoCollisionsWithLabelAndTags const& cols, o2::aod::FMcCols const& mcCols, FemtoTracksWithLabel const& tracks, FemtoLambdasWithLabel const& /*lambas*/, FemtoMcParticlesWithLabel const& mcParticles, o2::aod::FMcMothers const& mcMothers, o2::aod::FMcPartMoths const& mcPartonicMothers) + { + o2::framework::Partition taggedCollisions = ncheckbit(o2::aod::femtocollisions::collisionTag, confTaggingLambda.internalTagMask); + taggedCollisions.bindTable(cols); + pairTrackLambdaBuilder.processMixedEvent(taggedCollisions, mcCols, tracks, trackWithLabelPartition, lambdaWithLabelPartition, mcParticles, mcMothers, mcPartonicMothers, cache, mixBinsVtxMult, mixBinsVtxCent, mixBinsVtxMultCent); + } + PROCESS_SWITCH(FemtoPairTrackV0, processLambdaMixedEventMcWithTagging, "Enable processing mixed event processing for tracks and lambdas, pre-filtered using the collision tagger, with mc information", false); + void processK0shortSameEvent(FilteredFemtoCollision const& col, FemtoTracks const& tracks, FemtoK0shorts const& k0shorts) { pairTrackK0shortBuilder.processSameEvent(col, tracks, trackPartition, k0shorts, k0shortPartition, cache); @@ -389,6 +404,16 @@ struct FemtoPairTrackV0 { pairTrackK0shortBuilder.processMixedEvent(cols, tracks, trackWithFitVarsPartition, k0shortWithFitVarsPartition, cache, mixBinsVtxMult, mixBinsVtxCent, mixBinsVtxMultCent); } PROCESS_SWITCH(FemtoPairTrackV0, processK0shortMixedEventWithFitVars, "Enable processing mixed event processing for tracks and k0shorts, carrying through FitVars tables", false); + + // Same tagging filter as processK0shortMixedEventWithTagging above, on a collision table that + // also carries FColLabels, and the MC-aware processMixedEvent overload (same as processK0shortMixedEventMc). + void processK0shortMixedEventMcWithTagging(FilteredFemtoCollisionsWithLabelAndTags const& cols, o2::aod::FMcCols const& mcCols, FemtoTracksWithLabel const& tracks, FemtoK0shortsWithLabel const& /*k0shorts*/, FemtoMcParticlesWithLabel const& mcParticles, o2::aod::FMcMothers const& mcMothers, o2::aod::FMcPartMoths const& mcPartonicMothers) + { + o2::framework::Partition taggedCollisions = ncheckbit(o2::aod::femtocollisions::collisionTag, confTaggingK0short.internalTagMask); + taggedCollisions.bindTable(cols); + pairTrackK0shortBuilder.processMixedEvent(taggedCollisions, mcCols, tracks, trackWithLabelPartition, k0shortWithLabelPartition, mcParticles, mcMothers, mcPartonicMothers, cache, mixBinsVtxMult, mixBinsVtxCent, mixBinsVtxMultCent); + } + PROCESS_SWITCH(FemtoPairTrackV0, processK0shortMixedEventMcWithTagging, "Enable processing mixed event processing for tracks and k0shorts, pre-filtered using the collision tagger, with mc information", false); }; o2::framework::WorkflowSpec defineDataProcessing(o2::framework::ConfigContext const& context) diff --git a/PWGCF/Femto/Tasks/femtoPairV0V0.cxx b/PWGCF/Femto/Tasks/femtoPairV0V0.cxx index 4602b00fff4..9c31b37d2fe 100644 --- a/PWGCF/Femto/Tasks/femtoPairV0V0.cxx +++ b/PWGCF/Femto/Tasks/femtoPairV0V0.cxx @@ -70,16 +70,26 @@ struct FemtoPairV0V0 { using FemtoLambdas = o2::soa::Join; using FemtoK0shorts = o2::soa::Join; - using FemtoTracksWithLabel = o2::soa::Join; - using FemtoLambdasWithLabel = o2::soa::Join; - using FemtoK0shortsWithLabel = o2::soa::Join; + using FemtoTracksWithLabel = o2::soa::Join; + using FemtoLambdasWithLabel = o2::soa::Join; + using FemtoK0shortsWithLabel = o2::soa::Join; using FemtoMcParticlesWithLabel = o2::soa::Join; + // reco-only + FitVars (no MC labels, but carries the opt-in purity/fraction tables) + using FemtoTracksWithFitVars = o2::soa::Join; + using FemtoLambdasWithFitVars = o2::soa::Join; + using FemtoK0shortsWithFitVars = o2::soa::Join; + // opt-in: carries FColTags, only needed by the processXxxMixedEventWithTagging functions below. using FemtoCollisionsWithTags = o2::soa::Join; using FilteredFemtoCollisionsWithTags = o2::soa::Filtered; + // opt-in: carries both FColLabels and FColTags, for the processXxxMixedEventMcWithTagging + // functions below -- same collisionFilter auto-apply reasoning as FemtoCollisionsWithTags above. + using FemtoCollisionsWithLabelAndTags = o2::soa::Join; + using FilteredFemtoCollisionsWithLabelAndTags = o2::soa::Filtered; + o2::framework::SliceCache cache; // setup collisions @@ -118,6 +128,10 @@ struct FemtoPairV0V0 { o2::framework::Partition lambdaWithLabelPartition2 = MAKE_LAMBDA_PARTITION(confLambdaSelection2); o2::framework::Preslice perColLambdasWithLabel = o2::aod::femtobase::stored::fColId; + o2::framework::Partition lambdaWithFitVarsPartition1 = MAKE_LAMBDA_PARTITION(confLambdaSelection1); + o2::framework::Partition lambdaWithFitVarsPartition2 = MAKE_LAMBDA_PARTITION(confLambdaSelection2); + o2::framework::Preslice perColLambdasWithFitVars = o2::aod::femtobase::stored::fColId; + // setup k0shorts v0builder::ConfK0shortSelection1 confK0shortSelection1; v0builder::ConfK0shortSelection2 confK0shortSelection2; @@ -134,6 +148,10 @@ struct FemtoPairV0V0 { o2::framework::Partition k0shortWithLabelPartition2 = MAKE_K0SHORT_PARTITION(confK0shortSelection2); o2::framework::Preslice perColK0shortsWithLabel = o2::aod::femtobase::stored::fColId; + o2::framework::Partition k0shortWithFitVarsPartition1 = MAKE_K0SHORT_PARTITION(confK0shortSelection1); + o2::framework::Partition k0shortWithFitVarsPartition2 = MAKE_K0SHORT_PARTITION(confK0shortSelection2); + o2::framework::Preslice perColK0shortsWithFitVars = o2::aod::femtobase::stored::fColId; + // setup pairs pairhistmanager::ConfPairBinning confPairBinning; pairhistmanager::ConfPairCuts confPairCuts; @@ -228,55 +246,63 @@ struct FemtoPairV0V0 { bool processData = doprocessLambdaLambdaSameEvent || doprocessLambdaLambdaMixedEvent || doprocessLambdaLambdaMixedEventWithTagging || doprocessK0shortK0shortSameEvent || doprocessK0shortK0shortMixedEvent || doprocessK0shortK0shortMixedEventWithTagging || doprocessLambdaK0shortSameEvent || doprocessLambdaK0shortMixedEvent || doprocessLambdaK0shortMixedEventWithTagging; + bool processFitVars = doprocessLambdaLambdaSameEventWithFitVars || doprocessLambdaLambdaMixedEventWithFitVars || + doprocessK0shortK0shortSameEventWithFitVars || doprocessK0shortK0shortMixedEventWithFitVars || + doprocessLambdaK0shortSameEventWithFitVars || doprocessLambdaK0shortMixedEventWithFitVars; bool processMc = doprocessLambdaLambdaSameEventMc || doprocessLambdaLambdaMixedEventMc || doprocessK0shortK0shortSameEventMc || doprocessK0shortK0shortMixedEventMc || - doprocessLambdaK0shortSameEventMc || doprocessLambdaK0shortMixedEventMc; + doprocessLambdaK0shortSameEventMc || doprocessLambdaK0shortMixedEventMc || + doprocessLambdaLambdaMixedEventMcWithTagging || doprocessK0shortK0shortMixedEventMcWithTagging || doprocessLambdaK0shortMixedEventMcWithTagging; - if (processData && processMc) { - LOG(fatal) << "Both data and mc processing is enabled. Breaking..."; + if (static_cast(processData) + static_cast(processFitVars) + static_cast(processMc) > 1) { + LOG(fatal) << "More than one of data, FitVars or mc processing is activated. Breaking..."; } - if (!processData && !processMc) { - LOG(fatal) << "Neither data nor mc processing is enabled. Breaking..."; + if (!processData && !processFitVars && !processMc) { + LOG(fatal) << "None of data, FitVars or mc processing is activated. Breaking..."; } bool processLambdaLambda = doprocessLambdaLambdaSameEvent || doprocessLambdaLambdaMixedEvent || doprocessLambdaLambdaMixedEventWithTagging || - doprocessLambdaLambdaSameEventMc || doprocessLambdaLambdaMixedEventMc; + doprocessLambdaLambdaSameEventWithFitVars || doprocessLambdaLambdaMixedEventWithFitVars || + doprocessLambdaLambdaSameEventMc || doprocessLambdaLambdaMixedEventMc || doprocessLambdaLambdaMixedEventMcWithTagging; bool processK0shortK0short = doprocessK0shortK0shortSameEvent || doprocessK0shortK0shortMixedEvent || doprocessK0shortK0shortMixedEventWithTagging || - doprocessK0shortK0shortSameEventMc || doprocessK0shortK0shortMixedEventMc; + doprocessK0shortK0shortSameEventWithFitVars || doprocessK0shortK0shortMixedEventWithFitVars || + doprocessK0shortK0shortSameEventMc || doprocessK0shortK0shortMixedEventMc || doprocessK0shortK0shortMixedEventMcWithTagging; bool processLambdaK0short = doprocessLambdaK0shortSameEvent || doprocessLambdaK0shortMixedEvent || doprocessLambdaK0shortMixedEventWithTagging || - doprocessLambdaK0shortSameEventMc || doprocessLambdaK0shortMixedEventMc; + doprocessLambdaK0shortSameEventWithFitVars || doprocessLambdaK0shortMixedEventWithFitVars || + doprocessLambdaK0shortSameEventMc || doprocessLambdaK0shortMixedEventMc || doprocessLambdaK0shortMixedEventMcWithTagging; if (static_cast(processLambdaLambda) + static_cast(processK0shortK0short) + static_cast(processLambdaK0short) > 1) { LOG(fatal) << "Only one of lambda-lambda, k0short-k0short or lambda-k0short processing can be enabled. Breaking..."; } // Each pair type discovers its own tag bit independently (see Core/collisionTagger.h). - if (doprocessLambdaLambdaMixedEventWithTagging || doprocessK0shortK0shortMixedEventWithTagging || doprocessLambdaK0shortMixedEventWithTagging) { + if (doprocessLambdaLambdaMixedEventWithTagging || doprocessK0shortK0shortMixedEventWithTagging || doprocessLambdaK0shortMixedEventWithTagging || + doprocessLambdaLambdaMixedEventMcWithTagging || doprocessK0shortK0shortMixedEventMcWithTagging || doprocessLambdaK0shortMixedEventMcWithTagging) { auto const& workflows = context.services().get(); auto const& ownDevice = context.services().get(); auto roles = collisiontagger::discoverTaggedRoles(workflows); - if (doprocessLambdaLambdaMixedEventWithTagging) { + if (doprocessLambdaLambdaMixedEventWithTagging || doprocessLambdaLambdaMixedEventMcWithTagging) { int bit = collisiontagger::findOwnBit(roles, ownDevice.name, confTaggingLambdaLambda.Role); if (bit < 0) { - LOG(fatal) << "processLambdaLambdaMixedEventWithTagging is enabled, but no femto-collision-tagger device " + LOG(fatal) << "A processLambdaLambdaMixedEventWithTagging* function is enabled, but no femto-collision-tagger device " << "(with processV0V0 enabled) tagging this device (" << ownDevice.name << ") was found in this workflow."; } confTaggingLambdaLambda.internalTagMask.value = static_cast(1) << bit; LOG(info) << "Collision tagger bit for " << ownDevice.name << " (LambdaLambda): " << bit; } - if (doprocessK0shortK0shortMixedEventWithTagging) { + if (doprocessK0shortK0shortMixedEventWithTagging || doprocessK0shortK0shortMixedEventMcWithTagging) { int bit = collisiontagger::findOwnBit(roles, ownDevice.name, confTaggingK0shortK0short.Role); if (bit < 0) { - LOG(fatal) << "processK0shortK0shortMixedEventWithTagging is enabled, but no femto-collision-tagger device " + LOG(fatal) << "A processK0shortK0shortMixedEventWithTagging* function is enabled, but no femto-collision-tagger device " << "(with processV0V0 enabled) tagging this device (" << ownDevice.name << ") was found in this workflow."; } confTaggingK0shortK0short.internalTagMask.value = static_cast(1) << bit; LOG(info) << "Collision tagger bit for " << ownDevice.name << " (K0shortK0short): " << bit; } - if (doprocessLambdaK0shortMixedEventWithTagging) { + if (doprocessLambdaK0shortMixedEventWithTagging || doprocessLambdaK0shortMixedEventMcWithTagging) { int bit = collisiontagger::findOwnBit(roles, ownDevice.name, confTaggingLambdaK0short.Role); if (bit < 0) { - LOG(fatal) << "processLambdaK0shortMixedEventWithTagging is enabled, but no femto-collision-tagger device " + LOG(fatal) << "A processLambdaK0shortMixedEventWithTagging* function is enabled, but no femto-collision-tagger device " << "(with processV0V0 enabled) tagging this device (" << ownDevice.name << ") was found in this workflow."; } confTaggingLambdaK0short.internalTagMask.value = static_cast(1) << bit; @@ -305,7 +331,32 @@ struct FemtoPairV0V0 { std::map> cprHistSpecNeg = closepairrejection::makeCprHistSpecMap(confCprNeg); std::map> pairCleanerHistSpec = paircleaner::makePairCleanerHistSpecMap(confPairCleaner); - if (processData) { + if (processFitVars) { + colHistSpec = colhistmanager::makeColHistSpecMap(confCollisionBinning); + posDauSpec1 = trackhistmanager::makeTrackHistSpecMap(confV01PosDauBinning); + negDauSpec1 = trackhistmanager::makeTrackHistSpecMap(confV01NegDauBinning); + posDauSpec2 = trackhistmanager::makeTrackHistSpecMap(confV02PosDauBinning); + negDauSpec2 = trackhistmanager::makeTrackHistSpecMap(confV02NegDauBinning); + pairV0V0HistSpec = pairhistmanager::makePairHistSpecMap(confPairBinning, confMixing); + + if (processLambdaLambda) { + lambdaHistSpec1 = v0histmanager::makeV0HistSpecMap(confLambdaBinning1); + lambdaHistSpec2 = v0histmanager::makeV0HistSpecMap(confLambdaBinning2); + pairLambdaLambdaBuilder.init(&hRegistry, confCollisionBinning, confLambdaSelection1, confLambdaSelection2, confLambdaCleaner1, confLambdaCleaner2, confCprPos, confCprNeg, confMixing, confPairBinning, confPairCuts, colHistSpec, lambdaHistSpec1, lambdaHistSpec2, posDauSpec1, negDauSpec1, posDauSpec2, negDauSpec2, pairV0V0HistSpec, cprHistSpecPos, cprHistSpecNeg, pairCleanerHistSpec); + } + + if (processK0shortK0short) { + k0shortHistSpec1 = v0histmanager::makeV0HistSpecMap(confK0shortBinning1); + k0shortHistSpec2 = v0histmanager::makeV0HistSpecMap(confK0shortBinning2); + pairK0shortK0shortBuilder.init(&hRegistry, confCollisionBinning, confK0shortSelection1, confK0shortSelection2, confK0shortCleaner1, confK0shortCleaner2, confCprPos, confCprNeg, confMixing, confPairBinning, confPairCuts, colHistSpec, k0shortHistSpec1, k0shortHistSpec2, posDauSpec1, negDauSpec1, posDauSpec2, negDauSpec2, pairV0V0HistSpec, cprHistSpecPos, cprHistSpecNeg, pairCleanerHistSpec); + } + + if (processLambdaK0short) { + lambdaHistSpec1 = v0histmanager::makeV0HistSpecMap(confLambdaBinning1); + k0shortHistSpec2 = v0histmanager::makeV0HistSpecMap(confK0shortBinning2); + pairLambdaK0shortBuilder.init(&hRegistry, confCollisionBinning, confLambdaSelection1, confK0shortSelection2, confLambdaCleaner1, confK0shortCleaner2, confCprPos, confCprNeg, confMixing, confPairBinning, confPairCuts, colHistSpec, lambdaHistSpec1, k0shortHistSpec2, posDauSpec1, negDauSpec1, posDauSpec2, negDauSpec2, pairV0V0HistSpec, cprHistSpecPos, cprHistSpecNeg, pairCleanerHistSpec); + } + } else if (processData) { colHistSpec = colhistmanager::makeColHistSpecMap(confCollisionBinning); posDauSpec1 = trackhistmanager::makeTrackHistSpecMap(confV01PosDauBinning); negDauSpec1 = trackhistmanager::makeTrackHistSpecMap(confV01NegDauBinning); @@ -341,19 +392,19 @@ struct FemtoPairV0V0 { if (processLambdaLambda) { lambdaHistSpec1 = v0histmanager::makeV0McHistSpecMap(confLambdaBinning1); lambdaHistSpec2 = v0histmanager::makeV0McHistSpecMap(confLambdaBinning2); - pairLambdaLambdaBuilder.init(&hRegistry, confCollisionBinning, confLambdaSelection1, confLambdaSelection2, confLambdaCleaner1, confLambdaCleaner2, confCprPos, confCprNeg, confMixing, confPairBinning, confPairCuts, colHistSpec, lambdaHistSpec1, lambdaHistSpec2, posDauSpec1, negDauSpec1, posDauSpec2, negDauSpec2, pairV0V0HistSpec, cprHistSpecPos, cprHistSpecNeg, pairCleanerHistSpec); + pairLambdaLambdaBuilder.init(&hRegistry, confCollisionBinning, confLambdaSelection1, confLambdaSelection2, confLambdaCleaner1, confLambdaCleaner2, confCprPos, confCprNeg, confMixing, confPairBinning, confPairCuts, colHistSpec, lambdaHistSpec1, lambdaHistSpec2, posDauSpec1, negDauSpec1, posDauSpec2, negDauSpec2, pairV0V0HistSpec, cprHistSpecPos, cprHistSpecNeg, pairCleanerHistSpec); } if (processK0shortK0short) { k0shortHistSpec1 = v0histmanager::makeV0McHistSpecMap(confK0shortBinning1); k0shortHistSpec2 = v0histmanager::makeV0McHistSpecMap(confK0shortBinning2); - pairK0shortK0shortBuilder.init(&hRegistry, confCollisionBinning, confK0shortSelection1, confK0shortSelection2, confK0shortCleaner1, confK0shortCleaner2, confCprPos, confCprNeg, confMixing, confPairBinning, confPairCuts, colHistSpec, k0shortHistSpec1, k0shortHistSpec2, posDauSpec1, negDauSpec1, posDauSpec2, negDauSpec2, pairV0V0HistSpec, cprHistSpecPos, cprHistSpecNeg, pairCleanerHistSpec); + pairK0shortK0shortBuilder.init(&hRegistry, confCollisionBinning, confK0shortSelection1, confK0shortSelection2, confK0shortCleaner1, confK0shortCleaner2, confCprPos, confCprNeg, confMixing, confPairBinning, confPairCuts, colHistSpec, k0shortHistSpec1, k0shortHistSpec2, posDauSpec1, negDauSpec1, posDauSpec2, negDauSpec2, pairV0V0HistSpec, cprHistSpecPos, cprHistSpecNeg, pairCleanerHistSpec); } if (processLambdaK0short) { lambdaHistSpec1 = v0histmanager::makeV0McHistSpecMap(confLambdaBinning1); k0shortHistSpec2 = v0histmanager::makeV0McHistSpecMap(confK0shortBinning2); - pairLambdaK0shortBuilder.init(&hRegistry, confCollisionBinning, confLambdaSelection1, confK0shortSelection2, confLambdaCleaner1, confK0shortCleaner2, confCprPos, confCprNeg, confMixing, confPairBinning, confPairCuts, colHistSpec, lambdaHistSpec1, k0shortHistSpec2, posDauSpec1, negDauSpec1, posDauSpec2, negDauSpec2, pairV0V0HistSpec, cprHistSpecPos, cprHistSpecNeg, pairCleanerHistSpec); + pairLambdaK0shortBuilder.init(&hRegistry, confCollisionBinning, confLambdaSelection1, confK0shortSelection2, confLambdaCleaner1, confK0shortCleaner2, confCprPos, confCprNeg, confMixing, confPairBinning, confPairCuts, colHistSpec, lambdaHistSpec1, k0shortHistSpec2, posDauSpec1, negDauSpec1, posDauSpec2, negDauSpec2, pairV0V0HistSpec, cprHistSpecPos, cprHistSpecNeg, pairCleanerHistSpec); } } hRegistry.print(); @@ -367,7 +418,7 @@ struct FemtoPairV0V0 { void processLambdaLambdaSameEventMc(FilteredFemtoCollisionWithLabel const& col, o2::aod::FMcCols const& mcCols, FemtoTracksWithLabel const& tracks, FemtoLambdasWithLabel const& lambdas, FemtoMcParticlesWithLabel const& mcParticles, o2::aod::FMcMothers const& mcMothers, o2::aod::FMcPartMoths const& mcPartonicMothers) { - pairLambdaLambdaBuilder.processSameEvent(col, mcCols, tracks, lambdas, lambdaWithLabelPartition1, lambdaWithLabelPartition2, mcParticles, mcMothers, mcPartonicMothers, cache); + pairLambdaLambdaBuilder.processSameEvent(col, mcCols, tracks, lambdas, lambdaWithLabelPartition1, lambdaWithLabelPartition2, mcParticles, mcMothers, mcPartonicMothers, cache); } PROCESS_SWITCH(FemtoPairV0V0, processLambdaLambdaSameEventMc, "Enable processing same event processing for lambda-lambda with mc information", false); @@ -389,10 +440,32 @@ struct FemtoPairV0V0 { void processLambdaLambdaMixedEventMc(FilteredFemtoCollisionsWithLabel const& cols, o2::aod::FMcCols const& mcCols, FemtoTracksWithLabel const& tracks, FemtoLambdasWithLabel const& /*lambdas*/, FemtoMcParticlesWithLabel const& mcParticles, o2::aod::FMcMothers const& mcMothers, o2::aod::FMcPartMoths const& mcPartonicMothers) { - pairLambdaLambdaBuilder.processMixedEvent(cols, mcCols, tracks, lambdaWithLabelPartition1, lambdaWithLabelPartition2, mcParticles, mcMothers, mcPartonicMothers, cache, mixBinsVtxMult, mixBinsVtxCent, mixBinsVtxMultCent); + pairLambdaLambdaBuilder.processMixedEvent(cols, mcCols, tracks, lambdaWithLabelPartition1, lambdaWithLabelPartition2, mcParticles, mcMothers, mcPartonicMothers, cache, mixBinsVtxMult, mixBinsVtxCent, mixBinsVtxMultCent); } PROCESS_SWITCH(FemtoPairV0V0, processLambdaLambdaMixedEventMc, "Enable processing mixed event processing for lambda-lambda with mc information", false); + void processLambdaLambdaSameEventWithFitVars(FilteredFemtoCollision const& col, FemtoTracksWithFitVars const& tracks, FemtoLambdasWithFitVars const& lambdas) + { + pairLambdaLambdaBuilder.processSameEvent(col, tracks, lambdas, lambdaWithFitVarsPartition1, lambdaWithFitVarsPartition2, cache); + } + PROCESS_SWITCH(FemtoPairV0V0, processLambdaLambdaSameEventWithFitVars, "Enable processing same event processing for lambda-lambda, carrying through FitVars tables", false); + + void processLambdaLambdaMixedEventWithFitVars(FilteredFemtoCollisions const& cols, FemtoTracksWithFitVars const& tracks, FemtoLambdasWithFitVars const& /*lambdas*/) + { + pairLambdaLambdaBuilder.processMixedEvent(cols, tracks, lambdaWithFitVarsPartition1, lambdaWithFitVarsPartition2, cache, mixBinsVtxMult, mixBinsVtxCent, mixBinsVtxMultCent); + } + PROCESS_SWITCH(FemtoPairV0V0, processLambdaLambdaMixedEventWithFitVars, "Enable processing mixed event processing for lambda-lambda, carrying through FitVars tables", false); + + // Same tagging filter as processLambdaLambdaMixedEventWithTagging above, on a collision table + // that also carries FColLabels, and the MC-aware processMixedEvent overload (same as processLambdaLambdaMixedEventMc). + void processLambdaLambdaMixedEventMcWithTagging(FilteredFemtoCollisionsWithLabelAndTags const& cols, o2::aod::FMcCols const& mcCols, FemtoTracksWithLabel const& tracks, FemtoLambdasWithLabel const& /*lambdas*/, FemtoMcParticlesWithLabel const& mcParticles, o2::aod::FMcMothers const& mcMothers, o2::aod::FMcPartMoths const& mcPartonicMothers) + { + o2::framework::Partition taggedCollisions = ncheckbit(o2::aod::femtocollisions::collisionTag, confTaggingLambdaLambda.internalTagMask); + taggedCollisions.bindTable(cols); + pairLambdaLambdaBuilder.processMixedEvent(taggedCollisions, mcCols, tracks, lambdaWithLabelPartition1, lambdaWithLabelPartition2, mcParticles, mcMothers, mcPartonicMothers, cache, mixBinsVtxMult, mixBinsVtxCent, mixBinsVtxMultCent); + } + PROCESS_SWITCH(FemtoPairV0V0, processLambdaLambdaMixedEventMcWithTagging, "Enable processing mixed event processing for lambda-lambda, pre-filtered using the collision tagger, with mc information", false); + void processK0shortK0shortSameEvent(FilteredFemtoCollision const& col, FemtoTracks const& tracks, FemtoK0shorts const& k0shorts) { pairK0shortK0shortBuilder.processSameEvent(col, tracks, k0shorts, k0shortPartition1, k0shortPartition2, cache); @@ -401,7 +474,7 @@ struct FemtoPairV0V0 { void processK0shortK0shortSameEventMc(FilteredFemtoCollisionWithLabel const& col, o2::aod::FMcCols const& mcCols, FemtoTracksWithLabel const& tracks, FemtoK0shortsWithLabel const& k0shorts, FemtoMcParticlesWithLabel const& mcParticles, o2::aod::FMcMothers const& mcMothers, o2::aod::FMcPartMoths const& mcPartonicMothers) { - pairK0shortK0shortBuilder.processSameEvent(col, mcCols, tracks, k0shorts, k0shortWithLabelPartition1, k0shortWithLabelPartition2, mcParticles, mcMothers, mcPartonicMothers, cache); + pairK0shortK0shortBuilder.processSameEvent(col, mcCols, tracks, k0shorts, k0shortWithLabelPartition1, k0shortWithLabelPartition2, mcParticles, mcMothers, mcPartonicMothers, cache); } PROCESS_SWITCH(FemtoPairV0V0, processK0shortK0shortSameEventMc, "Enable processing same event processing for k0short-k0short with mc information", false); @@ -423,10 +496,32 @@ struct FemtoPairV0V0 { void processK0shortK0shortMixedEventMc(FilteredFemtoCollisionsWithLabel const& cols, o2::aod::FMcCols const& mcCols, FemtoTracksWithLabel const& tracks, FemtoK0shortsWithLabel const& /*k0shorts*/, FemtoMcParticlesWithLabel const& mcParticles, o2::aod::FMcMothers const& mcMothers, o2::aod::FMcPartMoths const& mcPartonicMothers) { - pairK0shortK0shortBuilder.processMixedEvent(cols, mcCols, tracks, k0shortWithLabelPartition1, k0shortWithLabelPartition2, mcParticles, mcMothers, mcPartonicMothers, cache, mixBinsVtxMult, mixBinsVtxCent, mixBinsVtxMultCent); + pairK0shortK0shortBuilder.processMixedEvent(cols, mcCols, tracks, k0shortWithLabelPartition1, k0shortWithLabelPartition2, mcParticles, mcMothers, mcPartonicMothers, cache, mixBinsVtxMult, mixBinsVtxCent, mixBinsVtxMultCent); } PROCESS_SWITCH(FemtoPairV0V0, processK0shortK0shortMixedEventMc, "Enable processing mixed event processing for k0short-k0short with mc information", false); + void processK0shortK0shortSameEventWithFitVars(FilteredFemtoCollision const& col, FemtoTracksWithFitVars const& tracks, FemtoK0shortsWithFitVars const& k0shorts) + { + pairK0shortK0shortBuilder.processSameEvent(col, tracks, k0shorts, k0shortWithFitVarsPartition1, k0shortWithFitVarsPartition2, cache); + } + PROCESS_SWITCH(FemtoPairV0V0, processK0shortK0shortSameEventWithFitVars, "Enable processing same event processing for k0short-k0short, carrying through FitVars tables", false); + + void processK0shortK0shortMixedEventWithFitVars(FilteredFemtoCollisions const& cols, FemtoTracksWithFitVars const& tracks, FemtoK0shortsWithFitVars const& /*k0shorts*/) + { + pairK0shortK0shortBuilder.processMixedEvent(cols, tracks, k0shortWithFitVarsPartition1, k0shortWithFitVarsPartition2, cache, mixBinsVtxMult, mixBinsVtxCent, mixBinsVtxMultCent); + } + PROCESS_SWITCH(FemtoPairV0V0, processK0shortK0shortMixedEventWithFitVars, "Enable processing mixed event processing for k0short-k0short, carrying through FitVars tables", false); + + // Same tagging filter as processK0shortK0shortMixedEventWithTagging above, on a collision table + // that also carries FColLabels, and the MC-aware processMixedEvent overload (same as processK0shortK0shortMixedEventMc). + void processK0shortK0shortMixedEventMcWithTagging(FilteredFemtoCollisionsWithLabelAndTags const& cols, o2::aod::FMcCols const& mcCols, FemtoTracksWithLabel const& tracks, FemtoK0shortsWithLabel const& /*k0shorts*/, FemtoMcParticlesWithLabel const& mcParticles, o2::aod::FMcMothers const& mcMothers, o2::aod::FMcPartMoths const& mcPartonicMothers) + { + o2::framework::Partition taggedCollisions = ncheckbit(o2::aod::femtocollisions::collisionTag, confTaggingK0shortK0short.internalTagMask); + taggedCollisions.bindTable(cols); + pairK0shortK0shortBuilder.processMixedEvent(taggedCollisions, mcCols, tracks, k0shortWithLabelPartition1, k0shortWithLabelPartition2, mcParticles, mcMothers, mcPartonicMothers, cache, mixBinsVtxMult, mixBinsVtxCent, mixBinsVtxMultCent); + } + PROCESS_SWITCH(FemtoPairV0V0, processK0shortK0shortMixedEventMcWithTagging, "Enable processing mixed event processing for k0short-k0short, pre-filtered using the collision tagger, with mc information", false); + void processLambdaK0shortSameEvent(FilteredFemtoCollision const& col, FemtoTracks const& tracks, FemtoLambdas const& lambdas, FemtoK0shorts const& /*k0shorts*/) { pairLambdaK0shortBuilder.processSameEvent(col, tracks, lambdas, lambdaPartition1, k0shortPartition2, cache); @@ -435,7 +530,7 @@ struct FemtoPairV0V0 { void processLambdaK0shortSameEventMc(FilteredFemtoCollisionWithLabel const& col, o2::aod::FMcCols const& mcCols, FemtoTracksWithLabel const& tracks, FemtoLambdasWithLabel const& lambdas, FemtoK0shortsWithLabel const& /*k0shorts*/, FemtoMcParticlesWithLabel const& mcParticles, o2::aod::FMcMothers const& mcMothers, o2::aod::FMcPartMoths const& mcPartonicMothers) { - pairLambdaK0shortBuilder.processSameEvent(col, mcCols, tracks, lambdas, lambdaWithLabelPartition1, k0shortWithLabelPartition2, mcParticles, mcMothers, mcPartonicMothers, cache); + pairLambdaK0shortBuilder.processSameEvent(col, mcCols, tracks, lambdas, lambdaWithLabelPartition1, k0shortWithLabelPartition2, mcParticles, mcMothers, mcPartonicMothers, cache); } PROCESS_SWITCH(FemtoPairV0V0, processLambdaK0shortSameEventMc, "Enable processing same event processing for lambda-k0short with mc information", false); @@ -457,9 +552,31 @@ struct FemtoPairV0V0 { void processLambdaK0shortMixedEventMc(FilteredFemtoCollisionsWithLabel const& cols, o2::aod::FMcCols const& mcCols, FemtoTracksWithLabel const& tracks, FemtoLambdasWithLabel const& /*lambdas*/, FemtoK0shortsWithLabel const& /*k0shorts*/, FemtoMcParticlesWithLabel const& mcParticles, o2::aod::FMcMothers const& mcMothers, o2::aod::FMcPartMoths const& mcPartonicMothers) { - pairLambdaK0shortBuilder.processMixedEvent(cols, mcCols, tracks, lambdaWithLabelPartition1, k0shortWithLabelPartition2, mcParticles, mcMothers, mcPartonicMothers, cache, mixBinsVtxMult, mixBinsVtxCent, mixBinsVtxMultCent); + pairLambdaK0shortBuilder.processMixedEvent(cols, mcCols, tracks, lambdaWithLabelPartition1, k0shortWithLabelPartition2, mcParticles, mcMothers, mcPartonicMothers, cache, mixBinsVtxMult, mixBinsVtxCent, mixBinsVtxMultCent); } PROCESS_SWITCH(FemtoPairV0V0, processLambdaK0shortMixedEventMc, "Enable processing mixed event processing for lambda-k0short with mc information", false); + + void processLambdaK0shortSameEventWithFitVars(FilteredFemtoCollision const& col, FemtoTracksWithFitVars const& tracks, FemtoLambdasWithFitVars const& lambdas, FemtoK0shortsWithFitVars const& /*k0shorts*/) + { + pairLambdaK0shortBuilder.processSameEvent(col, tracks, lambdas, lambdaWithFitVarsPartition1, k0shortWithFitVarsPartition2, cache); + } + PROCESS_SWITCH(FemtoPairV0V0, processLambdaK0shortSameEventWithFitVars, "Enable processing same event processing for lambda-k0short, carrying through FitVars tables", false); + + void processLambdaK0shortMixedEventWithFitVars(FilteredFemtoCollisions const& cols, FemtoTracksWithFitVars const& tracks, FemtoLambdasWithFitVars const& /*lambdas*/, FemtoK0shortsWithFitVars const& /*k0shorts*/) + { + pairLambdaK0shortBuilder.processMixedEvent(cols, tracks, lambdaWithFitVarsPartition1, k0shortWithFitVarsPartition2, cache, mixBinsVtxMult, mixBinsVtxCent, mixBinsVtxMultCent); + } + PROCESS_SWITCH(FemtoPairV0V0, processLambdaK0shortMixedEventWithFitVars, "Enable processing mixed event processing for lambda-k0short, carrying through FitVars tables", false); + + // Same tagging filter as processLambdaK0shortMixedEventWithTagging above, on a collision table + // that also carries FColLabels, and the MC-aware processMixedEvent overload (same as processLambdaK0shortMixedEventMc). + void processLambdaK0shortMixedEventMcWithTagging(FilteredFemtoCollisionsWithLabelAndTags const& cols, o2::aod::FMcCols const& mcCols, FemtoTracksWithLabel const& tracks, FemtoLambdasWithLabel const& /*lambdas*/, FemtoK0shortsWithLabel const& /*k0shorts*/, FemtoMcParticlesWithLabel const& mcParticles, o2::aod::FMcMothers const& mcMothers, o2::aod::FMcPartMoths const& mcPartonicMothers) + { + o2::framework::Partition taggedCollisions = ncheckbit(o2::aod::femtocollisions::collisionTag, confTaggingLambdaK0short.internalTagMask); + taggedCollisions.bindTable(cols); + pairLambdaK0shortBuilder.processMixedEvent(taggedCollisions, mcCols, tracks, lambdaWithLabelPartition1, k0shortWithLabelPartition2, mcParticles, mcMothers, mcPartonicMothers, cache, mixBinsVtxMult, mixBinsVtxCent, mixBinsVtxMultCent); + } + PROCESS_SWITCH(FemtoPairV0V0, processLambdaK0shortMixedEventMcWithTagging, "Enable processing mixed event processing for lambda-k0short, pre-filtered using the collision tagger, with mc information", false); }; o2::framework::WorkflowSpec defineDataProcessing(o2::framework::ConfigContext const& context)