Skip to content
86 changes: 56 additions & 30 deletions PWGLF/Tasks/Resonances/kstarInOO.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
#include <cmath>
#include <cstddef>
#include <cstdlib>
#include <iostream>

Check failure on line 52 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 <memory>
#include <string>
#include <utility>
Expand Down Expand Up @@ -149,7 +149,8 @@
//|
//======================
Configurable<float> cfgJetpT{"cfgJetpT", 8.0, "Set Jet pT minimum"};
Configurable<float> cfgJetR{"cfgJetR", 0.4, "Set Jet radius parameter"};
Configurable<float> cfgJetR{"cfgJetR", 0.4, "Anti-kT Radius"};
Configurable<float> cfgJetdR{"cfgJetdR", 0.4, "Set Jet radius parameter"};
Configurable<bool> cfgSingleJet{"cfgSingleJet", false, "Enforces strict phi-jet correspondance"};
Configurable<bool> cfgReqJets{"cfgReqJets", false, "False: MB, True: Inside Jets"};
Configurable<std::string> cfgRealTriggerMasks{"cfgRealTriggerMasks", "", "possible JE Trigger masks: fJetChLowPt,fJetChHighPt,fTrackLowPt,fTrackHighPt,fJetD0ChLowPt,fJetD0ChHighPt,fJetLcChLowPt,fJetLcChHighPt,fEMCALReadout,fJetFullHighPt,fJetFullLowPt,fJetNeutralHighPt,fJetNeutralLowPt,fGammaVeryHighPtEMCAL,fGammaVeryHighPtDCAL,fGammaHighPtEMCAL,fGammaHighPtDCAL,fGammaLowPtEMCAL,fGammaLowPtDCAL,fGammaVeryLowPtEMCAL,fGammaVeryLowPtDCAL"};
Expand Down Expand Up @@ -278,8 +279,14 @@
histos.add("missed_kpi_INJets_8_infinite", "missed kpi In Jets with 8 < jetPt < infinite", {HistType::kTH2F, {{120, 0.0, 1.2}, {100, 0., 20.}}});

histos.add("recoveredJetpT_6_8to8_10", "recovered Jet pT", kTH1F, {{2000, 0., 100.}});
histos.add("recoveredJetpT_6_8to8_10_kstarSpectra", "Kstar pT within the recovered Jet pT", kTH1F, {{2000, 0., 100.}});

histos.add("JetMigration", "bin to bin migration", {HistType::kTH2F, {{100, 0.0, 50.0, "True jet pT (GeV/c)"}, {100, 0., 50., "Recovered jet pT (GeV/c)"}}});
histos.add("normalJetpT_8_kstarSpectra", "kstar pT in Jet > 8GeV/c", kTH1F, {{2000, 0., 100.}});
histos.add("normalJetpT_6_8_kstarSpectra", "6 GeV/c < kstar pT in Jet < 8 GeV/c", kTH1F, {{2000, 0., 100.}});
histos.add("normalJetpT_8_10_kstarSpectra", "8 GeV/c < kstar pT in Jet < 10 GeV/c", kTH1F, {{2000, 0., 100.}});
histos.add("normalJetpT_10_12_kstarSpectra", "10 GeV/c < kstar pT in Jet < 12 GeV/c", kTH1F, {{2000, 0., 100.}});

histos.add("JetMigration", "bin to bin migration", {HistType::kTH2F, {{150, 0.0, 15.0, "True jet pT (GeV/c)"}, {150, 0., 15., "Recovered jet pT (GeV/c)"}}});
}

////////////////////////////////////
Expand Down Expand Up @@ -784,6 +791,9 @@
template <typename TracksType>
ROOT::Math::PxPyPzMVector TrueReconstruction(const TracksType& trk1, const TracksType& trk2)
{
constexpr int kaonPdg = 321;

Check failure on line 794 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.
constexpr int pionPdg = 211;

Check failure on line 795 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.
constexpr int kstar0Pdg = 313;

Check failure on line 796 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.
double conjugate = trk1.sign() * trk2.sign();
if (conjugate > 0)
return {};
Expand Down Expand Up @@ -812,26 +822,26 @@
mothers2PDG.push_back(particle2_mom.pdgCode());
}

