Skip to content
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
31 changes: 23 additions & 8 deletions PWGLF/TableProducer/Strangeness/phiStrangeCorrelator.cxx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2019-2020 CERN and copyright holders of ALICE O2.

Check failure on line 1 in PWGLF/TableProducer/Strangeness/phiStrangeCorrelator.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[name/workflow-file]

Name of a workflow file must match the name of the main struct in it (without the PWG prefix). (Class implementation files should be in "Core" directories.)
// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
// All rights not expressly granted are reserved.
//
Expand Down Expand Up @@ -550,8 +550,11 @@
// Configurable<bool> forceTOF{"forceTOF", false, "force the TOF signal for the PID"};
Configurable<float> tofPIDThreshold{"tofPIDThreshold", 0.5, "minimum pT after which TOF PID is applicable"};
Configurable<std::vector<int>> trkPIDspecies{"trkPIDspecies", std::vector<int>{o2::track::PID::Kaon, o2::track::PID::Proton}, "Trk sel: Particles species for PID rejection, kaon, proton"};
Configurable<std::vector<float>> pidTPCMax{"pidTPCMax", std::vector<float>{2.0f, 2.0f}, "maximum nSigma TPC"};
Configurable<std::vector<float>> pidTOFMax{"pidTOFMax", std::vector<float>{2.0f, 2.0f}, "maximum nSigma TOF"};
Configurable<std::pair<float, float>> pidRangeTPCEl{"pidRangeTPCEl", {-3.0f, 5.0f}, "nSigma TPC range for electrons"};
Comment thread
scannito marked this conversation as resolved.
Configurable<float> pidTPCMaxHadrons{"pidTPCMaxHadrons", 3.0f, "maximum nSigma TPC for hadrons"};
Configurable<float> pidTOFMaxHadrons{"pidTOFMaxHadrons", 3.0f, "maximum nSigma TOF for hadrons"};
Configurable<std::vector<float>> pidTPCMax{"pidTPCMax", std::vector<float>{3.0f, 3.0f}, "maximum nSigma TPC"};
Configurable<std::vector<float>> pidTOFMax{"pidTOFMax", std::vector<float>{3.0f, 3.0f}, "maximum nSigma TOF"};
Comment thread
scannito marked this conversation as resolved.

Configurable<float> cfgYAcceptance{"cfgYAcceptance", 0.5f, "Rapidity acceptance"};
} trackConfigs;
Expand Down Expand Up @@ -636,20 +639,32 @@
// Electron rejection
auto nSigmaTPCEl = aod::pidutils::tpcNSigma(o2::track::PID::Electron, track);

