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
94 changes: 59 additions & 35 deletions PWGLF/Tasks/Nuspex/hadronnucleicorrelation.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@
struct hadronnucleicorrelation {

// PDG codes and masses used in this analysis
static constexpr int pdgProton = 2212;

Check failure on line 58 in PWGLF/Tasks/Nuspex/hadronnucleicorrelation.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.
static constexpr int pdgDeuteron = 1000010020;

Check failure on line 59 in PWGLF/Tasks/Nuspex/hadronnucleicorrelation.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.

Configurable<int> mode{"mode", 0, "0: antid-antip, 1: d-p, 2: antid-p, 3: d-antip, 4: antip-p, 5: antip-antip, 6: p-p"};

Expand Down Expand Up @@ -179,6 +179,8 @@
std::vector<std::shared_ptr<TH3>> hPIDEtaPhiGen_AntiDeAntiPr_ME;
std::vector<std::shared_ptr<TH3>> hEtaPhiGen_AntiPrAntiPr_SE;
std::vector<std::shared_ptr<TH3>> hEtaPhiGen_AntiPrAntiPr_ME;
std::vector<std::shared_ptr<TH3>> hEtaPhiGen_AntiPrPr_SE;
std::vector<std::shared_ptr<TH3>> hEtaPhiGen_AntiPrPr_ME;

int nBinspT;
TH2F* hEffpTEta_proton;
Expand Down Expand Up @@ -264,6 +266,13 @@
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),
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}});
hEtaPhiGen_AntiPrAntiPr_ME.push_back(std::move(htempMEGen_AntiPrAntiPr));

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),
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}});
hEtaPhiGen_AntiPrPr_SE.push_back(std::move(htempSEGen_AntiPrPr));
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),
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}});
hEtaPhiGen_AntiPrPr_ME.push_back(std::move(htempMEGen_AntiPrPr));
}
}

Expand Down Expand Up @@ -713,7 +722,7 @@
}

