Skip to content

Commit 317b419

Browse files
author
jimun_lee
committed
[PWGLF] Return the previous code of KstarInOO.cxx
1 parent 579596b commit 317b419

File tree

1 file changed

+26
-133
lines changed

1 file changed

+26
-133
lines changed

PWGLF/Tasks/Resonances/kstarInOO.cxx

Lines changed: 26 additions & 133 deletions
Original file line numberDiff line numberDiff line change
@@ -179,25 +179,16 @@ struct kstarInOO {
179179
}
180180

181181
if (cfgMcHistos) {
182-
histos.add("hPion_PID_Purity", "hPion_PID_Purity", kTH1F, {{3, -1.5, 1.5}});
183-
histos.add("hKaon_PID_Purity", "hKaon_PID_Purity", kTH1F, {{3, -1.5, 1.5}});
184-
histos.add("hSimplePion_PID_Purity", "hSimplePion_PID_Purity", kTH1F, {{3, -1.5, 1.5}});
185-
histos.add("hSimpleKaon_PID_Purity", "hSimpleKaon_PID_Purity", kTH1F, {{3, -1.5, 1.5}});
186182

187183
histos.add("nEvents_MC", "nEvents_MC", kTH1F, {{4, 0.0, 4.0}});
188184
histos.add("nEvents_MC_True", "nEvents_MC_True", kTH1F, {{4, 0.0, 4.0}});
189-
190185
histos.add("hMC_kstar_True", "hMC_kstar_True", kTHnSparseF, {cfgCentAxis, ptAxis});
191186

187+
histos.add("hMC_USS", "hMC_USS", kTHnSparseF, {cfgCentAxis, ptAxis, minvAxis});
188+
histos.add("hMC_LSS", "hMC_LSS", kTHnSparseF, {cfgCentAxis, ptAxis, minvAxis});
189+
histos.add("hMC_USS_Mix", "hMC_USS_Mix", kTHnSparseF, {cfgCentAxis, ptAxis, minvAxis});
190+
histos.add("hMC_LSS_Mix", "hMC_LSS_Mix", kTHnSparseF, {cfgCentAxis, ptAxis, minvAxis});
192191
histos.add("hMC_USS_True", "hMC_USS_True", kTHnSparseF, {cfgCentAxis, ptAxis, minvAxis});
193-
histos.add("hMC_USS_KPi", "hMC_USS_KPi", kTHnSparseF, {cfgCentAxis, ptAxis, minvAxis});
194-
histos.add("hMC_USS_PiK", "hMC_USS_PiK", kTHnSparseF, {cfgCentAxis, ptAxis, minvAxis});
195-
histos.add("hMC_LSS_KPi", "hMC_LSS_KPi", kTHnSparseF, {cfgCentAxis, ptAxis, minvAxis});
196-
histos.add("hMC_LSS_PiK", "hMC_LSS_PiK", kTHnSparseF, {cfgCentAxis, ptAxis, minvAxis});
197-
histos.add("hMC_USS_KPi_Mix", "hMC_USS_KPi_Mix", kTHnSparseF, {cfgCentAxis, ptAxis, minvAxis});
198-
histos.add("hMC_USS_PiK_Mix", "hMC_USS_PiK_Mix", kTHnSparseF, {cfgCentAxis, ptAxis, minvAxis});
199-
histos.add("hMC_USS_KPi_True", "hMC_USS_KPi_True", kTHnSparseF, {cfgCentAxis, ptAxis, minvAxis});
200-
histos.add("hMC_USS_PiK_True", "hMC_USS_PiK_True", kTHnSparseF, {cfgCentAxis, ptAxis, minvAxis});
201192
}
202193
} // end of init
203194

