@@ -486,13 +486,63 @@ struct lambdapolsp {
486486 return result;
487487 }
488488
489- ROOT::Math::PxPyPzMVector Lambda, Lambdacopy, Proton, Pion, fourVecDauCM;
490- // ROOT::Math::XYZVector threeVecDauCM, threeVecDauCMXY, eventplaneVec, eventplaneVecNorm, beamvector;
489+ bool shouldReject (bool LambdaTag, bool aLambdaTag,
490+ const ROOT::Math::PxPyPzMVector& Lambdadummy,
491+ const ROOT::Math::PxPyPzMVector& AntiLambdadummy)
492+ {
493+ const double minMass = 1.105 ;
494+ const double maxMass = 1.125 ;
495+ return (LambdaTag && aLambdaTag &&
496+ (Lambdadummy.M () > minMass && Lambdadummy.M () < maxMass) &&
497+ (AntiLambdadummy.M () > minMass && AntiLambdadummy.M () < maxMass));
498+ }
499+
500+ void fillHistograms (bool tag1, bool tag2, const ROOT::Math::PxPyPzMVector& particle,
501+ const ROOT::Math::PxPyPzMVector& daughter,
502+ double psiZDCC, double psiZDCA, double centrality,
503+ double candmass, double candpt, double candeta)
504+ {
505+
506+ ROOT::Math::Boost boost{particle.BoostToCM ()};
507+ auto fourVecDauCM = boost (daughter);
508+ auto phiangle = TMath::ATan2 (fourVecDauCM.Py (), fourVecDauCM.Px ());
509+
510+ auto phiminuspsiC = GetPhiInRange (phiangle - psiZDCC);
511+ auto phiminuspsiA = GetPhiInRange (phiangle - psiZDCA);
512+ auto cosThetaStar = fourVecDauCM.Pz () / fourVecDauCM.P ();
513+ auto sinThetaStar = TMath::Sqrt (1 - (cosThetaStar * cosThetaStar));
514+ auto PolC = TMath::Sin (phiminuspsiC);
515+ auto PolA = TMath::Sin (phiminuspsiA);
516+
517+ auto sinPhiStar = TMath::Sin (GetPhiInRange (phiangle));
518+ auto cosPhiStar = TMath::Cos (GetPhiInRange (phiangle));
519+ auto sinThetaStarcosphiphiStar = sinThetaStar * TMath::Cos (2 * GetPhiInRange (particle.Phi () - phiangle));
520+ auto phiphiStar = GetPhiInRange (particle.Phi () - phiangle);
521+
522+ // Fill histograms using constructed names
523+ if (tag2) {
524+ histos.fill (HIST (" hSparseAntiLambdaPolA" ), candmass, candpt, candeta, PolA, centrality);
525+ histos.fill (HIST (" hSparseAntiLambdaPolC" ), candmass, candpt, candeta, PolC, centrality);
526+ histos.fill (HIST (" hSparseAntiLambda_corr1a" ), candmass, candpt, candeta, sinPhiStar, centrality);
527+ histos.fill (HIST (" hSparseAntiLambda_corr1b" ), candmass, candpt, candeta, cosPhiStar, centrality);
528+ histos.fill (HIST (" hSparseAntiLambda_corr1c" ), candmass, candpt, candeta, phiphiStar, centrality);
529+ histos.fill (HIST (" hSparseAntiLambda_corr2a" ), candmass, candpt, candeta, sinThetaStar, centrality);
530+ histos.fill (HIST (" hSparseAntiLambda_corr2b" ), candmass, candpt, candeta, sinThetaStarcosphiphiStar, centrality);
531+ }
532+ if (tag1) {
533+ histos.fill (HIST (" hSparseLambdaPolA" ), candmass, candpt, candeta, PolA, centrality);
534+ histos.fill (HIST (" hSparseLambdaPolC" ), candmass, candpt, candeta, PolC, centrality);
535+ histos.fill (HIST (" hSparseLambda_corr1a" ), candmass, candpt, candeta, sinPhiStar, centrality);
536+ histos.fill (HIST (" hSparseLambda_corr1b" ), candmass, candpt, candeta, cosPhiStar, centrality);
537+ histos.fill (HIST (" hSparseLambda_corr1c" ), candmass, candpt, candeta, phiphiStar, centrality);
538+ histos.fill (HIST (" hSparseLambda_corr2a" ), candmass, candpt, candeta, sinThetaStar, centrality);
539+ histos.fill (HIST (" hSparseLambda_corr2b" ), candmass, candpt, candeta, sinThetaStarcosphiphiStar, centrality);
540+ }
541+ }
542+
543+ ROOT::Math::PxPyPzMVector Lambda, AntiLambda, Lambdadummy, AntiLambdadummy, Proton, Pion, AntiProton, AntiPion, fourVecDauCM;
491544 ROOT::Math::XYZVector threeVecDauCM, threeVecDauCMXY;
492545 double phiangle = 0.0 ;
493- // double massPi = TDatabasePDG::Instance()->GetParticle(kPiPlus)->Mass();
494- // double massPr = TDatabasePDG::Instance()->GetParticle(kProton)->Mass();
495- // double massLambda = TDatabasePDG::Instance()->GetParticle(kLambda0)->Mass();
496546 double massLambda = o2::constants::physics::MassLambda;
497547 double massPr = o2::constants::physics::MassProton;
498548 double massPi = o2::constants::physics::MassPionCharged;
@@ -700,91 +750,42 @@ struct lambdapolsp {
700750 aLambdaTag = 1 ;
701751 }
702752
703- if (LambdaTag == aLambdaTag)
753+ if (! LambdaTag && ! aLambdaTag)
704754 continue ;
705755
706756 if (!SelectionV0 (collision, v0)) {
707757 continue ;
708758 }
709759
710760 if (LambdaTag) {
711- if (useglobal) {
712- Proton = ROOT::Math::PxPyPzMVector (postrack.px (), postrack.py (), postrack.pz (), massPr);
713- Pion = ROOT::Math::PxPyPzMVector (negtrack.px (), negtrack.py (), negtrack.pz (), massPi);
714- } else {
715- Proton = ROOT::Math::PxPyPzMVector (v0.pxpos (), v0.pypos (), v0.pzpos (), massPr);
716- Pion = ROOT::Math::PxPyPzMVector (v0.pxneg (), v0.pyneg (), v0.pzneg (), massPi);
717- }
761+ Proton = ROOT::Math::PxPyPzMVector (v0.pxpos (), v0.pypos (), v0.pzpos (), massPr);
762+ AntiPion = ROOT::Math::PxPyPzMVector (v0.pxneg (), v0.pyneg (), v0.pzneg (), massPi);
763+ Lambdadummy = Proton + AntiPion;
718764 }
719765 if (aLambdaTag) {
720- if (useglobal) {
721- Proton = ROOT::Math::PxPyPzMVector (negtrack. px (), negtrack. py (), negtrack. pz (), massPr );
722- Pion = ROOT::Math::PxPyPzMVector (postrack. px (), postrack. py (), postrack. pz (), massPi) ;
723- } else {
724- Proton = ROOT::Math::PxPyPzMVector (v0. pxneg (), v0. pyneg (), v0. pzneg (), massPr);
725- Pion = ROOT::Math::PxPyPzMVector (v0. pxpos (), v0. pypos (), v0. pzpos (), massPi);
726- }
766+ AntiProton = ROOT::Math::PxPyPzMVector (v0. pxneg (), v0. pyneg (), v0. pzneg (), massPr);
767+ Pion = ROOT::Math::PxPyPzMVector (v0. pxpos (), v0. pypos (), v0. pzpos (), massPi );
768+ AntiLambdadummy = AntiProton + Pion ;
769+ }
770+
771+ if ( shouldReject (LambdaTag, aLambdaTag, Lambdadummy, AntiLambdadummy)) {
772+ continue ;
727773 }
728- Lambda = Proton + Pion;
729- // Lambda.SetM(massLambda);
730-
731- ROOT::Math::Boost boost{Lambda.BoostToCM ()};
732- fourVecDauCM = boost (Proton);
733- threeVecDauCM = fourVecDauCM.Vect ();
734- // beamvector = ROOT::Math::XYZVector(0, 0, 1);
735- // eventplaneVec = ROOT::Math::XYZVector(collision.qFT0C(), collision.qFT0A(), 0); //this needs to be changed
736- // eventplaneVecNorm = eventplaneVec.Cross(beamvector); //z'
737- phiangle = TMath::ATan2 (fourVecDauCM.Py (), fourVecDauCM.Px ());
738- // double phiangledir = fourVecDauCM.Phi();
739-
740- auto phiminuspsiC = GetPhiInRange (phiangle - psiZDCC);
741- auto phiminuspsiA = GetPhiInRange (phiangle - psiZDCA);
742- // histos.fill(HIST("hpsiApsiC"), psiZDCA, psiZDCC);
743- // histos.fill(HIST("hpsiApsiC"), GetPhiInRange(GetPhiInRange(phiangle) - GetPhiInRange(psiZDCA)), phiminuspsiA);
744- // histos.fill(HIST("hphiminuspsiA"), (phiminuspsiA));
745- // histos.fill(HIST("hphiminuspsiC"), (phiminuspsiC));
746- // auto cosThetaStar = eventplaneVecNorm.Dot(threeVecDauCM) / std::sqrt(threeVecDauCM.Mag2()) / std::sqrt(eventplaneVecNorm.Mag2());
747- auto cosThetaStar = fourVecDauCM.Pz () / fourVecDauCM.P (); // A0 correction
748- auto sinThetaStar = TMath::Sqrt (1 - (cosThetaStar * cosThetaStar));
749- auto PolC = TMath::Sin (phiminuspsiC);
750- auto PolA = TMath::Sin (phiminuspsiA);
751-
752- // needed for corrections
753- auto sinPhiStar = TMath::Sin (GetPhiInRange (phiangle));
754- auto cosPhiStar = TMath::Cos (GetPhiInRange (phiangle));
755- auto sinThetaStarcosphiphiStar = sinThetaStar * TMath::Cos (2 * GetPhiInRange (Lambda.Phi () - phiangle)); // A2 correction
756- auto phiphiStar = GetPhiInRange (Lambda.Phi () - phiangle);
757-
758- auto candmass = 0.0 ;
759- auto candpt = 0.0 ;
760- auto candeta = 0.0 ;
774+
775+ int taga = LambdaTag;
776+ int tagb = aLambdaTag;
761777
762778 if (LambdaTag) {
763- candmass = v0.mLambda ();
764- candpt = v0.pt ();
765- candeta = v0.eta ();
766-
767- histos.fill (HIST (" hSparseLambdaPolA" ), candmass, candpt, candeta, PolA, centrality);
768- histos.fill (HIST (" hSparseLambdaPolC" ), candmass, candpt, candeta, PolC, centrality);
769- histos.fill (HIST (" hSparseLambda_corr1a" ), candmass, candpt, candeta, sinPhiStar, centrality);
770- histos.fill (HIST (" hSparseLambda_corr1b" ), candmass, candpt, candeta, cosPhiStar, centrality);
771- histos.fill (HIST (" hSparseLambda_corr1c" ), candmass, candpt, candeta, phiphiStar, centrality);
772- histos.fill (HIST (" hSparseLambda_corr2a" ), candmass, candpt, candeta, sinThetaStar, centrality);
773- histos.fill (HIST (" hSparseLambda_corr2b" ), candmass, candpt, candeta, sinThetaStarcosphiphiStar, centrality);
779+ Lambda = Proton + AntiPion;
780+ tagb = 0 ;
781+ fillHistograms (taga, tagb, Lambda, Proton, psiZDCC, psiZDCA, centrality, v0.mLambda (), v0.pt (), v0.eta ());
774782 }
775783
784+ tagb = aLambdaTag;
776785 if (aLambdaTag) {
777- candmass = v0.mAntiLambda ();
778- candpt = v0.pt ();
779- candeta = v0.eta ();
780-
781- histos.fill (HIST (" hSparseAntiLambdaPolA" ), candmass, candpt, candeta, PolA, centrality);
782- histos.fill (HIST (" hSparseAntiLambdaPolC" ), candmass, candpt, candeta, PolC, centrality);
783- histos.fill (HIST (" hSparseAntiLambda_corr1a" ), candmass, candpt, candeta, sinPhiStar, centrality);
784- histos.fill (HIST (" hSparseAntiLambda_corr1b" ), candmass, candpt, candeta, cosPhiStar, centrality);
785- histos.fill (HIST (" hSparseAntiLambda_corr1c" ), candmass, candpt, candeta, phiphiStar, centrality);
786- histos.fill (HIST (" hSparseAntiLambda_corr2a" ), candmass, candpt, candeta, sinThetaStar, centrality);
787- histos.fill (HIST (" hSparseAntiLambda_corr2b" ), candmass, candpt, candeta, sinThetaStarcosphiphiStar, centrality);
786+ AntiLambda = AntiProton + Pion;
787+ taga = 0 ;
788+ fillHistograms (taga, tagb, AntiLambda, AntiProton, psiZDCC, psiZDCA, centrality, v0.mAntiLambda (), v0.pt (), v0.eta ());
788789 }
789790 }
790791 }
@@ -842,7 +843,7 @@ struct lambdapolsp {
842843 bool LambdaTag = isCompatible (v0, 0 );
843844 bool aLambdaTag = isCompatible (v0, 1 );
844845
845- if (LambdaTag == aLambdaTag)
846+ if (! LambdaTag && ! aLambdaTag)
846847 continue ;
847848
848849 if (!SelectionV0 (collision, v0)) {
@@ -851,71 +852,35 @@ struct lambdapolsp {
851852
852853 if (LambdaTag) {
853854 Proton = ROOT::Math::PxPyPzMVector (v0.pxpos (), v0.pypos (), v0.pzpos (), massPr);
854- Pion = ROOT::Math::PxPyPzMVector (v0.pxneg (), v0.pyneg (), v0.pzneg (), massPi);
855+ AntiPion = ROOT::Math::PxPyPzMVector (v0.pxneg (), v0.pyneg (), v0.pzneg (), massPi);
856+ Lambdadummy = Proton + AntiPion;
855857 }
856858 if (aLambdaTag) {
857- Proton = ROOT::Math::PxPyPzMVector (v0.pxneg (), v0.pyneg (), v0.pzneg (), massPr);
859+ AntiProton = ROOT::Math::PxPyPzMVector (v0.pxneg (), v0.pyneg (), v0.pzneg (), massPr);
858860 Pion = ROOT::Math::PxPyPzMVector (v0.pxpos (), v0.pypos (), v0.pzpos (), massPi);
861+ AntiLambdadummy = AntiProton + Pion;
859862 }
860- Lambda = Proton + Pion;
861-
862- ROOT::Math::Boost boost{Lambda.BoostToCM ()};
863- fourVecDauCM = boost (Proton);
864- threeVecDauCM = fourVecDauCM.Vect ();
865- // beamvector = ROOT::Math::XYZVector(0, 0, 1);
866- // eventplaneVec = ROOT::Math::XYZVector(collision.qFT0C(), collision.qFT0A(), 0); //this needs to be changed
867- // eventplaneVecNorm = eventplaneVec.Cross(beamvector); //z'
868- phiangle = TMath::ATan2 (fourVecDauCM.Py (), fourVecDauCM.Px ());
869- // double phiangledir = fourVecDauCM.Phi();
870-
871- auto phiminuspsiC = GetPhiInRange (phiangle - psiZDCC);
872- auto phiminuspsiA = GetPhiInRange (phiangle - psiZDCA);
873- // histos.fill(HIST("hpsiApsiC"), psiZDCA, psiZDCC);
874- // histos.fill(HIST("hpsiApsiC"), GetPhiInRange(GetPhiInRange(phiangle) - GetPhiInRange(psiZDCA)), phiminuspsiA);
875- // histos.fill(HIST("hphiminuspsiA"), (phiminuspsiA));
876- // histos.fill(HIST("hphiminuspsiC"), (phiminuspsiC));
877- // auto cosThetaStar = eventplaneVecNorm.Dot(threeVecDauCM) / std::sqrt(threeVecDauCM.Mag2()) / std::sqrt(eventplaneVecNorm.Mag2());
878- auto cosThetaStar = fourVecDauCM.Pz () / fourVecDauCM.P (); // A0 correction
879- auto sinThetaStar = TMath::Sqrt (1 - (cosThetaStar * cosThetaStar));
880- auto PolC = TMath::Sin (phiminuspsiC);
881- auto PolA = TMath::Sin (phiminuspsiA);
882-
883- // needed for corrections
884- auto sinPhiStar = TMath::Sin (GetPhiInRange (phiangle));
885- auto cosPhiStar = TMath::Cos (GetPhiInRange (phiangle));
886- auto sinThetaStarcosphiphiStar = sinThetaStar * TMath::Cos (2 * GetPhiInRange (Lambda.Phi () - phiangle)); // A2 correction
887- auto phiphiStar = GetPhiInRange (Lambda.Phi () - phiangle);
888-
889- auto candmass = 0.0 ;
890- auto candpt = 0.0 ;
891- auto candeta = 0.0 ;
863+
864+ if (shouldReject (LambdaTag, aLambdaTag, Lambdadummy, AntiLambdadummy)) {
865+ continue ;
866+ }
867+
868+ int taga = LambdaTag;
869+ int tagb = aLambdaTag;
892870
893871 if (LambdaTag) {
894- candmass = v0.mLambda ();
895- candpt = v0.pt ();
896- candeta = v0.eta ();
897-
898- histos.fill (HIST (" hSparseLambdaPolA" ), candmass, candpt, candeta, PolA, centrality);
899- histos.fill (HIST (" hSparseLambdaPolC" ), candmass, candpt, candeta, PolC, centrality);
900- histos.fill (HIST (" hSparseLambda_corr1a" ), candmass, candpt, candeta, sinPhiStar, centrality);
901- histos.fill (HIST (" hSparseLambda_corr1b" ), candmass, candpt, candeta, cosPhiStar, centrality);
902- histos.fill (HIST (" hSparseLambda_corr1c" ), candmass, candpt, candeta, phiphiStar, centrality);
903- histos.fill (HIST (" hSparseLambda_corr2a" ), candmass, candpt, candeta, sinThetaStar, centrality);
904- histos.fill (HIST (" hSparseLambda_corr2b" ), candmass, candpt, candeta, sinThetaStarcosphiphiStar, centrality);
872+ Lambda = Proton + AntiPion;
873+ tagb = 0 ;
874+ fillHistograms (taga, tagb, Lambda, Proton, psiZDCC, psiZDCA, centrality,
875+ v0.mLambda (), v0.pt (), v0.eta ());
905876 }
906877
878+ tagb = aLambdaTag;
907879 if (aLambdaTag) {
908- candmass = v0.mAntiLambda ();
909- candpt = v0.pt ();
910- candeta = v0.eta ();
911-
912- histos.fill (HIST (" hSparseAntiLambdaPolA" ), candmass, candpt, candeta, PolA, centrality);
913- histos.fill (HIST (" hSparseAntiLambdaPolC" ), candmass, candpt, candeta, PolC, centrality);
914- histos.fill (HIST (" hSparseAntiLambda_corr1a" ), candmass, candpt, candeta, sinPhiStar, centrality);
915- histos.fill (HIST (" hSparseAntiLambda_corr1b" ), candmass, candpt, candeta, cosPhiStar, centrality);
916- histos.fill (HIST (" hSparseAntiLambda_corr1c" ), candmass, candpt, candeta, phiphiStar, centrality);
917- histos.fill (HIST (" hSparseAntiLambda_corr2a" ), candmass, candpt, candeta, sinThetaStar, centrality);
918- histos.fill (HIST (" hSparseAntiLambda_corr2b" ), candmass, candpt, candeta, sinThetaStarcosphiphiStar, centrality);
880+ AntiLambda = AntiProton + Pion;
881+ taga = 0 ;
882+ fillHistograms (taga, tagb, AntiLambda, AntiProton, psiZDCC, psiZDCA, centrality,
883+ v0.mAntiLambda (), v0.pt (), v0.eta ());
919884 }
920885 } // end loop over V0s
921886 }
0 commit comments