Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[PWGCF] FemtoUniverse: Adding process functions for cent. and mult. mixing #9515

Merged
merged 6 commits into from
Jan 24, 2025
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@
Configurable<float> ConfV0MHigh{"ConfV0MHigh", 25000.0, "Upper limit for V0M multiplicity"};
Configurable<int> ConfTPCOccupancyLow{"ConfTPCOccupancyLow", 0, "Lower limit for TPC occupancy"};
Configurable<int> ConfTPCOccupancyHigh{"ConfTPCOccupancyHigh", 500, "Higher limit for TPC occupancy"};
Configurable<bool> ConfIsCent{"ConfIsCent", true, "Condition to choose centrality of multiplicity for mixing"};

Filter collfilter = (o2::aod::femtouniversecollision::multV0M > ConfV0MLow) && (o2::aod::femtouniversecollision::multV0M < ConfV0MHigh) &&
(o2::aod::femtouniversecollision::occupancy > ConfTPCOccupancyLow) && (o2::aod::femtouniversecollision::occupancy < ConfTPCOccupancyHigh);
Expand All @@ -153,7 +154,8 @@
ConfigurableAxis ConfmTBins3D{"ConfmTBins3D", {VARIABLE_WIDTH, 1.02f, 1.14f, 1.20f, 1.26f, 1.38f, 1.56f, 1.86f, 4.50f}, "mT Binning for the 3Dimensional plot: k* vs multiplicity vs mT (set <<twotracksconfigs.ConfUse3D>> to true in order to use)"};
ConfigurableAxis ConfmultBins3D{"ConfmultBins3D", {VARIABLE_WIDTH, 0.0f, 20.0f, 30.0f, 40.0f, 99999.0f}, "multiplicity Binning for the 3Dimensional plot: k* vs multiplicity vs mT (set <<twotracksconfigs.ConfUse3D>> to true in order to use)"};

ColumnBinningPolicy<aod::collision::PosZ, aod::femtouniversecollision::MultV0M> colBinning{{ConfVtxBins, ConfMultBins}, true};
ColumnBinningPolicy<aod::collision::PosZ, aod::femtouniversecollision::MultV0M> colBinningCent{{ConfVtxBins, ConfMultBins}, true};
ColumnBinningPolicy<aod::collision::PosZ, aod::femtouniversecollision::MultNtr> colBinningNtr{{ConfVtxBins, ConfMultBins}, true};

ConfigurableAxis ConfkstarBins{"ConfkstarBins", {300, -1.5, 1.5}, "binning kstar"};
ConfigurableAxis ConfkTBins{"ConfkTBins", {150, 0., 9.}, "binning kT"};
Expand Down Expand Up @@ -416,9 +418,13 @@
}

template <typename CollisionType>
void fillCollision(CollisionType col)
void fillCollision(CollisionType col, bool IsCent)
{
MixQaRegistry.fill(HIST("MixingQA/hSECollisionBins"), colBinning.getBin({col.posZ(), col.multV0M()}));
if (IsCent) {
MixQaRegistry.fill(HIST("MixingQA/hSECollisionBins"), colBinningCent.getBin({col.posZ(), col.multV0M()}));
} else {
MixQaRegistry.fill(HIST("MixingQA/hSECollisionBins"), colBinningNtr.getBin({col.posZ(), col.multNtr()}));
}
eventHisto.fillQA(col);
}

Expand All @@ -438,7 +444,7 @@

