Skip to content

Commit 7b9b5cf

Browse files
committed
Fix: fix wrong collision association
1 parent f4e630a commit 7b9b5cf

1 file changed

Lines changed: 10 additions & 7 deletions

File tree

PWGCF/Femto/Core/trackHistManager.h

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -958,8 +958,8 @@ class TrackHistManager
958958
}
959959
}
960960

961-
template <modes::Mode mode, typename T1, typename T2, typename T3, typename T4>
962-
void fillMc(T1 const& track, T2 const& /*mcParticles*/, T3 const& /*mcMothers*/, T4 const& /*mcPartonicMothers*/)
961+
template <modes::Mode mode, typename T1, typename T2, typename T3, typename T4, typename T5>
962+
void fillMc(T1 const& track, T2 const& /*mcParticles*/, T3 const& /*mcMothers*/, T4 const& /*mcPartonicMothers*/, T5 const& col)
963963
{
964964
// No MC Particle
965965
if (!track.has_fMcParticle()) {
@@ -976,6 +976,10 @@ class TrackHistManager
976976
// Retrieve MC particle
977977
auto mcParticle = track.template fMcParticle_as<T2>();
978978

979+
// particles associcated to wrong collision
980+
// whether a particle is associated to a wrong collision or not cannot be known by the producer so we check it here
981+
bool fromWrongCollision = mcParticle.fMcColId() != col.fMcColId();
982+
979983
// missidentifed particles are special case
980984
// whether a particle is missidentfied or not cannot be known by the producer so we check it here
981985
bool isMissidentified = mcParticle.pdgCode() != mPdgCode;
@@ -1008,8 +1012,10 @@ class TrackHistManager
10081012

10091013
if constexpr (modes::isFlagSet(mode, modes::Mode::kQa)) {
10101014
if (mPlotOrigins) {
1011-
// check first if particle is missidentified
1012-
if (isMissidentified) {
1015+
// check first if particle is from a wrong collision
1016+
if (fromWrongCollision) {
1017+
mHistogramRegistry->fill(HIST(prefix) + HIST(McDir) + HIST(getHistName(kFromWrongCollision, HistTable)), track.pt(), track.dcaXY(), track.dcaZ());
1018+
} else if (isMissidentified) {
10131019
// if it is, we fill it as such
10141020
mHistogramRegistry->fill(HIST(prefix) + HIST(McDir) + HIST(getHistName(kMissidentified, HistTable)), track.pt(), track.dcaXY(), track.dcaZ());
10151021
} else {
@@ -1018,9 +1024,6 @@ class TrackHistManager
10181024
case modes::McOrigin::kPhysicalPrimary:
10191025
mHistogramRegistry->fill(HIST(prefix) + HIST(McDir) + HIST(getHistName(kPrimary, HistTable)), track.pt(), track.dcaXY(), track.dcaZ());
10201026
break;
1021-
case modes::McOrigin::kFromWrongCollision:
1022-
mHistogramRegistry->fill(HIST(prefix) + HIST(McDir) + HIST(getHistName(kFromWrongCollision, HistTable)), track.pt(), track.dcaXY(), track.dcaZ());
1023-
break;
10241027
case modes::McOrigin::kFromMaterial:
10251028
mHistogramRegistry->fill(HIST(prefix) + HIST(McDir) + HIST(getHistName(kFromMaterial, HistTable)), track.pt(), track.dcaXY(), track.dcaZ());
10261029
break;

0 commit comments

Comments
 (0)