2929#include < TMatrixD.h>
3030#include " TProfile2D.h"
3131#include " PWGLF/DataModel/lambdaJetpolarization.h"
32+ #include " Math/Vector3D.h"
33+ #include " Math/Vector4D.h"
34+ #include " Math/GenVector/Boost.h"
3235
3336#include < fastjet/ClusterSequence.hh>
3437#include < fastjet/ClusterSequenceArea.hh>
@@ -351,6 +354,8 @@ struct LfMyV0s {
351354 }
352355 double massPr = o2::constants::physics::MassProton;
353356 double massLambda = o2::constants::physics::MassLambda;
357+ double massPi = o2::constants::physics::MassPionCharged;
358+ ROOT::Math::PxPyPzMVector ProtonVec, PionVec, LambdaVec, ProtonBoostedVec, LambdaBoostedVec;
354359
355360 TMatrixD LorentzTransInV0frame (double ELambda, double Lambdapx, double Lambdapy, double Lambdapz)
356361 {
@@ -1233,32 +1238,20 @@ struct LfMyV0s {
12331238 if (passedLambdaSelection (v0, pos, neg) && ctauLambda < CtauLambda && ifpasslambda) {
12341239 V0NumbersPerEventsel++;
12351240 registryLongitudinalPolarization.fill (HIST (" hMassVsPtLambda" ), v0.pt (), v0.mLambda ());
1236- double PLambda = sqrt (v0.px () * v0.px () + v0.py () * v0.py () + v0.pz () * v0.pz ());
1237- double ELambda = sqrt (v0.mLambda () * v0.mLambda () + PLambda * PLambda);
1238- double protonE = sqrt (massPr * massPr + pos.px () * pos.px () + pos.py () * pos.py () + pos.pz () * pos.pz ());
1239- TMatrixD pLabV0 (4 , 1 );
1240- pLabV0 (0 , 0 ) = ELambda;
1241- pLabV0 (1 , 0 ) = v0.px ();
1242- pLabV0 (2 , 0 ) = v0.py ();
1243- pLabV0 (3 , 0 ) = v0.pz ();
12441241
1245- TMatrixD pLabproton (4 , 1 );
1246- pLabproton (0 , 0 ) = protonE;
1247- pLabproton (1 , 0 ) = pos.px ();
1248- pLabproton (2 , 0 ) = pos.py ();
1249- pLabproton (3 , 0 ) = pos.pz ();
1242+ ProtonVec = ROOT::Math::PxPyPzMVector (v0.pxpos (), v0.pypos (), v0.pzpos (), massPr);
1243+ PionVec = ROOT::Math::PxPyPzMVector (v0.pxneg (), v0.pyneg (), v0.pzneg (), massPi);
1244+ LambdaVec = ProtonVec + PionVec;
1245+ LambdaVec.SetM (massLambda);
1246+ ROOT::Math::Boost boost{LambdaVec.BoostToCM ()};
1247+ ProtonBoostedVec = boost (ProtonVec);
1248+ LambdaBoostedVec = boost (LambdaVec);
12501249
1251- TMatrixD V0InV0 (4 , 1 );
1252- V0InV0 = LorentzTransInV0frame (ELambda, v0.px (), v0.py (), v0.pz ()) * pLabV0;
1253- registryLongitudinalPolarization.fill (HIST (" V0pxInRest_frame" ), V0InV0 (1 , 0 ));
1254- registryLongitudinalPolarization.fill (HIST (" V0pyInRest_frame" ), V0InV0 (2 , 0 ));
1255- registryLongitudinalPolarization.fill (HIST (" V0pzInRest_frame" ), V0InV0 (3 , 0 ));
1250+ registryLongitudinalPolarization.fill (HIST (" V0pxInRest_frame" ), LambdaBoostedVec.Px ());
1251+ registryLongitudinalPolarization.fill (HIST (" V0pyInRest_frame" ), LambdaBoostedVec.Py ());
1252+ registryLongitudinalPolarization.fill (HIST (" V0pzInRest_frame" ), LambdaBoostedVec.Pz ());
12561253
1257- TMatrixD protonInV0 (4 , 1 );
1258- protonInV0 = LorentzTransInV0frame (ELambda, v0.px (), v0.py (), v0.pz ()) * pLabproton;
1259- double protonPInV0 = sqrt (protonInV0 (1 , 0 ) * protonInV0 (1 , 0 ) + protonInV0 (2 , 0 ) * protonInV0 (2 , 0 ) + protonInV0 (3 , 0 ) * protonInV0 (3 , 0 ));
1260-
1261- double protonCosThetainV0 = protonInV0 (3 , 0 ) / protonPInV0;
1254+ double protonCosThetainV0 = ProtonBoostedVec.Pz () / ProtonBoostedVec.P ();
12621255
12631256 registryLongitudinalPolarization.fill (HIST (" hprotoncosthetainV0" ), protonCosThetainV0);
12641257 registryLongitudinalPolarization.fill (HIST (" hprotoncosSquarethetainV0" ), protonCosThetainV0 * protonCosThetainV0);
@@ -1272,21 +1265,15 @@ struct LfMyV0s {
12721265 if (passedAntiLambdaSelection (v0, pos, neg) && ctauAntiLambda < CtauLambda && ifpasslambda) {
12731266 registryLongitudinalPolarization.fill (HIST (" hMassVsPtAntiLambda" ), v0.pt (), v0.mAntiLambda ());
12741267
1275- double PLambda = sqrt (v0.px () * v0.px () + v0.py () * v0.py () + v0.pz () * v0.pz ());
1276- double ELambda = sqrt (v0.mAntiLambda () * v0.mAntiLambda () + PLambda * PLambda);
1277- double protonE = sqrt (massPr * massPr + neg.px () * neg.px () + neg.py () * neg.py () + neg.pz () * neg.pz ());
1278-
1279- TMatrixD pLabproton (4 , 1 );
1280- pLabproton (0 , 0 ) = protonE;
1281- pLabproton (1 , 0 ) = neg.px ();
1282- pLabproton (2 , 0 ) = neg.py ();
1283- pLabproton (3 , 0 ) = neg.pz ();
1284-
1285- TMatrixD protonInV0 (4 , 1 );
1286- protonInV0 = LorentzTransInV0frame (ELambda, v0.px (), v0.py (), v0.pz ()) * pLabproton;
1287- double protonPInV0 = sqrt (protonInV0 (1 , 0 ) * protonInV0 (1 , 0 ) + protonInV0 (2 , 0 ) * protonInV0 (2 , 0 ) + protonInV0 (3 , 0 ) * protonInV0 (3 , 0 ));
1268+ ProtonVec = ROOT::Math::PxPyPzMVector (v0.pxneg (), v0.pyneg (), v0.pzneg (), massPr);
1269+ PionVec = ROOT::Math::PxPyPzMVector (v0.pxpos (), v0.pypos (), v0.pzpos (), massPi);
1270+ LambdaVec = ProtonVec + PionVec;
1271+ LambdaVec.SetM (massLambda);
1272+ ROOT::Math::Boost boost{LambdaVec.BoostToCM ()};
1273+ ProtonBoostedVec = boost (ProtonVec);
1274+ LambdaBoostedVec = boost (LambdaVec);
12881275
1289- double protonCosThetainV0 = protonInV0 ( 3 , 0 ) / protonPInV0 ;
1276+ double protonCosThetainV0 = ProtonBoostedVec. Pz ( ) / ProtonBoostedVec. P () ;
12901277
12911278 registryLongitudinalPolarization.fill (HIST (" hantiprotoncosthetainV0" ), protonCosThetainV0);
12921279 registryLongitudinalPolarization.fill (HIST (" hantiprotoncosSquarethetainV0" ), protonCosThetainV0 * protonCosThetainV0);
0 commit comments