@@ -179,16 +179,22 @@ 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_LSS_KPi" , " hMC_LSS_KPi" , kTHnSparseF , {cfgCentAxis, ptAxis, minvAxis});
195+ histos.add (" hMC_USS_KPi_Mix" , " hMC_USS_KPi_Mix" , kTHnSparseF , {cfgCentAxis, ptAxis, minvAxis});
196+ histos.add (" hMC_USS_KPi_True" , " hMC_USS_KPi_True" , kTHnSparseF , {cfgCentAxis, ptAxis, minvAxis});
197+ histos.add (" hMC_USS_PiK_True" , " hMC_USS_PiK_True" , kTHnSparseF , {cfgCentAxis, ptAxis, minvAxis});
192198 }
193199 } // end of init
194200
@@ -273,11 +279,13 @@ struct kstarInOO {
273279 return false ;
274280 if (cfgTrackGlobalWoDCATrack && !track.isGlobalTrackWoDCA ())
275281 return false ;
276- if (cfgTracknFindableTPCClusters > 0 && track.tpcNClsFindable () < cfgTracknFindableTPCClusters)
282+ // if (cfgTracknFindableTPCClusters > 0 && track.tpcNClsFindable() < cfgTracknFindableTPCClusters)
283+ if (track.tpcNClsFindable () < cfgTracknFindableTPCClusters)
277284 return false ;
278285 if (track.tpcNClsCrossedRows () < cfgTracknTPCCrossedRows)
279286 return false ;
280- if (cfgTracknRowsOverFindable > 0 && track.tpcCrossedRowsOverFindableCls () > cfgTracknRowsOverFindable)
287+ // if (cfgTracknRowsOverFindable > 0 && track.tpcCrossedRowsOverFindableCls() > cfgTracknRowsOverFindable)
288+ if (track.tpcCrossedRowsOverFindableCls () > cfgTracknRowsOverFindable)
281289 return false ;
282290 if (track.tpcChi2NCl () > cfgTracknTPCChi2)
283291 return false ;
@@ -373,7 +381,8 @@ struct kstarInOO {
373381 auto centrality = collision1.centFT0C ();
374382
375383 for (const auto & [trk1, trk2] : combinations (o2::soa::CombinationsFullIndexPolicy (tracks1, tracks2))) {
376- auto [KstarPt, Minv] = minvReconstruction (trk1, trk2, QA);
384+
385+ auto [KstarPt, Minv] = minvReconstruction (trk1, trk2, QA, false );
377386
378387 double conjugate = trk1.sign () * trk2.sign ();
379388 if (cfgDataHistos) {
@@ -403,26 +412,36 @@ struct kstarInOO {
403412 auto tracks2 = pionMC->sliceByCached (aod::track::collisionId, collision2.globalIndex (), cache);
404413 auto centrality = collision1.centFT0C ();
405414
415+ std::vector<int > mcMemory;
416+ std::vector<int > PIDPurityKey_Kaon;
417+ std::vector<int > PIDPurityKey_Pion;
418+
419+ double KstarPt_Kpi, Minv_Kpi;
420+
406421 for (const auto & [trk1, trk2] : combinations (o2::soa::CombinationsFullIndexPolicy (tracks1, tracks2))) {
407422 if (!trk1.has_mcParticle () || !trk2.has_mcParticle ())
408423 continue ;
409- auto [KstarPt_Kpi, Minv_Kpi] = minvReconstruction (trk1, trk2, QA);
424+
425+ // auto [KstarPt_Kpi, Minv_Kpi] = minvReconstruction(trk1, trk2, QA, false);
426+ // auto [KstarPt_piK, Minv_piK] = minvReconstruction(trk1, trk2, QA, true);
427+
428+ std::tie (KstarPt_Kpi, Minv_Kpi) = minvReconstruction (trk1, trk2, QA, false );
429+ std::tie (KstarPt_Kpi, Minv_Kpi) = minvReconstruction (trk1, trk2, QA, true );
430+
431+ if (Minv_Kpi < 0 )
432+ continue ;
410433
411434 double conjugate = trk1.sign () * trk2.sign ();
412435 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- }
436+ if (!IsMix) {
437+ if (conjugate < 0 ) {
438+ histos.fill (HIST (" hMC_USS_KPi" ), centrality, KstarPt_Kpi, Minv_Kpi);
439+ } else if (conjugate > 0 ) {
440+ histos.fill (HIST (" hMC_LSS_KPi" ), centrality, KstarPt_Kpi, Minv_Kpi);
441+ }
442+ } else {
443+ if (conjugate < 0 ) {
444+ histos.fill (HIST (" hMC_USS_KPi_Mix" ), centrality, KstarPt_Kpi, Minv_Kpi);
426445 }
427446 }
428447 }
@@ -434,6 +453,8 @@ struct kstarInOO {
434453 if (!particle1.has_mothers () || !particle2.has_mothers ()) {
435454 continue ;
436455 }
456+ int mcindex1 = trk1.globalIndex ();
457+ int mcindex2 = trk2.globalIndex ();
437458
438459 std::vector<int > mothers1{};
439460 std::vector<int > mothers1PDG{};
@@ -457,30 +478,86 @@ struct kstarInOO {
457478 if (mothers1[0 ] != mothers2[0 ])
458479 continue ; // Kaon and pion not from the same K*0
459480
481+ if (std::fabs (particle1.pdgCode ()) != 211 && std::fabs (particle1.pdgCode ()) != 321 )
482+ continue ;
483+ if (std::fabs (particle2.pdgCode ()) != 211 && std::fabs (particle2.pdgCode ()) != 321 )
484+ continue ;
485+
486+ double track1_mass, track2_mass;
487+ bool track1f{false }; // true means pion
488+
489+ if (std::fabs (particle1.pdgCode ()) == 211 ) {
490+ track1f = true ;
491+ track1_mass = massPi;
492+ } else {
493+ track1_mass = massKa;
494+ }
495+
496+ if (std::fabs (particle2.pdgCode ()) == 211 ) {
497+ track2_mass = massPi;
498+ } else {
499+ track2_mass = massKa;
500+ }
501+
502+ if (track1_mass == track2_mass) {
503+ return ;
504+ }
505+
506+ bool exists1 = std::find (mcMemory.begin (), mcMemory.end (), mcindex1) != mcMemory.end ();
507+ bool exists2 = std::find (mcMemory.begin (), mcMemory.end (), mcindex2) != mcMemory.end ();
508+ if (exists1 || exists2) {
509+ continue ;
510+ } else {
511+ mcMemory.push_back (trk1.globalIndex ());
512+ mcMemory.push_back (trk2.globalIndex ());
513+ }
514+
515+ TLorentzVector lDecayDaughter1, lDecayDaughter2, lResonance;
516+ lDecayDaughter1.SetXYZM (trk1.px (), trk1.py (), trk1.pz (), track1_mass);
517+ lDecayDaughter2.SetXYZM (trk2.px (), trk2.py (), trk2.pz (), track2_mass);
518+ lResonance = lDecayDaughter1 + lDecayDaughter2;
519+
460520 if (cfgMcHistos) {
461- histos.fill (HIST (" hMC_USS_True" ), centrality, KstarPt_Kpi, Minv_Kpi);
521+ histos.fill (HIST (" hMC_USS_True" ), centrality, lResonance.Pt (), lResonance.M ());
522+ if (track1f) {
523+ histos.fill (HIST (" hMC_USS_PiK_True" ), centrality, lResonance.Pt (), lResonance.M ());
524+ } else {
525+ histos.fill (HIST (" hMC_USS_KPi_True" ), centrality, lResonance.Pt (), lResonance.M ());
526+ }
462527 }
463528 // ======================
464529 } // for
465530 } // TrackSlicingMC
466531
467532 template <typename TracksType>
468- std::pair<double , double > minvReconstruction (const TracksType& trk1, const TracksType& trk2, const bool QA)
533+ std::pair<double , double > minvReconstruction (const TracksType& trk1, const TracksType& trk2, const bool QA, const bool flip )
469534 {
470535 if (!trackSelection (trk1, false ) || !trackSelection (trk2, false ))
471536 return {-1.0 , -1.0 };
472537
473- if (!trackPIDKaon (trk1, QA) || !trackPIDPion (trk2, QA)) {
474- return {-1.0 , -1.0 };
538+ if (!flip) {
539+ if (!trackPIDKaon (trk1, QA) || !trackPIDPion (trk2, QA)) {
540+ return {-1.0 , -1.0 };
541+ }
542+ } else {
543+ if (!trackPIDPion (trk1, false ) || !trackPIDKaon (trk2, false ))
544+ return {-1.0 , -1.0 };
475545 }
476546
477- if (trk1.globalIndex () == trk2.globalIndex ())
547+ if (trk1.index () >= trk2.index ())
478548 return {-1.0 , -1.0 };
479549
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);
550+ // if (trk1.globalIndex() == trk2.globalIndex())
551+ // return {-1.0, -1.0};
483552
553+ 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+ }
484561 lResonance = lDecayDaughter1 + lDecayDaughter2;
485562
486563 if (std::abs (lResonance.Eta ()) > cfgTrackMaxEta)
@@ -592,6 +669,36 @@ struct kstarInOO {
592669 if (!INELgt0)
593670 return ;
594671
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+
595702 if (cfgMcHistos) {
596703 histos.fill (HIST (" nEvents_MC" ), 1.5 );
597704 }
0 commit comments