if (mothers1PDG[0] != 313)
if (mothers1PDG[0] != kstar0Pdg)
return {}; // mother not K*0
if (mothers2PDG[0] != 313)
if (mothers2PDG[0] != kstar0Pdg)
return {}; // mothers not K*0
if (mothers1[0] != mothers2[0])
return {}; // Kaon and pion not from the same K*0

if (std::abs(particle1.pdgCode()) != 211 && std::abs(particle1.pdgCode()) != 321)
if (std::abs(particle1.pdgCode()) != pionPdg && std::abs(particle1.pdgCode()) != kaonPdg)
return {};
if (std::abs(particle2.pdgCode()) != 211 && std::abs(particle2.pdgCode()) != 321)
if (std::abs(particle2.pdgCode()) != pionPdg && std::abs(particle2.pdgCode()) != kaonPdg)
return {};

double track1_mass, track2_mass;
if (std::abs(particle1.pdgCode()) == 211) {
if (std::abs(particle1.pdgCode()) == pionPdg) {
track1_mass = massPi;
} else {
track1_mass = massKa;
}

if (std::abs(particle2.pdgCode()) == 211) {
if (std::abs(particle2.pdgCode()) == pionPdg) {
track2_mass = massPi;
} else {
track2_mass = massKa;
Expand Down Expand Up @@ -1160,6 +1170,10 @@
int nJetMCEvents = 0;
void processMCJets(o2::aod::JetCollision const& collision, JetTrackCandidatesMC const& jetTracks, soa::Filtered<aod::ChargedMCDetectorLevelJets> const& mcdjets, TrackCandidatesMC const&, aod::McParticles const&, aod::JetParticles const&)
{
constexpr int kaonPdg = 321;

Check failure on line 1173 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.
constexpr int pionPdg = 211;

Check failure on line 1174 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.
constexpr int kstar0Pdg = 313;

Check failure on line 1175 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.

if (cDebugLevel > 0) {
nJetMCEvents++;
if ((nJetMCEvents + 1) % 10000 == 0) {
Expand Down Expand Up @@ -1308,21 +1322,21 @@
histos.fill(HIST("hEffRecTest5_pT"), lResonanceTest1.Pt());
}

if (std::abs(particle1.pdgCode()) != 321) // kaon
if (std::abs(particle1.pdgCode()) != kaonPdg) // kaon
continue;

if (cfgJetMCHistos) {
histos.fill(HIST("hEffRecTest6_pT"), lResonanceTest1.Pt());
}

if (std::abs(particle2.pdgCode()) != 211) // pion
if (std::abs(particle2.pdgCode()) != pionPdg) // pion
continue;

if (cfgJetMCHistos) {
histos.fill(HIST("hEffRecTest7_pT"), lResonanceTest1.Pt());
}

if (std::abs(mothers1PDG[0]) != 313)
if (std::abs(mothers1PDG[0]) != kstar0Pdg)
continue; // mother not K*0
if (cfgJetMCHistos) {
histos.fill(HIST("hEffRecTest8_pT"), lResonanceTest1.Pt());
Expand All @@ -1332,7 +1346,7 @@
}
}

if (std::abs(mothers2PDG[0]) != 313)
if (std::abs(mothers2PDG[0]) != kstar0Pdg)
continue; // mothers not K*0

if (cfgJetMCHistos) {
Expand Down Expand Up @@ -1542,7 +1556,7 @@
return;

for (auto& particle : mcParticles) {
if (std::abs(particle.pdgCode()) != 313)

Check failure on line 1559 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::abs(particle.eta()) > cfgTrackMaxEta)
continue;
Expand Down Expand Up @@ -1581,7 +1595,7 @@
}

for (auto& particle : mcParticles) {
if (std::abs(particle.pdgCode()) != 313)

Check failure on line 1598 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; // Not K*0
if (std::abs(particle.eta()) > cfgTrackMaxEta)
continue;
Expand Down Expand Up @@ -1638,7 +1652,7 @@
return;

for (auto& particle : mcParticles) {
if (std::abs(particle.pdgCode()) != 313)

Check failure on line 1655 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::abs(particle.eta()) > cfgTrackMaxEta)
continue;
Expand Down Expand Up @@ -1757,16 +1771,19 @@
bool skip = false;
int daughter_kaon = 0;
int daughter_pion = 0;
constexpr int kaonPdg = 321;
constexpr int pionPdg = 211;

if (!cfgIsKstar) {
for (auto& daughter : mcParticle.daughters_as<aod::JetParticles>()) {
if (std::abs(daughter.pdgCode()) != 321)
if (std::abs(daughter.pdgCode()) != kaonPdg)
skip = true;
}
} else {
for (auto& daughter : mcParticle.daughters_as<aod::JetParticles>()) {
if (std::abs(daughter.pdgCode()) == 321)
if (std::abs(daughter.pdgCode()) == kaonPdg)
++daughter_kaon;
else if (std::abs(daughter.pdgCode()) == 211)
else if (std::abs(daughter.pdgCode()) == pionPdg)
++daughter_pion;
}
if (daughter_kaon != 1 || daughter_pion != 1)
Expand Down Expand Up @@ -1807,7 +1824,7 @@
bestJetEta = mcpjet.eta();
}
} // mcpJets
if (bestR > cfgJetR)
if (bestR > cfgJetdR)
continue;

//==================
Expand All @@ -1818,50 +1835,50 @@
bool pion_out = false;
for (auto& daughter : mcParticle.daughters_as<aod::JetParticles>()) {
if (cfgIsKstar) {
if (std::abs(daughter.pdgCode()) == 321) {
if (std::abs(daughter.pdgCode()) == kaonPdg) {

double dphi_kaon = TVector2::Phi_mpi_pi(bestJetPhi - daughter.phi());
double deta_kaon = bestJetEta - daughter.eta();
dR_kaon = TMath::Sqrt((dphi_kaon * dphi_kaon) + (deta_kaon * deta_kaon));

if (bestR < cfgJetR) {
if (bestR < cfgJetdR) {
if (cfgJetdRHistos) {
histos.fill(HIST("dR_taggedjet_kaon"), dR_kaon, lResonance.Pt());
histos.fill(HIST("dR_taggedjet_all"), dR_kaon, lResonance.Pt());
}
if (dR_kaon > cfgJetR) {
if (dR_kaon > cfgJetdR) {
kaon_out = true;
missing_pt += daughter.pt();
}
} // INSIDE Jets
} // kaon daughter
if (std::abs(daughter.pdgCode()) == 211) {
if (std::abs(daughter.pdgCode()) == pionPdg) {

double dphi_pion = TVector2::Phi_mpi_pi(bestJetPhi - daughter.phi());
double deta_pion = bestJetEta - daughter.eta();
dR_pion = TMath::Sqrt((dphi_pion * dphi_pion) + (deta_pion * deta_pion));

if (bestR < cfgJetR) {
if (bestR < cfgJetdR) {
if (cfgJetdRHistos) {
histos.fill(HIST("dR_taggedjet_pion"), dR_pion, lResonance.Pt());
histos.fill(HIST("dR_taggedjet_all"), dR_pion, lResonance.Pt());

if (bestJetpT > 6.0 && bestJetpT < 8.0)
histos.fill(HIST("dR_taggedjet_all_6_8"), dR_pion, lResonance.Pt());
}
if (dR_pion > cfgJetR) {
if (dR_pion > cfgJetdR) {
pion_out = true;
missing_pt += daughter.pt();
}
} // INSIDE Jets
} // pion daughter
} else {
if (std::abs(daughter.pdgCode()) == 321) {
if (std::abs(daughter.pdgCode()) == kaonPdg) {
double dphi_kaon = TVector2::Phi_mpi_pi(bestJetPhi - daughter.phi());
double deta_kaon = bestJetEta - daughter.eta();
dR_kaon = TMath::Sqrt((dphi_kaon * dphi_kaon) + (deta_kaon * deta_kaon));

if (bestR < cfgJetR) {
if (bestR < cfgJetdR) {
if (cfgJetdRHistos) {
histos.fill(HIST("dR_taggedjet_kaon"), dR_kaon, lResonance.Pt());
histos.fill(HIST("dR_taggedjet_all"), dR_kaon, lResonance.Pt());
Expand All @@ -1870,7 +1887,7 @@
histos.fill(HIST("dR_taggedjet_all_6_8"), dR_kaon, lResonance.Pt());
}

if (dR_kaon > cfgJetR) {
if (dR_kaon > cfgJetdR) {
kaon_out = true;
missing_pt = daughter.pt();
}
Expand All @@ -1883,24 +1900,33 @@
double recoveredJetpT = bestJetpT + missing_pt;
if (cfgJetdRHistos) {
if (bestJetpT > 6.0 && bestJetpT < 8.0) {
histos.fill(HIST("normalJetpT_6_8_kstarSpectra"), lResonance.Pt());
histos.fill(HIST("missed_kpi_INJets_6_8"), (bestJetpT - missing_pt) / bestJetpT, lResonance.Pt());
if (recoveredJetpT > 8.0)
if (recoveredJetpT > 8.0) {
histos.fill(HIST("recoveredJetpT_6_8to8_10"), recoveredJetpT);
histos.fill(HIST("recoveredJetpT_6_8to8_10_kstarSpectra"), lResonance.Pt());
}
}
if (bestJetpT > 8.0 && bestJetpT < 10.0)

if (bestJetpT > 8.0 && bestJetpT < 10.0) {
histos.fill(HIST("missed_kpi_INJets_8_10"), (bestJetpT - missing_pt) / bestJetpT, lResonance.Pt());
if (bestJetpT > 10.0 && bestJetpT < 12.0)
histos.fill(HIST("normalJetpT_8_10_kstarSpectra"), lResonance.Pt());
}
if (bestJetpT > 10.0 && bestJetpT < 12.0) {
histos.fill(HIST("missed_kpi_INJets_10_12"), (bestJetpT - missing_pt) / bestJetpT, lResonance.Pt());
histos.fill(HIST("normalJetpT_10_12_kstarSpectra"), lResonance.Pt());
}
if (bestJetpT > 12.0 && bestJetpT < 15.0)
histos.fill(HIST("missed_kpi_INJets_12_15"), (bestJetpT - missing_pt) / bestJetpT, lResonance.Pt());
if (bestJetpT > 15.0 && bestJetpT < 25.0)
histos.fill(HIST("missed_kpi_INJets_15_25"), (bestJetpT - missing_pt) / bestJetpT, lResonance.Pt());
if (bestJetpT > 25.0)
histos.fill(HIST("missed_kpi_INJets_25_infinite"), (bestJetpT - missing_pt) / bestJetpT, lResonance.Pt());

if (bestJetpT > 8.0)
if (bestJetpT > 8.0) {
histos.fill(HIST("missed_kpi_INJets_8_infinite"), (bestJetpT - missing_pt) / bestJetpT, lResonance.Pt());

histos.fill(HIST("normalJetpT_8_kstarSpectra"), lResonance.Pt());
}
histos.fill(HIST("JetMigration"), bestJetpT, recoveredJetpT);
} // cfgJetdRHistos
} // kaon_out || pion_out
Expand Down
Loading