@@ -179,16 +179,25 @@ 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}});
182186
183187 histos.add (" nEvents_MC" , " nEvents_MC" , kTH1F , {{4 , 0.0 , 4.0 }});
184188 histos.add (" nEvents_MC_True" , " nEvents_MC_True" , kTH1F , {{4 , 0.0 , 4.0 }});
189+
185190 histos.add (" hMC_kstar_True" , " hMC_kstar_True" , kTHnSparseF , {cfgCentAxis, ptAxis});
186191
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});
191192 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});
192201 }
193202 } // end of init
194203
@@ -273,11 +282,13 @@ struct kstarInOO {
273282 return false ;
274283 if (cfgTrackGlobalWoDCATrack && !track.isGlobalTrackWoDCA ())
275284 return false ;
276- if (cfgTracknFindableTPCClusters > 0 && track.tpcNClsFindable () < cfgTracknFindableTPCClusters)
285+ // if (cfgTracknFindableTPCClusters > 0 && track.tpcNClsFindable() < cfgTracknFindableTPCClusters)
286+ if (track.tpcNClsFindable () < cfgTracknFindableTPCClusters)
277287 return false ;
278288 if (track.tpcNClsCrossedRows () < cfgTracknTPCCrossedRows)
279289 return false ;
280- if (cfgTracknRowsOverFindable > 0 && track.tpcCrossedRowsOverFindableCls () > cfgTracknRowsOverFindable)
290+ // if (cfgTracknRowsOverFindable > 0 && track.tpcCrossedRowsOverFindableCls() > cfgTracknRowsOverFindable)
291+ if (track.tpcCrossedRowsOverFindableCls () > cfgTracknRowsOverFindable)
281292 return false ;
282293 if (track.tpcChi2NCl () > cfgTracknTPCChi2)
283294 return false ;
@@ -373,7 +384,8 @@ struct kstarInOO {
373384 auto centrality = collision1.centFT0C ();
374385
375386 for (const auto & [trk1, trk2] : combinations (o2::soa::CombinationsFullIndexPolicy (tracks1, tracks2))) {
376- auto [KstarPt, Minv] = minvReconstruction (trk1, trk2, QA);
387+
388+ auto [KstarPt, Minv] = minvReconstruction (trk1, trk2, QA, false );
377389
378390 double conjugate = trk1.sign () * trk2.sign ();
379391 if (cfgDataHistos) {
@@ -403,26 +415,36 @@ struct kstarInOO {
403415 auto tracks2 = pionMC->sliceByCached (aod::track::collisionId, collision2.globalIndex (), cache);
404416 auto centrality = collision1.centFT0C ();
405417
418+ std::vector<int > mcMemory;
419+ std::vector<int > PIDPurityKey_Kaon;
420+ std::vector<int > PIDPurityKey_Pion;
421+
422+ double KstarPt_Kpi, Minv_Kpi;
423+
406424 for (const auto & [trk1, trk2] : combinations (o2::soa::CombinationsFullIndexPolicy (tracks1, tracks2))) {
407425 if (!trk1.has_mcParticle () || !trk2.has_mcParticle ())
408426 continue ;
409- auto [KstarPt_Kpi, Minv_Kpi] = minvReconstruction (trk1, trk2, QA);
427+
428+ // auto [KstarPt_Kpi, Minv_Kpi] = minvReconstruction(trk1, trk2, QA, false);
429+ // auto [KstarPt_piK, Minv_piK] = minvReconstruction(trk1, trk2, QA, true);
430+
431+ std::tie (KstarPt_Kpi, Minv_Kpi) = minvReconstruction (trk1, trk2, QA, false );
432+ std::tie (KstarPt_Kpi, Minv_Kpi) = minvReconstruction (trk1, trk2, QA, true );
433+
434+ if (Minv_Kpi < 0 )
435+ continue ;
410436
411437 double conjugate = trk1.sign () * trk2.sign ();
412438 if (cfgMcHistos) {
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- }
439+ if (!IsMix) {
440+ if (conjugate < 0 ) {
441+ histos.fill (HIST (" hMC_USS_KPi" ), centrality, KstarPt_Kpi, Minv_Kpi);
442+ } else if (conjugate > 0 ) {
443+ histos.fill (HIST (" hMC_LSS_KPi" ), centrality, KstarPt_Kpi, Minv_Kpi);
444+ }
445+ } else {
446+ if (conjugate < 0 ) {
447+ histos.fill (HIST (" hMC_USS_KPi_Mix" ), centrality, KstarPt_Kpi, Minv_Kpi);
426448 }
427449 }
428450 }
@@ -434,6 +456,8 @@ struct kstarInOO {
434456 if (!particle1.has_mothers () || !particle2.has_mothers ()) {
435457 continue ;
436458 }
459+ int mcindex1 = trk1.globalIndex ();
460+ int mcindex2 = trk2.globalIndex ();
437461
438462 std::vector<int > mothers1{};
439463 std::vector<int > mothers1PDG{};
@@ -457,30 +481,86 @@ struct kstarInOO {
457481 if (mothers1[0 ] != mothers2[0 ])
458482 continue ; // Kaon and pion not from the same K*0
459483
484+ if (std::fabs (particle1.pdgCode ()) != 211 && std::fabs (particle1.pdgCode ()) != 321 )
485+ continue ;
486+ if (std::fabs (particle2.pdgCode ()) != 211 && std::fabs (particle2.pdgCode ()) != 321 )
487+ continue ;
488+
489+ double track1_mass, track2_mass;
490+ bool track1f{false }; // true means pion
491+
492+ if (std::fabs (particle1.pdgCode ()) == 211 ) {
493+ track1f = true ;
494+ track1_mass = massPi;
495+ } else {
496+ track1_mass = massKa;
497+ }
498+
499+ if (std::fabs (particle2.pdgCode ()) == 211 ) {
500+ track2_mass = massPi;
501+ } else {
502+ track2_mass = massKa;
503+ }
504+
505+ if (track1_mass == track2_mass) {
506+ return ;
507+ }
508+
509+ bool exists1 = std::find (mcMemory.begin (), mcMemory.end (), mcindex1) != mcMemory.end ();
510+ bool exists2 = std::find (mcMemory.begin (), mcMemory.end (), mcindex2) != mcMemory.end ();
511+ if (exists1 || exists2) {
512+ continue ;
513+ } else {
514+ mcMemory.push_back (trk1.globalIndex ());
515+ mcMemory.push_back (trk2.globalIndex ());
516+ }
517+
518+ TLorentzVector lDecayDaughter1, lDecayDaughter2, lResonance;
519+ lDecayDaughter1.SetXYZM (trk1.px (), trk1.py (), trk1.pz (), track1_mass);
520+ lDecayDaughter2.SetXYZM (trk2.px (), trk2.py (), trk2.pz (), track2_mass);
521+ lResonance = lDecayDaughter1 + lDecayDaughter2;
522+
460523 if (cfgMcHistos) {
461- histos.fill (HIST (" hMC_USS_True" ), centrality, KstarPt_Kpi, Minv_Kpi);
524+ histos.fill (HIST (" hMC_USS_True" ), centrality, lResonance.Pt (), lResonance.M ());
525+ if (track1f) {
526+ histos.fill (HIST (" hMC_USS_PiK_True" ), centrality, lResonance.Pt (), lResonance.M ());
527+ } else {
528+ histos.fill (HIST (" hMC_USS_KPi_True" ), centrality, lResonance.Pt (), lResonance.M ());
529+ }
462530 }
463531 // ======================
464532 } // for
465533 } // TrackSlicingMC
466534
467535 template <typename TracksType>
468- std::pair<double , double > minvReconstruction (const TracksType& trk1, const TracksType& trk2, const bool QA)
536+ std::pair<double , double > minvReconstruction (const TracksType& trk1, const TracksType& trk2, const bool QA, const bool flip )
469537 {
470538 if (!trackSelection (trk1, false ) || !trackSelection (trk2, false ))
471539 return {-1.0 , -1.0 };
472540
473- if (!trackPIDKaon (trk1, QA) || !trackPIDPion (trk2, QA)) {
474- return {-1.0 , -1.0 };
541+ if (!flip) {
542+ if (!trackPIDKaon (trk1, QA) || !trackPIDPion (trk2, QA)) {
543+ return {-1.0 , -1.0 };
544+ }
545+ } else {
546+ if (!trackPIDPion (trk1, false ) || !trackPIDKaon (trk2, false ))
547+ return {-1.0 , -1.0 };
475548 }
476549
477- if (trk1.globalIndex () == trk2.globalIndex ())
550+ if (trk1.index () >= trk2.index ())
478551 return {-1.0 , -1.0 };
479552
480- TLorentzVector lDecayDaughter1, lDecayDaughter2, lResonance;
481- lDecayDaughter1.SetXYZM (trk1.px (), trk1.py (), trk1.pz (), massKa);
482- lDecayDaughter2.SetXYZM (trk2.px (), trk2.py (), trk2.pz (), massPi);
553+ // if (trk1.globalIndex() == trk2.globalIndex())
554+ // return {-1.0, -1.0};
483555
556+ TLorentzVector lDecayDaughter1, lDecayDaughter2, lResonance;
557+ if (!flip) {
558+ lDecayDaughter1.SetXYZM (trk1.px (), trk1.py (), trk1.pz (), massKa);
559+ lDecayDaughter2.SetXYZM (trk2.px (), trk2.py (), trk2.pz (), massPi);
560+ } else {
561+ lDecayDaughter1.SetXYZM (trk1.px (), trk1.py (), trk1.pz (), massPi);
562+ lDecayDaughter2.SetXYZM (trk2.px (), trk2.py (), trk2.pz (), massKa);
563+ }
484564 lResonance = lDecayDaughter1 + lDecayDaughter2;
485565
486566 if (std::abs (lResonance.Eta ()) > cfgTrackMaxEta)
@@ -592,6 +672,36 @@ struct kstarInOO {
592672 if (!INELgt0)
593673 return ;
594674
675+ auto tracks1 = kaonMC->sliceByCached (aod::track::collisionId, collision.globalIndex (), cache);
676+ for (const auto & kaon : tracks1) {
677+ if (!trackSelection (kaon, false ))
678+ continue ;
679+ if (!trackPIDKaon (kaon, false ))
680+ continue ;
681+ auto particle1 = kaon.mcParticle ();
682+ if (std::fabs (particle1.pdgCode ()) == 321 )
683+ histos.fill (HIST (" hSimpleKaon_PID_Purity" ), 1 ); // histogram with two bins, -1.5, 1.5 fill 1 or -1
684+ else if (std::fabs (particle1.pdgCode ()) == 211 )
685+ histos.fill (HIST (" hSimpleKaon_PID_Purity" ), -1 ); // histogram with two bins, -1.5, 1.5 fill 1 or -1
686+ else
687+ histos.fill (HIST (" hSimpleKaon_PID_Purity" ), 0 ); // histogram with two bins, -1.5, 1.5 fill 1 or -1
688+ }
689+
690+ auto tracks2 = pionMC->sliceByCached (aod::track::collisionId, collision.globalIndex (), cache);
691+ for (const auto & pion : tracks2) {
692+ if (!trackSelection (pion, false ))
693+ continue ;
694+ if (!trackPIDPion (pion, false ))
695+ continue ;
696+ auto particle2 = pion.mcParticle ();
697+ if (std::fabs (particle2.pdgCode ()) == 211 )
698+ histos.fill (HIST (" hSimplePion_PID_Purity" ), 1 ); // histogram with two bins, -1.5, 1.5 fill 1 or -1
699+ else if (std::fabs (particle2.pdgCode ()) == 321 )
700+ histos.fill (HIST (" hSimplePion_PID_Purity" ), -1 ); // histogram with two bins, -1.5, 1.5 fill 1 or -1
701+ else
702+ histos.fill (HIST (" hSimplePion_PID_Purity" ), 0 ); // histogram with two bins, -1.5, 1.5 fill 1 or -1
703+ }
704+
595705 if (cfgMcHistos) {
596706 histos.fill (HIST (" nEvents_MC" ), 1.5 );
597707 }
0 commit comments