Skip to content
Closed
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
113 changes: 93 additions & 20 deletions PWGLF/Tasks/Nuspex/hadronnucleicorrelation.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,8 @@
struct hadronnucleicorrelation {

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

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.
static constexpr int pdgDeuteron = 1000010020;

Check failure on line 60 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, 7: p-antip"};

Expand Down Expand Up @@ -682,12 +682,22 @@
template <int ME, typename Type>
void mixTracks(Type const& tracks1, Type const& tracks2, bool isIdentical, bool dorapidity)
{ // last value: 0 -- SE; 1 -- ME
int i = 0;
for (auto const& it1 : tracks1) {
int j = 0;
for (auto const& it2 : tracks2) {

Pair->SetPair(it1, it2);
Pair->SetIdentical(isIdentical);

if (isIdentical) {
if (j <= i)
continue;

if (it1->globalIndex() == it1->globalIndex())
continue;
}

// if Identical (pp and antip-antip)
if (isIdentical && Pair->IsClosePair(deta, dphi, radiusTPC)) {
QA.fill(HIST("QA/hdetadphistar"), Pair->GetPhiStarDiff(radiusTPC), Pair->GetEtaDiff());
Expand Down Expand Up @@ -770,7 +780,9 @@

Pair->ResetPair();

j++;
} // tracks 2
i++;
} // tracks 1
}

Expand Down Expand Up @@ -823,7 +835,9 @@
template <int ME, typename Type>
void mixMCParticlesIdentical(Type const& particles1, Type const& particles2, bool ismatter, bool dorapidity)
{
int i = 0;
for (auto const& it1 : particles1) {
int j = 0;
for (auto const& it2 : particles2) {
// Calculate Delta-eta Delta-phi (gen)
float deltaEtaGen = it1->eta() - it2->eta();
Expand All @@ -833,6 +847,11 @@
deltaEtaGen = deltaRapGen;
}

if (j <= i)
continue;
if (it1->globalIndex() == it1->globalIndex())
continue;

if (!ME && std::abs(deltaPhiGen) < 0.0001 && std::abs(deltaEtaGen) < 0.0001) {
continue;
}
Expand All @@ -854,7 +873,9 @@
}
}
}
j++;
}
i++;
}
}

Expand Down Expand Up @@ -893,7 +914,7 @@

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

