Skip to content

Commit 05eac21

Browse files
spucilloalibuild
andauthored
[Tutorial,PWGLF] Fix V0 grouping (#18787)
Co-authored-by: ALICE Action Bot <alibuild@cern.ch>
1 parent 41aae3a commit 05eac21

5 files changed

Lines changed: 27 additions & 12 deletions

File tree

‎Tutorials/PWGLF/Strangeness/Derived/AnalysisV0/strangeness_derived_v0_step0.cxx‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,8 +74,9 @@ struct StrangenessDerivedV0Step0 {
7474
Filter eventFilter = (o2::aod::evsel::sel8 == true);
7575
Filter posZFilter = (nabs(o2::aod::collision::posZ) < cutzvertex);
7676

77+
// V0CollRefs carries the index to the collision: without it the V0s are not grouped per collision
7778
void process(soa::Filtered<soa::Join<aod::StraCollisions, aod::StraEvSels>>::iterator const& collision,
78-
aod::V0Cores const& V0s)
79+
soa::Join<aod::V0CollRefs, aod::V0Cores> const& V0s)
7980
{
8081
// Fill the event counter
8182
rEventSelection.fill(HIST("hVertexZRec"), collision.posZ());

‎Tutorials/PWGLF/Strangeness/Derived/AnalysisV0/strangeness_derived_v0_step1.cxx‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,8 +100,9 @@ struct StrangenessDerivedV0Step1 {
100100
nabs(aod::v0data::dcapostopv) > v0setting_dcapostopv &&
101101
nabs(aod::v0data::dcanegtopv) > v0setting_dcanegtopv);
102102

103+
// V0CollRefs carries the index to the collision: without it the V0s are not grouped per collision
103104
void process(soa::Filtered<soa::Join<aod::StraCollisions, aod::StraEvSels>>::iterator const& collision,
104-
soa::Filtered<aod::V0Cores> const& V0s)
105+
soa::Filtered<soa::Join<aod::V0CollRefs, aod::V0Cores>> const& V0s)
105106
{
106107
// Fill the event counter
107108
rEventSelection.fill(HIST("hVertexZRec"), collision.posZ());

‎Tutorials/PWGLF/Strangeness/Derived/AnalysisV0/strangeness_derived_v0_step2.cxx‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,8 +117,9 @@ struct StrangenessDerivedV0Step2 {
117117
// Defining the type of the daughter tracks
118118
using dauTracks = soa::Join<aod::DauTrackExtras, aod::DauTrackTPCPIDs>;
119119

120+
// V0CollRefs carries the index to the collision: without it the V0s are not grouped per collision
120121
void process(soa::Filtered<soa::Join<aod::StraCollisions, aod::StraEvSels>>::iterator const& collision,
121-
soa::Filtered<soa::Join<aod::V0Cores, aod::V0Extras>> const& V0s,
122+
soa::Filtered<soa::Join<aod::V0CollRefs, aod::V0Cores, aod::V0Extras>> const& V0s,
122123
dauTracks const&)
123124
{
124125
// Fill the event counter

‎Tutorials/PWGLF/Strangeness/Derived/AnalysisV0/strangeness_derived_v0_step3.cxx‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,8 +126,9 @@ struct StrangenessDerivedV0Step3 {
126126
// Defining the type of the daughter tracks
127127
using dauTracks = soa::Join<aod::DauTrackExtras, aod::DauTrackTPCPIDs>;
128128

129+
// V0CollRefs carries the index to the collision: without it the V0s are not grouped per collision
129130
void process(soa::Filtered<soa::Join<aod::StraCollisions, aod::StraEvSels>>::iterator const& collision,
130-
soa::Filtered<soa::Join<aod::V0Cores, aod::V0Extras, aod::V0TOFNSigmas>> const& V0s,
131+
soa::Filtered<soa::Join<aod::V0CollRefs, aod::V0Cores, aod::V0Extras, aod::V0TOFNSigmas>> const& V0s,
131132
dauTracks const&)
132133
{
133134
// Fill the event counter

‎Tutorials/PWGLF/Strangeness/Derived/AnalysisV0/strangeness_derived_v0_step4.cxx‎

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)