@@ -382,8 +373,7 @@ struct kstarInOO {
382373
auto centrality = collision1.centFT0C();
383374

384375
for (const auto& [trk1, trk2] : combinations(o2::soa::CombinationsFullIndexPolicy(tracks1, tracks2))) {
385-
386-
auto [KstarPt, Minv] = minvReconstruction(trk1, trk2, QA, false);
376+
auto [KstarPt, Minv] = minvReconstruction(trk1, trk2, QA);
387377

388378
double conjugate = trk1.sign() * trk2.sign();
389379
if (cfgDataHistos) {
@@ -413,36 +403,26 @@ struct kstarInOO {
413403
auto tracks2 = pionMC->sliceByCached(aod::track::collisionId, collision2.globalIndex(), cache);
414404
auto centrality = collision1.centFT0C();
415405

416-
std::vector<int> mcMemory;
417-
std::vector<int> PIDPurityKey_Kaon;
418-
std::vector<int> PIDPurityKey_Pion;
419-
420-
double KstarPt_Kpi, Minv_Kpi;
421-
422406
for (const auto& [trk1, trk2] : combinations(o2::soa::CombinationsFullIndexPolicy(tracks1, tracks2))) {
423407
if (!trk1.has_mcParticle() || !trk2.has_mcParticle())
424408
continue;
425-
426-
// auto [KstarPt_Kpi, Minv_Kpi] = minvReconstruction(trk1, trk2, QA, false);
427-
// auto [KstarPt_piK, Minv_piK] = minvReconstruction(trk1, trk2, QA, true);
428-
429-
std::tie(KstarPt_Kpi, Minv_Kpi) = minvReconstruction(trk1, trk2, QA, false);
430-
std::tie(KstarPt_Kpi, Minv_Kpi) = minvReconstruction(trk1, trk2, QA, true);
431-
432-
if (Minv_Kpi < 0)
433-
continue;
409+
auto [KstarPt_Kpi, Minv_Kpi] = minvReconstruction(trk1, trk2, QA);
434410

435411
double conjugate = trk1.sign() * trk2.sign();
436412
if (cfgMcHistos) {
437-
if (!IsMix) {
438-
if (conjugate < 0) {
439-
histos.fill(HIST("hMC_USS_KPi"), centrality, KstarPt_Kpi, Minv_Kpi);
440-
} else if (conjugate > 0) {
441-
histos.fill(HIST("hMC_LSS_KPi"), centrality, KstarPt_Kpi, Minv_Kpi);
442-
}
443-
} else {
444-
if (conjugate < 0) {
445-
histos.fill(HIST("hMC_USS_KPi_Mix"), centrality, KstarPt_Kpi, Minv_Kpi);
413+
if (Minv_Kpi > 0) {
414+
if (!IsMix) {
415+
if (conjugate < 0) {
416+
histos.fill(HIST("hMC_USS"), centrality, KstarPt_Kpi, Minv_Kpi);
417+
} else if (conjugate > 0) {
418+
histos.fill(HIST("hMC_LSS"), centrality, KstarPt_Kpi, Minv_Kpi);
419+
}
420+
} else {
421+
if (conjugate < 0) {
422+
histos.fill(HIST("hMC_USS_Mix"), centrality, KstarPt_Kpi, Minv_Kpi);
423+
} else if (conjugate > 0) {
424+
histos.fill(HIST("hMC_LSS_Mix"), centrality, KstarPt_Kpi, Minv_Kpi);
425+
}
446426
}
447427
}
448428
}
@@ -454,8 +434,6 @@ struct kstarInOO {
454434
if (!particle1.has_mothers() || !particle2.has_mothers()) {
455435
continue;
456436
}
457-
int mcindex1 = trk1.globalIndex();
458-
int mcindex2 = trk2.globalIndex();
459437

460438
std::vector<int> mothers1{};
461439
std::vector<int> mothers1PDG{};
@@ -479,85 +457,30 @@ struct kstarInOO {
479457
if (mothers1[0] != mothers2[0])
480458
continue; // Kaon and pion not from the same K*0
481459

482-
if (std::fabs(particle1.pdgCode()) != 211 && std::fabs(particle1.pdgCode()) != 321)
483-
continue;
484-
if (std::fabs(particle2.pdgCode()) != 211 && std::fabs(particle2.pdgCode()) != 321)
485-
continue;
486-
487-
double track1_mass, track2_mass;
488-
bool track1f{false}; // true means pion
489-
490-
if (std::fabs(particle1.pdgCode()) == 211) {
491-
track1f = true;
492-
track1_mass = massPi;
493-
} else {
494-
track1_mass = massKa;
495-
}
496-
497-
if (std::fabs(particle2.pdgCode()) == 211) {
498-
track2_mass = massPi;
499-
} else {
500-
track2_mass = massKa;
501-
}
502-
503-
if (track1_mass == track2_mass) {
504-
return;
505-
}
506-
507-
bool exists1 = std::find(mcMemory.begin(), mcMemory.end(), mcindex1) != mcMemory.end();
508-
bool exists2 = std::find(mcMemory.begin(), mcMemory.end(), mcindex2) != mcMemory.end();
509-
if (exists1 || exists2) {
510-
continue;
511-
} else {
512-
mcMemory.push_back(trk1.globalIndex());
513-
mcMemory.push_back(trk2.globalIndex());
514-
}
515-
516-
TLorentzVector lDecayDaughter1, lDecayDaughter2, lResonance;
517-
lDecayDaughter1.SetXYZM(trk1.px(), trk1.py(), trk1.pz(), track1_mass);
518-
lDecayDaughter2.SetXYZM(trk2.px(), trk2.py(), trk2.pz(), track2_mass);
519-
lResonance = lDecayDaughter1 + lDecayDaughter2;
520-
521460
if (cfgMcHistos) {
522461
histos.fill(HIST("hMC_USS_True"), centrality, lResonance.Pt(), lResonance.M());
523-
if (track1f) {
524-
histos.fill(HIST("hMC_USS_PiK_True"), centrality, lResonance.Pt(), lResonance.M());
525-
} else {
526-
histos.fill(HIST("hMC_USS_KPi_True"), centrality, lResonance.Pt(), lResonance.M());
527-
}
528462
}
529463
//======================
530464
} // for
531465
} // TrackSlicingMC
532466

533467
template <typename TracksType>
534-
std::pair<double, double> minvReconstruction(const TracksType& trk1, const TracksType& trk2, const bool QA, const bool flip)
468+
std::pair<double, double> minvReconstruction(const TracksType& trk1, const TracksType& trk2, const bool QA)
535469
{
536470
if (!trackSelection(trk1, false) || !trackSelection(trk2, false))
537471
return {-1.0, -1.0};
538472

539-
if (!flip) {
540-
if (!trackPIDKaon(trk1, QA) || !trackPIDPion(trk2, QA)) {
541-
return {-1.0, -1.0};
542-
}
543-
} else {
544-
if (!trackPIDPion(trk1, false) || !trackPIDKaon(trk2, false))
545-
return {-1.0, -1.0};
473+
if (!trackPIDKaon(trk1, QA) || !trackPIDPion(trk2, QA)) {
474+
return {-1.0, -1.0};
546475
}
547476

548-
// if (trk1.globalIndex() == trk2.globalIndex())
549-
// return {-1.0, -1.0};
550-
if (trk1.index() >= trk2.index())
477+
if (trk1.globalIndex() == trk2.globalIndex())
551478
return {-1.0, -1.0};
552479

553480
TLorentzVector lDecayDaughter1, lDecayDaughter2, lResonance;
554-
if (!flip) {
555-
lDecayDaughter1.SetXYZM(trk1.px(), trk1.py(), trk1.pz(), massKa);
556-
lDecayDaughter2.SetXYZM(trk2.px(), trk2.py(), trk2.pz(), massPi);
557-
} else {
558-
lDecayDaughter1.SetXYZM(trk1.px(), trk1.py(), trk1.pz(), massPi);
559-
lDecayDaughter2.SetXYZM(trk2.px(), trk2.py(), trk2.pz(), massKa);
560-
}
481+
lDecayDaughter1.SetXYZM(trk1.px(), trk1.py(), trk1.pz(), massKa);
482+
lDecayDaughter2.SetXYZM(trk2.px(), trk2.py(), trk2.pz(), massPi);
483+
561484
lResonance = lDecayDaughter1 + lDecayDaughter2;
562485

563486
if (std::abs(lResonance.Eta()) > cfgTrackMaxEta)
@@ -669,36 +592,6 @@ struct kstarInOO {
669592
if (!INELgt0)
670593
return;
671594

672-
auto tracks1 = kaonMC->sliceByCached(aod::track::collisionId, collision.globalIndex(), cache);
673-
for (const auto& kaon : tracks1) {
674-
if (!trackSelection(kaon, false))
675-
continue;
676-
if (!trackPIDKaon(kaon, false))
677-
continue;
678-
auto particle1 = kaon.mcParticle();
679-
if (std::fabs(particle1.pdgCode()) == 321)
680-
histos.fill(HIST("hSimpleKaon_PID_Purity"), 1); // histogram with two bins, -1.5, 1.5 fill 1 or -1
681-
else if (std::fabs(particle1.pdgCode()) == 211)
682-
histos.fill(HIST("hSimpleKaon_PID_Purity"), -1); // histogram with two bins, -1.5, 1.5 fill 1 or -1
683-
else
684-
histos.fill(HIST("hSimpleKaon_PID_Purity"), 0); // histogram with two bins, -1.5, 1.5 fill 1 or -1
685-
}
686-
687-
auto tracks2 = pionMC->sliceByCached(aod::track::collisionId, collision.globalIndex(), cache);
688-
for (const auto& pion : tracks2) {
689-
if (!trackSelection(pion, false))
690-
continue;
691-
if (!trackPIDPion(pion, false))
692-
continue;
693-
auto particle2 = pion.mcParticle();
694-
if (std::fabs(particle2.pdgCode()) == 211)
695-
histos.fill(HIST("hSimplePion_PID_Purity"), 1); // histogram with two bins, -1.5, 1.5 fill 1 or -1
696-
else if (std::fabs(particle2.pdgCode()) == 321)
697-
histos.fill(HIST("hSimplePion_PID_Purity"), -1); // histogram with two bins, -1.5, 1.5 fill 1 or -1
698-
else
699-
histos.fill(HIST("hSimplePion_PID_Purity"), 0); // histogram with two bins, -1.5, 1.5 fill 1 or -1
700-
}
701-
702595
if (cfgMcHistos) {
703596
histos.fill(HIST("nEvents_MC"), 1.5);
704597
}

0 commit comments

Comments
 (0)