99// granted to it by virtue of its status as an Intergovernmental Organization
1010// or submit itself to any jurisdiction.
1111
12- // / \file deltaanalysis .cxx
12+ // / \file deltaAnalysis .cxx
1313// / \brief Delta(1232) resonance analysis via proton-pion invariant mass reconstruction with advance PID and background rejection cuts also add efficiency correction and acceptance correction
1414// / \author Durgesh Bhatt <durgesh.bhatt@cern.ch>
1515
@@ -60,9 +60,10 @@ using namespace o2::constants::physics;
6060
6161namespace
6262{
63- constexpr float massProton = o2::constants::physics::MassProton;
64- constexpr float massPion = o2::constants::physics::MassPionCharged;
65- constexpr float minAbsCharge = 1e-3f ;
63+ constexpr float MassProton = o2::constants::physics::MassProton;
64+ constexpr float MassPion = o2::constants::physics::MassPionCharged;
65+ constexpr float MinAbsCharge = 1e-3f ;
66+ const std::array<float , 2 > kProtonPionMasses {MassProton, MassPion};
6667} // namespace
6768namespace delta_analysis
6869{
@@ -449,7 +450,13 @@ struct DeltaAnalysis {
449450 if (doprocessEventFactor) {
450451 histos.add (" EventFactor/hRecoEvents" , " Reconstructed INEL>0 events (Nrec)" , kTH1F , {centAxis});
451452 histos.add (" EventFactor/hEventsGenAll" , " Generated events passing truth |Zvtx| + truth INEL>0 cuts" , kTH1F , {centAxis});
452- histos.add (" EventFactor/hEventsGenAccepted" , " Generated events with >=1 accepted reconstructed collision" , kTH1F , {centAxis});
453+ histos.add (" EventFactor/hEventsGenAccepted" , " Generated events with >=1 accepted reconstructed collision (truth centrality)" , kTH1F , {centAxis});
454+ // NEW: same "generated with >=1 accepted reconstructed collision" population as
455+ // hEventsGenAccepted, but filled with the RECONSTRUCTED centrality of that accepted
456+ // collision instead of the truth centrality. This puts it on the same axis as
457+ // hRecoEvents so that event_splitting = hEventsGenAcceptedReco / hRecoEvents compares
458+ // like with like. hEventsGenAccepted (truth-binned) stays as-is for event_loss.
459+ histos.add (" EventFactor/hEventsGenAcceptedReco" , " Generated events with >=1 accepted reconstructed collision (reconstructed centrality)" , kTH1F , {centAxis});
453460 histos.add (" EventFactor/hNRecoCollisionsPerMcCollision" , " Number of reconstructed collisions per generated collision" , kTH1F , {{21 , -0 .5f , 20 .5f }});
454461 }
455462
@@ -545,7 +552,7 @@ struct DeltaAnalysis {
545552 if (!pdgParticle) {
546553 return false ;
547554 }
548- return std::abs (pdgParticle->Charge ()) > minAbsCharge ;
555+ return std::abs (pdgParticle->Charge ()) > MinAbsCharge ;
549556 }
550557
551558 // Truth-level analogue of isRecoInelGt0() above - at least one charged primary within
@@ -1029,7 +1036,7 @@ struct DeltaAnalysis {
10291036 const std::array<std::array<float , 3 >, 2 > rotMomenta = {
10301037 std::array<float , 3 >{pxProton, pyProton, pzProton},
10311038 std::array<float , 3 >{pxPionRot, pyPionRot, pzPion}};
1032- const float rotMass = RecoDecay::m (rotMomenta, std::array{massProton, massPion} );
1039+ const float rotMass = RecoDecay::m (rotMomenta, kProtonPionMasses );
10331040 const float rotPt = RecoDecay::pt (std::array{pxProton + pxPionRot, pyProton + pyPionRot});
10341041 const float rotY = RecoDecay::y (
10351042 std::array{pxProton + pxPionRot, pyProton + pyPionRot, pzProton + pzPion}, rotMass);
@@ -1155,7 +1162,7 @@ struct DeltaAnalysis {
11551162 const std::array<std::array<float , 3 >, 2 > bothMomenta = {
11561163 std::array<float , 3 >{pxPr, pyPr, pzPr},
11571164 std::array<float , 3 >{pxPi, pyPi, pzPi}};
1158- const float pairMass = RecoDecay::m (bothMomenta, std::array{massProton, massPion} );
1165+ const float pairMass = RecoDecay::m (bothMomenta, kProtonPionMasses );
11591166 const float pairPt = RecoDecay::pt (std::array{pxPr + pxPi, pyPr + pyPi});
11601167 const float pairY = RecoDecay::y (std::array{pxPr + pxPi, pyPr + pyPi, pzPr + pzPi}, pairMass);
11611168
@@ -1414,7 +1421,7 @@ struct DeltaAnalysis {
14141421 const std::array<std::array<float , 3 >, 2 > momentaReco = {
14151422 std::array<float , 3 >{t0.px (), t0.py (), t0.pz ()},
14161423 std::array<float , 3 >{t1.px (), t1.py (), t1.pz ()}};
1417- const float pairMassReco = RecoDecay::m (momentaReco, std::array{massProton, massPion} );
1424+ const float pairMassReco = RecoDecay::m (momentaReco, kProtonPionMasses );
14181425 const float pairPtReco = RecoDecay::pt (std::array{t0.px () + t1.px (), t0.py () + t1.py ()});
14191426 const float pairYReco = RecoDecay::y (std::array{t0.px () + t1.px (), t0.py () + t1.py (), t0.pz () + t1.pz ()}, pairMassReco);
14201427 if (pairYReco >= trackCuts.cfgMinY && pairYReco <= trackCuts.cfgMaxY ) {
@@ -1456,7 +1463,7 @@ struct DeltaAnalysis {
14561463 const std::array<std::array<float , 3 >, 2 > momenta = {
14571464 std::array<float , 3 >{t0.px (), t0.py (), t0.pz ()},
14581465 std::array<float , 3 >{t1.px (), t1.py (), t1.pz ()}};
1459- const float pairMass = RecoDecay::m (momenta, std::array{massProton, massPion} );
1466+ const float pairMass = RecoDecay::m (momenta, kProtonPionMasses );
14601467 const float pairPt = RecoDecay::pt (std::array{t0.px () + t1.px (), t0.py () + t1.py ()});
14611468 const float pairY = RecoDecay::y (std::array{t0.px () + t1.px (), t0.py () + t1.py (), t0.pz () + t1.pz ()}, pairMass);
14621469 if (pairY < trackCuts.cfgMinY || pairY > trackCuts.cfgMaxY ) {
@@ -1595,7 +1602,7 @@ struct DeltaAnalysis {
15951602 {
15961603 // ── Loop A: reconstructed collisions ──────────────────────────────────────────────────
15971604 std::unordered_map<int64_t , int > nRecoCollisionsPerMc;
1598- std::unordered_set <int64_t > acceptedMcCollisionIds ;
1605+ std::unordered_map <int64_t , float > acceptedMcCollisionRecoCent ;
15991606 for (auto const & collision : collisions) {
16001607 if (collision.has_mcCollision ()) {
16011608 ++nRecoCollisionsPerMc[collision.mcCollisionId ()];
@@ -1606,7 +1613,10 @@ struct DeltaAnalysis {
16061613 const float centrality = getCentrality (collision);
16071614 histos.fill (HIST (" EventFactor/hRecoEvents" ), centrality);
16081615 if (collision.has_mcCollision ()) {
1609- acceptedMcCollisionIds.insert (collision.mcCollisionId ());
1616+ // emplace() keeps the FIRST accepted collision's centrality if a generated collision
1617+ // has more than one accepted reconstructed collision (splitting), matching the
1618+ // "first accepted" convention already used in processMCGen() above.
1619+ acceptedMcCollisionRecoCent.emplace (collision.mcCollisionId (), centrality);
16101620 }
16111621 }
16121622
@@ -1636,11 +1646,16 @@ struct DeltaAnalysis {
16361646 histos.fill (HIST (" CutFlow/EventFactor/hEventAcceptedCutFlow" ), 3 .f ); // Has associated reconstructed collision
16371647 }
16381648
1639- const bool hasAcceptedReco = acceptedMcCollisionIds.contains (mcCollision.globalIndex ());
1649+ const auto itCent = acceptedMcCollisionRecoCent.find (mcCollision.globalIndex ());
1650+ const bool hasAcceptedReco = (itCent != acceptedMcCollisionRecoCent.end ());
16401651 if (hasAcceptedReco) {
16411652 histos.fill (HIST (" CutFlow/EventFactor/hEventAcceptedCutFlow" ), 4 .f ); // Associated reco collision passes event selection
16421653 histos.fill (HIST (" CutFlow/EventFactor/hEventAcceptedCutFlow" ), 5 .f ); // Final EventAccepted
1654+ // Truth-binned: denominator for event_loss = hEventsGenAccepted / hEventsGenAll (unchanged).
16431655 histos.fill (HIST (" EventFactor/hEventsGenAccepted" ), truthCentrality);
1656+ // NEW - reco-binned: numerator for event_splitting = hEventsGenAcceptedReco / hRecoEvents,
1657+ // now on the same (reconstructed) centrality axis as hRecoEvents.
1658+ histos.fill (HIST (" EventFactor/hEventsGenAcceptedReco" ), itCent->second );
16441659 }
16451660 }
16461661 }
0 commit comments