@@ -613,6 +613,18 @@ struct HStrangeCorrelation {
613613 bool physicalPrimary = false ;
614614 };
615615
616+ // One object of a GenStudy h-K0 pair: generated kinematics plus whether it has a
617+ // reconstructed counterpart, in exactly the sense the GenStudy single-particle
618+ // folders use.
619+ struct GenStudyPairObject {
620+ float pt = 0 .0f ;
621+ float eta = 0 .0f ;
622+ float phi = 0 .0f ;
623+ int64_t globalIndex = -1 ;
624+ int64_t motherIndex = -1 ;
625+ bool reconstructed = false ;
626+ };
627+
616628 struct PairLossTruthK0Info {
617629 int64_t globalIndex = -1 ;
618630 float pt = 0 .0f ;
@@ -2813,8 +2825,18 @@ struct HStrangeCorrelation {
28132825 // bin by bin and NotReconstructed/Gen reads directly as the loss.
28142826 histos.add (" PairLossK0/GenStudy/Gen/hTrigger" , " generated triggers;#it{p}_{T}^{gen} (GeV/#it{c});#eta^{gen};#varphi^{gen};#it{N}_{ch}^{gen}" , kTHnF , {axesConfigurations.axisPtQA , axesConfigurations.axisEta , axesConfigurations.axisPhi , axisGenStudyNch});
28152827 histos.add (" PairLossK0/GenStudy/Gen/hK0Short" , " generated K0s;#it{p}_{T}^{gen} (GeV/#it{c});#eta^{gen};#varphi^{gen};#it{N}_{ch}^{gen};findable" , kTHnF , {axesConfigurations.axisPtQA , axesConfigurations.axisEta , axesConfigurations.axisPhi , axisGenStudyNch, axisGenStudyFindable});
2828+ // h-K0 correlations of the very same objects. Gen/ is every generated pair and the
2829+ // four exclusive classes below split it by which of the two objects was
2830+ // reconstructed, so Reconstructed + OnlyTriggerReconstructed + OnlyK0Reconstructed
2831+ // + NotReconstructed equals Gen bin by bin.
2832+ histos.add (" PairLossK0/GenStudy/Gen/hCorrelation" , " generated h-K0s pairs;#Delta#eta;#Delta#varphi;#it{p}_{T}^{trigger} (GeV/#it{c});#it{p}_{T}^{K^{0}_{S}} (GeV/#it{c});#it{N}_{ch}^{gen}" , kTHnF , {axisDeltaEtaNDim, axisDeltaPhiNDim, axisPtTriggerNDim, axisPtAssocNDim, axisGenStudyNch});
28162833 histos.addClone (" PairLossK0/GenStudy/Gen/" , " PairLossK0/GenStudy/Reconstructed/" );
28172834 histos.addClone (" PairLossK0/GenStudy/Gen/" , " PairLossK0/GenStudy/NotReconstructed/" );
2835+ // Only the correlation exists for the two mixed classes -- a single particle is
2836+ // either reconstructed or not, so cloning the single-particle folders here would
2837+ // only produce histograms with no meaning.
2838+ histos.add (" PairLossK0/GenStudy/OnlyTriggerReconstructed/hCorrelation" , " h-K0s pairs with only the trigger reconstructed;#Delta#eta;#Delta#varphi;#it{p}_{T}^{trigger} (GeV/#it{c});#it{p}_{T}^{K^{0}_{S}} (GeV/#it{c});#it{N}_{ch}^{gen}" , kTHnF , {axisDeltaEtaNDim, axisDeltaPhiNDim, axisPtTriggerNDim, axisPtAssocNDim, axisGenStudyNch});
2839+ histos.add (" PairLossK0/GenStudy/OnlyK0Reconstructed/hCorrelation" , " h-K0s pairs with only the K0s reconstructed;#Delta#eta;#Delta#varphi;#it{p}_{T}^{trigger} (GeV/#it{c});#it{p}_{T}^{K^{0}_{S}} (GeV/#it{c});#it{N}_{ch}^{gen}" , kTHnF , {axisDeltaEtaNDim, axisDeltaPhiNDim, axisPtTriggerNDim, axisPtAssocNDim, axisGenStudyNch});
28182840
28192841 for (auto const & histogram : {histos.get <THn>(HIST (" PairLossK0/GenStudy/Gen/hK0Short" )),
28202842 histos.get <THn>(HIST (" PairLossK0/GenStudy/Reconstructed/hK0Short" )),
@@ -4433,6 +4455,8 @@ struct HStrangeCorrelation {
44334455 // them.
44344456 std::unordered_set<int64_t > reconstructedTrackMcIds;
44354457 std::unordered_set<int64_t > reconstructedV0McIds;
4458+ std::vector<GenStudyPairObject> genStudyTriggers;
4459+ std::vector<GenStudyPairObject> genStudyK0s;
44364460 for (auto const & collision : recCollisions) {
44374461 const auto trackSlice = tracks.sliceBy (pairLossTracksPerCollision, collision.globalIndex ());
44384462 for (auto const & track : trackSlice) {
@@ -4474,6 +4498,13 @@ struct HStrangeCorrelation {
44744498 } else {
44754499 histos.fill (HIST (" PairLossK0/GenStudy/NotReconstructed/hTrigger" ), genPt, genEta, genPhi, generatedNch);
44764500 }
4501+ genStudyTriggers.push_back (GenStudyPairObject{
4502+ .pt = genPt,
4503+ .eta = genEta,
4504+ .phi = genPhi,
4505+ .globalIndex = static_cast <int64_t >(mcParticle.globalIndex ()),
4506+ .motherIndex = mcParticle.has_mothers () ? static_cast <int64_t >(mcParticle.mothers_first_as <aod::McParticles>().globalIndex ()) : -1 ,
4507+ .reconstructed = reconstructedTrackMcIds.count (mcParticle.globalIndex ()) > 0 });
44774508 }
44784509 }
44794510
@@ -4511,6 +4542,38 @@ struct HStrangeCorrelation {
45114542 } else {
45124543 histos.fill (HIST (" PairLossK0/GenStudy/NotReconstructed/hK0Short" ), genPt, genEta, genPhi, generatedNch, k0Findable);
45134544 }
4545+ genStudyK0s.push_back (GenStudyPairObject{
4546+ .pt = genPt,
4547+ .eta = genEta,
4548+ .phi = genPhi,
4549+ .globalIndex = static_cast <int64_t >(mcParticle.globalIndex ()),
4550+ .motherIndex = -1 ,
4551+ .reconstructed = reconstructedV0McIds.count (mcParticle.globalIndex ()) > 0 });
4552+ }
4553+ }
4554+
4555+ // h-K0 correlations of the objects collected above, in generated coordinates.
4556+ // Same delta-phi / delta-eta convention as every other correlation in this task
4557+ // (trigger minus associated), and the same autocorrelation rejection: a trigger
4558+ // that is a decay product of the K0 it would be paired with is skipped.
4559+ // Every pair goes into Gen/ and into exactly one of the four exclusive classes.
4560+ for (auto const & trigger : genStudyTriggers) {
4561+ for (auto const & k0 : genStudyK0s) {
4562+ if (trigger.globalIndex == k0.globalIndex || trigger.motherIndex == k0.globalIndex ) {
4563+ continue ;
4564+ }
4565+ const float deltaPhi = computeDeltaPhi (trigger.phi , k0.phi );
4566+ const float deltaEta = trigger.eta - k0.eta ;
4567+ histos.fill (HIST (" PairLossK0/GenStudy/Gen/hCorrelation" ), deltaEta, deltaPhi, trigger.pt , k0.pt , generatedNch);
4568+ if (trigger.reconstructed && k0.reconstructed ) {
4569+ histos.fill (HIST (" PairLossK0/GenStudy/Reconstructed/hCorrelation" ), deltaEta, deltaPhi, trigger.pt , k0.pt , generatedNch);
4570+ } else if (trigger.reconstructed ) {
4571+ histos.fill (HIST (" PairLossK0/GenStudy/OnlyTriggerReconstructed/hCorrelation" ), deltaEta, deltaPhi, trigger.pt , k0.pt , generatedNch);
4572+ } else if (k0.reconstructed ) {
4573+ histos.fill (HIST (" PairLossK0/GenStudy/OnlyK0Reconstructed/hCorrelation" ), deltaEta, deltaPhi, trigger.pt , k0.pt , generatedNch);
4574+ } else {
4575+ histos.fill (HIST (" PairLossK0/GenStudy/NotReconstructed/hCorrelation" ), deltaEta, deltaPhi, trigger.pt , k0.pt , generatedNch);
4576+ }
45144577 }
45154578 }
45164579 };
0 commit comments