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
127 changes: 42 additions & 85 deletions PWGCF/FemtoUniverse/Tasks/femtoUniversePairTaskTrackPhi.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -61,16 +61,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 +119,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 +215,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 227 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) {
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) {
return std::abs(nsigmaTPCK) < 3.0;
} else if (mom >= 0.5) {
if (hasTOF) // if TOF is available, use combine nsigma
{
return true;
return std::hypot(nsigmaTOFK, nsigmaTPCK) < 3.0;
} else // if TOF is not available, use TPC nsigma only
{
return std::abs(nsigmaTPCK) < 3.0;
}
} 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
return std::abs(nsigmaTPCK) < 3.0;
} else if (mom < 0.45) { // 0.30 - 0.45
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 +285,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 +296,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 +320,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 +456,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 Down Expand Up @@ -627,7 +584,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 +691,18 @@
// charge +
if (pdgParticle->Charge() > 0.0) {
registryMCtruth.fill(HIST("MCtruthAllPositivePt"), part.pt());
if (pdgCode == 2212) {

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

View workflow job for this annotation

GitHub Actions / O2 linter

[pdg/explicit-code]

Avoid hard-coded PDG codes. Use named values from PDG_t or o2::constants::physics::Pdg instead.
registryMCtruth.fill(HIST("MCtruthPpos"), part.pt(), part.eta());
registryMCtruth.fill(HIST("MCtruthPposPt"), part.pt());
continue;
} else if (pdgCode == 321) {

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

View workflow job for this annotation

GitHub Actions / O2 linter

[pdg/explicit-code]

Avoid hard-coded PDG codes. Use named values from PDG_t or o2::constants::physics::Pdg instead.
registryMCtruth.fill(HIST("MCtruthKp"), part.pt(), part.eta());
registryMCtruth.fill(HIST("MCtruthKpPt"), part.pt());
continue;
}
}
// charge 0
if (pdgCode == 333) {

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

View workflow job for this annotation

GitHub Actions / O2 linter

[pdg/explicit-code]

Avoid hard-coded PDG codes. Use named values from PDG_t or o2::constants::physics::Pdg instead.
registryMCtruth.fill(HIST("MCtruthPhi"), part.pt(), part.eta());
registryMCtruth.fill(HIST("MCtruthPhiPt"), part.pt());
effCorrection.fillTruthHist<ParticleNo::ONE, FilteredFDCollisions>(part);
Expand All @@ -756,11 +713,11 @@
if (pdgParticle->Charge() < 0.0) {
registryMCtruth.fill(HIST("MCtruthAllNegativePt"), part.pt());

if (pdgCode == -321) {

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

View workflow job for this annotation

GitHub Actions / O2 linter

[pdg/explicit-code]

Avoid hard-coded PDG codes. Use named values from PDG_t or o2::constants::physics::Pdg instead.
registryMCtruth.fill(HIST("MCtruthKm"), part.pt(), part.eta());
registryMCtruth.fill(HIST("MCtruthKmPt"), part.pt());
continue;
} else if (pdgCode == -2212) {

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

View workflow job for this annotation

GitHub Actions / O2 linter

[pdg/explicit-code]

Avoid hard-coded PDG codes. Use named values from PDG_t or o2::constants::physics::Pdg instead.
registryMCtruth.fill(HIST("MCtruthPneg"), part.pt(), part.eta());
registryMCtruth.fill(HIST("MCtruthPnegPt"), part.pt());
continue;
Expand All @@ -783,7 +740,7 @@
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)) {

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

View workflow job for this annotation

GitHub Actions / O2 linter

[pdg/explicit-code]

Avoid hard-coded PDG codes. Use named values from PDG_t or o2::constants::physics::Pdg instead.
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);
Expand All @@ -791,19 +748,19 @@

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)) {

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

View workflow job for this annotation

GitHub Actions / O2 linter

[pdg/explicit-code]

Avoid hard-coded PDG codes. Use named values from PDG_t or o2::constants::physics::Pdg instead.
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))) {

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

View workflow job for this annotation

GitHub Actions / O2 linter

[pdg/explicit-code]

Avoid hard-coded PDG codes. Use named values from PDG_t or o2::constants::physics::Pdg instead.
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))) {

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

View workflow job for this annotation

GitHub Actions / O2 linter

[pdg/explicit-code]

Avoid hard-coded PDG codes. Use named values from PDG_t or o2::constants::physics::Pdg instead.
registryMCreco.fill(HIST("MCrecoPneg"), mcpart.pt(), mcpart.eta());
registryMCreco.fill(HIST("MCrecoPnegPt"), mcpart.pt());
}
Expand Down
Loading