Skip to content
Merged
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: 91 additions & 59 deletions PWGLF/Tasks/Resonances/kstarInOO.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
#include <Framework/OutputObjHeader.h>
#include <Framework/runDataProcessing.h>

#include <TLorentzVector.h>

Check failure on line 35 in PWGLF/Tasks/Resonances/kstarInOO.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[root/lorentz-vector]

Do not use the TLorentzVector legacy class. Use std::array with RecoDecay methods or the ROOT::Math::LorentzVector template instead.
#include <TMath.h>
#include <TMathBase.h>
#include <TVector2.h>
Expand All @@ -44,7 +44,7 @@
#include <cmath>
#include <cstddef>
#include <cstdlib>
#include <iostream>

Check failure on line 47 in PWGLF/Tasks/Resonances/kstarInOO.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[include-iostream]

Do not include iostream. Use O2 logging instead.
#include <string>
#include <utility>
#include <vector>
Expand All @@ -66,7 +66,10 @@

// Event Selection
Configurable<float> cfgEventVtxCut{"cfgEventVtxCut", 10.0, "V_z cut selection"};
ConfigurableAxis cfgCentAxis{"cfgCentAxis", {VARIABLE_WIDTH, 0.0, 1.0, 5.0, 10.0, 20.0, 30.0, 40.0, 50.0, 60.0, 70.0, 80.0, 90.0, 100.0, 110.0}, "Binning of the centrality axis"};
ConfigurableAxis cfgCentAxis{"cfgCentAxis", {VARIABLE_WIDTH, 0.0, 1.0, 5.0, 10.0, 20.0, 30.0, 40.0, 50.0, 60.0, 70.0, 80.0, 90.0, 100.0}, "Binning of the centrality axis"};
Configurable<bool> cfgOccupancySel{"cfgOccupancySel", false, "Occupancy selection"};
Configurable<int> cfgOccupancyMax{"cfgOccupancyMax", 999999, "maximum occupancy of tracks in neighbouring collisions in a given time range"};
Configurable<int> cfgOccupancyMin{"cfgOccupancyMin", -100, "minimum occupancy of tracks in neighbouring collisions in a given time range"};

// Track Selection
// General
Expand All @@ -90,6 +93,11 @@
// PID
Configurable<bool> cfgTrackTPCPID{"cfgTrackTPCPID", true, "Enables TPC PID"};
Configurable<bool> cfgTrackTOFPID{"cfgTrackTOFPID", true, "Enables TOF PID"};
Configurable<bool> cfgTrackSquarePIDCut{"cfgTrackSqurePIDCut", true, "Enables PID cut shape square switch"};
Configurable<bool> cfgTrackCirclePIDCut{"cfgTrackCirclePIDCut", true, "Enables PID cut shape circle switch"};
Configurable<int> cfgTrackCircleValue{"cfgTrackCircleValue", 2, "Enables TOF TPC PID circle cut value"};
Configurable<bool> cfgTrackTOFHard{"cfgTrackTOFHard", false, "Enables TOF Hard"};

Configurable<float> cfgTrackTPCPIDnSig{"cfgTrackTPCPIDnSig", 4.0, "nTPC PID sigma"};
Configurable<float> cfgTrackTOFPIDnSig{"cfgTrackTOFPIDnSig", 4.0, "nTOF PID sigma"};
Configurable<int> cDebugLevel{"cDebugLevel", 0, "Resolution of Debug"};
Expand All @@ -98,6 +106,7 @@
ConfigurableAxis cfgBinsMixMult{"cfgBinsCent", {VARIABLE_WIDTH, 0.0, 1.0, 5.0, 10.0, 20.0, 30.0, 40.0, 50.0, 60.0, 70.0, 80.0, 90.0, 100.0, 110.0}, "Binning of the centrality axis"};
ConfigurableAxis cfgBinsMixVtx{"cfgBinsMixVtx", {VARIABLE_WIDTH, -10.0f, -5.f, 0.f, 5.f, 10.f}, "Mixing bins - z-vertex"};
Configurable<int> cfgMixNMixedEvents{"cfgMixNMixedEvents", 10, "Number of mixed events per event"};
Configurable<int> cfgVtxMixCut{"cfgVtxMixCut", 10, "Vertex Mix Cut"};

