Skip to content

Commit b37021f

Browse files
committed
[PWGJE,EMCAL-670] Fix MCParticle check in taskEmcExtensiveMcQa.cxx
1 parent 3e24dd5 commit b37021f

File tree

1 file changed

+7
-12
lines changed

1 file changed

+7
-12
lines changed

PWGJE/Tasks/taskEmcExtensiveMcQa.cxx

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -140,18 +140,13 @@ struct TaskEmcExtensiveMcQa {
140140
/// \param mcparticle is the mcparticle we want to find the PoI type
141141
/// \param mcparticles table containing the mcparticles
142142
/// \return PoI type of the given mcparticle
143-
template <typename T, typename TMCs>
144-
int findPoIType(T const& mcparticle, TMCs const& mcparticles)
143+
template <typename T>
144+
int findPoIType(T const& mcparticle)
145145
{
146-
if (!mcparticle.has_mothers()) {
147-
return -1;
148-
}
149-
150-
int motherid = mcparticle.mothersIds()[0];
151-
auto mother = mcparticles.iteratorAt(motherid);
152-
auto it = std::find(arrPoIPDG.begin(), arrPoIPDG.end(), std::abs(mother.pdgCode()));
146+
auto it = std::find(arrPoIPDG.begin(), arrPoIPDG.end(), std::abs(mcparticle.pdgCode()));
153147
if (it != arrPoIPDG.end()) {
154-
return *it;
148+
int index = std::distance(arrPoIPDG.begin(), it);
149+
return index;
155150
} else {
156151
return PoI::kHadron;
157152
}
@@ -160,7 +155,7 @@ struct TaskEmcExtensiveMcQa {
160155
Filter clusterDefinitionSelection = (o2::aod::emcalcluster::definition == clusterDefinition);
161156

162157
/// \brief Process EMCAL clusters that are matched to a collisions
163-
void processCollisions(CollisionEvSels const& collisions, SelectedClusters const& clusters, McParticles const& mcparticles)
158+
void processCollisions(CollisionEvSels const& collisions, SelectedClusters const& clusters, McParticles const& /*mcparticles*/)
164159
{
165160

166161
for (const auto& collision : collisions) {
@@ -180,7 +175,7 @@ struct TaskEmcExtensiveMcQa {
180175
}
181176
auto mainMcParticle = cluster.mcParticle_as<McParticles>()[0];
182177
float radius = std::hypot(mainMcParticle.px(), mainMcParticle.py());
183-
mHistManager.fill(HIST("hSparseClusterQA"), cluster.energy(), cluster.time(), cluster.m02(), cluster.nCells(), radius, findPoIType(mainMcParticle, mcparticles));
178+
mHistManager.fill(HIST("hSparseClusterQA"), cluster.energy(), cluster.time(), cluster.m02(), cluster.nCells(), radius, findPoIType(mainMcParticle));
184179
}
185180
}
186181
}

0 commit comments

Comments
 (0)