Skip to content

Commit 6313c6c

Browse files
committed
Feat: wire FitVars into MC process functions
1 parent a301d38 commit 6313c6c

8 files changed

Lines changed: 467 additions & 64 deletions

File tree

‎PWGCF/Femto/Core/cascadeBuilder.h‎

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -863,6 +863,44 @@ class CascadeBuilderDerivedToDerived
863863
}
864864
}
865865

866+
/// Same as processXis, but also resolves the daughters' MC labels (via the
867+
/// MC-aware trackBuilder.getDaughterIndex overload) and writes the xi's own
868+
/// FXiLabels row. xiTable must be joined with FXiLabels upstream.
869+
template <typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9, typename T10, typename T11, typename T12, typename T13, typename T14>
870+
void processXisWithMc(T1 const& col, T2 const& /*xiTable*/, T3 const& oldTrackTable, T4& partitionXi, T5& trackBuilder, T6& cache, T7& newXiTable, T8& newTrackTable, T9& newCollisionTable,
871+
T10& mcBuilder, T11 const& mcCols, T12 const& mcParticles, T13 const& mcMothers, T14 const& mcPartonicMothers, auto& mcProducts)
872+
{
873+
if (mLimitXi == 0) { // xis disabled
874+
return;
875+
}
876+
877+
auto xiSlice = partitionXi->sliceByCached(o2::aod::femtobase::stored::fColId, col.globalIndex(), cache);
878+
879+
for (auto const& xi : xiSlice) {
880+
auto bachelor = oldTrackTable.rawIteratorAt(utils::daughterRow(xi.bachelorId(), oldTrackTable));
881+
auto posDaughter = oldTrackTable.rawIteratorAt(utils::daughterRow(xi.posDauId(), oldTrackTable));
882+
auto negDaughter = oldTrackTable.rawIteratorAt(utils::daughterRow(xi.negDauId(), oldTrackTable));
883+
884+
int64_t bachelorIndex = trackBuilder.getDaughterIndex(bachelor, newTrackTable, newCollisionTable, mcBuilder, mcCols, mcParticles, mcMothers, mcPartonicMothers, mcProducts);
885+
int64_t posDaughterIndex = trackBuilder.getDaughterIndex(posDaughter, newTrackTable, newCollisionTable, mcBuilder, mcCols, mcParticles, mcMothers, mcPartonicMothers, mcProducts);
886+
int64_t negDaughterIndex = trackBuilder.getDaughterIndex(negDaughter, newTrackTable, newCollisionTable, mcBuilder, mcCols, mcParticles, mcMothers, mcPartonicMothers, mcProducts);
887+
888+
newXiTable.producedXis(newCollisionTable.producedCollision.lastIndex(),
889+
xi.signedPt(),
890+
xi.eta(),
891+
xi.phi(),
892+
xi.mass(),
893+
bachelorIndex,
894+
posDaughterIndex,
895+
negDaughterIndex);
896+
newXiTable.producedXiMasks(xi.mask());
897+
if constexpr (utils::HasCascadeCosPa<decltype(xi)>) {
898+
newXiTable.producedXiFrac(xi.cascadeCosPa());
899+
}
900+
mcBuilder.fillXiWithLabel(xi, mcCols, mcParticles, mcMothers, mcPartonicMothers, mcProducts);
901+
}
902+
}
903+
866904
template <typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9>
867905
void processOmegas(T1 const& col, T2 const& /*omegaTable*/, T3 const& oldTrackTable, T4& partitionOmega, T5& trackBuilder, T6& cache, T7& newOmegaTable, T8& newTrackTable, T9& newCollisionTable)
868906
{

‎PWGCF/Femto/Core/mcBuilder.h‎

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -781,6 +781,8 @@ struct McBuilderDerivedToDerivedProducts : o2::framework::ProducesGroup {
781781
o2::framework::Produces<o2::aod::StoredFSigmaLabels> producedSigmaLabels;
782782
o2::framework::Produces<o2::aod::StoredFSigmaPlusLabels> producedSigmaPlusLabels;
783783
o2::framework::Produces<o2::aod::StoredFSigmaPlusPcmLabels> producedSigmaPlusPcmLabels;
784+
o2::framework::Produces<o2::aod::StoredFLambdaLabels> producedLambdaLabels;
785+
o2::framework::Produces<o2::aod::StoredFXiLabels> producedXiLabels;
784786
};
785787

786788
struct ConfMcTablesDerivedToDerived : o2::framework::ConfigurableGroup {
@@ -876,6 +878,32 @@ class McBuilderDerivedToDerived
876878
this->getOrCreateMcParticleRow(mcParticle, mcCols, mcMothers, mcPartonicMothers, mcProducts));
877879
}
878880

