Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 52 additions & 0 deletions PWGCF/Femto/Core/kinkBuilder.h
Original file line number Diff line number Diff line change
Expand Up @@ -821,6 +821,58 @@ class KinkBuilderDerivedToDerived
}
}

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, typename T15>
void processSigmaWithMc(T1 const& col, T2 const& /*sigmaTable*/, T3 const& oldTrackTable, T4& partitionSigma, T5& trackBuilder, T6& cache, T7& newSigmaTable, T8& newTrackTable, T9& newCollisionTable,
T10& mcBuilder, T11 const& mcCols, T12 const& mcParticles, T13 const& mcMothers, T14 const& mcPartonicMothers, T15& mcProducts)
{
if (mLimitSigma == 0) {
return;
}

auto sigmaSlice = partitionSigma->sliceByCached(o2::aod::femtobase::stored::fColId, col.globalIndex(), cache);

for (auto const& sigma : sigmaSlice) {
auto chaDaughter = oldTrackTable.rawIteratorAt(utils::daughterRow(sigma.chaDauId(), oldTrackTable));

int64_t chaDaughterIndex = trackBuilder.getDaughterIndex(chaDaughter, newTrackTable, newCollisionTable, mcBuilder, mcCols, mcParticles, mcMothers, mcPartonicMothers, mcProducts);

newSigmaTable.producedSigmas(newCollisionTable.producedCollision.lastIndex(),
sigma.signedPt(),
sigma.eta(),
sigma.phi(),
sigma.mass(),
chaDaughterIndex);
newSigmaTable.producedSigmaMasks(sigma.mask());
mcBuilder.fillSigmaWithLabel(sigma, mcCols, mcParticles, mcMothers, mcPartonicMothers, mcProducts);
}
}

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, typename T15>
void processSigmaPlusWithMc(T1 const& col, T2 const& /*sigmaPlusTable*/, T3 const& oldTrackTable, T4& partitionSigmaPlus, T5& trackBuilder, T6& cache, T7& newSigmaPlusTable, T8& newTrackTable, T9& newCollisionTable,
T10& mcBuilder, T11 const& mcCols, T12 const& mcParticles, T13 const& mcMothers, T14 const& mcPartonicMothers, T15& mcProducts)
{
if (mLimitSigmaPlus == 0) {
return;
}

auto sigmaPlusSlice = partitionSigmaPlus->sliceByCached(o2::aod::femtobase::stored::fColId, col.globalIndex(), cache);

for (auto const& sigmaPlus : sigmaPlusSlice) {
auto chaDaughter = oldTrackTable.rawIteratorAt(utils::daughterRow(sigmaPlus.chaDauId(), oldTrackTable));

int64_t chaDaughterIndex = trackBuilder.getDaughterIndex(chaDaughter, newTrackTable, newCollisionTable, mcBuilder, mcCols, mcParticles, mcMothers, mcPartonicMothers, mcProducts);

newSigmaPlusTable.producedSigmaPluses(newCollisionTable.producedCollision.lastIndex(),
sigmaPlus.signedPt(),
sigmaPlus.eta(),
sigmaPlus.phi(),
sigmaPlus.mass(),
chaDaughterIndex);
newSigmaPlusTable.producedSigmaPlusMasks(sigmaPlus.mask());
mcBuilder.fillSigmaPlusWithLabel(sigmaPlus, mcCols, mcParticles, mcMothers, mcPartonicMothers, mcProducts);
}
}

private:
int mLimitSigma = 0;
int mLimitSigmaPlus = 0;
Expand Down
26 changes: 26 additions & 0 deletions PWGCF/Femto/Core/mcBuilder.h
Original file line number Diff line number Diff line change
Expand Up @@ -765,6 +765,8 @@ struct McBuilderDerivedToDerivedProducts : o2::framework::ProducesGroup {

o2::framework::Produces<o2::aod::StoredFColLabels> producedCollisionLabels;
o2::framework::Produces<o2::aod::StoredFTrackLabels> producedTrackLabels;
o2::framework::Produces<o2::aod::StoredFSigmaLabels> producedSigmaLabels;
o2::framework::Produces<o2::aod::StoredFSigmaPlusLabels> producedSigmaPlusLabels;
};

struct ConfMcTablesDerivedToDerived : o2::framework::ConfigurableGroup {
Expand Down Expand Up @@ -824,6 +826,30 @@ class McBuilderDerivedToDerived
this->getOrCreateMcParticleRow(mcParticle, mcCols, mcMothers, mcPartonicMothers, mcProducts));
}

