1717#include < fairlogger/Logger.h>
1818#include < tuple>
1919#include < string>
20+ #include < vector>
21+ #include " Math/Vector2D.h"
2022#include " Math/Vector3D.h"
2123#include " Math/Vector4D.h"
2224#include " Math/GenVector/Boost.h"
@@ -59,6 +61,8 @@ struct LfTaskLambdaSpinCorr {
5961 Configurable<bool > cfgEvtRCTFlagCheckerLimitAcceptAsBad{" cfgEvtRCTFlagCheckerLimitAcceptAsBad" , true , " Evt sel: RCT flag checker treat Limited Acceptance As Bad" };
6062 } rctCut;
6163 // mixing
64+ Configurable<int > mixingCombination{" mixingCombination" , 1 , " mixing Combination" };
65+ Configurable<bool > mixingEvSel{" mixingEvSel" , false , " mixingEvSel" };
6266 Configurable<int > cfgCutOccupancy{" cfgCutOccupancy" , 2000 , " Occupancy cut" };
6367 ConfigurableAxis axisVertex{" axisVertex" , {5 , -10 , 10 }, " vertex axis for bin" };
6468 ConfigurableAxis axisMultiplicityClass{" axisMultiplicityClass" , {8 , 0 , 80 }, " multiplicity percentile for bin" };
@@ -122,6 +126,9 @@ struct LfTaskLambdaSpinCorr {
122126 AxisSpec thnAxisInvMass{iMNbins, lbinIM, hbinIM, " #it{M} (GeV/#it{c}^{2})" };
123127 AxisSpec thnAxisInvMasspair{iMNbinspair, lbinIMpair, hbinIMpair, " #it{M} (GeV/#it{c}^{2})" };
124128 histos.add (" hEvtSelInfo" , " hEvtSelInfo" , kTH1F , {{10 , 0 , 10.0 }});
129+ histos.add (" hPtDiff" , " hPtDiff" , kTH1F , {{1000 , 0 , 100.0 }});
130+ histos.add (" hRDiff" , " hRDiff" , kTH1F , {{640 , 0 , 16.0 }});
131+ histos.add (" hv0Mult" , " hv0Mult" , kTH1F , {{10001 , -0.5 , 10000.5 }});
125132 histos.add (" hCentrality" , " Centrality distribution" , kTH1F , {{configcentAxis}});
126133 histos.add (" hSparseLambdaLambda" , " hSparseLambdaLambda" , HistType::kTHnSparseF , {thnAxisInvMass, thnAxisInvMass, configthnAxisPol, configcentAxis, thnAxisInvMasspair}, true );
127134 histos.add (" hSparseLambdaAntiLambda" , " hSparseLambdaAntiLambda" , HistType::kTHnSparseF , {thnAxisInvMass, thnAxisInvMass, configthnAxisPol, configcentAxis, thnAxisInvMasspair}, true );
@@ -550,7 +557,7 @@ struct LfTaskLambdaSpinCorr {
550557 if (additionalEvSel4 && !collision1.selection_bit (o2::aod::evsel::kNoCollInTimeRangeStandard )) {
551558 continue ;
552559 }
553- if (additionalEvSel5 && !collision1.selection_bit (o2::aod::evsel::kIsGoodITSLayersAll )) {
560+ if (mixingEvSel && additionalEvSel5 && !collision1.selection_bit (o2::aod::evsel::kIsGoodITSLayersAll )) {
554561 continue ;
555562 }
556563
@@ -560,7 +567,7 @@ struct LfTaskLambdaSpinCorr {
560567 if (additionalEvSel4 && !collision2.selection_bit (o2::aod::evsel::kNoCollInTimeRangeStandard )) {
561568 continue ;
562569 }
563- if (additionalEvSel5 && !collision2.selection_bit (o2::aod::evsel::kIsGoodITSLayersAll )) {
570+ if (mixingEvSel && additionalEvSel5 && !collision2.selection_bit (o2::aod::evsel::kIsGoodITSLayersAll )) {
564571 continue ;
565572 }
566573
@@ -570,11 +577,17 @@ struct LfTaskLambdaSpinCorr {
570577 auto groupV03 = V0s.sliceBy (tracksPerCollisionV0, collision2.globalIndex ());
571578 // for (auto& [t1, t2, t3] : soa::combinations(o2::soa::CombinationsFullIndexPolicy(groupV01, groupV02, groupV03))) {
572579 // LOGF(info, "Mixed event collisions: (%d, %d, %d)", t1.collisionId(),t2.collisionId(),t3.collisionId());
573- auto maxV0Size = 1100 ;
574- if (groupV01.size () > maxV0Size || groupV02.size () > maxV0Size || groupV03.size () > maxV0Size) {
575- continue ;
576- }
577- bool pairStatus[1150 ][1150 ] = {{false }};
580+
581+ // auto maxV0Size = 1400;
582+ // if (groupV01.size() > maxV0Size || groupV02.size() > maxV0Size || groupV03.size() > maxV0Size) {
583+ // continue;
584+ // }
585+ // bool pairStatus[1500][1500] = {{false}};
586+
587+ size_t rows = groupV03.size () + 20 ;
588+ size_t cols = groupV01.size () + 20 ;
589+ std::vector<std::vector<bool >> pairStatus (rows, std::vector<bool >(cols, false ));
590+ histos.fill (HIST (" hv0Mult" ), groupV01.size ());
578591 for (auto & [t1, t2] : soa::combinations (o2::soa::CombinationsFullIndexPolicy (groupV01, groupV02))) {
579592 bool pairfound = false ;
580593 if (t2.index () <= t1.index ()) {
@@ -605,9 +618,14 @@ struct LfTaskLambdaSpinCorr {
605618 if (postrack1.globalIndex () == postrack2.globalIndex () || negtrack1.globalIndex () == negtrack2.globalIndex ()) {
606619 continue ;
607620 }
621+ auto samePairSumPt = t1.pt () + t2.pt ();
622+ auto samePairR = TMath::Sqrt (TMath::Power (t1.phi () - t2.phi (), 2.0 ) + TMath::Power (t1.eta () - t2.eta (), 2.0 ));
608623 for (const auto & t3 : groupV03) {
624+ // if (pairStatus[t3.index()][t2.index()]) {
625+ // LOGF(info, "repeat match found v0 id: (%d, %d)", t3.index(), t2.index());
626+ // continue;
627+ // }
609628 if (pairStatus[t3.index ()][t2.index ()]) {
610- // LOGF(info, "repeat match found v0 id: (%d, %d)", t3.index(), t2.index());
611629 continue ;
612630 }
613631 if (t1.collisionId () == t3.collisionId ()) {
@@ -623,13 +641,33 @@ struct LfTaskLambdaSpinCorr {
623641 if (lambdaTag1 != lambdaTag3 || aLambdaTag1 != aLambdaTag3) {
624642 continue ;
625643 }
626- if (std::abs (t1.pt () - t3.pt ()) > ptMix) {
644+ // if (std::abs(t1.pt() - t3.pt()) > ptMix) {
645+ // continue;
646+ // }
647+ // if (std::abs(t1.eta() - t3.eta()) > etaMix) {
648+ // continue;
649+ // }
650+ // if (std::abs(t1.phi() - t3.phi()) > phiMix) {
651+ // continue;
652+ // }
653+ auto mixPairSumPt = t3.pt () + t2.pt ();
654+ auto mixPairR = TMath::Sqrt (TMath::Power (t3.phi () - t2.phi (), 2.0 ) + TMath::Power (t3.eta () - t2.eta (), 2.0 ));
655+ histos.fill (HIST (" hPtDiff" ), TMath::Abs (mixPairSumPt - samePairSumPt));
656+ histos.fill (HIST (" hRDiff" ), TMath::Abs (mixPairR - samePairR));
657+ if (mixingCombination == 0 && std::abs (t1.pt () - t3.pt ()) > ptMix) {
627658 continue ;
628659 }
629- if (std::abs (t1.eta () - t3.eta ()) > etaMix) {
660+ if (mixingCombination == 0 && std::abs (t1.eta () - t3.eta ()) > etaMix) {
630661 continue ;
631662 }
632- if (std::abs (t1.phi () - t3.phi ()) > phiMix) {
663+ if (mixingCombination == 0 && std::abs (t1.phi () - t3.phi ()) > phiMix) {
664+ continue ;
665+ }
666+
667+ if (mixingCombination == 1 && std::abs (mixPairSumPt - samePairSumPt) > ptMix) {
668+ continue ;
669+ }
670+ if (mixingCombination == 1 && std::abs (mixPairR - samePairR) > etaMix) {
633671 continue ;
634672 }
635673 if (lambdaTag2) {
@@ -654,17 +692,17 @@ struct LfTaskLambdaSpinCorr {
654692 }
655693 if (lambdaTag2 && lambdaTag3) {
656694 fillHistograms (1 , 0 , 1 , 0 , lambda, lambda2, proton, proton2, centrality, 2 );
657- }
658- if (aLambdaTag2 && aLambdaTag3) {
695+ } else if (aLambdaTag2 && aLambdaTag3) {
659696 fillHistograms (0 , 1 , 0 , 1 , antiLambda, antiLambda2, antiProton, antiProton2, centrality, 2 );
660- }
661- if (lambdaTag2 && aLambdaTag3) {
697+ } else if (lambdaTag2 && aLambdaTag3) {
662698 fillHistograms (1 , 0 , 0 , 1 , lambda, antiLambda2, proton, antiProton2, centrality, 2 );
663- }
664- if (aLambdaTag2 && lambdaTag3) {
699+ } else if (aLambdaTag2 && lambdaTag3) {
665700 fillHistograms (0 , 1 , 1 , 0 , antiLambda, lambda2, antiProton, proton2, centrality, 2 );
701+ } else {
702+ continue ;
666703 }
667704 pairfound = true ;
705+ // pairStatus[t3.index()][t2.index()] = true;
668706 pairStatus[t3.index ()][t2.index ()] = true ;
669707 // LOGF(info, "v0 id: (%d, %d)", t3.index(), t2.index());
670708 if (pairfound) {
0 commit comments