Skip to content
Open
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
150 changes: 55 additions & 95 deletions PWGCF/FemtoUniverse/Tasks/femtoUniversePairTaskTrackPhi.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
#include "PWGCF/FemtoUniverse/DataModel/FemtoDerived.h"

#include <CommonConstants/MathConstants.h>
#include <CommonConstants/PhysicsConstants.h>
#include <Framework/ASoA.h>
#include <Framework/ASoAHelpers.h>
#include <Framework/AnalysisDataModel.h>
Expand All @@ -43,6 +44,8 @@
#include <Framework/runDataProcessing.h>
#include <ReconstructionDataFormats/PID.h>

#include <TPDGCode.h>

#include <cmath>
#include <cstddef>
#include <cstdint>
Expand All @@ -61,16 +64,16 @@
{
// static constexpr int NPart = 2;
// static constexpr int NCuts = 5;
static const std::vector<std::string> partNames{"PhiCandidate", "Track"};
static const std::vector<std::string> cutNames{"MaxPt", "PIDthr", "nSigmaTPC", "nSigmaTPCTOF", "MaxP"};
const std::vector<std::string> partNames{"PhiCandidate", "Track"};
const std::vector<std::string> cutNames{"MaxPt", "PIDthr", "nSigmaTPC", "nSigmaTPCTOF", "MaxP"};
// static const float cutsTable[NPart][NCuts]{ //unused variable
// {4.05f, 1.f, 3.f, 3.f, 100.f},
// {4.05f, 1.f, 3.f, 3.f, 100.f}};
} // namespace