template <typename T1, typename T2, typename T3, typename T4, typename T5, typename T6>
void fillSigmaWithLabel(T1 const& sigma, T2 const& mcCols, T3 const& /*mcParticles*/, T4 const& mcMothers, T5 const& mcPartonicMothers, T6& mcProducts)
{
if (!sigma.has_fMcParticle()) {
mcProducts.producedSigmaLabels(-1);
return;
}
auto mcParticle = sigma.template fMcParticle_as<T3>();
mcProducts.producedSigmaLabels(
this->getOrCreateMcParticleRow(mcParticle, mcCols, mcMothers, mcPartonicMothers, mcProducts));
}

template <typename T1, typename T2, typename T3, typename T4, typename T5, typename T6>
void fillSigmaPlusWithLabel(T1 const& sigmaPlus, T2 const& mcCols, T3 const& /*mcParticles*/, T4 const& mcMothers, T5 const& mcPartonicMothers, T6& mcProducts)
{
if (!sigmaPlus.has_fMcParticle()) {
mcProducts.producedSigmaPlusLabels(-1);
return;
}
auto mcParticle = sigmaPlus.template fMcParticle_as<T3>();
mcProducts.producedSigmaPlusLabels(
this->getOrCreateMcParticleRow(mcParticle, mcCols, mcMothers, mcPartonicMothers, mcProducts));
}

template <typename T1, typename T2>
void reset(T1 const& mcCols, T2 const& mcParticles)
{
Expand Down
7 changes: 7 additions & 0 deletions PWGCF/Femto/Core/trackBuilder.h
Original file line number Diff line number Diff line change
Expand Up @@ -984,6 +984,13 @@ class TrackBuilderDerivedToDerived
return this->fillTrack(daughter, trackProducts, collisionProducts);
}

template <typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9>
int64_t getDaughterIndex(const T1& daughter, T2& trackProducts, T3& collisionProducts,
T4& mcBuilder, T5 const& mcCols, T6 const& mcParticles, T7 const& mcMothers, T8 const& mcPartonicMothers, T9& mcProducts)
{
return this->fillTrackWithMcLabel(daughter, trackProducts, collisionProducts, mcBuilder, mcCols, mcParticles, mcMothers, mcPartonicMothers, mcProducts);
}

