Skip to content

Commit f9557f4

Browse files
committed
[PWGCF] Lambda-Cascade correlation: shorten comments, remove unreachable code
1 parent fbe8c14 commit f9557f4

1 file changed

Lines changed: 44 additions & 135 deletions

File tree

PWGCF/TwoParticleCorrelations/Tasks/Lambdacascadecorrelation.cxx

Lines changed: 44 additions & 135 deletions
Original file line numberDiff line numberDiff line change
@@ -486,26 +486,12 @@ enum PrmScdPairType {
486486
};
487487

488488
// =============================================================================
489-
// Shared event-selection helpers
490-
//
491-
// Both LambdaTableProducer (selCollision) and CascadeSelector (eventSelection)
492-
// historically applied their own, slightly different, sets of event cuts. That
493-
// produced collision populations that disagreed in subtle ways (e.g. LTP did
494-
// not veto same-bunch pileup by default, CSEL did) and broke the downstream
495-
// Λ-Ξ correlator's normalisation.
496-
//
497-
// This namespace provides:
498-
// - a POD `EventCuts` describing every cut either producer might apply,
499-
// - a templated `applyEventSelection<RunType>(col, cuts, centValue, &reason)`
500-
// that evaluates only the cuts whose `use*` flag is true,
501-
// - a `logEventCuts(tag, cuts)` that prints the cut configuration in a
502-
// unified, single-line, grep-friendly format.
503-
//
504-
// Each producer builds an `EventCuts` from its own Configurables in init() and
505-
// uses the shared function. Defaults are unchanged — nothing differs at
506-
// runtime unless the user touches the configurables — but the duplicated logic
507-
// is gone and the [EVENTSEL-LTP] / [EVENTSEL-CSEL] log lines now make the
508-
// producer-mismatch visible side by side.
489+
// Shared event selection. Historically the Λ producer and the cascade
490+
// selector applied slightly different event cuts, breaking the downstream
491+
// correlator's normalisation. Now: one POD `EventCuts`, one templated
492+
// `applyEventSelection<RunType>()` evaluating only cuts with use*=true,
493+
// and `logEventCuts()` for a grep-friendly one-line config dump.
494+
// Defaults unchanged.
509495
// =============================================================================
510496
namespace lcorr_evsel
511497
{
@@ -649,24 +635,12 @@ inline void logEventCuts(const char* tag, EventCuts const& cuts)
649635
} // namespace lcorr_evsel
650636

