@@ -431,7 +431,7 @@ struct LfTaskLambdaSpinCorr {
431431
432432 // 2nd loop for combination of lambda lambda
433433 for (const auto & v02 : V0s) {
434- if (v02.v0Id () <= v0.v0Id ()) {
434+ if (v02.index () <= v0.index ()) {
435435 continue ;
436436 }
437437 auto [lambdaTag2, aLambdaTag2, isValid2] = getLambdaTags (v02, collision);
@@ -507,14 +507,20 @@ struct LfTaskLambdaSpinCorr {
507507 auto groupV03 = V0s.sliceBy (tracksPerCollisionV0, collision2.globalIndex ());
508508 // for (auto& [t1, t2, t3] : soa::combinations(o2::soa::CombinationsFullIndexPolicy(groupV01, groupV02, groupV03))) {
509509 // LOGF(info, "Mixed event collisions: (%d, %d, %d)", t1.collisionId(),t2.collisionId(),t3.collisionId());
510+ auto maxV0Size = 1100 ;
511+ if (groupV01.size () > maxV0Size || groupV02.size () > maxV0Size || groupV03.size () > maxV0Size) {
512+ continue ;
513+ }
514+ bool pairStatus[1150 ][1150 ] = {{false }};
510515 for (auto & [t1, t2] : soa::combinations (o2::soa::CombinationsFullIndexPolicy (groupV01, groupV02))) {
511516 bool pairfound = false ;
512- if (t2.v0Id () <= t1.v0Id ()) {
517+ if (t2.index () <= t1.index ()) {
513518 continue ;
514519 }
515520 if (t1.collisionId () != t2.collisionId ()) {
516521 continue ;
517522 }
523+
518524 auto [lambdaTag1, aLambdaTag1, isValid1] = getLambdaTags (t1, collision1);
519525 auto [lambdaTag2, aLambdaTag2, isValid2] = getLambdaTags (t2, collision1);
520526 if (!isValid1) {
@@ -530,6 +536,10 @@ struct LfTaskLambdaSpinCorr {
530536 continue ;
531537 }
532538 for (const auto & t3 : groupV03) {
539+ if (pairStatus[t3.index ()][t2.index ()]) {
540+ // LOGF(info, "repeat match found v0 id: (%d, %d)", t3.index(), t2.index());
541+ continue ;
542+ }
533543 if (t1.collisionId () == t3.collisionId ()) {
534544 continue ;
535545 }
@@ -540,7 +550,6 @@ struct LfTaskLambdaSpinCorr {
540550 if (lambdaTag3 && aLambdaTag3) {
541551 continue ;
542552 }
543-
544553 if (lambdaTag1 != lambdaTag3 || aLambdaTag1 != aLambdaTag3) {
545554 continue ;
546555 }
@@ -553,7 +562,6 @@ struct LfTaskLambdaSpinCorr {
553562 if (std::abs (t1.phi () - t3.phi ()) > phiMix) {
554563 continue ;
555564 }
556-
557565 if (lambdaTag2) {
558566 proton = ROOT::Math::PxPyPzMVector (t2.pxpos (), t2.pypos (), t2.pzpos (), o2::constants::physics::MassProton);
559567 antiPion = ROOT::Math::PxPyPzMVector (t2.pxneg (), t2.pyneg (), t2.pzneg (), o2::constants::physics::MassPionCharged);
@@ -587,6 +595,8 @@ struct LfTaskLambdaSpinCorr {
587595 fillHistograms (0 , 1 , 1 , 0 , antiLambda, lambda2, antiProton, proton2, centrality, 2 );
588596 }
589597 pairfound = true ;
598+ pairStatus[t3.index ()][t2.index ()] = true ;
599+ // LOGF(info, "v0 id: (%d, %d)", t3.index(), t2.index());
590600 if (pairfound) {
591601 // LOGF(info, "Pair found");
592602 break ;
@@ -597,206 +607,79 @@ struct LfTaskLambdaSpinCorr {
597607 }
598608 PROCESS_SWITCH (LfTaskLambdaSpinCorr, processME, " Process data ME" , true );
599609
600- using CollisionMCTrueTable = aod::McCollisions;
601- using TrackMCTrueTable = aod::McParticles;
602-
603- using CollisionMCRecTableCentFT0C = soa::SmallGroups<soa::Join<aod::McCollisionLabels, aod::Collisions, aod::CentFT0Cs, aod::EvSels, aod::PVMults>>;
604- using TrackMCRecTable = soa::Join<aod::Tracks, aod::TracksExtra, aod::TracksDCA, aod::McTrackLabels, aod::TrackSelection, aod::pidTPCFullPi, aod::pidTPCFullPr>;
605- // using FilTrackMCRecTable = soa::Filtered<TrackMCRecTable>;
606- using FilTrackMCRecTable = TrackMCRecTable;
607- Preslice<TrackMCRecTable> perCollision = aod::track::collisionId;
610+ using CollisionMCRecTableCentFT0C = soa::Join<aod::Collisions, aod::CentFT0Cs, aod::EvSels>;
611+ using TrackMCRecTable = soa::Join<aod::Tracks, aod::TracksExtra, aod::TracksDCA, aod::TrackSelection, aod::pidTPCFullPi, aod::pidTPCFullPr>;
608612 using V0TrackCandidatesMC = soa::Join<aod::V0Datas, aod::McV0Labels>;
609-
610- void processMC (CollisionMCTrueTable::iterator const & /* TrueCollision*/ , CollisionMCRecTableCentFT0C const & RecCollisions, TrackMCTrueTable const & GenParticles, FilTrackMCRecTable const & /* RecTracks*/ , V0TrackCandidatesMC const & V0s)
613+ void processMC (CollisionMCRecTableCentFT0C::iterator const & collision, TrackMCRecTable const & tracks, V0TrackCandidatesMC const & V0s)
611614 {
612615
613- for (const auto & RecCollision : RecCollisions) {
614- if (!RecCollision.sel8 ()) {
616+ // for (const auto& RecCollis : collision) {
617+ if (!collision.sel8 ()) {
618+ return ;
619+ }
620+ if (std::abs (collision.posZ ()) > cfgCutVertex) {
621+ return ;
622+ }
623+ auto centrality = collision.centFT0C ();
624+ histos.fill (HIST (" hCentrality" ), centrality);
625+ for (const auto & v0 : V0s) {
626+ auto [lambdaTag, aLambdaTag, isValid] = getLambdaTagsMC (v0, collision);
627+ if (!isValid) {
615628 continue ;
616629 }
617- if (!RecCollision.selection_bit (aod::evsel::kNoTimeFrameBorder ) || !RecCollision.selection_bit (aod::evsel::kNoITSROFrameBorder )) {
618- // continue;
630+ if (lambdaTag) {
631+ proton = ROOT::Math::PxPyPzMVector (v0.pxpos (), v0.pypos (), v0.pzpos (), o2::constants::physics::MassProton);
632+ antiPion = ROOT::Math::PxPyPzMVector (v0.pxneg (), v0.pyneg (), v0.pzneg (), o2::constants::physics::MassPionCharged);
633+ lambda = proton + antiPion;
619634 }
620- if (std::abs (RecCollision.posZ ()) > cfgCutVertex) {
635+ if (aLambdaTag) {
636+ antiProton = ROOT::Math::PxPyPzMVector (v0.pxneg (), v0.pyneg (), v0.pzneg (), o2::constants::physics::MassProton);
637+ pion = ROOT::Math::PxPyPzMVector (v0.pxpos (), v0.pypos (), v0.pzpos (), o2::constants::physics::MassPionCharged);
638+ antiLambda = antiProton + pion;
639+ }
640+ if (lambdaTag && aLambdaTag) {
621641 continue ;
622642 }
623- auto centrality = RecCollision. centFT0C ();
624- histos. fill ( HIST ( " hCentrality " ), centrality );
625- for ( const auto & v0 : V0s) {
626- auto [lambdaTag, aLambdaTag, isValid] = getLambdaTagsMC (v0, RecCollision);
627- if (!isValid ) {
643+ auto postrack1 = v0. template posTrack_as <TrackMCRecTable> ();
644+ auto negtrack1 = v0. template negTrack_as <TrackMCRecTable>( );
645+ // 2nd loop for combination of lambda lambda
646+ for ( const auto & v02 : V0s) {
647+ if (v02. index () <= v0. index () ) {
628648 continue ;
629649 }
630- if (lambdaTag) {
631- proton = ROOT::Math::PxPyPzMVector (v0.pxpos (), v0.pypos (), v0.pzpos (), o2::constants::physics::MassProton);
632- antiPion = ROOT::Math::PxPyPzMVector (v0.pxneg (), v0.pyneg (), v0.pzneg (), o2::constants::physics::MassPionCharged);
633- lambda = proton + antiPion;
634- }
635- if (aLambdaTag) {
636- antiProton = ROOT::Math::PxPyPzMVector (v0.pxneg (), v0.pyneg (), v0.pzneg (), o2::constants::physics::MassProton);
637- pion = ROOT::Math::PxPyPzMVector (v0.pxpos (), v0.pypos (), v0.pzpos (), o2::constants::physics::MassPionCharged);
638- antiLambda = antiProton + pion;
639- }
640- if (lambdaTag && aLambdaTag) {
650+ auto [lambdaTag2, aLambdaTag2, isValid2] = getLambdaTagsMC (v02, collision);
651+ if (!isValid2) {
641652 continue ;
642653 }
643- auto postrack1 = v0.template posTrack_as <TrackMCRecTable>();
644- auto negtrack1 = v0.template negTrack_as <TrackMCRecTable>();
645- // 2nd loop for combination of lambda lambda
646- for (const auto & v02 : V0s) {
647- if (v02.v0Id () <= v0.v0Id ()) {
648- continue ;
649- }
650- auto [lambdaTag2, aLambdaTag2, isValid2] = getLambdaTagsMC (v02, RecCollision);
651- if (!isValid2) {
652- continue ;
653- }
654- if (lambdaTag2) {
655- proton2 = ROOT::Math::PxPyPzMVector (v02.pxpos (), v02.pypos (), v02.pzpos (), o2::constants::physics::MassProton);
656- antiPion2 = ROOT::Math::PxPyPzMVector (v02.pxneg (), v02.pyneg (), v02.pzneg (), o2::constants::physics::MassPionCharged);
657- lambda2 = proton2 + antiPion2;
658- }
659- if (aLambdaTag2) {
660- antiProton2 = ROOT::Math::PxPyPzMVector (v02.pxneg (), v02.pyneg (), v02.pzneg (), o2::constants::physics::MassProton);
661- pion2 = ROOT::Math::PxPyPzMVector (v02.pxpos (), v02.pypos (), v02.pzpos (), o2::constants::physics::MassPionCharged);
662- antiLambda2 = antiProton2 + pion2;
663- }
664- if (lambdaTag && aLambdaTag) {
665- continue ;
666- }
667- auto postrack2 = v02.template posTrack_as <TrackMCRecTable>();
668- auto negtrack2 = v02.template negTrack_as <TrackMCRecTable>();
669- if (postrack1.globalIndex () == postrack2.globalIndex () || negtrack1.globalIndex () == negtrack2.globalIndex ()) {
670- continue ; // no shared decay products
671- }
672- if (lambdaTag && lambdaTag2) {
673- fillHistograms (1 , 0 , 1 , 0 , lambda, lambda2, proton, proton2, centrality, 0 );
674- }
675- if (aLambdaTag && aLambdaTag2) {
676- fillHistograms (0 , 1 , 0 , 1 , antiLambda, antiLambda2, antiProton, antiProton2, centrality, 0 );
677- }
678- if (lambdaTag && aLambdaTag2) {
679- fillHistograms (1 , 0 , 0 , 1 , lambda, antiLambda2, proton, antiProton2, centrality, 0 );
680- }
681- if (aLambdaTag && lambdaTag2) {
682- fillHistograms (0 , 1 , 1 , 0 , antiLambda, lambda2, antiProton, proton2, centrality, 0 );
683- }
654+ if (lambdaTag2) {
655+ proton2 = ROOT::Math::PxPyPzMVector (v02.pxpos (), v02.pypos (), v02.pzpos (), o2::constants::physics::MassProton);
656+ antiPion2 = ROOT::Math::PxPyPzMVector (v02.pxneg (), v02.pyneg (), v02.pzneg (), o2::constants::physics::MassPionCharged);
657+ lambda2 = proton2 + antiPion2;
684658 }
685- }
686-
687- // *******generated****************
688- for (const auto & mcParticle : GenParticles) {
689- if (std::abs (mcParticle.y ()) > confV0Rap) {
690- continue ;
659+ if (aLambdaTag2) {
660+ antiProton2 = ROOT::Math::PxPyPzMVector (v02.pxneg (), v02.pyneg (), v02.pzneg (), o2::constants::physics::MassProton);
661+ pion2 = ROOT::Math::PxPyPzMVector (v02.pxpos (), v02.pypos (), v02.pzpos (), o2::constants::physics::MassPionCharged);
662+ antiLambda2 = antiProton2 + pion2;
691663 }
692- if (std::abs (mcParticle. pdgCode ()) != PDG_t:: kLambda0 ) {
664+ if (lambdaTag && aLambdaTag ) {
693665 continue ;
694666 }
695-
696- int tagamc = 0 ;
697- int tagbmc = 0 ;
698- int taga2mc = 0 ;
699- int tagb2mc = 0 ;
700-
701- auto pdg1 = mcParticle.pdgCode ();
702- auto kDaughters = mcParticle.daughters_as <aod::McParticles>();
703- int daughsize = 2 ;
704- if (kDaughters .size () != daughsize) {
705- continue ;
667+ auto postrack2 = v02.template posTrack_as <TrackMCRecTable>();
668+ auto negtrack2 = v02.template negTrack_as <TrackMCRecTable>();
669+ if (postrack1.globalIndex () == postrack2.globalIndex () || negtrack1.globalIndex () == negtrack2.globalIndex ()) {
670+ continue ; // no shared decay products
706671 }
707-
708- for (const auto & kCurrentDaughter : kDaughters ) {
709-
710- if (std::abs (kCurrentDaughter .pdgCode ()) != PDG_t::kProton && std::abs (kCurrentDaughter .pdgCode ()) != PDG_t::kPiPlus ) {
711- continue ;
712- }
713-
714- if (kCurrentDaughter .pdgCode () == PDG_t::kProton ) {
715- protonmc = ROOT::Math::PxPyPzMVector (kCurrentDaughter .px (), kCurrentDaughter .py (), kCurrentDaughter .pz (), o2::constants::physics::MassProton);
716- }
717- if (kCurrentDaughter .pdgCode () == PDG_t::kPiMinus ) {
718- antiPionmc = ROOT::Math::PxPyPzMVector (kCurrentDaughter .px (), kCurrentDaughter .py (), kCurrentDaughter .pz (), o2::constants::physics::MassPionCharged);
719- }
720-
721- if (kCurrentDaughter .pdgCode () == PDG_t::kProtonBar ) {
722- antiProtonmc = ROOT::Math::PxPyPzMVector (kCurrentDaughter .px (), kCurrentDaughter .py (), kCurrentDaughter .pz (), o2::constants::physics::MassProton);
723- }
724- if (kCurrentDaughter .pdgCode () == PDG_t::kPiPlus ) {
725- pionmc = ROOT::Math::PxPyPzMVector (kCurrentDaughter .px (), kCurrentDaughter .py (), kCurrentDaughter .pz (), o2::constants::physics::MassPionCharged);
726- }
672+ if (lambdaTag && lambdaTag2) {
673+ fillHistograms (1 , 0 , 1 , 0 , lambda, lambda2, proton, proton2, centrality, 0 );
727674 }
728- if (pdg1 == PDG_t::kLambda0 ) {
729- tagamc = 1 ;
730- lambdamc = protonmc + antiPionmc;
675+ if (aLambdaTag && aLambdaTag2) {
676+ fillHistograms (0 , 1 , 0 , 1 , antiLambda, antiLambda2, antiProton, antiProton2, centrality, 0 );
731677 }
732-
733- if (pdg1 == PDG_t::kLambda0Bar ) {
734- tagbmc = 1 ;
735- antiLambdamc = antiProtonmc + pionmc;
678+ if (lambdaTag && aLambdaTag2) {
679+ fillHistograms (1 , 0 , 0 , 1 , lambda, antiLambda2, proton, antiProton2, centrality, 0 );
736680 }
737-
738- for (const auto & mcParticle2 : GenParticles) {
739- if (std::abs (mcParticle2.y ()) > confV0Rap) {
740- continue ;
741- }
742- if (std::abs (mcParticle2.pdgCode ()) != PDG_t::kLambda0 ) {
743- continue ;
744- }
745- if (mcParticle.globalIndex () >= mcParticle2.globalIndex ()) {
746- continue ;
747- }
748-
749- auto pdg2 = mcParticle2.pdgCode ();
750- auto kDaughters2 = mcParticle2.daughters_as <aod::McParticles>();
751-
752- if (kDaughters2 .size () != daughsize) {
753- continue ;
754- }
755-
756- for (const auto & kCurrentDaughter2 : kDaughters2 ) {
757- if (std::abs (kCurrentDaughter2 .pdgCode ()) != PDG_t::kProton && std::abs (kCurrentDaughter2 .pdgCode ()) != PDG_t::kPiPlus ) {
758- continue ;
759- }
760-
761- if (kCurrentDaughter2 .pdgCode () == PDG_t::kProton ) {
762- proton2mc = ROOT::Math::PxPyPzMVector (kCurrentDaughter2 .px (), kCurrentDaughter2 .py (), kCurrentDaughter2 .pz (), o2::constants::physics::MassProton);
763- }
764- if (kCurrentDaughter2 .pdgCode () == PDG_t::kPiMinus ) {
765- antiPion2mc = ROOT::Math::PxPyPzMVector (kCurrentDaughter2 .px (), kCurrentDaughter2 .py (), kCurrentDaughter2 .pz (), o2::constants::physics::MassPionCharged);
766- }
767-
768- if (kCurrentDaughter2 .pdgCode () == PDG_t::kProtonBar ) {
769- antiProton2mc = ROOT::Math::PxPyPzMVector (kCurrentDaughter2 .px (), kCurrentDaughter2 .py (), kCurrentDaughter2 .pz (), o2::constants::physics::MassProton);
770- }
771- if (kCurrentDaughter2 .pdgCode () == PDG_t::kPiPlus ) {
772- pion2mc = ROOT::Math::PxPyPzMVector (kCurrentDaughter2 .px (), kCurrentDaughter2 .py (), kCurrentDaughter2 .pz (), o2::constants::physics::MassPionCharged);
773- }
774- }
775-
776- if (pdg2 == PDG_t::kLambda0 ) {
777- taga2mc = 1 ;
778- lambda2mc = proton2mc + antiPion2mc;
779- }
780-
781- if (pdg2 == PDG_t::kLambda0Bar ) {
782- tagb2mc = 1 ;
783- antiLambda2mc = antiProton2mc + pion2mc;
784- }
785-
786- if (tagamc && taga2mc) {
787- fillHistograms (tagamc, tagbmc, taga2mc, tagb2mc, lambdamc, lambda2mc, protonmc, proton2mc, centrality, 1 );
788- }
789- if (tagamc && tagb2mc) {
790- fillHistograms (tagamc, tagbmc, taga2mc, tagb2mc, lambdamc, antiLambda2mc, protonmc, antiProton2mc, centrality, 1 );
791- }
792-
793- if (tagbmc && taga2mc) {
794- fillHistograms (tagamc, tagbmc, taga2mc, tagb2mc, antiLambdamc, lambda2mc, antiProtonmc, proton2mc, centrality, 1 );
795- }
796-
797- if (tagbmc && tagb2mc) {
798- fillHistograms (tagamc, tagbmc, taga2mc, tagb2mc, antiLambdamc, antiLambda2mc, antiProtonmc, antiProton2mc, centrality, 1 );
799- }
681+ if (aLambdaTag && lambdaTag2) {
682+ fillHistograms (0 , 1 , 1 , 0 , antiLambda, lambda2, antiProton, proton2, centrality, 0 );
800683 }
801684 }
802685 }
@@ -828,9 +711,14 @@ struct LfTaskLambdaSpinCorr {
828711 auto groupV03 = V0s.sliceBy (tracksPerCollisionV0, collision2.globalIndex ());
829712 // for (auto& [t1, t2, t3] : soa::combinations(o2::soa::CombinationsFullIndexPolicy(groupV01, groupV02, groupV03))) {
830713 // LOGF(info, "Mixed event collisions: (%d, %d, %d)", t1.collisionId(),t2.collisionId(),t3.collisionId());
714+ auto maxV0Size = 1100 ;
715+ if (groupV01.size () > maxV0Size || groupV02.size () > maxV0Size || groupV03.size () > maxV0Size) {
716+ continue ;
717+ }
718+ bool pairStatus[1150 ][1150 ] = {{false }};
831719 for (auto & [t1, t2] : soa::combinations (o2::soa::CombinationsFullIndexPolicy (groupV01, groupV02))) {
832720 bool pairfound = false ;
833- if (t2.v0Id () <= t1.v0Id ()) {
721+ if (t2.index () <= t1.index ()) {
834722 continue ;
835723 }
836724 if (t1.collisionId () != t2.collisionId ()) {
@@ -851,6 +739,10 @@ struct LfTaskLambdaSpinCorr {
851739 continue ;
852740 }
853741 for (const auto & t3 : groupV03) {
742+ if (pairStatus[t3.index ()][t2.index ()]) {
743+ // LOGF(info, "repeat match found v0 id: (%d, %d)", t3.index(), t2.index());
744+ continue ;
745+ }
854746 if (t1.collisionId () == t3.collisionId ()) {
855747 continue ;
856748 }
@@ -873,7 +765,6 @@ struct LfTaskLambdaSpinCorr {
873765 if (std::abs (t1.phi () - t3.phi ()) > phiMix) {
874766 continue ;
875767 }
876-
877768 if (lambdaTag2) {
878769 proton = ROOT::Math::PxPyPzMVector (t2.pxpos (), t2.pypos (), t2.pzpos (), o2::constants::physics::MassProton);
879770 antiPion = ROOT::Math::PxPyPzMVector (t2.pxneg (), t2.pyneg (), t2.pzneg (), o2::constants::physics::MassPionCharged);
@@ -907,6 +798,7 @@ struct LfTaskLambdaSpinCorr {
907798 fillHistograms (0 , 1 , 1 , 0 , antiLambda, lambda2, antiProton, proton2, centrality, 2 );
908799 }
909800 pairfound = true ;
801+ pairStatus[t3.index ()][t2.index ()] = true ;
910802 if (pairfound) {
911803 // LOGF(info, "Pair found");
912804 break ;
0 commit comments