@@ -3704,41 +3704,41 @@ struct AntinucleiInJets {
37043704 registryMC.fill (HIST (" genEventsCoalescenceCorr" ), 2.5 );
37053705
37063706 // Build deuterons
3707- for (const auto & proton : protonCandidates) {
3708- if (proton.used )
3709- continue ;
3710-
3711- for (const auto & neutron : neutronCandidates) {
3712- if (neutron.used )
3713- continue ;
3714-
3715- // Physics consistency check
3716- if (proton.pdgCode * neutron.pdgCode < 0 )
3717- continue ;
3718-
3719- if (passDeuteronCoalescence (proton, neutron, coalescenceMomentum, mRand )) {
3720-
3721- neutron.used = true ;
3722- proton.used = true ;
3723-
3724- int sign = (proton.pdgCode > 0 ) ? +1 : -1 ;
3725- int deuteronPdg = sign * o2::constants::physics::Pdg::kDeuteron ;
3726-
3727- double pxDeut = proton.px + neutron.px ;
3728- double pyDeut = proton.py + neutron.py ;
3729- double pzDeut = proton.pz + neutron.pz ;
3730- double energyDeut = std::sqrt (pxDeut * pxDeut + pyDeut * pyDeut + pzDeut * pzDeut + massDeut * massDeut);
3731- LorentzVector pd (pxDeut, pyDeut, pzDeut, energyDeut);
3732- if (pd.Eta () >= minEta && pd.Eta () <= maxEta && (0.5 * pd.Pt ()) >= MinPtPerNucleon) {
3733- // Store Deuteron
3734- finalDeuterons.push_back ({pxDeut, pyDeut, pzDeut, deuteronPdg, proton.mcIndex , false });
3707+ for (size_t iP = 0 ; iP < protonCandidates.size (); ++iP) {
3708+ if (protonCandidates[iP].used )
3709+ continue ;
3710+
3711+ for (size_t iN = 0 ; iN < neutronCandidates.size (); ++iN) {
3712+ if (neutronCandidates[iN].used )
3713+ continue ;
3714+
3715+ // Physics consistency check
3716+ if (protonCandidates[iP].pdgCode * neutronCandidates[iN].pdgCode < 0 )
3717+ continue ;
3718+
3719+ if (passDeuteronCoalescence (protonCandidates[iP], neutronCandidates[iN], coalescenceMomentum, mRand )) {
3720+
3721+ neutronCandidates[iN].used = true ;
3722+ protonCandidates[iP].used = true ;
3723+
3724+ int sign = (protonCandidates[iP].pdgCode > 0 ) ? +1 : -1 ;
3725+ int deuteronPdg = sign * o2::constants::physics::Pdg::kDeuteron ;
3726+
3727+ double pxDeut = protonCandidates[iP].px + neutronCandidates[iN].px ;
3728+ double pyDeut = protonCandidates[iP].py + neutronCandidates[iN].py ;
3729+ double pzDeut = protonCandidates[iP].pz + neutronCandidates[iN].pz ;
3730+ double energyDeut = std::sqrt (pxDeut * pxDeut + pyDeut * pyDeut + pzDeut * pzDeut + massDeut * massDeut);
3731+ LorentzVector pd (pxDeut, pyDeut, pzDeut, energyDeut);
3732+ if (pd.Eta () >= minEta && pd.Eta () <= maxEta && (0.5 * pd.Pt ()) >= MinPtPerNucleon) {
3733+ // Store Deuteron
3734+ finalDeuterons.push_back ({pxDeut, pyDeut, pzDeut, deuteronPdg, protonCandidates[iP].mcIndex , false });
3735+ }
3736+
3737+ break ;
3738+ }
37353739 }
3736-
3737- break ;
3738- }
37393740 }
3740- }
3741-
3741+
37423742 // Add unused protons to final vectors
37433743 for (const auto & proton : protonCandidates) {
37443744 if (!proton.used ) {
0 commit comments