Skip to content

Commit 0b5c0e5

Browse files
[PWGCF] Track to collision association (#10524)
1 parent 4fb5c10 commit 0b5c0e5

File tree

2 files changed

+40
-0
lines changed

2 files changed

+40
-0
lines changed

PWGCF/EbyEFluctuations/Tasks/antiprotonCumulantsMc.cxx

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -990,6 +990,11 @@ struct AntiprotonCumulantsMc {
990990
float nAntiprot = 0.0;
991991

992992
for (const auto& mcParticle : mcParticles) {
993+
if (!mcParticle.has_mcCollision())
994+
continue;
995+
if (!(mcParticle.mcCollision().globalIndex() == mcCollision.globalIndex()))
996+
continue;
997+
993998
if (mcParticle.isPhysicalPrimary()) {
994999
if ((mcParticle.pt() > cfgCutPtLower) && (mcParticle.pt() < 5.0f) && (std::abs(mcParticle.eta()) < cfgCutEta)) {
9951000
histos.fill(HIST("hgenPtAll"), mcParticle.pt());
@@ -1096,6 +1101,13 @@ struct AntiprotonCumulantsMc {
10961101

10971102
// Start of the Monte-Carlo reconstructed tracks
10981103
for (const auto& track : tracks) {
1104+
if (!track.has_collision()) {
1105+
continue;
1106+
}
1107+
if (!(track.collision().globalIndex() == collision.globalIndex())) {
1108+
continue;
1109+
}
1110+
10991111
if (!track.has_mcParticle()) //! check if track has corresponding MC particle
11001112
{
11011113
continue;
@@ -1106,6 +1118,9 @@ struct AntiprotonCumulantsMc {
11061118
}
11071119

11081120
auto particle = track.mcParticle();
1121+
if (!particle.has_mcCollision())
1122+
continue;
1123+
11091124
if ((particle.pt() < cfgCutPtLower) || (particle.pt() > 5.0f) || (std::abs(particle.eta()) > cfgCutEta)) {
11101125
continue;
11111126
}
@@ -2037,6 +2052,12 @@ struct AntiprotonCumulantsMc {
20372052

20382053
// Start of the Monte-Carlo reconstructed tracks
20392054
for (const auto& track : inputTracks) {
2055+
if (!track.has_collision()) {
2056+
continue;
2057+
}
2058+
if (!(track.collision().globalIndex() == coll.globalIndex())) {
2059+
continue;
2060+
}
20402061
if (!track.isPVContributor()) //! track check as used in data
20412062
{
20422063
continue;

PWGCF/EbyEFluctuations/Tasks/netprotonCumulantsMc.cxx

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -990,6 +990,11 @@ struct NetprotonCumulantsMc {
990990
float nAntiprot = 0.0;
991991

992992
for (const auto& mcParticle : mcParticles) {
993+
if (!mcParticle.has_mcCollision())
994+
continue;
995+
if (!(mcParticle.mcCollision().globalIndex() == mcCollision.globalIndex()))
996+
continue;
997+
993998
if (mcParticle.isPhysicalPrimary()) {
994999
if ((mcParticle.pt() > cfgCutPtLower) && (mcParticle.pt() < 5.0f) && (std::abs(mcParticle.eta()) < cfgCutEta)) {
9951000
histos.fill(HIST("hgenPtAll"), mcParticle.pt());
@@ -1096,6 +1101,12 @@ struct NetprotonCumulantsMc {
10961101

10971102
// Start of the Monte-Carlo reconstructed tracks
10981103
for (const auto& track : tracks) {
1104+
if (!track.has_collision()) {
1105+
continue;
1106+
}
1107+
if (!(track.collision().globalIndex() == collision.globalIndex())) {
1108+
continue;
1109+
}
10991110
if (!track.has_mcParticle()) //! check if track has corresponding MC particle
11001111
{
11011112
continue;
@@ -1106,6 +1117,8 @@ struct NetprotonCumulantsMc {
11061117
}
11071118

11081119
auto particle = track.mcParticle();
1120+
if (!particle.has_mcCollision())
1121+
continue;
11091122
if ((particle.pt() < cfgCutPtLower) || (particle.pt() > 5.0f) || (std::abs(particle.eta()) > cfgCutEta)) {
11101123
continue;
11111124
}
@@ -2037,6 +2050,12 @@ struct NetprotonCumulantsMc {
20372050

20382051
// Start of the Monte-Carlo reconstructed tracks
20392052
for (const auto& track : inputTracks) {
2053+
if (!track.has_collision()) {
2054+
continue;
2055+
}
2056+
if (!(track.collision().globalIndex() == coll.globalIndex())) {
2057+
continue;
2058+
}
20402059
if (!track.isPVContributor()) //! track check as used in data
20412060
{
20422061
continue;

0 commit comments

Comments
 (0)