1616#include " PWGLF/DataModel/LFPhotonDeuteronTables.h"
1717#include " PWGLF/DataModel/LFStrangenessTables.h"
1818
19+ #include " Common/Core/PID/TPCPIDResponse.h"
20+ #include " Common/Core/RecoDecay.h"
1921#include " Common/DataModel/EventSelection.h"
20- #include " Common/DataModel/PIDResponse.h"
2122#include " Common/DataModel/TrackSelectionTables.h"
2223
2324#include " Framework/ASoAHelpers.h"
2425#include " Framework/AnalysisTask.h"
2526#include " Framework/HistogramRegistry.h"
2627#include " Framework/runDataProcessing.h"
2728
28- #include < TLorentzVector.h>
29- #include < TVector3.h>
30-
31- #include < iostream>
3229#include < vector>
3330
3431using namespace o2 ;
3532using namespace o2 ::framework;
3633using namespace o2 ::framework::expressions;
3734
38- struct PhotonDeuteronCorrelation {
35+ struct PhotonDeuteron {
3936 // Histogram registry
4037 HistogramRegistry histos{" Histos" , {}, OutputObjHandlingPolicy::AnalysisObject};
4138
@@ -59,11 +56,6 @@ struct PhotonDeuteronCorrelation {
5956 Configurable<float > cfgV0Radius{" cfgV0Radius" , 5.0 , " Minimum V0 radius (cm)" };
6057 Configurable<bool > cfgUsePhotonDaughterPIDTPCOnly{" cfgUsePhotonDaughterPIDTPCOnly" , true , " Use TPC-only PID for photon daughters" };
6158
62- // Particle masses (in GeV/c²)
63- static constexpr float massProton = o2::constants::physics::MassProton;
64- static constexpr float massNeutron = o2::constants::physics::MassNeutron;
65- static constexpr float massDeuteron = o2::constants::physics::MassDeuteron;
66-
6759 // Initialize histograms
6860 void init (InitContext const &)
6961 {
@@ -175,19 +167,6 @@ struct PhotonDeuteronCorrelation {
175167 return true ;
176168 }
177169
178- // range [-pi/2, 3pi/2]
179- float getDeltaPhi (float phi1, float phi2)
180- {
181- float dphi = phi1 - phi2;
182- if (dphi > 1.5 * M_PI) {
183- dphi -= 2.0 * M_PI;
184- }
185- if (dphi < -0.5 * M_PI) {
186- dphi += 2.0 * M_PI;
187- }
188- return dphi;
189- }
190-
191170 // Calculate relative momentum k*_pn from the photon-deuteron invariant mass [Eq. 4.6]
192171 float calculateRelativeMomentum (float invMass)
193172 {
@@ -198,8 +177,8 @@ struct PhotonDeuteronCorrelation {
198177 float M = invMass;
199178 float M2 = M * M;
200179 float M4 = M2 * M2;
201- float mn2 = massNeutron * massNeutron ;
202- float mp2 = massProton * massProton ;
180+ float mn2 = o2::constants::physics::MassNeutron * o2::constants::physics::MassNeutron ;
181+ float mp2 = o2::constants::physics::MassProton * o2::constants::physics::MassProton ;
203182 float deltaMass2 = mn2 - mp2;
204183 float sumMass2 = mn2 + mp2;
205184
@@ -241,10 +220,10 @@ struct PhotonDeuteronCorrelation {
241220 histos.fill (HIST (" hV0Phi" ), v0.phi ());
242221 histos.fill (HIST (" hPhotonPtEta" ), v0.pt (), v0.eta ());
243222
244- if (v0.isPhotonTPConly ())
223+ if (v0.isPhotonTPConly ()) {
245224 photonIndices.push_back (v0.index ());
246- if (v0. isPhotonTPConly ())
247- std::cout << " [main] global index photon: " << v0. globalIndex () << " v0 id: " << v0. index () << " pt " << v0. pt () << std::endl;
225+ LOGF (debug, " [main] global index photon: %d v0 id: %d pt %.3f " , v0. globalIndex (), v0. index (), v0. pt ());
226+ }
248227 }
249228
250229 // Loop over tracks to find deuterons
@@ -281,7 +260,7 @@ struct PhotonDeuteronCorrelation {
281260 const auto & deuteron = tracks.iteratorAt (deuteronIdx);
282261
283262 // Calculate angular correlations
284- float deltaPhi = getDeltaPhi (photon.phi (), deuteron.phi ());
263+ float deltaPhi = RecoDecay::constrainAngle (photon.phi () - deuteron.phi (), - 0.5 * M_PI );
285264 float deltaEta = photon.eta () - deuteron.eta ();
286265
287266 // Fill correlation histograms
@@ -290,13 +269,10 @@ struct PhotonDeuteronCorrelation {
290269 histos.fill (HIST (" hPhotonDeuteronCorrelation" ), deltaPhi, deltaEta);
291270 histos.fill (HIST (" hPhotonDeuteronPtCorr" ), photon.pt (), deuteron.pt ());
292271
293- // Calculate invariant mass
294- TLorentzVector photonVec, deuteronVec;
295- photonVec.SetPtEtaPhiM (photon.pt (), photon.eta (), photon.phi (), 0.0 ); // Photon-mass = 0
296- deuteronVec.SetPtEtaPhiM (deuteron.pt (), deuteron.eta (), deuteron.phi (), massDeuteron); // Deuteron-mass
297-
298- TLorentzVector combinedVec = photonVec + deuteronVec;
299- float invMass = combinedVec.M ();
272+ // Calculate invariant mass using RecoDecay
273+ std::array<float , 3 > pPhoton{photon.px (), photon.py (), photon.pz ()};
274+ std::array<float , 3 > pDeuteron{deuteron.px (), deuteron.py (), deuteron.pz ()};
275+ float invMass = RecoDecay::m (std::array{pPhoton, pDeuteron}, std::array{0 .0f , static_cast <float >(o2::constants::physics::MassDeuteron)});
300276 histos.fill (HIST (" hPhotonDeuteronInvMass" ), invMass);
301277
302278 // Calculate relative momentum using Equation 4.6
@@ -340,5 +316,5 @@ struct PhotonDeuteronCorrelation {
340316WorkflowSpec defineDataProcessing (ConfigContext const & cfgc)
341317{
342318 return WorkflowSpec{
343- adaptAnalysisTask<PhotonDeuteronCorrelation >(cfgc)};
319+ adaptAnalysisTask<PhotonDeuteron >(cfgc)};
344320}
0 commit comments