template <int ME, typename Type>
void mixMCParticles(Type const& particles1, Type const& particles2)
void mixMCParticles(Type const& particles1, Type const& particles2, bool ispap)
{
for (auto const& it1 : particles1) {
for (auto const& it2 : particles2) {
Expand All @@ -726,9 +735,15 @@
if (it1->pt() >= pTBins.value.at(k) && it1->pt() < pTBins.value.at(k + 1)) {
// Use correct histogram based on ME flag
if constexpr (ME) {
hEtaPhiGen_AntiDeAntiPr_ME[k]->Fill(deltaEtaGen, deltaPhiGen, it2->pt());
if (ispap)
hEtaPhiGen_AntiPrPr_ME[k]->Fill(deltaEtaGen, deltaPhiGen, it2->pt());
else
hEtaPhiGen_AntiDeAntiPr_ME[k]->Fill(deltaEtaGen, deltaPhiGen, it2->pt());
} else {
hEtaPhiGen_AntiDeAntiPr_SE[k]->Fill(deltaEtaGen, deltaPhiGen, it2->pt());
if (ispap)
hEtaPhiGen_AntiPrPr_SE[k]->Fill(deltaEtaGen, deltaPhiGen, it2->pt());
else
hEtaPhiGen_AntiDeAntiPr_SE[k]->Fill(deltaEtaGen, deltaPhiGen, it2->pt());
}
}
}
Expand Down Expand Up @@ -799,7 +814,7 @@

void processData(FilteredCollisions const& collisions, FilteredTracks const& tracks)
{
for (auto track : tracks) {

Check failure on line 817 in PWGLF/Tasks/Nuspex/hadronnucleicorrelation.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[const-ref-in-for-loop]

Use constant references for non-modified iterators in range-based for loops.
if (std::abs(track.template singleCollSel_as<FilteredCollisions>().posZ()) > cutzvertex)
continue;

Expand Down Expand Up @@ -900,7 +915,7 @@
}
}

for (auto collision : collisions) {

Check failure on line 918 in PWGLF/Tasks/Nuspex/hadronnucleicorrelation.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[const-ref-in-for-loop]

Use constant references for non-modified iterators in range-based for loops.

if (std::abs(collision.posZ()) > cutzvertex)
continue;
Expand Down Expand Up @@ -1175,22 +1190,22 @@
(i->second).clear();
selectedtracks_d.clear();

for (auto& pair : mixbins_antid) {

Check failure on line 1193 in PWGLF/Tasks/Nuspex/hadronnucleicorrelation.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[const-ref-in-for-loop]

Use constant references for non-modified iterators in range-based for loops.
pair.second.clear(); // Clear the vector associated with the key
}
mixbins_antid.clear(); // Then clear the map itself

for (auto& pair : mixbins_d) {

Check failure on line 1198 in PWGLF/Tasks/Nuspex/hadronnucleicorrelation.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[const-ref-in-for-loop]

Use constant references for non-modified iterators in range-based for loops.
pair.second.clear(); // Clear the vector associated with the key
}
mixbins_d.clear(); // Then clear the map itself

for (auto& pair : mixbins_antip) {

Check failure on line 1203 in PWGLF/Tasks/Nuspex/hadronnucleicorrelation.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[const-ref-in-for-loop]

Use constant references for non-modified iterators in range-based for loops.
pair.second.clear(); // Clear the vector associated with the key
}
mixbins_antip.clear(); // Then clear the map itself

for (auto& pair : mixbins_p) {

Check failure on line 1208 in PWGLF/Tasks/Nuspex/hadronnucleicorrelation.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[const-ref-in-for-loop]

Use constant references for non-modified iterators in range-based for loops.
pair.second.clear(); // Clear the vector associated with the key
}
mixbins_p.clear(); // Then clear the map itself
Expand All @@ -1199,7 +1214,7 @@

void processMC(FilteredCollisions const& collisions, FilteredTracksMC const& tracks)
{
for (auto track : tracks) {

Check failure on line 1217 in PWGLF/Tasks/Nuspex/hadronnucleicorrelation.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[const-ref-in-for-loop]

Use constant references for non-modified iterators in range-based for loops.
if (std::abs(track.template singleCollSel_as<FilteredCollisions>().posZ()) > cutzvertex)
continue;

Expand Down Expand Up @@ -1273,18 +1288,16 @@
bool isDe = (IsDeuteron(track, +1) && track.pdgCode() == pdgDeuteron);
bool isAntiDe = (IsDeuteron(track, -1) && track.pdgCode() == -pdgDeuteron);

if (track.origin() == 1 || track.origin() == 0) { // primaries and secondaries
if (isPr) {
registry.fill(HIST("hPrimSec_EtaPhiPt_Proton"), track.eta(), track.phi(), track.pt() * +1);
if (track.origin() == 1) { // secondaries
registry.fill(HIST("hSec_EtaPhiPt_Proton"), track.eta(), track.phi(), track.pt() * +1);
}
if (isPr) {
registry.fill(HIST("hPrimSec_EtaPhiPt_Proton"), track.eta(), track.phi(), track.pt() * +1);
if (track.origin() == 1 || track.origin() == 2) { // secondaries
registry.fill(HIST("hSec_EtaPhiPt_Proton"), track.eta(), track.phi(), track.pt() * +1);
}
if (isAntiPr) {
registry.fill(HIST("hPrimSec_EtaPhiPt_Proton"), track.eta(), track.phi(), track.pt() * -1);
if (track.origin() == 1) {
registry.fill(HIST("hSec_EtaPhiPt_Proton"), track.eta(), track.phi(), track.pt() * -1);
}
}
if (isAntiPr) {
registry.fill(HIST("hPrimSec_EtaPhiPt_Proton"), track.eta(), track.phi(), track.pt() * -1);
if (track.origin() == 1 || track.origin() == 2) {
registry.fill(HIST("hSec_EtaPhiPt_Proton"), track.eta(), track.phi(), track.pt() * -1);
}
}

Expand Down Expand Up @@ -1596,7 +1609,7 @@
return;
}

for (auto collision : collisions) {

Check failure on line 1612 in PWGLF/Tasks/Nuspex/hadronnucleicorrelation.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[const-ref-in-for-loop]

Use constant references for non-modified iterators in range-based for loops.
if (std::abs(collision.posZ()) > cutzvertex)
continue;
registry.fill(HIST("hNEvents"), 0.5);
Expand Down Expand Up @@ -1769,25 +1782,10 @@
selectedparticlesMC_antid[particle.mcCollisionId()].push_back(std::make_shared<decltype(particle)>(particle));
}
if (particle.pdgCode() == pdgProton) {
if (!particle.has_daughters()) {
selectedparticlesMC_p[particle.mcCollisionId()].push_back(std::make_shared<decltype(particle)>(particle));
registry.fill(HIST("Generated/hQAProtons"), 3.5);
} else {
bool isd = false;
for (auto& dau : particle.daughters_as<aod::McParticles>()) {
if (dau.pdgCode() == pdgDeuteron) {
isd = true;
}
}
if (isd) {
registry.fill(HIST("Generated/hQAProtons"), 4.5);
}
}
selectedparticlesMC_p[particle.mcCollisionId()].push_back(std::make_shared<decltype(particle)>(particle));
}
if (particle.pdgCode() == -pdgProton) {
if (!particle.has_daughters()) {
selectedparticlesMC_antip[particle.mcCollisionId()].push_back(std::make_shared<decltype(particle)>(particle));
}
selectedparticlesMC_antip[particle.mcCollisionId()].push_back(std::make_shared<decltype(particle)>(particle));
}
}

Expand All @@ -1798,7 +1796,7 @@
// anti-d - anti-p correlation
if (selectedparticlesMC_antid.find(collision1.globalIndex()) != selectedparticlesMC_antid.end()) {
if (selectedparticlesMC_antip.find(collision1.globalIndex()) != selectedparticlesMC_antip.end()) {
mixMCParticles<0>(selectedparticlesMC_antid[collision1.globalIndex()], selectedparticlesMC_antip[collision1.globalIndex()]); // mixing SE
mixMCParticles<0>(selectedparticlesMC_antid[collision1.globalIndex()], selectedparticlesMC_antip[collision1.globalIndex()], 0); // mixing SE
}

int stop1 = 0;
Expand All @@ -1814,7 +1812,7 @@
}

if (selectedparticlesMC_antip.find(collision2.globalIndex()) != selectedparticlesMC_antip.end()) {
mixMCParticles<1>(selectedparticlesMC_antid[collision1.globalIndex()], selectedparticlesMC_antip[collision2.globalIndex()]); // mixing ME
mixMCParticles<1>(selectedparticlesMC_antid[collision1.globalIndex()], selectedparticlesMC_antip[collision2.globalIndex()], 0); // mixing ME
}

stop1++;
Expand All @@ -1825,7 +1823,7 @@
if (domatterGen) {
if (selectedparticlesMC_d.find(collision1.globalIndex()) != selectedparticlesMC_d.end()) {
if (selectedparticlesMC_p.find(collision1.globalIndex()) != selectedparticlesMC_p.end()) {
mixMCParticles<0>(selectedparticlesMC_d[collision1.globalIndex()], selectedparticlesMC_p[collision1.globalIndex()]); // mixing SE
mixMCParticles<0>(selectedparticlesMC_d[collision1.globalIndex()], selectedparticlesMC_p[collision1.globalIndex()], 0); // mixing SE
}

int stop2 = 0;
Expand All @@ -1841,7 +1839,7 @@
}

if (selectedparticlesMC_p.find(collision2.globalIndex()) != selectedparticlesMC_p.end()) {
mixMCParticles<1>(selectedparticlesMC_d[collision1.globalIndex()], selectedparticlesMC_p[collision2.globalIndex()]); // mixing ME
mixMCParticles<1>(selectedparticlesMC_d[collision1.globalIndex()], selectedparticlesMC_p[collision2.globalIndex()], 0); // mixing ME
}

stop2++;
Expand Down Expand Up @@ -1899,6 +1897,32 @@
}
}
}

// p-antip correlation
if (selectedparticlesMC_p.find(collision1.globalIndex()) != selectedparticlesMC_p.end()) {
if (selectedparticlesMC_antip.find(collision1.globalIndex()) != selectedparticlesMC_antip.end()) {
mixMCParticles<0>(selectedparticlesMC_p[collision1.globalIndex()], selectedparticlesMC_antip[collision1.globalIndex()], 1); // mixing SE
}

int stop5 = 0;

for (auto collision2 : mcCollisions) { // nested loop on collisions

if (collision1.globalIndex() == collision2.globalIndex()) {
continue;
}

if (stop5 > maxmixcollsGen) {
break;
}

if (selectedparticlesMC_antip.find(collision2.globalIndex()) != selectedparticlesMC_antip.end()) {
mixMCParticles<1>(selectedparticlesMC_p[collision1.globalIndex()], selectedparticlesMC_antip[collision2.globalIndex()], 1); // mixing ME
}

stop5++;
}
}
}

// clearing up
Expand Down
Loading