881+
/// Write one FLambdaLabels row. lambda must be joined with FLambdaLabels upstream.
882+
template <typename T1, typename T2, typename T3, typename T4, typename T5, typename T6>
883+
void fillLambdaWithLabel(T1 const& lambda, T2 const& mcCols, T3 const& /*mcParticles*/, T4 const& mcMothers, T5 const& mcPartonicMothers, T6& mcProducts)
884+
{
885+
if (!lambda.has_fMcParticle()) {
886+
mcProducts.producedLambdaLabels(-1);
887+
return;
888+
}
889+
auto mcParticle = lambda.template fMcParticle_as<T3>();
890+
mcProducts.producedLambdaLabels(
891+
this->getOrCreateMcParticleRow(mcParticle, mcCols, mcMothers, mcPartonicMothers, mcProducts));
892+
}
893+
894+
/// Write one FXiLabels row. xi must be joined with FXiLabels upstream.
895+
template <typename T1, typename T2, typename T3, typename T4, typename T5, typename T6>
896+
void fillXiWithLabel(T1 const& xi, T2 const& mcCols, T3 const& /*mcParticles*/, T4 const& mcMothers, T5 const& mcPartonicMothers, T6& mcProducts)
897+
{
898+
if (!xi.has_fMcParticle()) {
899+
mcProducts.producedXiLabels(-1);
900+
return;
901+
}
902+
auto mcParticle = xi.template fMcParticle_as<T3>();
903+
mcProducts.producedXiLabels(
904+
this->getOrCreateMcParticleRow(mcParticle, mcCols, mcMothers, mcPartonicMothers, mcProducts));
905+
}
906+
879907
template <typename T1, typename T2>
880908
void reset(T1 const& mcCols, T2 const& mcParticles)
881909
{

‎PWGCF/Femto/Core/v0Builder.h‎

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -870,6 +870,41 @@ class V0BuilderDerivedToDerived
870870
}
871871
}
872872

873+
/// Same as processLambdas, but also resolves the daughters' MC labels (via the
874+
/// MC-aware trackBuilder.getDaughterIndex overload) and writes the lambda's own
875+
/// FLambdaLabels row. lambdaTable must be joined with FLambdaLabels upstream.
876+
template <typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9, typename T10, typename T11, typename T12, typename T13, typename T14>
877+
void processLambdasWithMc(T1 const& col, T2 const& /*lambdaTable*/, T3 const& oldTrackTable, T4& partitionLambda, T5& trackBuilder, T6& cache, T7& newLambdaTable, T8& newTrackTable, T9& newCollisionTable,
878+
T10& mcBuilder, T11 const& mcCols, T12 const& mcParticles, T13 const& mcMothers, T14 const& mcPartonicMothers, auto& mcProducts)
879+
{
880+
if (mLimitLambda == 0) { // lambdas disabled
881+
return;
882+
}
883+
884+
auto lambdaSlice = partitionLambda->sliceByCached(o2::aod::femtobase::stored::fColId, col.globalIndex(), cache);
885+
886+
for (auto const& lambda : lambdaSlice) {
887+
auto posDaughter = oldTrackTable.rawIteratorAt(utils::daughterRow(lambda.posDauId(), oldTrackTable));
888+
auto negDaughter = oldTrackTable.rawIteratorAt(utils::daughterRow(lambda.negDauId(), oldTrackTable));
889+
890+
int64_t posDaughterIndex = trackBuilder.getDaughterIndex(posDaughter, newTrackTable, newCollisionTable, mcBuilder, mcCols, mcParticles, mcMothers, mcPartonicMothers, mcProducts);
891+
int64_t negDaughterIndex = trackBuilder.getDaughterIndex(negDaughter, newTrackTable, newCollisionTable, mcBuilder, mcCols, mcParticles, mcMothers, mcPartonicMothers, mcProducts);
892+
893+
newLambdaTable.producedLambdas(newCollisionTable.producedCollision.lastIndex(),
894+
lambda.signedPt(),
895+
lambda.eta(),
896+
lambda.phi(),
897+
lambda.mass(),
898+
posDaughterIndex,
899+
negDaughterIndex);
900+
newLambdaTable.producedLambdaMasks(lambda.mask());
901+
if constexpr (utils::HasCosPa<decltype(lambda)>) {
902+
newLambdaTable.producedLambdaFrac(lambda.cosPa());
903+
}
904+
mcBuilder.fillLambdaWithLabel(lambda, mcCols, mcParticles, mcMothers, mcPartonicMothers, mcProducts);
905+
}
906+
}
907+
873908
template <typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9>
874909
void processK0shorts(T1 const& col, T2 const& /*k0shortTable*/, T3 const& oldTrackTable, T4& partitionK0short, T5& trackBuilder, T6& cache, T7& newK0shortTable, T8& newTrackTable, T9& newCollisionTable)
875910
{

0 commit comments

Comments
 (0)