@@ -309,44 +309,42 @@ struct HfHelper {
309309 return std::abs (massKKPairDsToPiKK (candidate) - o2::constants::physics::MassPhi);
310310 }
311311
312- // / Calculate the cosine of the angle between the pion and the opposite sign kaon in the phi rest frame
313- // / \param candidate Ds candidate from aod::HfCand3Prong table
314- // / \param option mass hypothesis considered: 0 = KKPi, 1 = PiKK
315- // / \return cosine of pion-kaon angle in the phi rest frame
312+ // / Calculate the cosine of the angle between two particles in the rest frame of two particles
313+ // / \param candidate Candidate with three prongs
314+ // / \param massHypo mass array of the three prongs in the order of prong0, prong1, prong2
315+ // / \param prong0ForRestFrame index of the first prong to define the rest frame (0, 1, or 2)
316+ // / \param prong1ForRestFrame index of the second prong to define the rest frame (0, 1, or 2)
317+ // / \return cosine of the angle between the two particles in the rest frame of two particles
316318 template <typename T>
317- static auto cosPiKPhiRestFrame (const T& candidate, int option )
319+ static auto cosABInRestFrame (const T& candidate, std::array< double , 3 > massHypo, int prong0ForRestFrame, int prong1ForRestFrame )
318320 {
319321 // Ported from AliAODRecoDecayHF3Prong::CosPiKPhiRFrame
320- std::array<float , 3 > momPi {};
321- std::array<float , 3 > momK1 {};
322- std::array<float , 3 > momK2 {};
322+ std::array<float , 3 > momProng0 {};
323+ std::array<float , 3 > momProng1 {};
324+ std::array<float , 3 > momProng2 {};
323325
324- if (option == 0 ) { // KKPi
325- momPi = candidate.pVectorProng2 ();
326- momK1 = candidate.pVectorProng1 ();
327- momK2 = candidate.pVectorProng0 ();
328- } else { // PiKK
329- momPi = candidate.pVectorProng0 ();
330- momK1 = candidate.pVectorProng1 ();
331- momK2 = candidate.pVectorProng2 ();
332- }
326+ momProng0 = candidate.pVectorProng0 ();
327+ momProng1 = candidate.pVectorProng1 ();
328+ momProng2 = candidate.pVectorProng2 ();
333329
334- ROOT ::Math::PxPyPzMVector const vecPi (momPi[0 ], momPi[1 ], momPi[2 ], o2::constants::physics::MassPiPlus);
335- ROOT ::Math::PxPyPzMVector const vecK1 (momK1[0 ], momK1[1 ], momK1[2 ], o2::constants::physics::MassKPlus);
336- ROOT ::Math::PxPyPzMVector const vecK2 (momK2[0 ], momK2[1 ], momK2[2 ], o2::constants::physics::MassKPlus);
337- ROOT ::Math::PxPyPzMVector const vecPhi = vecK1 + vecK2;
330+ auto prongForAngle = 3 - prong0ForRestFrame - prong1ForRestFrame;
331+ ROOT ::Math::PxPyPzMVector const vecProng0 (momProng0[0 ], momProng0[1 ], momProng0[2 ], massHypo[0 ]);
332+ ROOT ::Math::PxPyPzMVector const vecProng1 (momProng1[0 ], momProng1[1 ], momProng1[2 ], massHypo[1 ]);
333+ ROOT ::Math::PxPyPzMVector const vecProng2 (momProng2[0 ], momProng2[1 ], momProng2[2 ], massHypo[2 ]);
334+ std::array<ROOT ::Math::PxPyPzMVector, 3 > vecProngs{vecProng0, vecProng1, vecProng2};
335+ ROOT ::Math::PxPyPzMVector const vecRestFrame = vecProngs[prong0ForRestFrame] + vecProngs[prong1ForRestFrame];
338336
339- ROOT ::Math::Boost const boostToPhiRestFrame (vecPhi .BoostToCM ());
340- auto momPiPhiRestFrame = boostToPhiRestFrame (vecPi ).Vect ();
341- auto momK1PhiRestFrame = boostToPhiRestFrame (vecK1 ).Vect ();
337+ ROOT ::Math::Boost const boostToPhiRestFrame (vecRestFrame .BoostToCM ());
338+ auto momProng0ForAngle = boostToPhiRestFrame (vecProngs[prongForAngle] ).Vect ();
339+ auto momProng1ForAngle = boostToPhiRestFrame (vecProngs[prong1ForRestFrame] ).Vect ();
342340
343- return momPiPhiRestFrame .Dot (momK1PhiRestFrame ) / std::sqrt (momPiPhiRestFrame .Mag2 () * momK1PhiRestFrame .Mag2 ());
341+ return momProng0ForAngle .Dot (momProng1ForAngle ) / std::sqrt (momProng0ForAngle .Mag2 () * momProng1ForAngle .Mag2 ());
344342 }
345343
346344 template <typename T>
347345 static auto cos3PiKDsToKKPi (const T& candidate)
348346 {
349- auto cosPiK = cosPiKPhiRestFrame (candidate, 0 );
347+ auto cosPiK = cosABInRestFrame (candidate, std::array{o2::constants::physics::MassKPlus, o2::constants::physics::MassKPlus, o2::constants::physics::MassPiPlus}, 0 , 1 );
350348 return cosPiK * cosPiK * cosPiK;
351349 }
352350
@@ -359,7 +357,7 @@ struct HfHelper {
359357 template <typename T>
360358 static auto cos3PiKDsToPiKK (const T& candidate)
361359 {
362- auto cosPiK = cosPiKPhiRestFrame (candidate, 1 );
360+ auto cosPiK = cosABInRestFrame (candidate, std::array{o2::constants::physics::MassPiPlus, o2::constants::physics::MassKPlus, o2::constants::physics::MassKPlus}, 1 , 2 );
363361 return cosPiK * cosPiK * cosPiK;
364362 }
365363
@@ -369,6 +367,32 @@ struct HfHelper {
369367 return std::abs (cos3PiKDsToPiKK (candidate));
370368 }
371369
370+ template <typename T>
371+ static auto cos3MuKBpToMuMuK (const T& candidate)
372+ {
373+ auto cosMuK = cosABInRestFrame (candidate, std::array{o2::constants::physics::MassMuon, o2::constants::physics::MassMuon, o2::constants::physics::MassKPlus}, 0 , 1 );
374+ return cosMuK * cosMuK * cosMuK;
375+ }
376+
377+ template <typename T>
378+ static auto absCos3MuKBpToMuMuK (const T& candidate)
379+ {
380+ return std::abs (cos3MuKBpToMuMuK (candidate));
381+ }
382+
383+ template <typename T>
384+ static auto cos3MuKBpToKMuMu (const T& candidate)
385+ {
386+ auto cosMuK = cosABInRestFrame (candidate, std::array{o2::constants::physics::MassKPlus, o2::constants::physics::MassMuon, o2::constants::physics::MassMuon}, 1 , 2 );
387+ return cosMuK * cosMuK * cosMuK;
388+ }
389+
390+ template <typename T>
391+ static auto absCos3MuKBpToKMuMu (const T& candidate)
392+ {
393+ return std::abs (cos3MuKBpToKMuMu (candidate));
394+ }
395+
372396 // Λc± → p± K∓ π±
373397
374398 template <typename T>
0 commit comments