Skip to content

Commit 7f6e2fd

Browse files
author
Prottay Das
committed
updated rec loop for eff
1 parent 54d8936 commit 7f6e2fd

File tree

1 file changed

+153
-122
lines changed

1 file changed

+153
-122
lines changed

PWGLF/Tasks/Strangeness/lambdak0seff.cxx

Lines changed: 153 additions & 122 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,7 @@ struct lambdak0seff {
146146
std::vector<AxisSpec> runaxes2 = {thnAxisInvMass, axisGrp.configthnAxispT, axisGrp.configetaAxis, axisGrp.configvzAxis, axisGrp.configcentAxis};
147147

148148
histos.add("hCentrality", "Centrality distribution", kTH1F, {{axisGrp.configcentAxis}});
149+
histos.add("hCentralitymc", "Centrality distribution MC", kTH1F, {{axisGrp.configcentAxis}});
149150
histos.add("hSparseGenLambda", "hSparseGenLambda", HistType::kTHnSparseF, runaxes2, true);
150151
histos.add("hSparseGenAntiLambda", "hSparseGenAntiLambda", HistType::kTHnSparseF, runaxes2, true);
151152
histos.add("hSparseRecLambda", "hSparseRecLambda", HistType::kTHnSparseF, runaxes2, true);
@@ -239,10 +240,10 @@ struct lambdak0seff {
239240
return false;
240241
}
241242
if (pid == 0 && (candidate.positivept() < cfgDaughPrPt || candidate.negativept() < cfgDaughPiPt)) {
242-
return false; // doesn´t pass lambda pT sels
243+
return false;
243244
}
244245
if (pid == 1 && (candidate.positivept() < cfgDaughPiPt || candidate.negativept() < cfgDaughPrPt)) {
245-
return false; // doesn´t pass antilambda pT sels
246+
return false;
246247
}
247248
if (std::abs(candidate.positiveeta()) > ConfDaughEta || std::abs(candidate.negativeeta()) > ConfDaughEta) {
248249
return false;
@@ -285,166 +286,196 @@ struct lambdak0seff {
285286
Filter centralityFilter = (nabs(aod::cent::centFT0C) < cfgCutCentralityMax && nabs(aod::cent::centFT0C) > cfgCutCentralityMin);
286287
Filter acceptanceFilter = (nabs(aod::track::eta) < cfgCutEta && nabs(aod::track::pt) > cfgCutPT);
287288

289+
using CollisionMCTrueTable = aod::McCollisions;
290+
// using EventCandidatesMC = soa::Filtered<soa::Join<aod::Collisions, aod::EvSels, aod::CentFT0Cs, aod::McCollisionLabels>>;
288291
using EventCandidatesMC = soa::Filtered<soa::Join<aod::Collisions, aod::EvSels, aod::CentFT0Cs>>;
289292
using AllTrackCandidates = soa::Filtered<soa::Join<aod::Tracks, aod::TracksExtra, aod::TracksDCA, aod::TrackSelection, aod::pidTPCFullPi, aod::pidTPCFullPr, aod::pidTPCFullKa>>;
290293
using ResoV0s = aod::V0Datas;
291294

292295
using TrackMCTrueTable = aod::McParticles;
296+
Preslice<ResoV0s> perCollision = aod::v0data::collisionId;
297+
293298
ROOT::Math::PxPyPzMVector lambdadummymc, antiLambdadummymc, kshortdummymc, protonmc, pionmc, antiProtonmc, antiPionmc;
294299

295-
void processMC(EventCandidatesMC::iterator const& collision, AllTrackCandidates const& /*tracks*/, TrackMCTrueTable const& GenParticles, ResoV0s const& V0s)
300+
void processMC(CollisionMCTrueTable::iterator const&, EventCandidatesMC const& RecCollisions, TrackMCTrueTable const& GenParticles, ResoV0s const& V0s, AllTrackCandidates const&)
296301
{
297-
if (!collision.sel8()) {
298-
return;
299-
}
300-
double centrality = -999.;
301-
centrality = collision.centFT0C();
302-
// centrality = collision.multiplicity();
303-
double vz = collision.posZ();
304-
305-
if (evselGrp.additionalEvSel && (!collision.selection_bit(aod::evsel::kNoSameBunchPileup) || !collision.selection_bit(aod::evsel::kIsGoodZvtxFT0vsPV))) {
306-
return;
307-
}
308-
if (evselGrp.additionalEvSel2 && (!collision.selection_bit(aod::evsel::kNoTimeFrameBorder) || !collision.selection_bit(aod::evsel::kNoITSROFrameBorder))) {
309-
return;
310-
}
311-
if (evselGrp.additionalEvSel3 && !collision.selection_bit(o2::aod::evsel::kIsGoodITSLayersAll)) {
312-
return;
313-
}
314-
315-
histos.fill(HIST("hCentrality"), centrality);
316302

317-
for (const auto& v0 : V0s) {
303+
for (auto& collision : RecCollisions) {
318304

319-
auto postrack = v0.template posTrack_as<AllTrackCandidates>();
320-
auto negtrack = v0.template negTrack_as<AllTrackCandidates>();
305+
if (!collision.sel8()) {
306+
continue;
307+
}
308+
double centrality = -999.;
309+
centrality = collision.centFT0C();
310+
double vz = collision.posZ();
321311

322-
if (analyzeLambda && analyzeK0s)
312+
if (evselGrp.additionalEvSel && (!collision.selection_bit(aod::evsel::kNoSameBunchPileup) || !collision.selection_bit(aod::evsel::kIsGoodZvtxFT0vsPV))) {
323313
continue;
324-
if (!analyzeLambda && !analyzeK0s)
314+
}
315+
if (evselGrp.additionalEvSel2 && (!collision.selection_bit(aod::evsel::kNoTimeFrameBorder) || !collision.selection_bit(aod::evsel::kNoITSROFrameBorder))) {
316+
continue;
317+
}
318+
if (evselGrp.additionalEvSel3 && !collision.selection_bit(o2::aod::evsel::kIsGoodITSLayersAll)) {
325319
continue;
320+
}
326321

327-
int LambdaTag = 0;
328-
int aLambdaTag = 0;
329-
int K0sTag = 0;
322+
histos.fill(HIST("hCentrality"), centrality);
330323

331-
const auto signpos = postrack.sign();
332-
const auto signneg = negtrack.sign();
324+
auto v0sThisColl = V0s.sliceBy(perCollision, collision.globalIndex());
333325

334-
if (signpos < 0 || signneg > 0) {
335-
continue;
336-
}
337-
if (analyzeLambda) {
338-
if (isSelectedV0Daughter(v0, postrack, 0, 0) && isSelectedV0Daughter(v0, negtrack, 1, 0)) {
339-
LambdaTag = 1;
326+
for (const auto& v0 : v0sThisColl) {
327+
328+
auto postrack = v0.template posTrack_as<AllTrackCandidates>();
329+
auto negtrack = v0.template negTrack_as<AllTrackCandidates>();
330+
331+
if (analyzeLambda && analyzeK0s)
332+
continue;
333+
if (!analyzeLambda && !analyzeK0s)
334+
continue;
335+
336+
int LambdaTag = 0;
337+
int aLambdaTag = 0;
338+
int K0sTag = 0;
339+
340+
const auto signpos = postrack.sign();
341+
const auto signneg = negtrack.sign();
342+
343+
if (signpos < 0 || signneg > 0) {
344+
continue;
340345
}
341-
if (isSelectedV0Daughter(v0, negtrack, 0, 1) && isSelectedV0Daughter(v0, postrack, 1, 1)) {
342-
aLambdaTag = 1;
346+
if (analyzeLambda) {
347+
if (isSelectedV0Daughter(v0, postrack, 0, 0) && isSelectedV0Daughter(v0, negtrack, 1, 0)) {
348+
LambdaTag = 1;
349+
}
350+
if (isSelectedV0Daughter(v0, negtrack, 0, 1) && isSelectedV0Daughter(v0, postrack, 1, 1)) {
351+
aLambdaTag = 1;
352+
}
343353
}
344-
}
345-
if (analyzeK0s) {
346-
if (isSelectedV0Daughter(v0, postrack, 0, 0) && isSelectedV0Daughter(v0, negtrack, 1, 0)) {
347-
K0sTag = 1;
354+
if (analyzeK0s) {
355+
if (isSelectedV0Daughter(v0, postrack, 0, 0) && isSelectedV0Daughter(v0, negtrack, 1, 0)) {
356+
K0sTag = 1;
357+
}
348358
}
349-
}
350359

351-
if (analyzeLambda && (!LambdaTag && !aLambdaTag))
352-
continue;
353-
if (analyzeK0s && (!K0sTag))
354-
continue;
360+
if (analyzeLambda && (!LambdaTag && !aLambdaTag))
361+
continue;
362+
if (analyzeK0s && (!K0sTag))
363+
continue;
355364

356-
if (!SelectionV0(collision, v0)) {
357-
continue;
358-
}
365+
if (!SelectionV0(collision, v0)) {
366+
continue;
367+
}
359368

360-
if (analyzeLambda) {
361-
if (LambdaTag) {
362-
Proton = ROOT::Math::PxPyPzMVector(v0.pxpos(), v0.pypos(), v0.pzpos(), massPr);
363-
AntiPion = ROOT::Math::PxPyPzMVector(v0.pxneg(), v0.pyneg(), v0.pzneg(), massPi);
364-
Lambdadummy = Proton + AntiPion;
369+
if (analyzeLambda) {
370+
if (LambdaTag) {
371+
Proton = ROOT::Math::PxPyPzMVector(v0.pxpos(), v0.pypos(), v0.pzpos(), massPr);
372+
AntiPion = ROOT::Math::PxPyPzMVector(v0.pxneg(), v0.pyneg(), v0.pzneg(), massPi);
373+
Lambdadummy = Proton + AntiPion;
374+
}
375+
if (aLambdaTag) {
376+
AntiProton = ROOT::Math::PxPyPzMVector(v0.pxneg(), v0.pyneg(), v0.pzneg(), massPr);
377+
Pion = ROOT::Math::PxPyPzMVector(v0.pxpos(), v0.pypos(), v0.pzpos(), massPi);
378+
AntiLambdadummy = AntiProton + Pion;
379+
}
380+
381+
if (shouldReject(LambdaTag, aLambdaTag, Lambdadummy, AntiLambdadummy)) {
382+
continue;
383+
}
365384
}
366-
if (aLambdaTag) {
367-
AntiProton = ROOT::Math::PxPyPzMVector(v0.pxneg(), v0.pyneg(), v0.pzneg(), massPr);
368-
Pion = ROOT::Math::PxPyPzMVector(v0.pxpos(), v0.pypos(), v0.pzpos(), massPi);
369-
AntiLambdadummy = AntiProton + Pion;
385+
386+
if (analyzeK0s) {
387+
if (K0sTag) {
388+
Pion = ROOT::Math::PxPyPzMVector(v0.pxpos(), v0.pypos(), v0.pzpos(), massPi);
389+
AntiPion = ROOT::Math::PxPyPzMVector(v0.pxneg(), v0.pyneg(), v0.pzneg(), massPi);
390+
K0sdummy = Pion + AntiPion;
391+
}
370392
}
371393

372-
if (shouldReject(LambdaTag, aLambdaTag, Lambdadummy, AntiLambdadummy)) {
394+
if (TMath::Abs(v0.eta()) > 0.8)
373395
continue;
374-
}
375-
}
376396

377-
if (analyzeK0s) {
397+
if (LambdaTag) {
398+
Lambda = Proton + AntiPion;
399+
histos.fill(HIST("hSparseRecLambda"), v0.mLambda(), v0.pt(), v0.eta(), vz, centrality);
400+
}
401+
if (aLambdaTag) {
402+
AntiLambda = AntiProton + Pion;
403+
histos.fill(HIST("hSparseRecAntiLambda"), v0.mAntiLambda(), v0.pt(), v0.eta(), vz, centrality);
404+
}
378405
if (K0sTag) {
379-
Pion = ROOT::Math::PxPyPzMVector(v0.pxpos(), v0.pypos(), v0.pzpos(), massPi);
380-
AntiPion = ROOT::Math::PxPyPzMVector(v0.pxneg(), v0.pyneg(), v0.pzneg(), massPi);
381-
K0sdummy = Pion + AntiPion;
406+
histos.fill(HIST("hSparseRecK0s"), v0.mK0Short(), v0.pt(), v0.eta(), vz, centrality);
382407
}
383408
}
384409

385-
if (TMath::Abs(v0.eta()) > 0.8)
386-
continue;
387-
388-
if (LambdaTag) {
389-
Lambda = Proton + AntiPion;
390-
histos.fill(HIST("hSparseRecLambda"), v0.mLambda(), v0.pt(), v0.eta(), vz, centrality);
391-
}
392-
if (aLambdaTag) {
393-
AntiLambda = AntiProton + Pion;
394-
histos.fill(HIST("hSparseRecAntiLambda"), v0.mAntiLambda(), v0.pt(), v0.eta(), vz, centrality);
395-
}
396-
if (K0sTag) {
397-
histos.fill(HIST("hSparseRecK0s"), v0.mK0Short(), v0.pt(), v0.eta(), vz, centrality);
398-
}
399-
}
400-
401-
for (const auto& mcParticle : GenParticles) {
402-
if (analyzeLambda && std::abs(mcParticle.pdgCode()) != PDG_t::kLambda0) {
403-
continue;
404-
}
405-
if (analyzeK0s && std::abs(mcParticle.pdgCode()) != PDG_t::kK0Short) {
406-
continue;
407-
}
408-
if (std::abs(mcParticle.y()) > ConfV0Rap) {
409-
continue;
410-
}
411-
auto pdg1 = mcParticle.pdgCode();
412-
auto kDaughters = mcParticle.daughters_as<aod::McParticles>();
413-
int daughsize = 2;
414-
if (kDaughters.size() != daughsize) {
415-
continue;
416-
}
417-
for (const auto& kCurrentDaughter : kDaughters) {
410+
for (const auto& mcParticle : GenParticles) {
418411

419-
if (std::abs(kCurrentDaughter.pdgCode()) != PDG_t::kProton && std::abs(kCurrentDaughter.pdgCode()) != PDG_t::kPiPlus) {
412+
if (analyzeLambda && std::abs(mcParticle.pdgCode()) != PDG_t::kLambda0) {
413+
continue;
414+
}
415+
if (analyzeK0s && std::abs(mcParticle.pdgCode()) != PDG_t::kK0Short) {
416+
continue;
417+
}
418+
if (std::abs(mcParticle.y()) > ConfV0Rap) {
420419
continue;
421420
}
422-
if (kCurrentDaughter.pdgCode() == PDG_t::kProton) {
423-
protonmc = ROOT::Math::PxPyPzMVector(kCurrentDaughter.px(), kCurrentDaughter.py(), kCurrentDaughter.pz(), o2::constants::physics::MassProton);
421+
if (!mcParticle.isPhysicalPrimary() || !mcParticle.producedByGenerator()) {
422+
continue;
424423
}
425-
if (kCurrentDaughter.pdgCode() == PDG_t::kPiMinus) {
426-
antiPionmc = ROOT::Math::PxPyPzMVector(kCurrentDaughter.px(), kCurrentDaughter.py(), kCurrentDaughter.pz(), o2::constants::physics::MassPionCharged);
424+
425+
auto pdg1 = mcParticle.pdgCode();
426+
auto kDaughters = mcParticle.daughters_as<aod::McParticles>();
427+
int daughsize = 2;
428+
if (kDaughters.size() != daughsize) {
429+
continue;
427430
}
428431

429-
if (kCurrentDaughter.pdgCode() == PDG_t::kProtonBar) {
430-
antiProtonmc = ROOT::Math::PxPyPzMVector(kCurrentDaughter.px(), kCurrentDaughter.py(), kCurrentDaughter.pz(), o2::constants::physics::MassProton);
432+
int lambdacounter = 0;
433+
int antilambdacounter = 0;
434+
int k0scounter = 0;
435+
int counter = 0;
436+
437+
for (const auto& kCurrentDaughter : kDaughters) {
438+
counter += 1;
439+
if (std::abs(kCurrentDaughter.pdgCode()) != PDG_t::kProton && std::abs(kCurrentDaughter.pdgCode()) != PDG_t::kPiPlus) {
440+
continue;
441+
}
442+
if (kCurrentDaughter.pt() < 0.2 || TMath::Abs(kCurrentDaughter.eta()) > 0.8)
443+
continue;
444+
445+
if (kCurrentDaughter.pdgCode() == PDG_t::kProton) {
446+
lambdacounter += 1;
447+
protonmc = ROOT::Math::PxPyPzMVector(kCurrentDaughter.px(), kCurrentDaughter.py(), kCurrentDaughter.pz(), o2::constants::physics::MassProton);
448+
}
449+
if (kCurrentDaughter.pdgCode() == PDG_t::kPiMinus) {
450+
lambdacounter += 1;
451+
k0scounter += 1;
452+
antiPionmc = ROOT::Math::PxPyPzMVector(kCurrentDaughter.px(), kCurrentDaughter.py(), kCurrentDaughter.pz(), o2::constants::physics::MassPionCharged);
453+
}
454+
455+
if (kCurrentDaughter.pdgCode() == PDG_t::kProtonBar) {
456+
antilambdacounter += 1;
457+
antiProtonmc = ROOT::Math::PxPyPzMVector(kCurrentDaughter.px(), kCurrentDaughter.py(), kCurrentDaughter.pz(), o2::constants::physics::MassProton);
458+
}
459+
if (kCurrentDaughter.pdgCode() == PDG_t::kPiPlus) {
460+
antilambdacounter += 1;
461+
k0scounter += 1;
462+
pionmc = ROOT::Math::PxPyPzMVector(kCurrentDaughter.px(), kCurrentDaughter.py(), kCurrentDaughter.pz(), o2::constants::physics::MassPionCharged);
463+
}
431464
}
432-
if (kCurrentDaughter.pdgCode() == PDG_t::kPiPlus) {
433-
pionmc = ROOT::Math::PxPyPzMVector(kCurrentDaughter.px(), kCurrentDaughter.py(), kCurrentDaughter.pz(), o2::constants::physics::MassPionCharged);
465+
466+
if (analyzeLambda && pdg1 == PDG_t::kLambda0 && lambdacounter == 2 && antilambdacounter != 2 && k0scounter != 2) {
467+
lambdadummymc = protonmc + antiPionmc;
468+
histos.fill(HIST("hSparseGenLambda"), lambdadummymc.M(), lambdadummymc.Pt(), lambdadummymc.Eta(), vz, centrality);
434469
}
435-
}
436-
if (pdg1 == PDG_t::kLambda0) {
437-
lambdadummymc = protonmc + antiPionmc;
438-
histos.fill(HIST("hSparseGenLambda"), lambdadummymc.M(), lambdadummymc.Pt(), lambdadummymc.Eta(), vz, centrality);
439-
}
440470

441-
if (pdg1 == PDG_t::kLambda0Bar) {
442-
antiLambdadummymc = antiProtonmc + pionmc;
443-
histos.fill(HIST("hSparseGenAntiLambda"), antiLambdadummymc.M(), antiLambdadummymc.Pt(), lambdadummymc.Eta(), vz, centrality);
444-
}
445-
if (pdg1 == PDG_t::kK0Short) {
446-
kshortdummymc = antiPionmc + pionmc;
447-
histos.fill(HIST("hSparseGenK0s"), kshortdummymc.M(), kshortdummymc.Pt(), kshortdummymc.Eta(), vz, centrality);
471+
if (analyzeLambda && pdg1 == PDG_t::kLambda0Bar && antilambdacounter == 2 && lambdacounter != 2 && k0scounter != 2) {
472+
antiLambdadummymc = antiProtonmc + pionmc;
473+
histos.fill(HIST("hSparseGenAntiLambda"), antiLambdadummymc.M(), antiLambdadummymc.Pt(), antiLambdadummymc.Eta(), vz, centrality);
474+
}
475+
if (analyzeK0s && pdg1 == PDG_t::kK0Short && k0scounter == 2 && lambdacounter != 2 && antilambdacounter != 2) {
476+
kshortdummymc = antiPionmc + pionmc;
477+
histos.fill(HIST("hSparseGenK0s"), kshortdummymc.M(), kshortdummymc.Pt(), kshortdummymc.Eta(), vz, centrality);
478+
}
448479
}
449480
}
450481
}

0 commit comments

Comments
 (0)