@@ -150,8 +150,9 @@ struct StrangenessDerivedV0Step4 {
150150 // Defining the type of the daughter tracks
151151 using dauTracks = soa::Join<aod::DauTrackExtras, aod::DauTrackTPCPIDs>;
152152
153+ // V0CollRefs carries the index to the collision: without it the V0s are not grouped per collision
153154 void processRecMC (soa::Filtered<soa::Join<aod::StraCollisions, aod::StraEvSels>>::iterator const & collision,
154- soa::Filtered<soa::Join<aod::V0Cores, aod::V0Extras, aod::V0TOFNSigmas, aod::V0CoreMCLabels>> const & V0s,
155+ soa::Filtered<soa::Join<aod::V0CollRefs, aod:: V0Cores, aod::V0Extras, aod::V0TOFNSigmas, aod::V0CoreMCLabels>> const & V0s,
155156 dauTracks const &,
156157 aod::V0MCCores const & /* v0mccores*/ )
157158 {
@@ -272,28 +273,29 @@ struct StrangenessDerivedV0Step4 {
272273 }
273274
274275 // Checking that the V0 is a true K0S / Lambda / AntiLambda
276+ // The generated pT is used, consistently with the denominator of the efficiency
275277 if (v0mccore.pdgCode () == PDG_t::kK0Short && isK0Short) {
276278 rK0Short.fill (HIST (" hMassK0ShortTrueRec" ), v0.mK0Short ());
277- rK0Short.fill (HIST (" hPtK0ShortTrueRec" ), v0. pt ());
279+ rK0Short.fill (HIST (" hPtK0ShortTrueRec" ), v0mccore. ptMC ());
278280 if (k0ShortPassTOFSelection) {
279281 rK0Short.fill (HIST (" hMassK0ShortTrueRecWithTOF" ), v0.mK0Short ());
280- rK0Short.fill (HIST (" hPtK0ShortTrueRecWithTOF" ), v0. pt ());
282+ rK0Short.fill (HIST (" hPtK0ShortTrueRecWithTOF" ), v0mccore. ptMC ());
281283 }
282284 }
283285 if (v0mccore.pdgCode () == PDG_t::kLambda0 && isLambda) {
284286 rLambda.fill (HIST (" hMassLambdaTrueRec" ), v0.mLambda ());
285- rLambda.fill (HIST (" hPtLambdaTrueRec" ), v0. pt ());
287+ rLambda.fill (HIST (" hPtLambdaTrueRec" ), v0mccore. ptMC ());
286288 if (lambdaPassTOFSelection) {
287289 rLambda.fill (HIST (" hMassLambdaTrueRecWithTOF" ), v0.mLambda ());
288- rLambda.fill (HIST (" hPtLambdaTrueRecWithTOF" ), v0. pt ());
290+ rLambda.fill (HIST (" hPtLambdaTrueRecWithTOF" ), v0mccore. ptMC ());
289291 }
290292 }
291293 if (v0mccore.pdgCode () == PDG_t::kLambda0Bar && isAntiLambda) {
292294 rLambda.fill (HIST (" hMassAntiLambdaTrueRec" ), v0.mAntiLambda ());
293- rLambda.fill (HIST (" hPtAntiLambdaTrueRec" ), v0. pt ());
295+ rLambda.fill (HIST (" hPtAntiLambdaTrueRec" ), v0mccore. ptMC ());
294296 if (antiLambdaPassTOFSelection) {
295297 rLambda.fill (HIST (" hMassAntiLambdaTrueRecWithTOF" ), v0.mAntiLambda ());
296- rLambda.fill (HIST (" hPtAntiLambdaTrueRecWithTOF" ), v0. pt ());
298+ rLambda.fill (HIST (" hPtAntiLambdaTrueRecWithTOF" ), v0mccore. ptMC ());
297299 }
298300 }
299301 }
@@ -303,7 +305,16 @@ struct StrangenessDerivedV0Step4 {
303305 const soa::SmallGroups<soa::Join<aod::StraCollisions, o2::aod::StraEvSels, aod::StraCollLabels>>& collisions,
304306 const soa::SmallGroups<soa::Join<aod::V0MCCores, aod::V0MCCollRefs>>& v0MC)
305307 {
306- if (collisions.size () < 1 ) { // to process generated collisions that've been reconstructed at least once
308+ // Process only generated collisions reconstructed at least once by a collision
309+ // passing the same event selection as in processRecMC (sel8 and z-vertex cut)
310+ bool hasSelectedCollision = false ;
311+ for (const auto & collision : collisions) {
312+ if (collision.sel8 () && std::abs (collision.posZ ()) < cutzvertex) {
313+ hasSelectedCollision = true ;
314+ break ;
315+ }
316+ }
317+ if (!hasSelectedCollision) {
307318 return ;
308319 }
309320 rEventSelection.fill (HIST (" hVertexZGen" ), mcCollision.posZ ());
0 commit comments