struct FemtoUniversePairTaskTrackPhi {

Service<o2::framework::O2DatabasePDG> pdgMC;
Service<o2::framework::O2DatabasePDG> pdgMC = {};

using FilteredFemtoFullParticles = soa::Join<aod::FDParticles, aod::FDExtParticles>;

Expand Down Expand Up @@ -119,6 +122,7 @@
Configurable<float> ConfTrackPtPIDLimit{"ConfTrackPtPIDLimit", 0.5, "Momentum threshold for change of the PID method (from using TPC to TPC and TOF)."};
Configurable<float> ConfTrackPtLow{"ConfTrackPtLow", 0.5, "Lower limit of the hadron pT."};
Configurable<float> ConfTrackPtHigh{"ConfTrackPtHigh", 2.5, "Higher limit of the hadron pT."};
Configurable<bool> ConfTrackUseRun3PIDforKaons{"ConfTrackUseRun3PIDforKaons", true, "Use Run3 PID for kaons from Veronika Barbasova's AN (https://alice-notes.web.cern.ch/node/1758). If this is on the other PID methods are ignored for kaons."};

/// Partitions for the track (particle 1)
Partition<FilteredFemtoFullParticles> partsTrack = (aod::femtouniverseparticle::partType == uint8_t(aod::femtouniverseparticle::ParticleType::kTrack)) &&
Expand Down Expand Up @@ -214,95 +218,67 @@
bool isProtonNSigma(float mom, float nsigmaTPCPr, float nsigmaTOFPr) // previous version from: https://github.com/alisw/AliPhysics/blob/master/PWGCF/FEMTOSCOPY/AliFemtoUser/AliFemtoMJTrackCut.cxx
{
if (mom < ConfTrackPtPIDLimit) {
if (std::abs(nsigmaTPCPr) < ConfPIDProtonNsigmaTPC) {
return true;
} else {
return false;
}
return std::abs(nsigmaTPCPr) < ConfPIDProtonNsigmaTPC;
} else if (mom > ConfTrackPtPIDLimit) {
if (std::hypot(nsigmaTOFPr, nsigmaTPCPr) < ConfPIDProtonNsigmaCombined) {
return true;
} else {
return false;
}
return std::hypot(nsigmaTOFPr, nsigmaTPCPr) < ConfPIDProtonNsigmaCombined;
}
return false;
}

bool isProtonRejected(float mom, float nsigmaTPCPi, float nsigmaTOFPi, float nsigmaTPCK, float nsigmaTOFK)
{
if (mom < 0.5) {

Check failure on line 230 in PWGCF/FemtoUniverse/Tasks/femtoUniversePairTaskTrackPhi.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[magic-number]

Avoid magic numbers in expressions. Assign the value to a clearly named variable or constant.
return true;
}
if (mom > 0.5) {

Check failure on line 233 in PWGCF/FemtoUniverse/Tasks/femtoUniversePairTaskTrackPhi.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[magic-number]

Avoid magic numbers in expressions. Assign the value to a clearly named variable or constant.
if (std::hypot(nsigmaTOFPi, nsigmaTPCPi) < ConfPIDPionNsigmaReject) {
return true;
} else if (std::hypot(nsigmaTOFK, nsigmaTPCK) < ConfPIDKaonNsigmaReject) {
return true;
} else {
return false;
}
return std::hypot(nsigmaTOFPi, nsigmaTPCPi) < ConfPIDPionNsigmaReject || std::hypot(nsigmaTOFK, nsigmaTPCK) < ConfPIDKaonNsigmaReject;
} else {
return false;
}
}

bool isKaonNSigma(float mom, float nsigmaTPCK, float nsigmaTOFK)
bool isKaonNSigma(float mom, bool hasTOF, float nsigmaTPCK, float nsigmaTOFK)
{
if (mom < 0.3) { // 0.0-0.3
if (std::abs(nsigmaTPCK) < 3.0) {
return true;
} else {
return false;
}
} else if (mom < 0.45) { // 0.30 - 0.45
if (std::abs(nsigmaTPCK) < 2.0) {
return true;
} else {
return false;
}
} else if (mom < 0.55) { // 0.45-0.55
if (std::abs(nsigmaTPCK) < 1.0) {
return true;
} else {
return false;
}
} else if (mom < 1.5) { // 0.55-1.5 (now we use TPC and TOF)
if ((std::abs(nsigmaTOFK) < 3.0) && (std::abs(nsigmaTPCK) < 3.0)) {
if (ConfTrackUseRun3PIDforKaons) {
if (mom < 0.5) {

Check failure on line 243 in PWGCF/FemtoUniverse/Tasks/femtoUniversePairTaskTrackPhi.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[magic-number]

Avoid magic numbers in expressions. Assign the value to a clearly named variable or constant.
return std::abs(nsigmaTPCK) < 3.0;

Check failure on line 244 in PWGCF/FemtoUniverse/Tasks/femtoUniversePairTaskTrackPhi.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[magic-number]

Avoid magic numbers in expressions. Assign the value to a clearly named variable or constant.
} else if (mom >= 0.5) {

Check failure on line 245 in PWGCF/FemtoUniverse/Tasks/femtoUniversePairTaskTrackPhi.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[magic-number]

Avoid magic numbers in expressions. Assign the value to a clearly named variable or constant.
if (hasTOF) // if TOF is available, use combine nsigma
{
return std::hypot(nsigmaTOFK, nsigmaTPCK) < 3.0;

Check failure on line 248 in PWGCF/FemtoUniverse/Tasks/femtoUniversePairTaskTrackPhi.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[magic-number]

Avoid magic numbers in expressions. Assign the value to a clearly named variable or constant.
} else // if TOF is not available, use TPC nsigma only
{
return true;
return std::abs(nsigmaTPCK) < 3.0;

Check failure on line 251 in PWGCF/FemtoUniverse/Tasks/femtoUniversePairTaskTrackPhi.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[magic-number]

Avoid magic numbers in expressions. Assign the value to a clearly named variable or constant.
}
} else {
}

else {
return false;
}
} else if (mom > 1.5) { // 1.5 -
if ((std::abs(nsigmaTOFK) < 2.0) && (std::abs(nsigmaTPCK) < 3.0)) {
return true;
} else {
if (mom < 0.3) { // 0.0-0.3

Check failure on line 259 in PWGCF/FemtoUniverse/Tasks/femtoUniversePairTaskTrackPhi.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[magic-number]

Avoid magic numbers in expressions. Assign the value to a clearly named variable or constant.
return std::abs(nsigmaTPCK) < 3.0;

Check failure on line 260 in PWGCF/FemtoUniverse/Tasks/femtoUniversePairTaskTrackPhi.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[magic-number]

Avoid magic numbers in expressions. Assign the value to a clearly named variable or constant.
} else if (mom < 0.45) { // 0.30 - 0.45

Check failure on line 261 in PWGCF/FemtoUniverse/Tasks/femtoUniversePairTaskTrackPhi.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[magic-number]

Avoid magic numbers in expressions. Assign the value to a clearly named variable or constant.
return std::abs(nsigmaTPCK) < 2.0;
} else if (mom < 0.55) { // 0.45-0.55
return std::abs(nsigmaTPCK) < 1.0;
} else if (mom < 1.5) { // 0.55-1.5 (now we use TPC and TOF)
return std::hypot(nsigmaTOFK, nsigmaTPCK) < 3.0;
} else if (mom > 1.5) { // 1.5 -
return (std::abs(nsigmaTOFK) < 2.0) && (std::abs(nsigmaTPCK) < 3.0);
} else {
return false;
}
} else {
return false;
}
}

bool isKaonRejected(float mom, float nsigmaTPCPr, float nsigmaTOFPr, float nsigmaTPCPi, float nsigmaTOFPi)
{
if (mom < 0.5) {
if (std::abs(nsigmaTPCPi) < ConfPIDPionNsigmaReject) {
return true;
} else if (std::abs(nsigmaTPCPr) < ConfPIDProtonNsigmaReject) {
return true;
}
return (std::abs(nsigmaTPCPi) < ConfPIDPionNsigmaReject) || (std::abs(nsigmaTPCPr) < ConfPIDProtonNsigmaReject);
}
if (mom > 0.5) {
if (std::hypot(nsigmaTOFPi, nsigmaTPCPi) < ConfPIDPionNsigmaReject) {
return true;
} else if (std::hypot(nsigmaTOFPr, nsigmaTPCPr) < ConfPIDProtonNsigmaReject) {
return true;
} else {
return false;
}
return (std::hypot(nsigmaTOFPi, nsigmaTPCPi) < ConfPIDPionNsigmaReject) || (std::hypot(nsigmaTOFPr, nsigmaTPCPr) < ConfPIDProtonNsigmaReject);
} else {
return false;
}
Expand All @@ -312,17 +288,9 @@
{
if (true) {
if (mom < 0.5) {
if (std::abs(nsigmaTPCPi) < ConfPIDPionNsigmaTPC) {
return true;
} else {
return false;
}
return (std::abs(nsigmaTPCPi) < ConfPIDPionNsigmaTPC);
} else if (mom > 0.5) {
if (std::hypot(nsigmaTOFPi, nsigmaTPCPi) < ConfPIDPionNsigmaCombined) {
return true;
} else {
return false;
}
return (std::hypot(nsigmaTOFPi, nsigmaTPCPi) < ConfPIDPionNsigmaCombined);
}
}
return false;
Expand All @@ -331,27 +299,19 @@
bool isPionRejected(float mom, float nsigmaTPCPr, float nsigmaTOFPr, float nsigmaTPCK, float nsigmaTOFK)
{
if (mom < 0.5) {
if (std::abs(nsigmaTPCK) < ConfPIDKaonNsigmaReject) {
return true;
} else if (std::abs(nsigmaTPCPr) < ConfPIDProtonNsigmaReject) {
return true;
}
return (std::abs(nsigmaTPCK) < ConfPIDKaonNsigmaReject) || (std::abs(nsigmaTPCPr) < ConfPIDProtonNsigmaReject);
}
if (mom > 0.5) {
if (std::hypot(nsigmaTOFK, nsigmaTPCK) < ConfPIDKaonNsigmaReject) {
return true;
} else if (std::hypot(nsigmaTOFPr, nsigmaTPCPr) < ConfPIDProtonNsigmaReject) {
return true;
} else {
return false;
}
return (std::hypot(nsigmaTOFK, nsigmaTPCK) < ConfPIDKaonNsigmaReject) || (std::hypot(nsigmaTOFPr, nsigmaTPCPr) < ConfPIDProtonNsigmaReject);
} else {
return false;
}
}

bool isParticleNSigmaAccepted(float mom, float nsigmaTPCPr, float nsigmaTOFPr, float nsigmaTPCPi, float nsigmaTOFPi, float nsigmaTPCK, float nsigmaTOFK)
{
bool hasTOF = std::isfinite(nsigmaTOFPr) || std::isfinite(nsigmaTOFPi) || std::isfinite(nsigmaTOFK);

switch (ConfTrackPDGCode) {
case 2212: // Proton
case -2212: // anty Proton
Expand All @@ -363,7 +323,7 @@
break;
case 321: // Kaon+
case -321: // Kaon-
return isKaonNSigma(mom, nsigmaTPCK, nsigmaTOFK);
return isKaonNSigma(mom, hasTOF, nsigmaTPCK, nsigmaTOFK);
break;
default:
return false;
Expand Down Expand Up @@ -499,7 +459,7 @@
}

template <bool isMC, typename PartitionType, typename PartType, typename MCParticles = std::nullptr_t>
void doSameEvent(PartitionType groupPartsTrack, PartitionType groupPartsPhi, PartType parts, float magFieldTesla, int multCol, [[maybe_unused]] MCParticles mcParts = nullptr)
void doSameEvent(const PartitionType& groupPartsTrack, const PartitionType& groupPartsPhi, const PartType& parts, float magFieldTesla, int multCol, [[maybe_unused]] MCParticles mcParts = nullptr)
{
for (auto const& phicandidate : groupPartsPhi) {
// TODO: add phi meson minv cut here
Expand All @@ -526,7 +486,7 @@
trackHistoPartPhi.fillQA<false, false>(phicandidate);
if constexpr (isMC) {
// reco
effCorrection.fillRecoHist<ParticleNo::ONE, FilteredFDCollisions>(phicandidate, 333);
effCorrection.fillRecoHist<ParticleNo::ONE, FilteredFDCollisions>(phicandidate, o2::constants::physics::Pdg::kPhi);
}
}

Expand Down Expand Up @@ -627,7 +587,7 @@
}

template <bool isMC, typename PartitionType, typename PartType, typename MCParticles = std::nullptr_t>
void doMixedEvent(PartitionType groupPartsTrack, PartitionType groupPartsPhi, PartType parts, float magFieldTesla, int multCol, [[maybe_unused]] MCParticles mcParts = nullptr)
void doMixedEvent(const PartitionType& groupPartsTrack, const PartitionType& groupPartsPhi, const PartType& parts, float magFieldTesla, int multCol, [[maybe_unused]] MCParticles mcParts = nullptr)
{
for (auto const& [track, phicandidate] : combinations(CombinationsFullIndexPolicy(groupPartsTrack, groupPartsPhi))) {
if (ConfTrackIsIdentified) {
Expand Down Expand Up @@ -734,18 +694,18 @@
// charge +
if (pdgParticle->Charge() > 0.0) {
registryMCtruth.fill(HIST("MCtruthAllPositivePt"), part.pt());
if (pdgCode == 2212) {
if (pdgCode == kProton) {
registryMCtruth.fill(HIST("MCtruthPpos"), part.pt(), part.eta());
registryMCtruth.fill(HIST("MCtruthPposPt"), part.pt());
continue;
} else if (pdgCode == 321) {
} else if (pdgCode == kKPlus) {
registryMCtruth.fill(HIST("MCtruthKp"), part.pt(), part.eta());
registryMCtruth.fill(HIST("MCtruthKpPt"), part.pt());
continue;
}
}
// charge 0
if (pdgCode == 333) {
if (pdgCode == o2::constants::physics::Pdg::kPhi) {
registryMCtruth.fill(HIST("MCtruthPhi"), part.pt(), part.eta());
registryMCtruth.fill(HIST("MCtruthPhiPt"), part.pt());
effCorrection.fillTruthHist<ParticleNo::ONE, FilteredFDCollisions>(part);
Expand All @@ -756,11 +716,11 @@
if (pdgParticle->Charge() < 0.0) {
registryMCtruth.fill(HIST("MCtruthAllNegativePt"), part.pt());

if (pdgCode == -321) {
if (pdgCode == kKMinus) {
registryMCtruth.fill(HIST("MCtruthKm"), part.pt(), part.eta());
registryMCtruth.fill(HIST("MCtruthKmPt"), part.pt());
continue;
} else if (pdgCode == -2212) {
} else if (pdgCode == kProtonBar) {
registryMCtruth.fill(HIST("MCtruthPneg"), part.pt(), part.eta());
registryMCtruth.fill(HIST("MCtruthPnegPt"), part.pt());
continue;
Expand All @@ -783,27 +743,27 @@
float weightTrack = effCorrection.getWeight<FilteredFDCollisions>(ParticleNo::TWO, part);
registryMCpT.fill(HIST("MCReco/C_p_pT"), part.pt(), weightTrack);
}
if ((mcpart.pdgMCTruth() == 333) && (part.partType() == aod::femtouniverseparticle::ParticleType::kPhi) && (part.pt() > ConfPhiPtLow) && (part.pt() < ConfPhiPtHigh)) {
if ((mcpart.pdgMCTruth() == o2::constants::physics::Pdg::kPhi) && (part.partType() == aod::femtouniverseparticle::ParticleType::kPhi) && (part.pt() > ConfPhiPtLow) && (part.pt() < ConfPhiPtHigh)) {
registryMCpT.fill(HIST("MCReco/NC_phi_pT"), part.pt());
float weightPhi = effCorrection.getWeight<FilteredFDCollisions>(ParticleNo::ONE, part);
registryMCpT.fill(HIST("MCReco/C_phi_pT"), part.pt(), weightPhi);
}

if (isParticleNSigmaAccepted(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)))
hTrackDCA.fillQA<true, true>(part);
if ((part.partType() == aod::femtouniverseparticle::ParticleType::kPhi) && (mcpart.pdgMCTruth() == 333) && (mcpart.partOriginMCTruth() == aod::femtouniverse_mc_particle::ParticleOriginMCTruth::kPrimary)) {
if ((part.partType() == aod::femtouniverseparticle::ParticleType::kPhi) && (mcpart.pdgMCTruth() == o2::constants::physics::Pdg::kPhi) && (mcpart.partOriginMCTruth() == aod::femtouniverse_mc_particle::ParticleOriginMCTruth::kPrimary)) {
registryMCreco.fill(HIST("MCrecoPhi"), mcpart.pt(), mcpart.eta()); // phi
registryMCreco.fill(HIST("MCrecoPhiPt"), mcpart.pt());
} else if (part.partType() == aod::femtouniverseparticle::ParticleType::kTrack) {
if (part.sign() > 0) {
registryMCreco.fill(HIST("MCrecoAllPositivePt"), mcpart.pt());
if (mcpart.pdgMCTruth() == 2212 && isParticleNSigmaAccepted(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))) {
if (mcpart.pdgMCTruth() == kProton && isParticleNSigmaAccepted(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))) {
registryMCreco.fill(HIST("MCrecoPpos"), mcpart.pt(), mcpart.eta());
registryMCreco.fill(HIST("MCrecoPposPt"), mcpart.pt());
}
} else if (part.sign() < 0) {
registryMCreco.fill(HIST("MCrecoAllNegativePt"), mcpart.pt());
if (mcpart.pdgMCTruth() == -2212 && isParticleNSigmaAccepted(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))) {
if (mcpart.pdgMCTruth() == kProtonBar && isParticleNSigmaAccepted(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))) {
registryMCreco.fill(HIST("MCrecoPneg"), mcpart.pt(), mcpart.eta());
registryMCreco.fill(HIST("MCrecoPnegPt"), mcpart.pt());
}
Expand Down
Loading