Check failure on line 917 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 @@ -954,7 +975,8 @@
if (isAntiDe) {
selectedtracks_antid[track.singleCollSelId()].push_back(std::make_shared<decltype(track)>(track));
if (mode == 0 || mode == 2) {
registry.fill(HIST("hNtrig_total"), track.pt(), hEffpTEta_antideuteron->Interpolate(track.pt(), track.eta()));
if (docorrection)
registry.fill(HIST("hNtrig_total"), track.pt(), hEffpTEta_antideuteron->Interpolate(track.pt(), track.eta()));
}

if (doQA) {
Expand All @@ -968,7 +990,8 @@
selectedtracks_d[track.singleCollSelId()].push_back(std::make_shared<decltype(track)>(track));

if (mode == 1 || mode == 3) {
registry.fill(HIST("hNtrig_total"), track.pt(), hEffpTEta_deuteron->Interpolate(track.pt(), track.eta()));
if (docorrection)
registry.fill(HIST("hNtrig_total"), track.pt(), hEffpTEta_deuteron->Interpolate(track.pt(), track.eta()));
}

if (doQA) {
Expand All @@ -984,7 +1007,8 @@
selectedtracks_p[track.singleCollSelId()].push_back(std::make_shared<decltype(track)>(track));

if (mode == 6 || mode == 7) {
registry.fill(HIST("hNtrig_total"), track.pt(), hEffpTEta_proton->Interpolate(track.pt(), track.eta()));
if (docorrection)
registry.fill(HIST("hNtrig_total"), track.pt(), hEffpTEta_proton->Interpolate(track.pt(), track.eta()));
}

if (doQA) {
Expand All @@ -997,7 +1021,8 @@
selectedtracks_antip[track.singleCollSelId()].push_back(std::make_shared<decltype(track)>(track));

if (mode == 4 || mode == 5) {
registry.fill(HIST("hNtrig_total"), track.pt(), hEffpTEta_antiproton->Interpolate(track.pt(), track.eta()));
if (docorrection)
registry.fill(HIST("hNtrig_total"), track.pt(), hEffpTEta_antiproton->Interpolate(track.pt(), track.eta()));
}

if (doQA) {
Expand All @@ -1009,7 +1034,7 @@
}
}

for (auto collision : collisions) {

Check failure on line 1037 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 @@ -1049,6 +1074,54 @@

Pair->SetMagField1(collision.magField());
Pair->SetMagField2(collision.magField());

if (mode == 0 &&
selectedtracks_antid.find(collision.globalIndex()) != selectedtracks_antid.end() &&
selectedtracks_antip.find(collision.globalIndex()) != selectedtracks_antip.end()) {
mixTracks<0>(selectedtracks_antid[collision.globalIndex()], selectedtracks_antip[collision.globalIndex()], 0, dorapidity); // mixing SE
}

if (mode == 1 &&
selectedtracks_d.find(collision.globalIndex()) != selectedtracks_d.end() &&
selectedtracks_p.find(collision.globalIndex()) != selectedtracks_p.end()) {
mixTracks<0>(selectedtracks_d[collision.globalIndex()], selectedtracks_p[collision.globalIndex()], 0, dorapidity); // mixing SE
}

if (mode == 2 &&
selectedtracks_antid.find(collision.globalIndex()) != selectedtracks_antid.end() &&
selectedtracks_p.find(collision.globalIndex()) != selectedtracks_p.end()) {
mixTracks<0>(selectedtracks_antid[collision.globalIndex()], selectedtracks_p[collision.globalIndex()], 0, dorapidity); // mixing SE
}

if (mode == 3 &&
selectedtracks_d.find(collision.globalIndex()) != selectedtracks_d.end() &&
selectedtracks_antip.find(collision.globalIndex()) != selectedtracks_antip.end()) {
mixTracks<0>(selectedtracks_d[collision.globalIndex()], selectedtracks_antip[collision.globalIndex()], 0, dorapidity); // mixing SE
}

if (mode == 4 &&
selectedtracks_antip.find(collision.globalIndex()) != selectedtracks_antip.end() &&
selectedtracks_p.find(collision.globalIndex()) != selectedtracks_p.end()) {
mixTracks<0>(selectedtracks_antip[collision.globalIndex()], selectedtracks_p[collision.globalIndex()], 0, dorapidity); // mixing SE
}

if (mode == 5 &&
selectedtracks_antip.find(collision.globalIndex()) != selectedtracks_antip.end() &&
selectedtracks_antip.find(collision.globalIndex()) != selectedtracks_antip.end()) {
mixTracks<0>(selectedtracks_antip[collision.globalIndex()], selectedtracks_antip[collision.globalIndex()], 1, dorapidity); // mixing SE
}

if (mode == 6 &&
selectedtracks_p.find(collision.globalIndex()) != selectedtracks_p.end() &&
selectedtracks_p.find(collision.globalIndex()) != selectedtracks_p.end()) {
mixTracks<0>(selectedtracks_p[collision.globalIndex()], selectedtracks_p[collision.globalIndex()], 1, dorapidity); // mixing SE
}

if (mode == 7 &&
selectedtracks_p.find(collision.globalIndex()) != selectedtracks_p.end() &&
selectedtracks_antip.find(collision.globalIndex()) != selectedtracks_antip.end()) {
mixTracks<0>(selectedtracks_p[collision.globalIndex()], selectedtracks_antip[collision.globalIndex()], 0, dorapidity); // mixing SE
}
}

if (mode == 0 && !mixbins_antid.empty()) {
Expand All @@ -1062,9 +1135,9 @@

auto col1 = value[indx1];

if (selectedtracks_antip.find(col1->index()) != selectedtracks_antip.end()) {
/*if (selectedtracks_antip.find(col1->index()) != selectedtracks_antip.end()) {
mixTracks<0>(selectedtracks_antid[col1->index()], selectedtracks_antip[col1->index()], 0, dorapidity); // mixing SE
}
}*/

for (int indx2 = 0; indx2 < EvPerBin; indx2++) { // nested loop for all the combinations of collisions in a chosen mult/vertex bin

Expand Down Expand Up @@ -1093,9 +1166,9 @@

auto col1 = value[indx1];

if (selectedtracks_p.find(col1->index()) != selectedtracks_p.end()) {
/*if (selectedtracks_p.find(col1->index()) != selectedtracks_p.end()) {
mixTracks<0>(selectedtracks_d[col1->index()], selectedtracks_p[col1->index()], 0, dorapidity); // mixing SE
}
}*/

for (int indx2 = 0; indx2 < EvPerBin; indx2++) { // nested loop for all the combinations of collisions in a chosen mult/vertex bin

Expand Down Expand Up @@ -1124,9 +1197,9 @@

auto col1 = value[indx1];

if (selectedtracks_p.find(col1->index()) != selectedtracks_p.end()) {
/*if (selectedtracks_p.find(col1->index()) != selectedtracks_p.end()) {
mixTracks<0>(selectedtracks_antid[col1->index()], selectedtracks_p[col1->index()], 0, dorapidity); // mixing SE
}
}*/

for (int indx2 = 0; indx2 < EvPerBin; indx2++) { // nested loop for all the combinations of collisions in a chosen mult/vertex bin

Expand Down Expand Up @@ -1155,9 +1228,9 @@

auto col1 = value[indx1];

if (selectedtracks_antip.find(col1->index()) != selectedtracks_antip.end()) {
/*if (selectedtracks_antip.find(col1->index()) != selectedtracks_antip.end()) {
mixTracks<0>(selectedtracks_d[col1->index()], selectedtracks_antip[col1->index()], 0, dorapidity); // mixing SE
}
}*/

for (int indx2 = 0; indx2 < EvPerBin; indx2++) { // nested loop for all the combinations of collisions in a chosen mult/vertex bin

Expand Down Expand Up @@ -1186,9 +1259,9 @@

auto col1 = value[indx1];

if (selectedtracks_p.find(col1->index()) != selectedtracks_p.end()) {
/*if (selectedtracks_p.find(col1->index()) != selectedtracks_p.end()) {
mixTracks<0>(selectedtracks_antip[col1->index()], selectedtracks_p[col1->index()], 0, dorapidity); // mixing SE
}
}*/

for (int indx2 = 0; indx2 < EvPerBin; indx2++) { // nested loop for all the combinations of collisions in a chosen mult/vertex bin

Expand Down Expand Up @@ -1217,9 +1290,9 @@

auto col1 = value[indx1];

if (selectedtracks_antip.find(col1->index()) != selectedtracks_antip.end()) {
/*if (selectedtracks_antip.find(col1->index()) != selectedtracks_antip.end()) {
mixTracks<0>(selectedtracks_antip[col1->index()], selectedtracks_antip[col1->index()], 1, dorapidity); // mixing SE
}
}*/

for (int indx2 = 0; indx2 < EvPerBin; indx2++) { // nested loop for all the combinations of collisions in a chosen mult/vertex bin

Expand Down Expand Up @@ -1248,9 +1321,9 @@

auto col1 = value[indx1];

if (selectedtracks_p.find(col1->index()) != selectedtracks_p.end()) {
/*if (selectedtracks_p.find(col1->index()) != selectedtracks_p.end()) {
mixTracks<0>(selectedtracks_p[col1->index()], selectedtracks_p[col1->index()], 1, dorapidity); // mixing SE
}
}*/

for (int indx2 = 0; indx2 < EvPerBin; indx2++) { // nested loop for all the combinations of collisions in a chosen mult/vertex bin

Expand Down Expand Up @@ -1279,9 +1352,9 @@

auto col1 = value[indx1];

if (selectedtracks_antip.find(col1->index()) != selectedtracks_antip.end()) {
/*if (selectedtracks_antip.find(col1->index()) != selectedtracks_antip.end()) {
mixTracks<0>(selectedtracks_p[col1->index()], selectedtracks_antip[col1->index()], 0, dorapidity); // mixing SE
}
}*/

for (int indx2 = 0; indx2 < EvPerBin; indx2++) { // nested loop for all the combinations of collisions in a chosen mult/vertex bin

Expand Down Expand Up @@ -1316,22 +1389,22 @@
(i->second).clear();
selectedtracks_d.clear();

for (auto& pair : mixbins_antid) {

Check failure on line 1392 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 1397 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 1402 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 1407 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 @@ -1340,7 +1413,7 @@

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

Check failure on line 1416 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 @@ -1709,7 +1782,7 @@
void processGen(SimCollisions const& mcCollisions,
SimParticles const& mcParticles)
{
for (auto particle : mcParticles) {

Check failure on line 1785 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(particle.template mcCollision_as<aod::McCollisions>().posZ()) > cutzvertex)
continue;
Expand Down
Loading