651637
// =============================================================================
652-
// LambdaCascadeProducer — merger of LambdaTableProducer (LTP) and
653-
// the standalone CascadeSelector (CSEL).
654-
//
655-
// Why merged: event selection used to run twice (once in LTP, once in CSEL),
656-
// with subtly different defaults, producing inconsistent collision populations
657-
// in the downstream Lambdacascadecorrelation. The merge guarantees a single
658-
// `selCollision()` call per event drives BOTH the Lambda table production
659-
// and the cascade flagging — they can no longer disagree.
660-
//
661-
// Output tables (unchanged from before):
662-
// - aod::LambdaCollisions, aod::LambdaTracks (Lambda)
663-
// - aod::LambdaMcGenCollisions, aod::LambdaMcGenTracks (Lambda MC)
664-
// - aod::CascadeFlags (Cascade)
665-
//
666-
// Histogram registries: kept distinct (`histos` for Lambda-side, `cascRegistry`
667-
// for cascade-side) so every existing path in AnalysisResults.root stays
668-
// byte-identical. Downstream macros / hyperloop wagons / plotting scripts
669-
// require no changes.
638+
// LambdaCascadeProducer — merger of the former LambdaTableProducer and
639+
// CascadeSelector. One selCollision() per event drives both the Λ tables
640+
// and the cascade flagging, so their collision populations cannot disagree.
641+
// Outputs: LambdaCollisions, LambdaTracks, LambdaMcGen*, CascadeFlags.
642+
// Registries stay separate (histos / cascRegistry) so every histogram path
643+
// in AnalysisResults.root is unchanged.
670644
// =============================================================================
671645
struct LambdaCascadeProducer {
672646

@@ -771,14 +745,10 @@ struct LambdaCascadeProducer {
771745
Service<o2::framework::O2DatabasePDG> pdgDB;
772746

773747
// ===========================================================================
774-
// All cascade-side Configurables and Axes bundled into a
775-
// single ConfigurableGroup. Reason: the framework's StructToTuple has a
776-
// hard cap of 99 task members (DPL_HOMOGENEOUS_APPLY_ENTRY (9,9)). Without
777-
// grouping, the merged struct lands at 129 members. ConfigurableGroup
778-
// makes the whole bundle count as one member while still exposing every
779-
// inner Configurable to JSON/CLI (no behaviour change for users — JSON keys
780-
// unchanged because each Configurable's first-arg name is preserved).
781-
// Code references go from `tpcNsigmaProton` → `cascCfg.tpcNsigmaProton`.
748+
// Cascade-side Configurables bundled into one ConfigurableGroup:
749+
// StructToTuple caps a task at 99 members and the merged struct has 129.
750+
// The group counts as one member; JSON keys are unchanged (first-arg
751+
// names preserved). Access pattern: cascCfg.tpcNsigmaProton.
782752
// ===========================================================================
783753
struct : ConfigurableGroup {
784754
// Deprecated CSEL-style event-selection knobs. Echoed in the
@@ -1459,13 +1429,8 @@ struct LambdaCascadeProducer {
14591429
return false;
14601430
}
14611431

1462-
if (lambdaFlag || antiLambdaFlag) {
1463-
return true;
1464-
}
1465-
1466-
histos.fill(HIST("Tracks/h1f_tracks_info"), kNotLambdaAfterSel);
1467-
1468-
return false;
1432+
// Exactly one hypothesis survived.
1433+
return true;
14691434
}
14701435

14711436
template <typename C, typename V, typename T>
@@ -1510,15 +1475,10 @@ struct LambdaCascadeProducer {
15101475
return true;
15111476
}
15121477

1513-
// Compute the per-V0 cut bitmask UNCONDITIONALLY. Each bit
1514-
// mirrors a stage of the existing selV0Particle / topoCutSelection /
1515-
// selDaughterTracks chain, but no early-return short-circuits. The
1516-
// resulting uint32 captures the cut state of EVERY candidate so an
1517-
// offline macro can replay any cut combination from the tree alone.
1518-
//
1519-
// Note: this duplicates the cut conditions written elsewhere — keep
1520-
// in sync if you ever change a numerical bound. Cheap (~10 comparisons
1521-
// per V0), only called once per V0.
1478+
// Per-V0 cut bitmask, computed with NO short-circuit: each bit mirrors a
1479+
// stage of the selV0Particle chain, so any cut combination can be replayed
1480+
// offline from the tree alone. WARNING: duplicates the cut conditions —
1481+
// keep in sync when changing any bound. ~10 comparisons per V0.
15221482
template <typename C, typename V, typename T>
15231483
uint32_t computeLambdaCutBits(C const& col, V const& v0, T const&,
15241484
ParticleType v0Type, bool ambVeto)
@@ -2718,19 +2678,12 @@ struct LambdaCascadeProducer {
27182678
PROCESS_SWITCH(LambdaCascadeProducer, processMCGenOnlyRun3, "Gen-only Run3 (no reco tables)", false);
27192679

27202680
// ===========================================================================
2721-
// Cascade-side MC truth-only path (port of former
2722-
// CascadeSelector::processGenMC). Self-contained MC-truth event selection
2723-
// (INELgtN on McParticles, MC z-vertex), distinct from the reco-level
2724-
// selCollision because it operates on McCollisions/McParticles directly.
2725-
// Used as a closure/efficiency check for the cascade MC truth side.
2681+
// Cascade MC truth-only path (former CascadeSelector::processGenMC):
2682+
// self-contained MC-truth event selection on McCollisions/McParticles,
2683+
// used as a closure/efficiency check.
27262684
//
2727-
// DO NOT add `private:` access specifiers here. Any non-public
2728-
// non-static data member breaks the struct's aggregate-ness, and the
2729-
// framework's `brace_constructible_size` (which uses brace-init to count
2730-
// members for StructToTuple dispatch) collapses, mis-routing dispatch to
2731-
// the D == 0 chain. The original CascadeSelector kept all members in the
2732-
// implicit public section for the same reason. The previously-declared
2733-
// `mCascCounter` was unused and has been removed.
2685+
// DO NOT add `private:` here: a non-public data member breaks the
2686+
// struct's aggregate-ness and StructToTuple dispatch mis-routes.
27342687
// ===========================================================================
27352688

27362689
// Use CollisionsRun3 (which carries CentFT0Ms etc.) instead of
@@ -3009,17 +2962,8 @@ struct LambdaTracksExtProducer {
30092962
};
30102963

30112964
// =============================================================================
3012-
// Dead structs removed:
3013-
//
3014-
// - LambdaR2Correlation (was struct at this position; commented out of the
3015-
// workflow, ~340 lines of unused code)
3016-
// - CascadeSelector_REMOVED_PHASE4 (#if 0 block, kept temporarily
3017-
// for reference, ~575 lines)
3018-
// - CascadeCorrelations (was struct CSEL block; commented out
3019-
// of the workflow, ~450 lines)
3020-
//
3021-
// Total: roughly 1370 fewer lines compiled per build. All three structs are
3022-
// available in git history if anyone wants to revive them.
2965+
// Removed dead structs (LambdaR2Correlation, CascadeSelector,
2966+
// CascadeCorrelations; ~1370 lines) — see git history to revive.
30232967
// =============================================================================
30242968

30252969
// TTree branch structs + connectors inlined
@@ -3246,18 +3190,11 @@ struct Lambdacascadecorrelation {
32463190
Configurable<bool> saveLambdaTree{"saveLambdaTree", false,
32473191
"Save TTree of standalone-Λ candidates into AnalysisResults.root"};
32483192

3249-
// Auto-correlation veto policy (replaces previous bool
3250-
// cVetoSharedDau). Three modes for systematic studies:
3251-
// 0 = off (keep all pairs, including same-Λ self-pairs)
3252-
// 1 = strict — drop pair if pos AND neg daughter tracks both match
3253-
// the cascade's V0 daughters. (Default; matches the old
3254-
// cVetoSharedDau=true behaviour.)
3255-
// 2 = loose — drop pair if EITHER daughter matches. Catches the
3256-
// rare case where the standalone V0 was fit to one
3257-
// cascade-V0 daughter plus a different second track.
3258-
// The legacy `cVetoSharedDau` Configurable is still parsed from JSON
3259-
// for backward compatibility but ignored at runtime — set cVetoMode
3260-
// instead.
3193+
// Auto-correlation veto (replaces bool cVetoSharedDau; legacy key still
3194+
// parsed but ignored):
3195+
// 0 = off — keep all pairs (systematics only).
3196+
// 1 = strict — drop if BOTH daughters match the cascade V0 (default).
3197+
// 2 = loose — drop if EITHER daughter matches.
32613198
Configurable<int> cVetoMode{"cVetoMode", 1,
32623199
"Auto-correlation veto: 0=off, 1=strict (both daughters shared), 2=loose (any daughter)"};
32633200
Configurable<bool> cVetoSharedDau{"cVetoSharedDau", true,
@@ -3424,24 +3361,12 @@ struct Lambdacascadecorrelation {
34243361
Configurable<bool> cRequireTrueCascade{"cRequireTrueCascade", true,
34253362
"MC: drop cascade candidates not flagged IsTrueCascade==true"};
34263363

3427-
// ITS strangeness-tracking gating policy. Lets you A/B-compare
3428-
// what the IsItsTracked flag adds without recompiling.
3429-
//
3430-
// 0 = OFF — ignore IsItsTracked entirely (current behaviour).
3431-
// 1 = REQUIRE — accept ONLY cascades flagged IsItsTracked. Highest
3432-
// purity on data (ITS confirmed the Ξ flight) but
3433-
// trades a lot of statistics: ITS strangeness-tracking
3434-
// efficiency is typically 5–20% of the topological
3435-
// cascade yield in pp, depending on pT and η.
3436-
// 2 = RESCUE — keep cascades that fail purity gates (in particular
3437-
// cRequireTrueCascade on MC) IF IsItsTracked is true.
3438-
// Useful for data-side high-purity systematic where
3439-
// the truth flag is unavailable but ITS confirms.
3440-
// 3 = QA-ONLY — no gating; only fill QA histos so you can plot
3441-
// the IsItsTracked fraction vs cascade pT/centrality.
3442-
//
3443-
// QA histograms are filled regardless of the mode so the comparison is
3444-
// always available downstream.
3364+
// ITS strangeness-tracking gating policy (A/B-compare without recompiling):
3365+
// 0 = OFF — ignore IsItsTracked (default behaviour).
3366+
// 1 = REQUIRE — accept only IsItsTracked cascades (high purity, low stats).
3367+
// 2 = RESCUE — keep purity-gate failures IF IsItsTracked confirms them.
3368+
// 3 = QA-ONLY — no gating; QA histos only.
3369+
// QA histograms are filled in every mode.
34453370
Configurable<int> cItsTrackMode{"cItsTrackMode", 0,
34463371
"ITS strangeness-tracking gate: 0=off, 1=require, 2=rescue, 3=qa-only"};
34473372

@@ -3526,26 +3451,10 @@ struct Lambdacascadecorrelation {
35263451
// so |pdg|==3312 AND |pdg|==3334 would always be false.)
35273452
Preslice<aod::McParticles> mcParticlesPerMcCollision = aod::mcparticle::mcCollisionId;
35283453

3529-
// Cascade efficiency weight (mirror of useEff for the Λ side).
3530-
// Returns 1/eff so multiplying it into the pair weight yields an
3531-
// efficiency-corrected count. The default implementation returns 1.0
3532-
// (no correction) — fill in the CCDB-load body once you have an
3533-
// efficiency map for cascades. The kKind template parameter is 0 for Ξ
3534-
// and 1 for Ω so the map can be specialised by particle.
3535-
//
3536-
// Usage in pair loops:
3537-
// float wCasc = getCascadeEfficiency<0/*Xi*/>(casc.sign(), casc.pt(), xiY);
3538-
// float wPair = wLam * wCasc;
3539-
//
3540-
// Suggested CCDB-load skeleton (uncomment + adapt when you have a map):
3541-
// if (!cUseCascEff) return 1.0f;
3542-
// static TList* effList = ccdb->getForTimeStamp<TList>(cCascEffPath, -1);
3543-
// const char* hName = (kKind == 0)
3544-
// ? (sign < 0 ? "hEffXiMinus" : "hEffXiPlus")
3545-
// : (sign < 0 ? "hEffOmegaMinus" : "hEffOmegaPlus");
3546-
// auto* h = static_cast<TH3*>(effList->FindObject(hName));
3547-
// double e = h->GetBinContent(h->FindBin(/*cent*/, pt, rap));
3548-
// return (e > 0) ? 1.0f / static_cast<float>(e) : 1.0f;
3454+
// Cascade efficiency weight: returns 1/eff for the pair weight
3455+
// (w = wLam * wCasc). Default returns 1.0 (no correction); load a CCDB
3456+
// efficiency map here when available. kKind: 0 = Xi, 1 = Omega.
3457+
// Usage: getCascadeEfficiency<0>(casc.sign(), casc.pt(), xiY).
35493458
template <int kKind /*0=Xi, 1=Omega*/>
35503459
float getCascadeEfficiency(int /*sign*/, float /*pt*/, float /*rap*/)
35513460
{

0 commit comments

Comments
 (0)