Skip to content

Commit 8c68ee8

Browse files
authored
[PWGLF] nuclei-proton correlation: fix processGen and add antip-p correlation (#13200)
1 parent 2cc7f7f commit 8c68ee8

File tree

1 file changed

+59
-35
lines changed

1 file changed

+59
-35
lines changed

PWGLF/Tasks/Nuspex/hadronnucleicorrelation.cxx

Lines changed: 59 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,8 @@ struct hadronnucleicorrelation {
179179
std::vector<std::shared_ptr<TH3>> hPIDEtaPhiGen_AntiDeAntiPr_ME;
180180
std::vector<std::shared_ptr<TH3>> hEtaPhiGen_AntiPrAntiPr_SE;
181181
std::vector<std::shared_ptr<TH3>> hEtaPhiGen_AntiPrAntiPr_ME;
182+
std::vector<std::shared_ptr<TH3>> hEtaPhiGen_AntiPrPr_SE;
183+
std::vector<std::shared_ptr<TH3>> hEtaPhiGen_AntiPrPr_ME;
182184

183185
int nBinspT;
184186
TH2F* hEffpTEta_proton;
@@ -264,6 +266,13 @@ struct hadronnucleicorrelation {
264266
auto htempMEGen_AntiPrAntiPr = registry.add<TH3>(Form("hEtaPhiGen_AntiPrAntiPr_ME_pt%02.0f%02.0f", pTBins.value.at(i) * 10, pTBins.value.at(i + 1) * 10),
265267
Form("Gen #Delta#eta#Delta#phi (%.1f<p_{T} #bar{p} <%.1f GeV/c)", pTBins.value.at(i), pTBins.value.at(i + 1)), {HistType::kTH3F, {DeltaEtaAxis, DeltaPhiAxis, ptBinnedAxis}});
266268
hEtaPhiGen_AntiPrAntiPr_ME.push_back(std::move(htempMEGen_AntiPrAntiPr));
269+
270+
auto htempSEGen_AntiPrPr = registry.add<TH3>(Form("hEtaPhiGen_AntiPrPr_SE_pt%02.0f%02.0f", pTBins.value.at(i) * 10, pTBins.value.at(i + 1) * 10),
271+
Form("Gen #Delta#eta#Delta#phi (%.1f<p_{T} p <%.1f GeV/c)", pTBins.value.at(i), pTBins.value.at(i + 1)), {HistType::kTH3F, {DeltaEtaAxis, DeltaPhiAxis, ptBinnedAxis}});
272+
hEtaPhiGen_AntiPrPr_SE.push_back(std::move(htempSEGen_AntiPrPr));
273+
auto htempMEGen_AntiPrPr = registry.add<TH3>(Form("hEtaPhiGen_AntiPrPr_ME_pt%02.0f%02.0f", pTBins.value.at(i) * 10, pTBins.value.at(i + 1) * 10),
274+
Form("Gen #Delta#eta#Delta#phi (%.1f<p_{T} p <%.1f GeV/c)", pTBins.value.at(i), pTBins.value.at(i + 1)), {HistType::kTH3F, {DeltaEtaAxis, DeltaPhiAxis, ptBinnedAxis}});
275+
hEtaPhiGen_AntiPrPr_ME.push_back(std::move(htempMEGen_AntiPrPr));
267276
}
268277
}
269278

@@ -713,7 +722,7 @@ struct hadronnucleicorrelation {
713722
}
714723

715724
template <int ME, typename Type>
716-
void mixMCParticles(Type const& particles1, Type const& particles2)
725+
void mixMCParticles(Type const& particles1, Type const& particles2, bool ispap)
717726
{
718727
for (auto const& it1 : particles1) {
719728
for (auto const& it2 : particles2) {
@@ -726,9 +735,15 @@ struct hadronnucleicorrelation {
726735
if (it1->pt() >= pTBins.value.at(k) && it1->pt() < pTBins.value.at(k + 1)) {
727736
// Use correct histogram based on ME flag
728737
if constexpr (ME) {
729-
hEtaPhiGen_AntiDeAntiPr_ME[k]->Fill(deltaEtaGen, deltaPhiGen, it2->pt());
738+
if (ispap)
739+
hEtaPhiGen_AntiPrPr_ME[k]->Fill(deltaEtaGen, deltaPhiGen, it2->pt());
740+
else
741+
hEtaPhiGen_AntiDeAntiPr_ME[k]->Fill(deltaEtaGen, deltaPhiGen, it2->pt());
730742
} else {
731-
hEtaPhiGen_AntiDeAntiPr_SE[k]->Fill(deltaEtaGen, deltaPhiGen, it2->pt());
743+
if (ispap)
744+
hEtaPhiGen_AntiPrPr_SE[k]->Fill(deltaEtaGen, deltaPhiGen, it2->pt());
745+
else
746+
hEtaPhiGen_AntiDeAntiPr_SE[k]->Fill(deltaEtaGen, deltaPhiGen, it2->pt());
732747
}
733748
}
734749
}
@@ -1273,18 +1288,16 @@ struct hadronnucleicorrelation {
12731288
bool isDe = (IsDeuteron(track, +1) && track.pdgCode() == pdgDeuteron);
12741289
bool isAntiDe = (IsDeuteron(track, -1) && track.pdgCode() == -pdgDeuteron);
12751290

1276-
if (track.origin() == 1 || track.origin() == 0) { // primaries and secondaries
1277-
if (isPr) {
1278-
registry.fill(HIST("hPrimSec_EtaPhiPt_Proton"), track.eta(), track.phi(), track.pt() * +1);
1279-
if (track.origin() == 1) { // secondaries
1280-
registry.fill(HIST("hSec_EtaPhiPt_Proton"), track.eta(), track.phi(), track.pt() * +1);
1281-
}
1291+
if (isPr) {
1292+
registry.fill(HIST("hPrimSec_EtaPhiPt_Proton"), track.eta(), track.phi(), track.pt() * +1);
1293+
if (track.origin() == 1 || track.origin() == 2) { // secondaries
1294+
registry.fill(HIST("hSec_EtaPhiPt_Proton"), track.eta(), track.phi(), track.pt() * +1);
12821295
}
1283-
if (isAntiPr) {
1284-
registry.fill(HIST("hPrimSec_EtaPhiPt_Proton"), track.eta(), track.phi(), track.pt() * -1);
1285-
if (track.origin() == 1) {
1286-
registry.fill(HIST("hSec_EtaPhiPt_Proton"), track.eta(), track.phi(), track.pt() * -1);
1287-
}
1296+
}
1297+
if (isAntiPr) {
1298+
registry.fill(HIST("hPrimSec_EtaPhiPt_Proton"), track.eta(), track.phi(), track.pt() * -1);
1299+
if (track.origin() == 1 || track.origin() == 2) {
1300+
registry.fill(HIST("hSec_EtaPhiPt_Proton"), track.eta(), track.phi(), track.pt() * -1);
12881301
}
12891302
}
12901303

@@ -1769,25 +1782,10 @@ struct hadronnucleicorrelation {
17691782
selectedparticlesMC_antid[particle.mcCollisionId()].push_back(std::make_shared<decltype(particle)>(particle));
17701783
}
17711784
if (particle.pdgCode() == pdgProton) {
1772-
if (!particle.has_daughters()) {
1773-
selectedparticlesMC_p[particle.mcCollisionId()].push_back(std::make_shared<decltype(particle)>(particle));
1774-
registry.fill(HIST("Generated/hQAProtons"), 3.5);
1775-
} else {
1776-
bool isd = false;
1777-
for (auto& dau : particle.daughters_as<aod::McParticles>()) {
1778-
if (dau.pdgCode() == pdgDeuteron) {
1779-
isd = true;
1780-
}
1781-
}
1782-
if (isd) {
1783-
registry.fill(HIST("Generated/hQAProtons"), 4.5);
1784-
}
1785-
}
1785+
selectedparticlesMC_p[particle.mcCollisionId()].push_back(std::make_shared<decltype(particle)>(particle));
17861786
}
17871787
if (particle.pdgCode() == -pdgProton) {
1788-
if (!particle.has_daughters()) {
1789-
selectedparticlesMC_antip[particle.mcCollisionId()].push_back(std::make_shared<decltype(particle)>(particle));
1790-
}
1788+
selectedparticlesMC_antip[particle.mcCollisionId()].push_back(std::make_shared<decltype(particle)>(particle));
17911789
}
17921790
}
17931791

@@ -1798,7 +1796,7 @@ struct hadronnucleicorrelation {
17981796
// anti-d - anti-p correlation
17991797
if (selectedparticlesMC_antid.find(collision1.globalIndex()) != selectedparticlesMC_antid.end()) {
18001798
if (selectedparticlesMC_antip.find(collision1.globalIndex()) != selectedparticlesMC_antip.end()) {
1801-
mixMCParticles<0>(selectedparticlesMC_antid[collision1.globalIndex()], selectedparticlesMC_antip[collision1.globalIndex()]); // mixing SE
1799+
mixMCParticles<0>(selectedparticlesMC_antid[collision1.globalIndex()], selectedparticlesMC_antip[collision1.globalIndex()], 0); // mixing SE
18021800
}
18031801

18041802
int stop1 = 0;
@@ -1814,7 +1812,7 @@ struct hadronnucleicorrelation {
18141812
}
18151813

18161814
if (selectedparticlesMC_antip.find(collision2.globalIndex()) != selectedparticlesMC_antip.end()) {
1817-
mixMCParticles<1>(selectedparticlesMC_antid[collision1.globalIndex()], selectedparticlesMC_antip[collision2.globalIndex()]); // mixing ME
1815+
mixMCParticles<1>(selectedparticlesMC_antid[collision1.globalIndex()], selectedparticlesMC_antip[collision2.globalIndex()], 0); // mixing ME
18181816
}
18191817

18201818
stop1++;
@@ -1825,7 +1823,7 @@ struct hadronnucleicorrelation {
18251823
if (domatterGen) {
18261824
if (selectedparticlesMC_d.find(collision1.globalIndex()) != selectedparticlesMC_d.end()) {
18271825
if (selectedparticlesMC_p.find(collision1.globalIndex()) != selectedparticlesMC_p.end()) {
1828-
mixMCParticles<0>(selectedparticlesMC_d[collision1.globalIndex()], selectedparticlesMC_p[collision1.globalIndex()]); // mixing SE
1826+
mixMCParticles<0>(selectedparticlesMC_d[collision1.globalIndex()], selectedparticlesMC_p[collision1.globalIndex()], 0); // mixing SE
18291827
}
18301828

18311829
int stop2 = 0;
@@ -1841,7 +1839,7 @@ struct hadronnucleicorrelation {
18411839
}
18421840

18431841
if (selectedparticlesMC_p.find(collision2.globalIndex()) != selectedparticlesMC_p.end()) {
1844-
mixMCParticles<1>(selectedparticlesMC_d[collision1.globalIndex()], selectedparticlesMC_p[collision2.globalIndex()]); // mixing ME
1842+
mixMCParticles<1>(selectedparticlesMC_d[collision1.globalIndex()], selectedparticlesMC_p[collision2.globalIndex()], 0); // mixing ME
18451843
}
18461844

18471845
stop2++;
@@ -1899,6 +1897,32 @@ struct hadronnucleicorrelation {
18991897
}
19001898
}
19011899
}
1900+
1901+
// p-antip correlation
1902+
if (selectedparticlesMC_p.find(collision1.globalIndex()) != selectedparticlesMC_p.end()) {
1903+
if (selectedparticlesMC_antip.find(collision1.globalIndex()) != selectedparticlesMC_antip.end()) {
1904+
mixMCParticles<0>(selectedparticlesMC_p[collision1.globalIndex()], selectedparticlesMC_antip[collision1.globalIndex()], 1); // mixing SE
1905+
}
1906+
1907+
int stop5 = 0;
1908+
1909+
for (auto collision2 : mcCollisions) { // nested loop on collisions
1910+
1911+
if (collision1.globalIndex() == collision2.globalIndex()) {
1912+
continue;
1913+
}
1914+
1915+
if (stop5 > maxmixcollsGen) {
1916+
break;
1917+
}
1918+
1919+
if (selectedparticlesMC_antip.find(collision2.globalIndex()) != selectedparticlesMC_antip.end()) {
1920+
mixMCParticles<1>(selectedparticlesMC_p[collision1.globalIndex()], selectedparticlesMC_antip[collision2.globalIndex()], 1); // mixing ME
1921+
}
1922+
1923+
stop5++;
1924+
}
1925+
}
19021926
}
19031927

19041928
// clearing up

0 commit comments

Comments
 (0)