template <typename T>
void reset(T const& tracks)
{
Expand Down
63 changes: 62 additions & 1 deletion PWGCF/Femto/TableProducer/femtoProducerDerivedToDerived.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@ struct FemtoProducerDerivedToDerived {
using FemtoSigmaPlus = o2::soa::Join<o2::aod::FSigmaPlus, o2::aod::FSigmaPlusMasks>;

using FemtoMcTracks = o2::soa::Join<FemtoTracks, o2::aod::FTrackLabels>;
using FemtoMcSigma = o2::soa::Join<FemtoSigma, o2::aod::FSigmaLabels>;
using FemtoMcSigmaPlus = o2::soa::Join<FemtoSigmaPlus, o2::aod::FSigmaPlusLabels>;
using FemtoMcParticles = o2::soa::Join<o2::aod::FMcParticles, o2::aod::FMcMotherLabels>;

o2::framework::SliceCache cache;
Expand Down Expand Up @@ -126,6 +128,12 @@ struct FemtoProducerDerivedToDerived {
o2::framework::Partition<FemtoMcTracks> mcTrackPartition2 = MAKE_TRACK_PARTITION(trackSelections2);
o2::framework::Preslice<FemtoMcTracks> perColMcTracks = o2::aod::femtobase::stored::fColId;

o2::framework::Partition<FemtoMcSigma> mcSigmaPartition = MAKE_SIGMA_PARTITION(sigmaSelection1);
o2::framework::Preslice<FemtoMcSigma> perColMcSigma = o2::aod::femtobase::stored::fColId;

o2::framework::Partition<FemtoMcSigmaPlus> mcSigmaPlusPartition = MAKE_SIGMAPLUS_PARTITION(sigmaPlusSelection1);
o2::framework::Preslice<FemtoMcSigmaPlus> perColMcSigmaPlus = o2::aod::femtobase::stored::fColId;

void init(o2::framework::InitContext& /*context*/)
{
const int activeProcesses =
Expand All @@ -135,7 +143,8 @@ struct FemtoProducerDerivedToDerived {
static_cast<int>(doprocessTracksXis) + static_cast<int>(doprocessTracksOmegas) +
static_cast<int>(doprocessTracksK0shorts) + static_cast<int>(doprocessTracksSigma) +
static_cast<int>(doprocessTracksSigmaPlus) +
static_cast<int>(doprocessTracksMc);
static_cast<int>(doprocessTracksMc) + static_cast<int>(doprocessTracksSigmaMc) +
static_cast<int>(doprocessTracksSigmaPlusMc);
if (activeProcesses != 1) {
LOG(fatal) << "Exactly one process function must be activated (got " << activeProcesses << ").";
}
Expand Down Expand Up @@ -293,6 +302,58 @@ struct FemtoProducerDerivedToDerived {
}
}
PROCESS_SWITCH(FemtoProducerDerivedToDerived, processTracksMc, "Process tracks with MC information", false);

void processTracksSigmaMc(FilteredFemtoMcCollisions const& cols,
FemtoMcTracks const& tracks,
FemtoMcSigma const& sigma,
o2::aod::FMcCols const& mcCols,
FemtoMcParticles const& mcParticles,
o2::aod::FMcMothers const& mcMothers,
o2::aod::FMcPartMoths const& mcPartonicMothers)
{
mcBuilder.reset(mcCols, mcParticles);

for (auto const& col : cols) {
if (trackBuilder.collisionHasTooFewTracks(col, tracks, mcTrackPartition1, mcTrackPartition2, cache) || kinkBuilder.collisionHasTooFewSigma(col, sigma, mcSigmaPartition, cache)) {
continue;
}
trackBuilder.reset(tracks);
collisionBuilder.processCollision(col, collisionBuilderProducts);
mcBuilder.fillCollisionWithLabel(col, mcCols, mcBuilderProducts);
trackBuilder.processTracksWithMc(col, tracks, mcTrackPartition1, mcTrackPartition2, cache,
trackBuilderProducts, collisionBuilderProducts,
mcBuilder, mcCols, mcParticles, mcMothers, mcPartonicMothers, mcBuilderProducts);
kinkBuilder.processSigmaWithMc(col, sigma, tracks, mcSigmaPartition, trackBuilder, cache, kinkBuilderProducts, trackBuilderProducts, collisionBuilderProducts,
mcBuilder, mcCols, mcParticles, mcMothers, mcPartonicMothers, mcBuilderProducts);
}
}
PROCESS_SWITCH(FemtoProducerDerivedToDerived, processTracksSigmaMc, "Process sigma and tracks with MC information", false);

void processTracksSigmaPlusMc(FilteredFemtoMcCollisions const& cols,
FemtoMcTracks const& tracks,
FemtoMcSigmaPlus const& sigmaplus,
o2::aod::FMcCols const& mcCols,
FemtoMcParticles const& mcParticles,
o2::aod::FMcMothers const& mcMothers,
o2::aod::FMcPartMoths const& mcPartonicMothers)
{
mcBuilder.reset(mcCols, mcParticles);

for (auto const& col : cols) {
if (trackBuilder.collisionHasTooFewTracks(col, tracks, mcTrackPartition1, mcTrackPartition2, cache) || kinkBuilder.collisionHasTooFewSigmaPlus(col, sigmaplus, mcSigmaPlusPartition, cache)) {
continue;
}
trackBuilder.reset(tracks);
collisionBuilder.processCollision(col, collisionBuilderProducts);
mcBuilder.fillCollisionWithLabel(col, mcCols, mcBuilderProducts);
trackBuilder.processTracksWithMc(col, tracks, mcTrackPartition1, mcTrackPartition2, cache,
trackBuilderProducts, collisionBuilderProducts,
mcBuilder, mcCols, mcParticles, mcMothers, mcPartonicMothers, mcBuilderProducts);
kinkBuilder.processSigmaPlusWithMc(col, sigmaplus, tracks, mcSigmaPlusPartition, trackBuilder, cache, kinkBuilderProducts, trackBuilderProducts, collisionBuilderProducts,
mcBuilder, mcCols, mcParticles, mcMothers, mcPartonicMothers, mcBuilderProducts);
}
}
PROCESS_SWITCH(FemtoProducerDerivedToDerived, processTracksSigmaPlusMc, "Process sigmaPlus and tracks with MC information", false);
};

o2::framework::WorkflowSpec defineDataProcessing(o2::framework::ConfigContext const& context)
Expand Down
Loading