1515// / \author Pritam Chakraborty, WUT Warsaw, pritam.chakraborty@pw.edu.pl
1616
1717#include < vector>
18+ #include < string>
1819#include " TRandom2.h"
1920#include " Framework/AnalysisTask.h"
2021#include " Framework/runDataProcessing.h"
@@ -214,6 +215,8 @@ struct femtoUniversePairTaskTrackTrack3DMultKtExtended {
214215 HistogramRegistry SameMultRegistryMM{" SameMultRegistryMM" , {}, OutputObjHandlingPolicy::AnalysisObject, true , true };
215216 HistogramRegistry MixedMultRegistryMM{" MixedMultRegistryMM" , {}, OutputObjHandlingPolicy::AnalysisObject, true , true };
216217
218+ TRandom2* randgen;
219+
217220 // PID for protons
218221 bool IsProtonNSigma (float mom, float nsigmaTPCPr, float nsigmaTOFPr) // previous version from: https://github.com/alisw/AliPhysics/blob/master/PWGCF/FEMTOSCOPY/AliFemtoUser/AliFemtoMJTrackCut.cxx
219222 {
@@ -485,7 +488,6 @@ struct femtoUniversePairTaskTrackTrack3DMultKtExtended {
485488 }
486489 } else {
487490 // / Now build the combinations for identical particles pairs
488- TRandom2* randgen = new TRandom2 (0 );
489491 double rand;
490492 for (auto & [p1, p2] : combinations (CombinationsStrictlyUpperIndexPolicy (groupPartsOne, groupPartsOne))) {
491493
@@ -573,6 +575,7 @@ struct femtoUniversePairTaskTrackTrack3DMultKtExtended {
573575 auto thegroupPartsTwo = partsTwo->sliceByCached (aod::femtouniverseparticle::fdCollisionId, col.globalIndex (), cache);
574576
575577 bool fillQA = true ;
578+ randgen = new TRandom2 (0 );
576579
577580 if (cfgProcessPM) {
578581 doSameEvent<false >(thegroupPartsOne, thegroupPartsTwo, parts, col.magField (), col.multV0M (), 1 , fillQA);
@@ -585,6 +588,7 @@ struct femtoUniversePairTaskTrackTrack3DMultKtExtended {
585588 if (cfgProcessMM) {
586589 doSameEvent<false >(thegroupPartsTwo, thegroupPartsTwo, parts, col.magField (), col.multV0M (), 3 , fillQA);
587590 }
591+ delete randgen;
588592 }
589593 PROCESS_SWITCH (femtoUniversePairTaskTrackTrack3DMultKtExtended, processSameEvent, " Enable processing same event" , true );
590594
@@ -647,38 +651,72 @@ struct femtoUniversePairTaskTrackTrack3DMultKtExtended {
647651 }
648652 }
649653
654+ double rand;
655+ rand = randgen->Rndm ();
656+
650657 switch (ContType) {
651658 case 1 : {
652659 float kT = FemtoUniverseMath::getkT (p1, mass1, p2, mass2);
653- if (!cfgProcessMultBins) {
654- mixedEventCont.setPair <isMC>(p1, p2, multCol, twotracksconfigs.ConfUse3D , ConfIsIden);
660+
661+ if (rand > 0.5 ) {
662+ if (!cfgProcessMultBins) {
663+ mixedEventCont.setPair <isMC>(p1, p2, multCol, twotracksconfigs.ConfUse3D , ConfIsIden);
664+ } else {
665+ std::vector<double > k3d = FemtoUniverseMath::newpairfunc (p1, mass1, p2, mass2, ConfIsIden);
666+ mixedEventMultCont.fill_3D <float >(k3d[1 ], k3d[2 ], k3d[3 ], multCol, kT );
667+ }
655668 } else {
656- std::vector<double > k3d = FemtoUniverseMath::newpairfunc (p1, mass1, p2, mass2, ConfIsIden);
657- mixedEventMultCont.fill_3D <float >(k3d[1 ], k3d[2 ], k3d[3 ], multCol, kT );
669+ if (!cfgProcessMultBins) {
670+ mixedEventCont.setPair <isMC>(p2, p1, multCol, twotracksconfigs.ConfUse3D , ConfIsIden);
671+ } else {
672+ std::vector<double > k3d = FemtoUniverseMath::newpairfunc (p2, mass2, p1, mass1, ConfIsIden);
673+ mixedEventMultCont.fill_3D <float >(k3d[1 ], k3d[2 ], k3d[3 ], multCol, kT );
674+ }
658675 }
659676 break ;
660677 }
661678 case 2 : {
662679 float kT = FemtoUniverseMath::getkT (p1, mass1, p2, mass1);
663- if (!cfgProcessMultBins) {
664- mixedEventContPP.setPair <isMC>(p1, p2, multCol, twotracksconfigs.ConfUse3D , ConfIsIden);
680+
681+ if (rand > 0.5 ) {
682+ if (!cfgProcessMultBins) {
683+ mixedEventContPP.setPair <isMC>(p1, p2, multCol, twotracksconfigs.ConfUse3D , ConfIsIden);
684+ } else {
685+ std::vector<double > k3d = FemtoUniverseMath::newpairfunc (p1, mass1, p2, mass2, ConfIsIden);
686+ mixedEventMultContPP.fill_3D <float >(k3d[1 ], k3d[2 ], k3d[3 ], multCol, kT );
687+ }
665688 } else {
666- std::vector<double > k3d = FemtoUniverseMath::newpairfunc (p1, mass1, p2, mass2, ConfIsIden);
667- mixedEventMultContPP.fill_3D <float >(k3d[1 ], k3d[2 ], k3d[3 ], multCol, kT );
689+ if (!cfgProcessMultBins) {
690+ mixedEventContPP.setPair <isMC>(p2, p1, multCol, twotracksconfigs.ConfUse3D , ConfIsIden);
691+ } else {
692+ std::vector<double > k3d = FemtoUniverseMath::newpairfunc (p2, mass2, p1, mass1, ConfIsIden);
693+ mixedEventMultContPP.fill_3D <float >(k3d[1 ], k3d[2 ], k3d[3 ], multCol, kT );
694+ }
668695 }
669696 break ;
670697 }
671698
672699 case 3 : {
673700 float kT = FemtoUniverseMath::getkT (p1, mass2, p2, mass2);
674- if (!cfgProcessMultBins) {
675- mixedEventContMM.setPair <isMC>(p1, p2, multCol, twotracksconfigs.ConfUse3D , ConfIsIden);
701+
702+ if (rand > 0.5 ) {
703+ if (!cfgProcessMultBins) {
704+ mixedEventContMM.setPair <isMC>(p1, p2, multCol, twotracksconfigs.ConfUse3D , ConfIsIden);
705+ } else {
706+ std::vector<double > k3d = FemtoUniverseMath::newpairfunc (p1, mass1, p2, mass2, ConfIsIden);
707+ mixedEventMultContMM.fill_3D <float >(k3d[1 ], k3d[2 ], k3d[3 ], multCol, kT );
708+ }
676709 } else {
677- std::vector<double > k3d = FemtoUniverseMath::newpairfunc (p1, mass1, p2, mass2, ConfIsIden);
678- mixedEventMultContMM.fill_3D <float >(k3d[1 ], k3d[2 ], k3d[3 ], multCol, kT );
710+ if (!cfgProcessMultBins) {
711+ mixedEventContMM.setPair <isMC>(p2, p1, multCol, twotracksconfigs.ConfUse3D , ConfIsIden);
712+ } else {
713+ std::vector<double > k3d = FemtoUniverseMath::newpairfunc (p2, mass2, p1, mass1, ConfIsIden);
714+ mixedEventMultContMM.fill_3D <float >(k3d[1 ], k3d[2 ], k3d[3 ], multCol, kT );
715+ }
679716 }
680717 break ;
681718 }
719+
682720 default :
683721 break ;
684722 }
@@ -691,6 +729,8 @@ struct femtoUniversePairTaskTrackTrack3DMultKtExtended {
691729 void processMixedEvent (FilteredFDCollisions& cols,
692730 FilteredFemtoFullParticles& parts)
693731 {
732+ randgen = new TRandom2 (0 );
733+
694734 for (auto & [collision1, collision2] : soa::selfCombinations (colBinning, 5 , -1 , cols, cols)) {
695735
696736 const int multiplicityCol = collision1.multV0M ();
@@ -719,6 +759,7 @@ struct femtoUniversePairTaskTrackTrack3DMultKtExtended {
719759 doMixedEvent<false >(groupPartsOne, groupPartsTwo, parts, magFieldTesla1, multiplicityCol, 3 );
720760 }
721761 }
762+ delete randgen;
722763 }
723764 PROCESS_SWITCH (femtoUniversePairTaskTrackTrack3DMultKtExtended, processMixedEvent, " Enable processing mixed events" , true );
724765
0 commit comments