if (nSigmaTPCEl > -3.0f && nSigmaTPCEl < 5.0f) {
if (nSigmaTPCEl > trackConfigs.pidRangeTPCEl->first && nSigmaTPCEl < trackConfigs.pidRangeTPCEl->second) {
auto nSigmaTPCPi = aod::pidutils::tpcNSigma(o2::track::PID::Pion, track);
auto nSigmaTPCKa = aod::pidutils::tpcNSigma(o2::track::PID::Kaon, track);
auto nSigmaTPCPr = aod::pidutils::tpcNSigma(o2::track::PID::Proton, track);

if (std::abs(nSigmaTPCPi) > 3.0f &&
std::abs(nSigmaTPCKa) > 3.0f &&
std::abs(nSigmaTPCPr) > 3.0f) {
if (std::abs(nSigmaTPCPi) > trackConfigs.pidTPCMaxHadrons &&
std::abs(nSigmaTPCKa) > trackConfigs.pidTPCMaxHadrons &&
std::abs(nSigmaTPCPr) > trackConfigs.pidTPCMaxHadrons) {
return false;
}
}

// Other hadron species rejection
for (size_t speciesIndex = 0; speciesIndex < trackConfigs.trkPIDspecies->size(); ++speciesIndex) {
for (auto pid : {o2::track::PID::Kaon, o2::track::PID::Proton}) {

Check failure on line 655 in PWGLF/TableProducer/Strangeness/phiStrangeCorrelator.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[const-ref-in-for-loop]

Use constant references for non-modified iterators in range-based for loops.
auto nSigmaTPC = aod::pidutils::tpcNSigma(pid, track);

if (std::abs(nSigmaTPC) < trackConfigs.pidTPCMaxHadrons) {
// Reject if only TPC is within threshold and TOF is unavailable or if both TPC and TOF are within thresholds
if (!track.hasTOF() || std::abs(aod::pidutils::tofNSigma(pid, track)) < trackConfigs.pidTOFMaxHadrons) {
return false;
}
}
Comment thread
scannito marked this conversation as resolved.
}

// Other hadron species rejection
/*for (size_t speciesIndex = 0; speciesIndex < trackConfigs.trkPIDspecies->size(); ++speciesIndex) {
auto const& pid = trackConfigs.trkPIDspecies->at(speciesIndex);
auto nSigmaTPC = aod::pidutils::tpcNSigma(pid, track);

Comment thread
scannito marked this conversation as resolved.
Expand All @@ -663,7 +678,7 @@
return false; // Reject if only TPC is within threshold and TOF is unavailable
}
}
}
}*/
Comment thread
scannito marked this conversation as resolved.

return true;
}
Expand Down
61 changes: 36 additions & 25 deletions PWGLF/Tasks/Strangeness/phiStrangeCorrelation.cxx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2019-2020 CERN and copyright holders of ALICE O2.

Check failure on line 1 in PWGLF/Tasks/Strangeness/phiStrangeCorrelation.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[name/workflow-file]

Name of a workflow file must match the name of the main struct in it (without the PWG prefix). (Class implementation files should be in "Core" directories.)
// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
// All rights not expressly granted are reserved.
//
Expand Down Expand Up @@ -241,19 +241,22 @@
// Configurables for Pions selection
struct : ConfigurableGroup {
Configurable<bool> selectPionInSigRegion{"selectPionInSigRegion", true, "Select Pion candidates in signal region"};
Configurable<float> pidTPCMax{"pidTPCMax", 2.0f, "Maximum nSigma TPC"};
Configurable<float> pidTOFMax{"pidTOFMax", 2.0f, "Maximum nSigma TOF"};
Configurable<float> pidTPCMax{"pidTPCMax", 3.0f, "Maximum nSigma TPC"};
Configurable<float> pidTOFMax{"pidTOFMax", 3.0f, "Maximum nSigma TOF"};
// Configurable<float> tofPIDThreshold{"tofPIDThreshold", 0.5f, "Minimum pT after which TOF PID is applicable"};
} pionConfigs;

// Configurables on phi pT bins
Configurable<std::vector<double>> binspTPhi{"binspTPhi", {0.4, 0.8, 1.4, 2.0, 2.8, 4.0, 6.0, 10.0}, "pT bin limits for Phi"};
Configurable<std::vector<double>> binspTPhiExt{"binspTPhiExt", {0.0, 0.4, 0.8, 1.4, 2.0, 2.8, 4.0, 6.0, 10.0}, "pT bin limits for Phi extended for MC Gen"};

// Configurable on K0S pT bins
Configurable<std::vector<double>> binspTK0S{"binspTK0S", {0.1, 0.5, 0.8, 1.2, 1.6, 2.0, 2.5, 3.0, 4.0, 6.0}, "pT bin limits for K0S"};
Configurable<std::vector<double>> binspTK0SExt{"binspTK0SExt", {0.0, 0.1, 0.5, 0.8, 1.2, 1.6, 2.0, 2.5, 3.0, 4.0, 6.0}, "pT bin limits for K0S extended for MC Gen"};

// Configurable on pion pT bins
Configurable<std::vector<double>> binspTPi{"binspTPi", {0.2, 0.3, 0.4, 0.5, 0.6, 0.8, 1.0, 1.2, 1.5, 2.0, 3.0}, "pT bin limits for pions"};
Configurable<std::vector<double>> binspTPi{"binspTPi", {0.2, 0.3, 0.4, 0.5, 0.6, 0.8, 1.0, 1.2, 1.5, 2.0, 3.0}, "pT bin limits for Pions"};
Configurable<std::vector<double>> binspTPiExt{"binspTPiExt", {0.0, 0.2, 0.3, 0.4, 0.5, 0.6, 0.8, 1.0, 1.2, 1.5, 2.0, 3.0}, "pT bin limits for Pions extended for MC Gen"};

struct : ConfigurableGroup {
Configurable<bool> doK0SCorrelation{"doK0SCorrelation", true, "Enable Phi-K0S correlation"};
Expand All @@ -270,8 +273,11 @@
} yConfigs;

// Configurables to apply efficiency online and how to
Configurable<bool> applyEfficiency{"applyEfficiency", false, "Use efficiency for filling histograms"};
Configurable<bool> useEffInterpolation{"useEffInterpolation", false, "If true, interpolates efficiency map, else uses bin center"};
struct : ConfigurableGroup {
Configurable<bool> applyEfficiency{"applyEfficiency", false, "Use efficiency for filling histograms"};
Configurable<bool> useEffInterpolation{"useEffInterpolation", false, "If true, interpolates efficiency map, else uses bin center"};
Configurable<bool> applyPhiEfficiency{"applyPhiEfficiency", true, "Apply efficiency for Phi candidates"};
} efficiencyConfigs;

// Configurable for event mixing
Configurable<int> cfgNoMixedEvents{"cfgNoMixedEvents", 5, "Number of mixed events per event"};
Expand All @@ -285,6 +291,7 @@
Configurable<float> minPhiPt{"minPhiPt", 0.4f, "Minimum pT for Phi candidates"};
Configurable<float> v0SettingMinPt{"v0SettingMinPt", 0.1f, "V0 min pt"};
Configurable<float> cMinPionPtcut{"cMinPionPtcut", 0.2f, "Track minimum pt cut"};
Configurable<bool> bypassPtCut{"bypassPtCut", false, "Bypass the minimum pt cut at MCGen level"};
Comment thread
scannito marked this conversation as resolved.
} minPtMcGenConfigs;

// Filter on phi selected collisions
Expand Down Expand Up @@ -362,12 +369,15 @@
AxisSpec massPhiAxis = {200, 0.9f, 1.2f, "#it{M}_{inv} [GeV/#it{c}^{2}]"};
AxisSpec pTPhiAxis = {120, 0.0f, 12.0f, "#it{p}_{T} (GeV/#it{c})"};
AxisSpec binnedpTPhiAxis{(std::vector<double>)binspTPhi, "#it{p}_{T} (GeV/#it{c})"};
AxisSpec binnedpTPhiAxisExt{(std::vector<double>)binspTPhiExt, "#it{p}_{T} (GeV/#it{c})"};
AxisSpec massK0SAxis = {200, 0.45f, 0.55f, "#it{M}_{inv} [GeV/#it{c}^{2}]"};
AxisSpec pTK0SAxis = {100, 0.0f, 10.0f, "#it{p}_{T} (GeV/#it{c})"};
AxisSpec binnedpTK0SAxis{(std::vector<double>)binspTK0S, "#it{p}_{T} (GeV/#it{c})"};
AxisSpec binnedpTK0SAxisExt{(std::vector<double>)binspTK0SExt, "#it{p}_{T} (GeV/#it{c})"};
AxisSpec nSigmaPiAxis = {100, -10.0f, 10.0f, "N#sigma #pi"};
AxisSpec pTPiAxis = {50, 0.0f, 5.0f, "#it{p}_{T} (GeV/#it{c})"};
AxisSpec binnedpTPiAxis{(std::vector<double>)binspTPi, "#it{p}_{T} (GeV/#it{c})"};
AxisSpec binnedpTPiAxisExt{(std::vector<double>)binspTPiExt, "#it{p}_{T} (GeV/#it{c})"};

histos.add("phi/h3PhiData", "Invariant mass of Phi in Data", kTH3F, {binnedmultAxis, binnedpTPhiAxis, massPhiAxis});

Expand Down Expand Up @@ -406,16 +416,16 @@
histos.add("pi/h3PiMCGen", "Pion in MC Gen", kTH3F, {binnedmultAxis, binnedpTPiAxis, yAxis});
histos.add("pi/h4PiMCGenAssocReco", "Pion in MC Gen Assoc Reco", kTHnSparseF, {vertexZAxis, binnedmultAxis, binnedpTPiAxis, yAxis});

histos.add("phi/h3PhiMCClosureGen", "Phi in MC Gen for MC Closure Test", kTH3F, {binnedmultAxis, binnedpTPhiAxis, yAxis});
histos.add("phi/h3PhiMCClosureGen", "Phi in MC Gen for MC Closure Test", kTH3F, {binnedmultAxis, binnedpTPhiAxisExt, yAxis});

histos.add("phiK0S/h5PhiK0SClosureMCGen", "Deltay vs deltaphi for Phi and K0Short in MCGen", kTHnSparseF, {binnedmultAxis, binnedpTPhiAxis, binnedpTK0SAxis, deltayAxis, deltaphiAxis});
histos.add("phiPi/h5PhiPiClosureMCGen", "Deltay vs deltaphi for Phi and Pion in MCGen", kTHnSparseF, {binnedmultAxis, binnedpTPhiAxis, binnedpTPiAxis, deltayAxis, deltaphiAxis});
histos.add("phiK0S/h5PhiK0SClosureMCGen", "Deltay vs deltaphi for Phi and K0Short in MCGen", kTHnSparseF, {binnedmultAxis, binnedpTPhiAxisExt, binnedpTK0SAxisExt, deltayAxis, deltaphiAxis});
histos.add("phiPi/h5PhiPiClosureMCGen", "Deltay vs deltaphi for Phi and Pion in MCGen", kTHnSparseF, {binnedmultAxis, binnedpTPhiAxisExt, binnedpTPiAxisExt, deltayAxis, deltaphiAxis});

histos.add("phiK0S/h5PhiK0SClosureMCGenME", "Deltay vs deltaphi for Phi and K0Short in MCGen ME", kTHnSparseF, {binnedmultAxis, binnedpTPhiAxis, binnedpTK0SAxis, deltayAxis, deltaphiAxis});
histos.add("phiPi/h5PhiPiClosureMCGenME", "Deltay vs deltaphi for Phi and Pion in MCGen ME", kTHnSparseF, {binnedmultAxis, binnedpTPhiAxis, binnedpTPiAxis, deltayAxis, deltaphiAxis});
histos.add("phiK0S/h5PhiK0SClosureMCGenME", "Deltay vs deltaphi for Phi and K0Short in MCGen ME", kTHnSparseF, {binnedmultAxis, binnedpTPhiAxisExt, binnedpTK0SAxisExt, deltayAxis, deltaphiAxis});
histos.add("phiPi/h5PhiPiClosureMCGenME", "Deltay vs deltaphi for Phi and Pion in MCGen ME", kTHnSparseF, {binnedmultAxis, binnedpTPhiAxisExt, binnedpTPiAxisExt, deltayAxis, deltaphiAxis});

// Load efficiency maps from CCDB
if (applyEfficiency) {
if (efficiencyConfigs.applyEfficiency) {
ccdb->setURL(ccdbUrl);
ccdb->setCaching(true);
ccdb->setLocalObjectValidityChecking();
Expand Down Expand Up @@ -451,8 +461,9 @@

void loadEfficiencyMaps()
{
// Always load the Trigger (Phi) map
fetchSingleEfficiencyMapFromCCDB(effMapPhi, "Phi");
// Load the Trigger (Phi) map if requested by analysis method
if (efficiencyConfigs.applyPhiEfficiency)
fetchSingleEfficiencyMapFromCCDB(effMapPhi, "Phi");

// Map the user configurations for the associated particles
bool doAssocCorrelations[kAssocPartSize] = {activeCorrelationConfigs.doK0SCorrelation, activeCorrelationConfigs.doXiCorrelation, activeCorrelationConfigs.doPionCorrelation};
Expand All @@ -476,10 +487,10 @@
template <typename... BoundEffMaps>
float computeWeight(const BoundEffMaps&... boundEffMaps)
{
if (!applyEfficiency)
if (!efficiencyConfigs.applyEfficiency)
return 1.0f;

float totalEfficiency = ((useEffInterpolation ? boundEffMaps.interpolateEfficiency() : boundEffMaps.getBinEfficiency()) * ...);
float totalEfficiency = ((efficiencyConfigs.useEffInterpolation ? boundEffMaps.interpolateEfficiency() : boundEffMaps.getBinEfficiency()) * ...);

return totalEfficiency <= 0.0f ? 1.0f : 1.0f / totalEfficiency;
}
Expand Down Expand Up @@ -512,7 +523,7 @@
const bool applyK0sMassCut = (analysisMode == kDeltaYvsDeltaPhi) && k0sConfigs.selectK0sInSigRegion;
const auto& [minMassK0s, maxMassK0s] = k0sConfigs.rangeMK0sSignal.value;
auto isK0sValid = [&](const auto& k0s) {
return (!applyEfficiency || k0s.pt() < binspTK0S->back()) && (!applyK0sMassCut || k0s.inMassRegion(minMassK0s, maxMassK0s));
return (!efficiencyConfigs.applyEfficiency || k0s.pt() < binspTK0S->back()) && (!applyK0sMassCut || k0s.inMassRegion(minMassK0s, maxMassK0s));
};

const bool applyPionNSigmaCut = (analysisMode == kDeltaYvsDeltaPhi) && pionConfigs.selectPionInSigRegion;
Expand All @@ -521,11 +532,11 @@
// const float& tofPIDThreshold = pionConfigs.tofPIDThreshold;

auto isPionValid = [&](const auto& pion) {
return (!applyEfficiency || pion.pt() < binspTPi->back()) && (!applyPionNSigmaCut || pion.inNSigmaRegion(pidTPCMax, pidTOFMax));
return (!efficiencyConfigs.applyEfficiency || pion.pt() < binspTPi->back()) && (!applyPionNSigmaCut || pion.inNSigmaRegion(pidTPCMax, pidTOFMax));
};

for (const auto& phiCand : phiCandidates) {
if (applyEfficiency && phiCand.pt() >= binspTPhi->back())
if (efficiencyConfigs.applyEfficiency && efficiencyConfigs.applyPhiEfficiency && phiCand.pt() >= binspTPhi->back())
continue;
Comment thread
scannito marked this conversation as resolved.

float weightPhi = computeWeight(BoundEfficiencyMap(effMapPhi, multiplicity, phiCand.pt(), phiCand.y()));
Expand Down Expand Up @@ -652,7 +663,7 @@
const auto& [minMassK0s, maxMassK0s] = k0sConfigs.rangeMK0sSignal.value;

auto isK0sValid = [&](const auto& k0s) {
return (!applyEfficiency || k0s.pt() < binspTK0S->back()) && (!applyK0sMassCut || k0s.inMassRegion(minMassK0s, maxMassK0s));
return (!efficiencyConfigs.applyEfficiency || k0s.pt() < binspTK0S->back()) && (!applyK0sMassCut || k0s.inMassRegion(minMassK0s, maxMassK0s));
};

auto tuplePhiK0S = std::make_tuple(phiCandidates, k0sReduced);
Expand All @@ -663,7 +674,7 @@
float multiplicity = c1.centFT0M();

for (const auto& [phiCand, k0s] : o2::soa::combinations(o2::soa::CombinationsFullIndexPolicy(phiCands, k0sRed))) {
if (applyEfficiency && phiCand.pt() >= binspTPhi->back())
if (efficiencyConfigs.applyEfficiency && efficiencyConfigs.applyPhiEfficiency && phiCand.pt() >= binspTPhi->back())
Comment thread
scannito marked this conversation as resolved.
continue;
if (!isK0sValid(k0s))
continue;
Expand Down Expand Up @@ -747,7 +758,7 @@
// const float& tofPIDThreshold = pionConfigs.tofPIDThreshold;

auto isPionValid = [&](const auto& pion) {
return (!applyEfficiency || pion.pt() < binspTPi->back()) && (!applyPionNSigmaCut || pion.inNSigmaRegion(pidTPCMax, pidTOFMax));
return (!efficiencyConfigs.applyEfficiency || pion.pt() < binspTPi->back()) && (!applyPionNSigmaCut || pion.inNSigmaRegion(pidTPCMax, pidTOFMax));
};

auto tuplePhiPion = std::make_tuple(phiCandidates, pionTracks);
Expand All @@ -758,7 +769,7 @@
float multiplicity = c1.centFT0M();

for (const auto& [phiCand, piTrack] : o2::soa::combinations(o2::soa::CombinationsFullIndexPolicy(phiCands, piTracks))) {
if (applyEfficiency && phiCand.pt() >= binspTPhi->back())
if (efficiencyConfigs.applyEfficiency && efficiencyConfigs.applyPhiEfficiency && phiCand.pt() >= binspTPhi->back())
Comment thread
scannito marked this conversation as resolved.
continue;
if (!isPionValid(piTrack))
continue;
Expand Down Expand Up @@ -1098,15 +1109,15 @@

switch (std::abs(mcParticle.pdgCode())) {
case o2::constants::physics::Pdg::kPhi:
if (eventSelectionType == 0 && mcParticle.pt() >= minPtMcGenConfigs.minPhiPt)
if (eventSelectionType == 0 && (minPtMcGenConfigs.bypassPtCut || mcParticle.pt() >= minPtMcGenConfigs.minPhiPt))
phiParticles.emplace_back(mcParticle.pt(), mcParticle.y(), mcParticle.phi());
break;
case PDG_t::kK0Short:
if (mcParticle.isPhysicalPrimary() && mcParticle.pt() >= minPtMcGenConfigs.v0SettingMinPt)
if (mcParticle.isPhysicalPrimary() && (minPtMcGenConfigs.bypassPtCut || mcParticle.pt() >= minPtMcGenConfigs.v0SettingMinPt))
k0sParticles.emplace_back(mcParticle.pt(), mcParticle.y(), mcParticle.phi());
break;
case PDG_t::kPiPlus:
if (mcParticle.isPhysicalPrimary() && mcParticle.pt() >= minPtMcGenConfigs.cMinPionPtcut)
if (mcParticle.isPhysicalPrimary() && (minPtMcGenConfigs.bypassPtCut || mcParticle.pt() >= minPtMcGenConfigs.cMinPionPtcut))
pionParticles.emplace_back(mcParticle.pt(), mcParticle.y(), mcParticle.phi());
break;
default:
Expand Down
Loading