/// Histogramming same event
if ((ContType == 1 || ContType == 2) && fillQA) {
for (auto& part : groupPartsOne) {
for (const auto& part : groupPartsOne) {
if (!IsParticleNSigma((int8_t)1, part.p(), trackCuts.getNsigmaTPC(part, o2::track::PID::Proton), trackCuts.getNsigmaTOF(part, o2::track::PID::Proton), trackCuts.getNsigmaTPC(part, o2::track::PID::Pion), trackCuts.getNsigmaTOF(part, o2::track::PID::Pion), trackCuts.getNsigmaTPC(part, o2::track::PID::Kaon), trackCuts.getNsigmaTOF(part, o2::track::PID::Kaon))) {
continue;
}
Expand All @@ -447,7 +453,7 @@
}

if ((ContType == 1 || ContType == 3) && fillQA) {
for (auto& part : groupPartsTwo) {
for (const auto& part : groupPartsTwo) {
if (!IsParticleNSigma((int8_t)2, part.p(), trackCuts.getNsigmaTPC(part, o2::track::PID::Proton), trackCuts.getNsigmaTOF(part, o2::track::PID::Proton), trackCuts.getNsigmaTPC(part, o2::track::PID::Pion), trackCuts.getNsigmaTOF(part, o2::track::PID::Pion), trackCuts.getNsigmaTPC(part, o2::track::PID::Kaon), trackCuts.getNsigmaTOF(part, o2::track::PID::Kaon))) {
continue;
}
Expand All @@ -458,7 +464,7 @@
if (ContType == 1) {

/// Now build the combinations for non-identical particle pairs
for (auto& [p1, p2] : combinations(CombinationsFullIndexPolicy(groupPartsOne, groupPartsTwo))) {
for (const auto& [p1, p2] : combinations(CombinationsFullIndexPolicy(groupPartsOne, groupPartsTwo))) {

if (!IsParticleNSigma((int8_t)1, p1.p(), trackCuts.getNsigmaTPC(p1, o2::track::PID::Proton), trackCuts.getNsigmaTOF(p1, o2::track::PID::Proton), trackCuts.getNsigmaTPC(p1, o2::track::PID::Pion), trackCuts.getNsigmaTOF(p1, o2::track::PID::Pion), trackCuts.getNsigmaTPC(p1, o2::track::PID::Kaon), trackCuts.getNsigmaTOF(p1, o2::track::PID::Kaon))) {
continue;
Expand Down Expand Up @@ -491,7 +497,7 @@
} else {
/// Now build the combinations for identical particles pairs
double rand;
for (auto& [p1, p2] : combinations(CombinationsStrictlyUpperIndexPolicy(groupPartsOne, groupPartsOne))) {
for (const auto& [p1, p2] : combinations(CombinationsStrictlyUpperIndexPolicy(groupPartsOne, groupPartsOne))) {

if (!IsParticleNSigma((int8_t)2, p1.p(), trackCuts.getNsigmaTPC(p1, o2::track::PID::Proton), trackCuts.getNsigmaTOF(p1, o2::track::PID::Proton), trackCuts.getNsigmaTPC(p1, o2::track::PID::Pion), trackCuts.getNsigmaTOF(p1, o2::track::PID::Pion), trackCuts.getNsigmaTPC(p1, o2::track::PID::Kaon), trackCuts.getNsigmaTOF(p1, o2::track::PID::Kaon))) {
continue;
Expand Down Expand Up @@ -569,9 +575,9 @@
/// \param col subscribe to the collision table (Data)
/// \param parts subscribe to the femtoUniverseParticleTable
void processSameEvent(FilteredFDCollision& col,
FilteredFemtoFullParticles& parts)

Check warning on line 578 in PWGCF/FemtoUniverse/Tasks/femtoUniversePairTaskTrackTrack3DMultKtExtended.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[const-ref-in-process]

Argument FilteredFDCollision& col is not const&.

Check warning on line 578 in PWGCF/FemtoUniverse/Tasks/femtoUniversePairTaskTrackTrack3DMultKtExtended.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[const-ref-in-process]

Argument FilteredFemtoFullParticles& parts is not const&.
{
fillCollision(col);
fillCollision(col, ConfIsCent);

auto thegroupPartsOne = partsOne->sliceByCached(aod::femtouniverseparticle::fdCollisionId, col.globalIndex(), cache);
auto thegroupPartsTwo = partsTwo->sliceByCached(aod::femtouniverseparticle::fdCollisionId, col.globalIndex(), cache);
Expand Down Expand Up @@ -600,9 +606,9 @@
/// \param FemtoUniverseMCParticles subscribe to the Monte Carlo truth table
void processSameEventMC(o2::aod::FdCollision& col,
soa::Join<FilteredFemtoFullParticles, aod::FDMCLabels>& parts,
o2::aod::FdMCParticles&)

Check warning on line 609 in PWGCF/FemtoUniverse/Tasks/femtoUniversePairTaskTrackTrack3DMultKtExtended.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[const-ref-in-process]

Argument o2::aod::FdCollision& col is not const&.

Check warning on line 609 in PWGCF/FemtoUniverse/Tasks/femtoUniversePairTaskTrackTrack3DMultKtExtended.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[const-ref-in-process]

Argument soa::Join<FilteredFemtoFullParticles__aod::FDMCLabels>& parts is not const&.

Check warning on line 609 in PWGCF/FemtoUniverse/Tasks/femtoUniversePairTaskTrackTrack3DMultKtExtended.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[const-ref-in-process]

Argument o2::aod::FdMCParticles& is not const&.
{
fillCollision(col);
fillCollision(col, ConfIsCent);

auto thegroupPartsOne = partsOneMC->sliceByCached(aod::femtouniverseparticle::fdCollisionId, col.globalIndex(), cache);
auto thegroupPartsTwo = partsTwoMC->sliceByCached(aod::femtouniverseparticle::fdCollisionId, col.globalIndex(), cache);
Expand Down Expand Up @@ -639,7 +645,7 @@
void doMixedEvent(PartitionType groupPartsOne, PartitionType groupPartsTwo, PartType parts, float magFieldTesla, int multCol, int ContType)
{

for (auto& [p1, p2] : combinations(CombinationsFullIndexPolicy(groupPartsOne, groupPartsTwo))) {
for (const auto& [p1, p2] : combinations(CombinationsFullIndexPolicy(groupPartsOne, groupPartsTwo))) {

if (!IsParticleNSigma((int8_t)2, p1.p(), trackCuts.getNsigmaTPC(p1, o2::track::PID::Proton), trackCuts.getNsigmaTOF(p1, o2::track::PID::Proton), trackCuts.getNsigmaTPC(p1, o2::track::PID::Pion), trackCuts.getNsigmaTOF(p1, o2::track::PID::Pion), trackCuts.getNsigmaTPC(p1, o2::track::PID::Kaon), trackCuts.getNsigmaTOF(p1, o2::track::PID::Kaon))) {
continue;
Expand Down Expand Up @@ -730,15 +736,15 @@
/// process function for to call doMixedEvent with Data
/// @param cols subscribe to the collisions table (Data)
/// @param parts subscribe to the femtoUniverseParticleTable
void processMixedEvent(FilteredFDCollisions& cols,
FilteredFemtoFullParticles& parts)
void processMixedEventCent(FilteredFDCollisions& cols,
FilteredFemtoFullParticles& parts)

Check warning on line 740 in PWGCF/FemtoUniverse/Tasks/femtoUniversePairTaskTrackTrack3DMultKtExtended.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[const-ref-in-process]

Argument FilteredFDCollisions& cols is not const&.

Check warning on line 740 in PWGCF/FemtoUniverse/Tasks/femtoUniversePairTaskTrackTrack3DMultKtExtended.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[const-ref-in-process]

Argument FilteredFemtoFullParticles& parts is not const&.
{
randgen = new TRandom2(0);

for (auto& [collision1, collision2] : soa::selfCombinations(colBinning, ConfNEventsMix, -1, cols, cols)) {
for (const auto& [collision1, collision2] : soa::selfCombinations(colBinningCent, ConfNEventsMix, -1, cols, cols)) {

const int multiplicityCol = collision1.multV0M();
MixQaRegistry.fill(HIST("MixingQA/hMECollisionBins"), colBinning.getBin({collision1.posZ(), multiplicityCol}));
MixQaRegistry.fill(HIST("MixingQA/hMECollisionBins"), colBinningCent.getBin({collision1.posZ(), multiplicityCol}));

const auto& magFieldTesla1 = collision1.magField();
const auto& magFieldTesla2 = collision2.magField();
Expand All @@ -765,22 +771,106 @@
}
delete randgen;
}
PROCESS_SWITCH(femtoUniversePairTaskTrackTrack3DMultKtExtended, processMixedEvent, "Enable processing mixed events", true);
PROCESS_SWITCH(femtoUniversePairTaskTrackTrack3DMultKtExtended, processMixedEventCent, "Enable processing mixed events", true);

/// brief process function for to call doMixedEvent with Monte Carlo
/// @param cols subscribe to the collisions table (Monte Carlo Reconstructed reconstructed)
/// @param parts subscribe to joined table FemtoUniverseParticles and FemtoUniverseMCLables to access Monte Carlo truth
/// @param FemtoUniverseMCParticles subscribe to the Monte Carlo truth table
void processMixedEventMC(o2::aod::FdCollisions& cols,
soa::Join<FilteredFemtoFullParticles, aod::FDMCLabels>& parts,
o2::aod::FdMCParticles&)
void processMixedEventMCCent(o2::aod::FdCollisions& cols,
soa::Join<FilteredFemtoFullParticles, aod::FDMCLabels>& parts,
o2::aod::FdMCParticles&)

Check warning on line 782 in PWGCF/FemtoUniverse/Tasks/femtoUniversePairTaskTrackTrack3DMultKtExtended.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[const-ref-in-process]

Argument o2::aod::FdCollisions& cols is not const&.

Check warning on line 782 in PWGCF/FemtoUniverse/Tasks/femtoUniversePairTaskTrackTrack3DMultKtExtended.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[const-ref-in-process]

Argument soa::Join<FilteredFemtoFullParticles__aod::FDMCLabels>& parts is not const&.

Check warning on line 782 in PWGCF/FemtoUniverse/Tasks/femtoUniversePairTaskTrackTrack3DMultKtExtended.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[const-ref-in-process]

Argument o2::aod::FdMCParticles& is not const&.
{
randgen = new TRandom2(0);

for (auto& [collision1, collision2] : soa::selfCombinations(colBinning, ConfNEventsMix, -1, cols, cols)) {
for (const auto& [collision1, collision2] : soa::selfCombinations(colBinningCent, ConfNEventsMix, -1, cols, cols)) {

const int multiplicityCol = collision1.multV0M();
MixQaRegistry.fill(HIST("MixingQA/hMECollisionBins"), colBinning.getBin({collision1.posZ(), multiplicityCol}));
MixQaRegistry.fill(HIST("MixingQA/hMECollisionBins"), colBinningCent.getBin({collision1.posZ(), multiplicityCol}));

const auto& magFieldTesla1 = collision1.magField();
const auto& magFieldTesla2 = collision2.magField();

if (magFieldTesla1 != magFieldTesla2) {
continue;
}
/// \todo before mixing we should check whether both collisions contain a pair of particles!
// if (partsOne.size() == 0 || nPart2Evt1 == 0 || nPart1Evt2 == 0 || partsTwo.size() == 0 ) continue;

if (cfgProcessPM) {
auto groupPartsOne = partsOneMC->sliceByCached(aod::femtouniverseparticle::fdCollisionId, collision1.globalIndex(), cache);
auto groupPartsTwo = partsTwoMC->sliceByCached(aod::femtouniverseparticle::fdCollisionId, collision2.globalIndex(), cache);
doMixedEvent<false>(groupPartsOne, groupPartsTwo, parts, magFieldTesla1, multiplicityCol, 1);
}
if (cfgProcessPP) {
auto groupPartsOne = partsOneMC->sliceByCached(aod::femtouniverseparticle::fdCollisionId, collision1.globalIndex(), cache);
auto groupPartsTwo = partsOneMC->sliceByCached(aod::femtouniverseparticle::fdCollisionId, collision2.globalIndex(), cache);
doMixedEvent<false>(groupPartsOne, groupPartsTwo, parts, magFieldTesla1, multiplicityCol, 2);
}
if (cfgProcessMM) {
auto groupPartsOne = partsTwoMC->sliceByCached(aod::femtouniverseparticle::fdCollisionId, collision1.globalIndex(), cache);
auto groupPartsTwo = partsTwoMC->sliceByCached(aod::femtouniverseparticle::fdCollisionId, collision2.globalIndex(), cache);
doMixedEvent<false>(groupPartsOne, groupPartsTwo, parts, magFieldTesla1, multiplicityCol, 3);
}
}
delete randgen;
}
PROCESS_SWITCH(femtoUniversePairTaskTrackTrack3DMultKtExtended, processMixedEventMCCent, "Enable processing mixed events MC", false);

/// process function for to call doMixedEvent with Data
/// @param cols subscribe to the collisions table (Data)
/// @param parts subscribe to the femtoUniverseParticleTable
void processMixedEventNtr(FilteredFDCollisions& cols,
FilteredFemtoFullParticles& parts)
{
randgen = new TRandom2(0);

for (const auto& [collision1, collision2] : soa::selfCombinations(colBinningNtr, ConfNEventsMix, -1, cols, cols)) {

const int multiplicityCol = collision1.multNtr();
MixQaRegistry.fill(HIST("MixingQA/hMECollisionBins"), colBinningNtr.getBin({collision1.posZ(), multiplicityCol}));

const auto& magFieldTesla1 = collision1.magField();
const auto& magFieldTesla2 = collision2.magField();

if (magFieldTesla1 != magFieldTesla2) {
continue;
}

if (cfgProcessPM) {
auto groupPartsOne = partsOne->sliceByCached(aod::femtouniverseparticle::fdCollisionId, collision1.globalIndex(), cache);
auto groupPartsTwo = partsTwo->sliceByCached(aod::femtouniverseparticle::fdCollisionId, collision2.globalIndex(), cache);
doMixedEvent<false>(groupPartsOne, groupPartsTwo, parts, magFieldTesla1, multiplicityCol, 1);
}
if (cfgProcessPP) {
auto groupPartsOne = partsOne->sliceByCached(aod::femtouniverseparticle::fdCollisionId, collision1.globalIndex(), cache);
auto groupPartsTwo = partsOne->sliceByCached(aod::femtouniverseparticle::fdCollisionId, collision2.globalIndex(), cache);
doMixedEvent<false>(groupPartsOne, groupPartsTwo, parts, magFieldTesla1, multiplicityCol, 2);
}
if (cfgProcessMM) {
auto groupPartsOne = partsTwo->sliceByCached(aod::femtouniverseparticle::fdCollisionId, collision1.globalIndex(), cache);
auto groupPartsTwo = partsTwo->sliceByCached(aod::femtouniverseparticle::fdCollisionId, collision2.globalIndex(), cache);
doMixedEvent<false>(groupPartsOne, groupPartsTwo, parts, magFieldTesla1, multiplicityCol, 3);
}
}
delete randgen;
}
PROCESS_SWITCH(femtoUniversePairTaskTrackTrack3DMultKtExtended, processMixedEventNtr, "Enable processing mixed events", false);

/// brief process function for to call doMixedEvent with Monte Carlo
/// @param cols subscribe to the collisions table (Monte Carlo Reconstructed reconstructed)
/// @param parts subscribe to joined table FemtoUniverseParticles and FemtoUniverseMCLables to access Monte Carlo truth
/// @param FemtoUniverseMCParticles subscribe to the Monte Carlo truth table
void processMixedEventMCNtr(o2::aod::FdCollisions& cols,
soa::Join<FilteredFemtoFullParticles, aod::FDMCLabels>& parts,
o2::aod::FdMCParticles&)
{
randgen = new TRandom2(0);

for (const auto& [collision1, collision2] : soa::selfCombinations(colBinningCent, ConfNEventsMix, -1, cols, cols)) {

const int multiplicityCol = collision1.multNtr();
MixQaRegistry.fill(HIST("MixingQA/hMECollisionBins"), colBinningNtr.getBin({collision1.posZ(), multiplicityCol}));

const auto& magFieldTesla1 = collision1.magField();
const auto& magFieldTesla2 = collision2.magField();
Expand Down Expand Up @@ -809,7 +899,7 @@
}
delete randgen;
}
PROCESS_SWITCH(femtoUniversePairTaskTrackTrack3DMultKtExtended, processMixedEventMC, "Enable processing mixed events MC", false);
PROCESS_SWITCH(femtoUniversePairTaskTrackTrack3DMultKtExtended, processMixedEventMCNtr, "Enable processing mixed events MC", false);
};

WorkflowSpec defineDataProcessing(ConfigContext const& cfgc)
Expand Down
Loading
Loading