Skip to content

Commit e6a70f7

Browse files
authored
[PWGLF] isDCAPureSample for MC histograms (#9579)
1 parent 9d2fc17 commit e6a70f7

File tree

1 file changed

+110
-100
lines changed

1 file changed

+110
-100
lines changed

PWGLF/Tasks/Nuspex/spectraTOF.cxx

Lines changed: 110 additions & 100 deletions
Original file line numberDiff line numberDiff line change
@@ -1696,113 +1696,127 @@ struct tofSpectra { // o2-linter: disable=name/struct
16961696
return;
16971697
}
16981698

1699-
if (enableDCAvsmotherHistograms) {
1700-
hDcaXYMC[i]->Fill(track.pt(), track.dcaXY());
1701-
hDcaZMC[i]->Fill(track.pt(), track.dcaZ());
1699+
const auto& nsigmaTPCKa = o2::aod::pidutils::tpcNSigma<3>(track);
1700+
1701+
bool isKaonTPC = std::abs(nsigmaTPCKa) < trkselOptions.cfgCutNsigma;
1702+
1703+
const auto& nsigmaTOFKa = o2::aod::pidutils::tofNSigma<3>(track);
1704+
1705+
bool isKaonTOF = std::abs(nsigmaTOFKa) < trkselOptions.cfgCutNsigma;
1706+
1707+
// Filling DCA info with the TPC+TOF PID
1708+
bool isDCAPureSample = (std::sqrt(nsigmaTOFKa * nsigmaTOFKa + nsigmaTPCKa * nsigmaTPCKa) < 2.f);
1709+
if (track.pt() <= 0.4) {
1710+
isDCAPureSample = (nsigmaTPCKa < 1.f);
17021711
}
1703-
if (!mcParticle.isPhysicalPrimary()) { // Secondaries (weak decays and material)
1704-
if (mcParticle.getProcess() == 4) {
1705-
if (enableDCAxyzHistograms) {
1706-
hDcaXYZStr[i]->Fill(track.pt(), track.dcaXY(), track.dcaZ());
1707-
} else {
1708-
histos.fill(HIST(hdcaxystr[i]), track.pt(), track.dcaXY());
1709-
histos.fill(HIST(hdcazstr[i]), track.pt(), track.dcaZ());
1710-
}
17111712

1712-
if (mcParticle.has_mothers()) {
1713-
for (const auto& mother : mcParticle.template mothers_as<aod::McParticles>()) {
1714-
auto daughter0 = mother.template daughters_as<aod::McParticles>().begin();
1715-
double vertexDau[3] = {daughter0.vx(), daughter0.vy(), daughter0.vz()};
1716-
double vertexMoth[3] = {mother.vx(), mother.vy(), mother.vz()};
1717-
auto decayLength = RecoDecay::distance(vertexMoth, vertexDau);
1718-
hDecayLengthStr[i]->Fill(track.pt(), decayLength);
1713+
if (isDCAPureSample) {
1714+
if (enableDCAvsmotherHistograms) {
1715+
hDcaXYMC[i]->Fill(track.pt(), track.dcaXY());
1716+
hDcaZMC[i]->Fill(track.pt(), track.dcaZ());
1717+
}
1718+
1719+
if (!mcParticle.isPhysicalPrimary()) { // Secondaries (weak decays and material)
1720+
if (mcParticle.getProcess() == 4) {
1721+
if (enableDCAxyzHistograms) {
1722+
hDcaXYZStr[i]->Fill(track.pt(), track.dcaXY(), track.dcaZ());
1723+
} else {
1724+
histos.fill(HIST(hdcaxystr[i]), track.pt(), track.dcaXY());
1725+
histos.fill(HIST(hdcazstr[i]), track.pt(), track.dcaZ());
1726+
}
1727+
1728+
if (mcParticle.has_mothers()) {
1729+
for (const auto& mother : mcParticle.template mothers_as<aod::McParticles>()) {
1730+
auto daughter0 = mother.template daughters_as<aod::McParticles>().begin();
1731+
double vertexDau[3] = {daughter0.vx(), daughter0.vy(), daughter0.vz()};
1732+
double vertexMoth[3] = {mother.vx(), mother.vy(), mother.vz()};
1733+
auto decayLength = RecoDecay::distance(vertexMoth, vertexDau);
1734+
hDecayLengthStr[i]->Fill(track.pt(), decayLength);
1735+
}
1736+
}
1737+
} else {
1738+
if (enableDCAxyzHistograms) {
1739+
hDcaXYZMat[i]->Fill(track.pt(), track.dcaXY(), track.dcaZ());
1740+
} else {
1741+
histos.fill(HIST(hdcaxymat[i]), track.pt(), track.dcaXY());
1742+
histos.fill(HIST(hdcazmat[i]), track.pt(), track.dcaZ());
17191743
}
17201744
}
1721-
} else {
1745+
} else { // Primaries
17221746
if (enableDCAxyzHistograms) {
1723-
hDcaXYZMat[i]->Fill(track.pt(), track.dcaXY(), track.dcaZ());
1747+
hDcaXYZPrm[i]->Fill(track.pt(), track.dcaXY(), track.dcaZ());
1748+
if (enableDcaGoodEvents.value && collision.has_mcCollision()) {
1749+
histos.fill(HIST(hdcaxyprmgoodevs[i]), track.pt(), track.dcaXY(), track.dcaZ());
1750+
}
17241751
} else {
1725-
histos.fill(HIST(hdcaxymat[i]), track.pt(), track.dcaXY());
1726-
histos.fill(HIST(hdcazmat[i]), track.pt(), track.dcaZ());
1752+
// DCAxy for all primaries
1753+
histos.fill(HIST(hdcaxyprm[i]), track.pt(), track.dcaXY());
1754+
histos.fill(HIST(hdcazprm[i]), track.pt(), track.dcaZ());
17271755
}
1728-
}
1729-
} else { // Primaries
1730-
if (enableDCAxyzHistograms) {
1731-
hDcaXYZPrm[i]->Fill(track.pt(), track.dcaXY(), track.dcaZ());
17321756
if (enableDcaGoodEvents.value && collision.has_mcCollision()) {
1733-
histos.fill(HIST(hdcaxyprmgoodevs[i]), track.pt(), track.dcaXY(), track.dcaZ());
1734-
}
1735-
} else {
1736-
// DCAxy for all primaries
1737-
histos.fill(HIST(hdcaxyprm[i]), track.pt(), track.dcaXY());
1738-
histos.fill(HIST(hdcazprm[i]), track.pt(), track.dcaZ());
1739-
}
1740-
if (enableDcaGoodEvents.value && collision.has_mcCollision()) {
1741-
histos.fill(HIST(hdcaxyprmgoodevs[i]), track.pt(), track.dcaXY());
1742-
histos.fill(HIST(hdcazprmgoodevs[i]), track.pt(), track.dcaZ());
1743-
}
1744-
1745-
if (enableDCAvsmotherHistograms) {
1746-
bool IsD0Mother = false; // o2-linter: disable=name/function-variable
1747-
bool IsCharmMother = false; // o2-linter: disable=name/function-variable
1748-
bool IsBeautyMother = false; // o2-linter: disable=name/function-variable
1749-
bool IsNotHFMother = false; // o2-linter: disable=name/function-variable
1750-
if (mcParticle.has_mothers()) {
1751-
const int charmOrigin = RecoDecay::getCharmHadronOrigin(mcParticles, mcParticle, false);
1752-
for (const auto& mother : mcParticle.template mothers_as<aod::McParticles>()) {
1753-
const int motherPdgCode = std::abs(mother.pdgCode());
1754-
if (motherPdgCode == 421) {
1755-
IsD0Mother = true;
1756-
}
1757-
if (charmOrigin == RecoDecay::OriginType::NonPrompt) {
1758-
IsBeautyMother = true;
1759-
LOG(info) << "Charm Origin for Beauty: " << charmOrigin;
1760-
}
1761-
if (charmOrigin == RecoDecay::OriginType::Prompt) {
1762-
IsCharmMother = true;
1763-
LOG(info) << "Charm Origin for Charm: " << charmOrigin;
1764-
}
1765-
if (charmOrigin == RecoDecay::OriginType::None) {
1766-
IsNotHFMother = true;
1767-
LOG(info) << "Charm Origin for NotHF: " << charmOrigin;
1757+
histos.fill(HIST(hdcaxyprmgoodevs[i]), track.pt(), track.dcaXY());
1758+
histos.fill(HIST(hdcazprmgoodevs[i]), track.pt(), track.dcaZ());
1759+
}
1760+
1761+
if (enableDCAvsmotherHistograms) {
1762+
bool IsD0Mother = false; // o2-linter: disable=name/function-variable
1763+
bool IsCharmMother = false; // o2-linter: disable=name/function-variable
1764+
bool IsBeautyMother = false; // o2-linter: disable=name/function-variable
1765+
bool IsNotHFMother = false; // o2-linter: disable=name/function-variable
1766+
if (mcParticle.has_mothers()) {
1767+
const int charmOrigin = RecoDecay::getCharmHadronOrigin(mcParticles, mcParticle, false);
1768+
for (const auto& mother : mcParticle.template mothers_as<aod::McParticles>()) {
1769+
const int motherPdgCode = std::abs(mother.pdgCode());
1770+
if (motherPdgCode == 421) {
1771+
IsD0Mother = true;
1772+
}
1773+
if (charmOrigin == RecoDecay::OriginType::NonPrompt) {
1774+
IsBeautyMother = true;
1775+
}
1776+
if (charmOrigin == RecoDecay::OriginType::Prompt) {
1777+
IsCharmMother = true;
1778+
}
1779+
if (charmOrigin == RecoDecay::OriginType::None) {
1780+
IsNotHFMother = true;
1781+
}
17681782
}
17691783
}
1770-
}
1771-
if (IsD0Mother) {
1772-
hDcaXYMCD0[i]->Fill(track.pt(), track.dcaXY());
1773-
hDcaZMCD0[i]->Fill(track.pt(), track.dcaZ());
1774-
}
1775-
if (IsCharmMother) {
1776-
hDcaXYMCCharm[i]->Fill(track.pt(), track.dcaXY());
1777-
hdcaZMCCharm[i]->Fill(track.pt(), track.dcaZ());
1778-
}
1779-
if (IsBeautyMother) {
1780-
hDcaXYMCBeauty[i]->Fill(track.pt(), track.dcaXY());
1781-
hDcaZMCBeauty[i]->Fill(track.pt(), track.dcaZ());
1782-
}
1783-
if (IsNotHFMother) {
1784-
hDcaXYMCNotHF[i]->Fill(track.pt(), track.dcaXY());
1785-
hDcaZMCNotHF[i]->Fill(track.pt(), track.dcaZ());
1786-
}
1787-
1788-
if (mcParticle.has_mothers()) {
1789-
for (const auto& mother : mcParticle.template mothers_as<aod::McParticles>()) {
1790-
auto daughter0 = mother.template daughters_as<aod::McParticles>().begin();
1791-
double vertexDau[3] = {daughter0.vx(), daughter0.vy(), daughter0.vz()};
1792-
double vertexMoth[3] = {mother.vx(), mother.vy(), mother.vz()};
1793-
auto decayLength = RecoDecay::distance(vertexMoth, vertexDau);
1784+
if (IsD0Mother) {
1785+
hDcaXYMCD0[i]->Fill(track.pt(), track.dcaXY());
1786+
hDcaZMCD0[i]->Fill(track.pt(), track.dcaZ());
1787+
}
1788+
if (IsCharmMother) {
1789+
hDcaXYMCCharm[i]->Fill(track.pt(), track.dcaXY());
1790+
hdcaZMCCharm[i]->Fill(track.pt(), track.dcaZ());
1791+
}
1792+
if (IsBeautyMother) {
1793+
hDcaXYMCBeauty[i]->Fill(track.pt(), track.dcaXY());
1794+
hDcaZMCBeauty[i]->Fill(track.pt(), track.dcaZ());
1795+
}
1796+
if (IsNotHFMother) {
1797+
hDcaXYMCNotHF[i]->Fill(track.pt(), track.dcaXY());
1798+
hDcaZMCNotHF[i]->Fill(track.pt(), track.dcaZ());
1799+
}
17941800

1795-
if (IsD0Mother) {
1796-
hDecayLengthMCD0[i]->Fill(track.pt(), decayLength);
1797-
}
1798-
if (IsCharmMother) {
1799-
hDecayLengthMCCharm[i]->Fill(track.pt(), decayLength);
1800-
}
1801-
if (IsBeautyMother) {
1802-
hDecayLengthMCBeauty[i]->Fill(track.pt(), decayLength);
1803-
}
1804-
if (IsNotHFMother) {
1805-
hDecayLengthMCNotHF[i]->Fill(track.pt(), decayLength);
1801+
if (mcParticle.has_mothers()) {
1802+
for (const auto& mother : mcParticle.template mothers_as<aod::McParticles>()) {
1803+
auto daughter0 = mother.template daughters_as<aod::McParticles>().begin();
1804+
double vertexDau[3] = {daughter0.vx(), daughter0.vy(), daughter0.vz()};
1805+
double vertexMoth[3] = {mother.vx(), mother.vy(), mother.vz()};
1806+
auto decayLength = RecoDecay::distance(vertexMoth, vertexDau);
1807+
1808+
if (IsD0Mother) {
1809+
hDecayLengthMCD0[i]->Fill(track.pt(), decayLength);
1810+
}
1811+
if (IsCharmMother) {
1812+
hDecayLengthMCCharm[i]->Fill(track.pt(), decayLength);
1813+
}
1814+
if (IsBeautyMother) {
1815+
hDecayLengthMCBeauty[i]->Fill(track.pt(), decayLength);
1816+
}
1817+
if (IsNotHFMother) {
1818+
hDecayLengthMCNotHF[i]->Fill(track.pt(), decayLength);
1819+
}
18061820
}
18071821
}
18081822
}
@@ -1826,19 +1840,15 @@ struct tofSpectra { // o2-linter: disable=name/struct
18261840
}
18271841
int pdgCode = mcParticle.pdgCode();
18281842
const auto& nsigmaTPCPi = o2::aod::pidutils::tpcNSigma<2>(track);
1829-
const auto& nsigmaTPCKa = o2::aod::pidutils::tpcNSigma<3>(track);
18301843
const auto& nsigmaTPCPr = o2::aod::pidutils::tpcNSigma<4>(track);
18311844

18321845
bool isPionTPC = std::abs(nsigmaTPCPi) < trkselOptions.cfgCutNsigma;
1833-
bool isKaonTPC = std::abs(nsigmaTPCKa) < trkselOptions.cfgCutNsigma;
18341846
bool isProtonTPC = std::abs(nsigmaTPCPr) < trkselOptions.cfgCutNsigma;
18351847

18361848
const auto& nsigmaTOFPi = o2::aod::pidutils::tofNSigma<2>(track);
1837-
const auto& nsigmaTOFKa = o2::aod::pidutils::tofNSigma<3>(track);
18381849
const auto& nsigmaTOFPr = o2::aod::pidutils::tofNSigma<4>(track);
18391850

18401851
bool isPionTOF = std::abs(nsigmaTOFPi) < trkselOptions.cfgCutNsigma;
1841-
bool isKaonTOF = std::abs(nsigmaTOFKa) < trkselOptions.cfgCutNsigma;
18421852
bool isProtonTOF = std::abs(nsigmaTOFPr) < trkselOptions.cfgCutNsigma;
18431853

18441854
if (!mcParticle.isPhysicalPrimary()) {

0 commit comments

Comments
 (0)