// MCGen
Configurable<bool> cfgForceGenReco{"cfgForceGenReco", false, "Only consider events which are reconstructed (neglect event-loss)"};
Expand Down Expand Up @@ -181,14 +190,8 @@
}

if (cfgMcHistos) {
histos.add("hPion_PID_Purity", "hPion_PID_Purity", kTH1F, {{3, -1.5, 1.5}});
histos.add("hKaon_PID_Purity", "hKaon_PID_Purity", kTH1F, {{3, -1.5, 1.5}});
histos.add("hSimplePion_PID_Purity", "hSimplePion_PID_Purity", kTH1F, {{3, -1.5, 1.5}});
histos.add("hSimpleKaon_PID_Purity", "hSimpleKaon_PID_Purity", kTH1F, {{3, -1.5, 1.5}});

histos.add("nEvents_MC", "nEvents_MC", kTH1F, {{4, 0.0, 4.0}});
histos.add("nEvents_MC_True", "nEvents_MC_True", kTH1F, {{4, 0.0, 4.0}});

histos.add("hMC_kstar_True", "hMC_kstar_True", kTHnSparseF, {cfgCentAxis, ptAxis});

histos.add("hMC_USS_True", "hMC_USS_True", kTHnSparseF, {cfgCentAxis, ptAxis, minvAxis});
Expand Down Expand Up @@ -248,6 +251,10 @@
return false;
if (!event.selection_bit(aod::evsel::kNoCollInTimeRangeStandard))
return false;
if (!event.selection_bit(o2::aod::evsel::kIsGoodITSLayersAll))
return false;
if (cfgOccupancySel && (event.trackOccupancyInTimeRange() > cfgOccupancyMax || event.trackOccupancyInTimeRange() < cfgOccupancyMin))
return false;

if (cfgEventCutQA) {
histos.fill(HIST("hPosZ_AC"), event.posZ());
Expand Down Expand Up @@ -322,19 +329,42 @@
histos.fill(HIST("QA_nSigma_kaon_TOF_BC"), candidate.pt(), candidate.tofNSigmaKa());
histos.fill(HIST("QA_kaon_TPC_TOF_BC"), candidate.tpcNSigmaKa(), candidate.tofNSigmaKa());
}

double tpcpid = 0;
double tofpid = 0;
bool tpcPIDPassed{false}, tofPIDPassed{false};
// TPC
if (std::abs(candidate.tpcNSigmaKa()) < cfgTrackTPCPIDnSig)
tpcPIDPassed = true;
// TOF
if (candidate.hasTOF()) {
if (std::abs(candidate.tofNSigmaKa()) < cfgTrackTOFPIDnSig) {
if (cfgTrackSquarePIDCut) {
if (std::abs(candidate.tpcNSigmaKa()) < cfgTrackTPCPIDnSig)
tpcPIDPassed = true;
if (candidate.hasTOF()) {
if (std::abs(candidate.tofNSigmaKa()) < cfgTrackTOFPIDnSig) {
tofPIDPassed = true;
}
} else {
if (!cfgTrackTOFHard) {
tofPIDPassed = true;
} else {
tofPIDPassed = false;
}
}
} // end of square cut
if (cfgTrackCirclePIDCut) {
if (std::abs(candidate.tpcNSigmaKa()) < cfgTrackTPCPIDnSig)
tpcpid = std::abs(candidate.tpcNSigmaKa());
tofpid = 0;

if (candidate.hasTOF()) {
tofpid = std::abs(candidate.tofNSigmaKa());
} else {
if (cfgTrackTOFHard) {
tofpid = 999;
}
}
if (std::sqrt(tpcpid * tpcpid + tofpid * tofpid) < cfgTrackCircleValue) {
tpcPIDPassed = true;
tofPIDPassed = true;
}
} else {
tofPIDPassed = true;
}
} // circular cut
// TPC & TOF
if (tpcPIDPassed && tofPIDPassed) {
if (cfgTrackCutQA && QA) {
Expand All @@ -355,18 +385,44 @@
histos.fill(HIST("QA_nSigma_pion_TOF_BC"), candidate.pt(), candidate.tofNSigmaPi());
histos.fill(HIST("QA_pion_TPC_TOF_BC"), candidate.tpcNSigmaPi(), candidate.tofNSigmaPi());
}
double tpcpid = 0;
double tofpid = 0;
bool tpcPIDPassed{false}, tofPIDPassed{false};
// TPC
if (std::abs(candidate.tpcNSigmaPi()) < cfgTrackTPCPIDnSig)
tpcPIDPassed = true;
if (candidate.hasTOF()) {
if (std::abs(candidate.tofNSigmaPi()) < cfgTrackTOFPIDnSig) {
if (cfgTrackSquarePIDCut) {
if (std::abs(candidate.tpcNSigmaPi()) < cfgTrackTPCPIDnSig)
tpcPIDPassed = true;
if (candidate.hasTOF()) {
if (std::abs(candidate.tofNSigmaPi()) < cfgTrackTOFPIDnSig) {
tofPIDPassed = true;
}
} else {
if (!cfgTrackTOFHard) {
tofPIDPassed = true;
} else {
tofPIDPassed = false;
}
}
} // end of square cut
if (cfgTrackCirclePIDCut) {
if (std::abs(candidate.tpcNSigmaPi()) < cfgTrackTPCPIDnSig)
tpcpid = std::abs(candidate.tpcNSigmaPi());
tofpid = 0;

if (candidate.hasTOF()) {
tofpid = std::abs(candidate.tofNSigmaPi());
} else {
if (cfgTrackTOFHard) {
tofpid = 999;
}
}
if (std::sqrt(tpcpid * tpcpid + tofpid * tofpid) < cfgTrackCircleValue) {
tpcPIDPassed = true;
tofPIDPassed = true;
}
} else {
tofPIDPassed = true;
}
// TPC & TOF
} // circular cut

// TPC & TOF
if (tpcPIDPassed && tofPIDPassed) {
if (cfgTrackCutQA && QA) {
histos.fill(HIST("QA_nSigma_pion_TPC_AC"), candidate.pt(), candidate.tpcNSigmaPi());
Expand Down Expand Up @@ -421,8 +477,6 @@
auto centrality = collision1.centFT0C();

std::vector<int> mcMemory;
std::vector<int> PIDPurityKey_Kaon;
std::vector<int> PIDPurityKey_Pion;

for (const auto& [trk1, trk2] : combinations(o2::soa::CombinationsFullIndexPolicy(tracks1, tracks2))) {
if (!trk1.has_mcParticle() || !trk2.has_mcParticle())
Expand Down Expand Up @@ -476,23 +530,23 @@
mothers2PDG.push_back(particle2_mom.pdgCode());
}

if (mothers1PDG[0] != 313)

Check failure on line 533 in PWGLF/Tasks/Resonances/kstarInOO.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.
continue; // mother not K*0
if (mothers2PDG[0] != 313)

Check failure on line 535 in PWGLF/Tasks/Resonances/kstarInOO.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.
continue; // mothers not K*0

if (mothers1[0] != mothers2[0])
continue; // Kaon and pion not from the same K*0

if (std::fabs(particle1.pdgCode()) != 211 && std::fabs(particle1.pdgCode()) != 321)

Check failure on line 541 in PWGLF/Tasks/Resonances/kstarInOO.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.
continue;
if (std::fabs(particle2.pdgCode()) != 211 && std::fabs(particle2.pdgCode()) != 321)

Check failure on line 543 in PWGLF/Tasks/Resonances/kstarInOO.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.
continue;

double track1_mass, track2_mass;
bool track1f{false}; // true means pion

if (std::fabs(particle1.pdgCode()) == 211) {

Check failure on line 549 in PWGLF/Tasks/Resonances/kstarInOO.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.
track1f = true;
track1_mass = massPi;
} else {
Expand All @@ -518,7 +572,7 @@
mcMemory.push_back(trk2.globalIndex());
}

TLorentzVector lDecayDaughter1, lDecayDaughter2, lResonance;

Check failure on line 575 in PWGLF/Tasks/Resonances/kstarInOO.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[root/lorentz-vector]

Do not use the TLorentzVector legacy class. Use std::array with RecoDecay methods or the ROOT::Math::LorentzVector template instead.
lDecayDaughter1.SetXYZM(trk1.px(), trk1.py(), trk1.pz(), track1_mass);
lDecayDaughter2.SetXYZM(trk2.px(), trk2.py(), trk2.pz(), track2_mass);
lResonance = lDecayDaughter1 + lDecayDaughter2;
Expand All @@ -544,13 +598,10 @@
if (!trackPIDKaon(trk1, QA) || !trackPIDPion(trk2, QA))
return {-1.0, -1.0};

// if (trk1.index() >= trk2.index())
// return {-1.0, -1.0};
// I checked that index and globalIndex was same function
if (trk1.globalIndex() >= trk2.globalIndex())
return {-1.0, -1.0};

TLorentzVector lDecayDaughter1, lDecayDaughter2, lResonance;

Check failure on line 604 in PWGLF/Tasks/Resonances/kstarInOO.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[root/lorentz-vector]

Do not use the TLorentzVector legacy class. Use std::array with RecoDecay methods or the ROOT::Math::LorentzVector template instead.
if (!flip) {
lDecayDaughter1.SetXYZM(trk1.px(), trk1.py(), trk1.pz(), massKa);
lDecayDaughter2.SetXYZM(trk2.px(), trk2.py(), trk2.pz(), massPi);
Expand Down Expand Up @@ -626,9 +677,20 @@
}
auto goodEv1 = eventSelection(collision1);
auto goodEv2 = eventSelection(collision2);
bool VtxMixFlag = false;
bool CentMixFlag = false;
// bool OccupanacyMixFlag = false;
if (std::fabs(collision1.posZ() - collision2.posZ()) <= cfgVtxMixCut) // set default to maybe 10
VtxMixFlag = true;
if (std::fabs(collision1.centFT0C() - collision2.centFT0C()) <= cfgVtxMixCut) // set default to maybe 10
CentMixFlag = true;

if (!goodEv1 || !goodEv2)
continue;
if (!CentMixFlag)
continue;
if (!VtxMixFlag)
continue;

TrackSlicing(collision1, tracks1, collision2, tracks2, true, false);
}
Expand Down Expand Up @@ -669,36 +731,6 @@
if (!INELgt0)
return;

auto tracks1 = kaonMC->sliceByCached(aod::track::collisionId, collision.globalIndex(), cache);
for (const auto& kaon : tracks1) {
if (!trackSelection(kaon, false))
continue;
if (!trackPIDKaon(kaon, false))
continue;
auto particle1 = kaon.mcParticle();
if (std::fabs(particle1.pdgCode()) == 321)
histos.fill(HIST("hSimpleKaon_PID_Purity"), 1); // histogram with two bins, -1.5, 1.5 fill 1 or -1
else if (std::fabs(particle1.pdgCode()) == 211)
histos.fill(HIST("hSimpleKaon_PID_Purity"), -1); // histogram with two bins, -1.5, 1.5 fill 1 or -1
else
histos.fill(HIST("hSimpleKaon_PID_Purity"), 0); // histogram with two bins, -1.5, 1.5 fill 1 or -1
}

auto tracks2 = pionMC->sliceByCached(aod::track::collisionId, collision.globalIndex(), cache);
for (const auto& pion : tracks2) {
if (!trackSelection(pion, false))
continue;
if (!trackPIDPion(pion, false))
continue;
auto particle2 = pion.mcParticle();
if (std::fabs(particle2.pdgCode()) == 211)
histos.fill(HIST("hSimplePion_PID_Purity"), 1); // histogram with two bins, -1.5, 1.5 fill 1 or -1
else if (std::fabs(particle2.pdgCode()) == 321)
histos.fill(HIST("hSimplePion_PID_Purity"), -1); // histogram with two bins, -1.5, 1.5 fill 1 or -1
else
histos.fill(HIST("hSimplePion_PID_Purity"), 0); // histogram with two bins, -1.5, 1.5 fill 1 or -1
}

if (cfgMcHistos) {
histos.fill(HIST("nEvents_MC"), 1.5);
}
Expand Down Expand Up @@ -747,7 +779,7 @@
++nEventsTrue;
}

if (fabs(collision.posZ()) > cfgEventVtxCut)

Check failure on line 782 in PWGLF/Tasks/Resonances/kstarInOO.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[std-prefix]

Use std:: prefix for names from the std namespace.
return;
if (recocolls.size() <= 0) { // not reconstructed
if (cfgForceGenReco) {
Expand Down
Loading