Skip to content

Commit d403c01

Browse files
committed
Simplify the code
1 parent 150d8b9 commit d403c01

1 file changed

Lines changed: 39 additions & 35 deletions

File tree

PWGLF/Tasks/Strangeness/hStrangeCorrelation.cxx

Lines changed: 39 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -461,40 +461,47 @@ struct HStrangeCorrelation {
461461
static constexpr int AssocV0Types = 3; // K0S, Lambda, AntiLambda,
462462
static constexpr int AssocCascadeTypes = 4; // Xi-, Xi+, Omega-, Omega+
463463

464+
// Cumulative reconstruction ladder for one truth h-K0 pair: every stage is a
465+
// strictly narrower requirement than the one before it, so the ratio of two
466+
// neighbouring stages is the efficiency of exactly the step between them.
467+
//
468+
// Two "pure reconstruction" levels anchor the chain. Both mean "the object is
469+
// present in the reconstruction with no selection applied whatsoever":
470+
// PairLossTriggerPureReco a track carrying the trigger's MC label exists
471+
// PairLossV0PureReco both K0 daughters have a reconstructed track
472+
// The V0 one sits deliberately at daughter-track level rather than at V0Datas
473+
// level: a row in V0Datas has already survived the V0 builder's own cuts
474+
// (cos(PA), daughter DCA, radius, crossed rows), so the step
475+
// PairLossV0PureReco -> PairLossV0Candidate isolates exactly what the builder
476+
// throws away, which no other stage can show.
477+
//
478+
// Everything is evaluated in the best collision. The "any reconstructed
479+
// collision" variants live in the ClosureTest/PairLossK0/AnyTrack* folders
480+
// instead, so keeping them here as well would only duplicate them.
464481
enum PairLossK0Stage : int {
465482
PairLossGenPair = 0,
466483
PairLossFindablePair,
467-
PairLossTriggerAnyCollision,
468-
PairLossTriggerBestCollision,
484+
PairLossTriggerPureReco,
469485
PairLossTriggerInTable,
470486
PairLossTriggerFinal,
471-
PairLossPositiveDaughterBestCollision,
472-
PairLossNegativeDaughterBestCollision,
473-
PairLossBothDaughtersBestCollision,
474-
PairLossV0AnyCollision,
475-
PairLossV0BestCollision,
487+
PairLossV0PureReco,
488+
PairLossV0Candidate,
476489
PairLossV0InTable,
477490
PairLossV0Final,
478-
PairLossBothFinalBeforeAutocorrelation,
479491
PairLossFinalPair,
480492
PairLossK0NStages
481493
};
482494

483495
static constexpr std::array<std::string_view, PairLossK0NStages> PairLossK0StageNames = {
484496
"Gen pair",
485497
"Findable K0->pi+pi-",
486-
"Trigger track, any rec collision",
487-
"Trigger track, best collision",
498+
"Trigger pure reco (best collision)",
488499
"Trigger in TriggerTracks",
489500
"Trigger final selection",
490-
"Positive daughter track",
491-
"Negative daughter track",
492-
"Both daughter tracks",
493-
"V0 candidate, any rec collision",
494-
"V0 candidate, best collision",
501+
"V0 pure reco (both daughters)",
502+
"V0 candidate (best collision)",
495503
"V0 in AssocV0s",
496504
"V0 final selection",
497-
"Both final, before autocorrelation",
498505
"Final reconstructed pair"};
499506

500507
struct PairLossTrackInfo {
@@ -2514,8 +2521,8 @@ struct HStrangeCorrelation {
25142521
histos.add("PairLossK0/Event/hNRecoCollisions", "reconstructed collisions per MC collision", kTH1F, {axisPairLossNRecoCollisions});
25152522
histos.add("PairLossK0/Stage/hCounts", "pair-loss diagnostic stage counts", kTH1F, {axisPairLossStage});
25162523
histos.add("PairLossK0/Stage/hCountsFindable", "pair-loss diagnostic stage counts for findable K0", kTH1F, {axisPairLossStage});
2517-
histos.add("PairLossK0/Stage/hPhysics", "stages in h-K0 physics variables", kTHnF, {axisPairLossStage, axisPairLossTruthDeltaPhi, axisPairLossTruthDeltaEta, axisPairLossTruthK0Pt, axisPairLossTruthTriggerPt, axisPairLossFieldSign});
2518-
histos.add("PairLossK0/Stage/hPhysicsFindable", "stages in h-K0 physics variables for findable K0", kTHnF, {axisPairLossStage, axisPairLossTruthDeltaPhi, axisPairLossTruthDeltaEta, axisPairLossTruthK0Pt, axisPairLossTruthTriggerPt, axisPairLossFieldSign});
2524+
histos.add("PairLossK0/Stage/hPhysics", "stages in h-K0 physics variables", kTHnF, {axisPairLossStage, axisPairLossTruthDeltaPhi, axisPairLossTruthDeltaEta, axisPairLossTruthK0Pt, axisPairLossTruthTriggerPt, axisMultNDim});
2525+
histos.add("PairLossK0/Stage/hPhysicsFindable", "stages in h-K0 physics variables for findable K0", kTHnF, {axisPairLossStage, axisPairLossTruthDeltaPhi, axisPairLossTruthDeltaEta, axisPairLossTruthK0Pt, axisPairLossTruthTriggerPt, axisMultNDim});
25192526
histos.add("PairLossK0/Stage/hClose", "stages in trigger-daughter close-pair variables", kTHnF, {axisPairLossStage, axisPairLossMinDeltaPhiStar, axisPairLossDaughterDeltaEta, axisPairLossTruthK0Pt, axisPairLossTruthTriggerPt, axisPairLossFieldSign, axisPairLossChargeProduct});
25202527
histos.add("PairLossK0/Stage/hTriggerTracksFailureReason", "first-failing TriggerTracks condition for best-collision triggers, in h-K0 physics variables", kTHnF, {axisPairLossTriggerTracksFailureReason, axisPairLossTruthDeltaPhi, axisPairLossTruthDeltaEta, axisPairLossTruthK0Pt, axisPairLossTruthTriggerPt});
25212528

@@ -2904,11 +2911,13 @@ struct HStrangeCorrelation {
29042911
// matching MC label for the trigger, a V0 candidate with a matching MC
29052912
// core for the K0) in any reconstructed collision associated with this MC
29062913
// collision, with no quality selection whatsoever.
2907-
// folder trigger K0 processPairLossK0MC stage
2908-
// Truth truth truth PairLossGenPair
2909-
// AnyTrack any truth PairLossTriggerAnyCollision
2910-
// AnyTrackK0 truth any PairLossV0AnyCollision
2911-
// AnyTrackBoth any any both stages at once
2914+
// folder trigger K0 reconstruction requirement
2915+
// Truth truth truth none (PairLossGenPair)
2916+
// AnyTrack any truth trigger has a track in any collision
2917+
// AnyTrackK0 truth any K0 has a V0 candidate in any collision
2918+
// AnyTrackBoth any any both requirements at once
2919+
// The "any reconstructed collision" level exists only here: the
2920+
// processPairLossK0MC stage ladder is evaluated in the best collision.
29122921
// Final final final fully selected, both in one collision
29132922
// "final" means the object has a reconstructed counterpart that survives
29142923
// every selection the reconstructed correlation applies, and for the pair
@@ -4649,7 +4658,6 @@ struct HStrangeCorrelation {
46494658
const double magneticField = getPairLossMagneticField(bc.runNumber(), bc.timestamp());
46504659
const int magneticFieldSign = magneticField > 0.0 ? 1 : (magneticField < 0.0 ? -1 : 0);
46514660
const float multiplicity = masterConfigurations.doPPAnalysis ? collision.centFT0M() : collision.centFT0C();
4652-
static_cast<void>(multiplicity); // retained for straightforward extension of the diagnostic axes
46534661

46544662
PairLossTrackMap tracksBestCollision;
46554663
const auto bestTrackSlice = tracks.sliceBy(pairLossTracksPerCollision, bestCollisionId);
@@ -4908,14 +4916,12 @@ struct HStrangeCorrelation {
49084916
}
49094917
}
49104918

4911-
const bool triggerAnyCollision = contains(tracksAnyCollision, truthTrigger.globalIndex);
49124919
const bool triggerBestCollision = contains(tracksBestCollision, truthTrigger.globalIndex);
49134920
const bool triggerInTable = contains(triggersInTable, truthTrigger.globalIndex);
49144921
const bool triggerFinal = contains(triggersFinal, truthTrigger.globalIndex);
49154922
const bool positiveDaughterBestCollision = contains(tracksBestCollision, truthK0.positiveDaughter.globalIndex);
49164923
const bool negativeDaughterBestCollision = contains(tracksBestCollision, truthK0.negativeDaughter.globalIndex);
49174924
const bool bothDaughtersBestCollision = positiveDaughterBestCollision && negativeDaughterBestCollision;
4918-
const bool v0AnyCollision = contains(v0sAnyCollision, truthK0.globalIndex);
49194925
const bool v0BestCollision = contains(v0sBestCollision, truthK0.globalIndex);
49204926
const bool v0InTable = contains(v0sInTable, truthK0.globalIndex);
49214927
const bool v0Final = contains(v0sFinal, truthK0.globalIndex);
@@ -4960,31 +4966,31 @@ struct HStrangeCorrelation {
49604966
}
49614967
}
49624968

4969+
// Order must match PairLossK0Stage / PairLossK0StageNames one to one.
4970+
// positiveDaughterBestCollision and negativeDaughterBestCollision are
4971+
// intentionally absent: the per-daughter breakdown lives in
4972+
// State/hDaughterTrackStateClose, and pairBeforeAutocorrelation in
4973+
// Geometry/hAutocorrelationRejected.
49634974
const std::array<bool, PairLossK0NStages> stagePassed = {
49644975
true,
49654976
truthK0.findable,
4966-
triggerAnyCollision,
49674977
triggerBestCollision,
49684978
triggerInTable,
49694979
triggerFinal,
4970-
positiveDaughterBestCollision,
4971-
negativeDaughterBestCollision,
49724980
bothDaughtersBestCollision,
4973-
v0AnyCollision,
49744981
v0BestCollision,
49754982
v0InTable,
49764983
v0Final,
4977-
pairBeforeAutocorrelation,
49784984
finalPair};
49794985
for (int stage = 0; stage < PairLossK0NStages; ++stage) {
49804986
if (!stagePassed[stage]) {
49814987
continue;
49824988
}
49834989
histos.fill(HIST("PairLossK0/Stage/hCounts"), stage);
4984-
histos.fill(HIST("PairLossK0/Stage/hPhysics"), stage, truthDeltaPhi, truthDeltaEta, truthK0.pt, truthTrigger.pt, magneticFieldSign);
4990+
histos.fill(HIST("PairLossK0/Stage/hPhysics"), stage, truthDeltaPhi, truthDeltaEta, truthK0.pt, truthTrigger.pt, multiplicity);
49854991
if (truthK0.findable) {
49864992
histos.fill(HIST("PairLossK0/Stage/hCountsFindable"), stage);
4987-
histos.fill(HIST("PairLossK0/Stage/hPhysicsFindable"), stage, truthDeltaPhi, truthDeltaEta, truthK0.pt, truthTrigger.pt, magneticFieldSign);
4993+
histos.fill(HIST("PairLossK0/Stage/hPhysicsFindable"), stage, truthDeltaPhi, truthDeltaEta, truthK0.pt, truthTrigger.pt, multiplicity);
49884994
if (closestDeltaPhiStar.valid) {
49894995
histos.fill(HIST("PairLossK0/Stage/hClose"), stage, closestDeltaPhiStar.minAbs, closestDeltaEta, truthK0.pt, truthTrigger.pt, magneticFieldSign, closestChargeProduct);
49904996
}
@@ -5127,10 +5133,8 @@ struct HStrangeCorrelation {
51275133
// AnyTrack the truth trigger must have at least one reconstructed track
51285134
// pointing back to it through its MC label, in any
51295135
// reconstructed collision associated with this MC collision
5130-
// (stage PairLossTriggerAnyCollision)
51315136
// AnyTrackK0 the truth K0 must have at least one reconstructed V0
51325137
// candidate pointing back to it, in any associated collision
5133-
// (stage PairLossV0AnyCollision)
51345138
// AnyTrackBoth both requirements at the same time
51355139
// Final the strictest stage: both the trigger and the K0 must have a
51365140
// *fully selected* reconstructed counterpart -- the very

0 commit comments

Comments
 (0)