|
54 | 54 | #include <Framework/StaticFor.h> |
55 | 55 | #include <Framework/runDataProcessing.h> |
56 | 56 |
|
| 57 | +#include <TAxis.h> |
57 | 58 | #include <TH1.h> |
58 | 59 | #include <TH2.h> |
59 | 60 | #include <TH3.h> |
60 | 61 | #include <THn.h> |
| 62 | +#include <THnSparse.h> |
61 | 63 | #include <TList.h> |
62 | 64 | #include <TPDGCode.h> |
63 | 65 | #include <TString.h> |
@@ -2543,6 +2545,9 @@ struct HStrangeCorrelation { |
2543 | 2545 | histos.add("PairLossK0/Stage/hPhysicsFindable", "stages in h-K0 physics variables for findable K0", kTHnF, {axisPairLossStage, axisPairLossTruthDeltaPhi, axisPairLossTruthDeltaEta, axisPairLossTruthK0Pt, axisPairLossTruthTriggerPt, axisMultNDim}); |
2544 | 2546 | histos.add("PairLossK0/Stage/hClose", "stages in trigger-daughter close-pair variables", kTHnF, {axisPairLossStage, axisPairLossMinDeltaPhiStar, axisPairLossDaughterDeltaEta, axisPairLossTruthK0Pt, axisPairLossTruthTriggerPt, axisPairLossFieldSign, axisPairLossChargeProduct}); |
2545 | 2547 | histos.add("PairLossK0/Stage/hTriggerTracksFailureReason", "first-failing TriggerTracks condition for best-collision triggers, in h-K0 physics variables", kTHnF, {axisPairLossTriggerTracksFailureReason, axisPairLossTruthDeltaPhi, axisPairLossTruthDeltaEta, axisPairLossTruthK0Pt, axisPairLossTruthTriggerPt}); |
| 2548 | + // 1/N_trigger denominator of the stage ladder: same stage axis as hCounts/hPhysics, generated trigger pT, eta, phi. |
| 2549 | + // Sparse because the eta-phi part would cost tens of MB dense for an occupancy of a few percent. |
| 2550 | + histos.add("PairLossK0/Stage/hTriggers", "triggers per stage: the 1/#it{N}_{trigger} normalisation of the stage ladder", kTHnSparseF, {axisPairLossStage, axisPairLossTruthTriggerPt, axesConfigurations.axisEta, axesConfigurations.axisPhi, axisVtxZNDim, axisMultNDim}); |
2546 | 2551 |
|
2547 | 2552 | histos.add("PairLossK0/State/hFinalObjectStatePhysics", "00/01/10/11 final trigger-K0 object state", kTHnF, {axisPairLossFinalObjectState, axisPairLossTruthDeltaPhi, axisPairLossTruthDeltaEta, axisPairLossTruthK0Pt, axisPairLossTruthTriggerPt, axisPairLossFieldSign}); |
2548 | 2553 | histos.add("PairLossK0/State/hFinalObjectStateClose", "00/01/10/11 final trigger-K0 object state in close-pair variables", kTHnF, {axisPairLossFinalObjectState, axisPairLossMinDeltaPhiStar, axisPairLossDaughterDeltaEta, axisPairLossTruthK0Pt, axisPairLossTruthTriggerPt, axisPairLossFieldSign, axisPairLossChargeProduct}); |
@@ -2584,15 +2589,19 @@ struct HStrangeCorrelation { |
2584 | 2589 | } |
2585 | 2590 | eventCounter->GetYaxis()->SetTitle("Entries"); |
2586 | 2591 | histos.get<TH1>(HIST("PairLossK0/Event/hNRecoCollisions"))->GetYaxis()->SetTitle("MC collisions"); |
2587 | | - auto setStageLabels = [&](auto const& stageHistogram) { |
| 2592 | + auto setStageAxisLabels = [&](TAxis* stageAxis) { |
2588 | 2593 | for (int i = 0; i < PairLossK0NStages; ++i) { |
2589 | | - stageHistogram->GetXaxis()->SetBinLabel(i + 1, PairLossK0StageNames[i].data()); |
| 2594 | + stageAxis->SetBinLabel(i + 1, PairLossK0StageNames[i].data()); |
2590 | 2595 | } |
2591 | 2596 | }; |
| 2597 | + auto setStageLabels = [&](auto const& stageHistogram) { |
| 2598 | + setStageAxisLabels(stageHistogram->GetXaxis()); |
| 2599 | + }; |
2592 | 2600 | auto stageCounts = histos.get<TH1>(HIST("PairLossK0/Stage/hCounts")); |
2593 | 2601 | auto stageCountsFindable = histos.get<TH1>(HIST("PairLossK0/Stage/hCountsFindable")); |
2594 | 2602 | setStageLabels(stageCounts); |
2595 | 2603 | setStageLabels(stageCountsFindable); |
| 2604 | + setStageAxisLabels(histos.get<THnSparse>(HIST("PairLossK0/Stage/hTriggers"))->GetAxis(0)); |
2596 | 2605 | stageCounts->GetYaxis()->SetTitle("Truth-pair entries"); |
2597 | 2606 | stageCountsFindable->GetYaxis()->SetTitle("Findable truth-pair entries"); |
2598 | 2607 |
|
@@ -5083,6 +5092,28 @@ struct HStrangeCorrelation { |
5083 | 5092 | return &*std::max_element(iterator->second.begin(), iterator->second.end(), [](auto const& lhs, auto const& rhs) { return lhs.cosPA < rhs.cosPA; }); |
5084 | 5093 | }; |
5085 | 5094 |
|
| 5095 | + // Separate from the pair loop, which would count a trigger once per truth K0 and drop it entirely in events without one. |
| 5096 | + // Each stage holds the trigger-side condition of the same stage of hCounts/hPhysics, so the ratio keeps one trigger population. |
| 5097 | + for (auto const& truthTrigger : truthTriggers) { |
| 5098 | + const std::array<bool, PairLossK0NStages> triggerStagePassed = { |
| 5099 | + true, // Gen pair |
| 5100 | + true, // Findable K0->pi+pi-: K0 side only |
| 5101 | + contains(tracksBestCollision, truthTrigger.globalIndex), // Trigger pure reco (best collision) |
| 5102 | + contains(triggersInTable, truthTrigger.globalIndex), // Trigger in TriggerTracks |
| 5103 | + contains(triggersFinal, truthTrigger.globalIndex), // Trigger final selection |
| 5104 | + true, // V0 pure reco: K0 side only |
| 5105 | + true, // V0 candidate: K0 side only |
| 5106 | + true, // V0 in AssocV0s: K0 side only |
| 5107 | + true, // V0 final selection: K0 side only |
| 5108 | + contains(triggersFinal, truthTrigger.globalIndex)}; // Final reconstructed pair |
| 5109 | + for (int stage = 0; stage < PairLossK0NStages; ++stage) { |
| 5110 | + if (!triggerStagePassed[stage]) { |
| 5111 | + continue; |
| 5112 | + } |
| 5113 | + histos.fill(HIST("PairLossK0/Stage/hTriggers"), stage, truthTrigger.pt, truthTrigger.eta, truthTrigger.phi, collision.posZ(), multiplicity); |
| 5114 | + } |
| 5115 | + } |
| 5116 | + |
5086 | 5117 | bool hasTruthPair = false; |
5087 | 5118 | for (auto const& truthTrigger : truthTriggers) { |
5088 | 5119 | for (auto const& truthK0 : truthK0s) { |
|
0 commit comments