Repository navigation
[PWGLF] phiStrangeCorrelation/phiStrangeCorrelator: CCDB map ownership, event selection and MC phi trigger fixes, selections update - #18958
Merged
romainschotter merged 25 commits intoNov 27, 2026
Conversation
The efficiency maps were wrapped in std::shared_ptr, but with caching on (the default) BasicCCDBManager owns the objects it returns. The double ownership deleted each map twice, and with per-run fetching the reassignment at a run change deleted a map still held by the cache (use-after-free). The maps are now non-owning const pointers. Fetching the same path as TH3D and then as TH2D is also replaced by one fetch as TH1 plus dynamic_cast: the cache is keyed by path only and returns its object cast to the requested type, so on a cache hit a TH2 map came back as a non-null TH3. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Remove the code commented out in the previous PR (AliceO2Group#18061), the seven unused uniform-binning axes (multAxis and the pT axes, superseded by the binned ones) and the "TO BE REMOVED" tags on cutZVertex and vertexZAxis, which stay. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The uncertainty of the efficiency maps is no longer added per entry, and propagateEffError goes with it. All entries reading a map bin share that bin's uncertainty, so within the bin it adds linearly. Summed in quadrature per entry it is underestimated by sqrt(N), which leaves the statistical error larger by only sqrt(1 + r^2), with r the relative error of the map. It is to be propagated offline. The weight alone goes into the histograms. They are registered with Sumw2 and filled through the registry with the weight as last argument, so each bin carries the statistical variance, sum of w^2. customFillHist and customFillTHn are removed. Bin contents are unchanged; errors are smaller by sqrt(1 + r^2) where the efficiency is applied with propagateEffError=true, and unchanged where it was false. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…orrelation
An efficiency that cannot be computed (a map bin without reconstructed MC, a
candidate outside the map, a non-positive or non-finite interpolation) was
handled on the product of the two efficiencies: the pair got weight 1, losing
the correction of the other particle as well, and nothing recorded it.
The efficiency is now checked per particle. computeWeight returns no weight
when one of its efficiencies cannot be computed, and the entry is dropped, as
candidates beyond the last pT bin of the maps already are. It is counted in
zeroEfficiency/{SE,ME}/h3<particle>, in the multiplicity, pT and rapidity of
the particle whose efficiency failed. A phi candidate is checked once, before
the trigger count and its pairs, so that both see the same candidates.
computeAssocWeight is renamed computePhiAssocWeight: it is the weight of the
pair.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…phiStrangeCorrelation In processMCGenClosure a generated phi was taken as trigger only with eventSelectionType == 0. With type 1 the collision filter keeps only events with a generated phi, and the guard then dropped every one of them: the trigger count and the SE/ME pairs of the generated closure stayed empty, with no message. The guard belongs to the efficiency (processParticleEfficiency), where events selected on a phi would bias the phi efficiency; in the closure the phi is the trigger. Only the pT cut is kept.
…ngeCorrelator cfgRCTLabel selects one of the predefined run-condition selections (CBT, CBT_hadronPID, ...) of RCTFlagsChecker; empty, the default, applies none. The cut is applied after INEL>0 in data and after the generated-collision match in MC reconstructed events, and gets its own bin in hEventSelectionData and hEventSelectionMC, before the one of events with a phi candidate. An unknown label stops the task in init instead of at the first event. Also removes the commented-out Produces of the event selection tables. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…lation The generated-particle switches of processParticleEfficiency and processMCGenClosure are on |PDG|, so the AntiLambda case (-3122) could never match: every generated anti-Lambda went into the Lambda histograms and the Lambda generated collection, and the AntiLambda ones stayed empty. The reconstructed side tells them apart by the signed PDG code, so the Lambda efficiency came out about half the true one and the AntiLambda efficiency could not be computed. The |PDG| 3122 case now takes the sign: Lambda for +3122, AntiLambda for -3122. Xi, Omega and pions keep both charges in one species, as on the reconstructed side. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…hiStrangeCorrelation
EventSelectionProducer counts events with a phi candidate in a signal window
given by two floats in a configurable group; it is now one
std::pair rangeMPhiSignal, named and written as the window of the correlation
task, with the value every train uses, {1.0, 1.05}. The group, left with one
member, is gone. The wagon key changes from minMPhiSignal/maxMPhiSignal to
rangeMPhiSignal.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…igned with the trains The defaults of the selections, mass windows, pT binnings and active species are set to the values every current data train uses: the V0 and cascade selections, the phi mass limit of the candidate producer, the signal and sideband windows, the minimum pT of K0S and Lambda, the analysis pT bins of the correlation task and the finer bins of the producers (from which the purity is fitted and merged). MC trains keep overriding the correlation binning with finer bins for the efficiency; every analysis bin edge is also an edge there. No current train changes: all of them set these values. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ections in phiStrangeCorrelator furtherV0Selection gated, all together, the ctau cuts of K0S and Lambda, the rejection of Lambda among the K0S (with the Armenteros cut) and the rejection of K0S among the Lambda, so the competing-mass rejection could not be switched on for the Lambda without changing the K0S selection. A K0S whose pi+ passes the proton PID enters the Lambda mass spectrum with a kinematic edge that falls under the Lambda peak at low pT. It is replaced by three switches: applyCtauCut, vetoLambdaInK0S, vetoK0SInLambda. All are off by default, as furtherV0Selection was in the trains. Also removes rangeMK0sSignal and rangeMLambdaSignal, declared and never read: the signal windows of the associated particles are those of phiStrangeCorrelation. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ducer phiStrangeCorrelation counts a pion within the TPC nSigma window, and within the TOF one as well when the track has TOF. The two existing histograms hold each nSigma over every selected track: the TPC one mixes the tracks with and without TOF, and the TOF one puts the tracks without TOF in its underflow, at -999. Neither gives the purity or the window efficiency of the counted sample. Adds, for the selected pions, the TPC and TOF nSigma together for the tracks with TOF (THnSparse) and the TPC nSigma alone for those without, and the same two for the true primary pions in MC reconstruction. The old histograms are kept, with their nSigma axes now titled TPC and TOF: they are the sums of the new ones, and they are what is read offline until the new ones are. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…d phiStrangeCorrelation The producer requires the TOF from tofPIDThreshold up, but the nSigma window of phiStrangeCorrelation cut in nSigma TOF every track that had a TOF signal, at any pT, and so did the K/p rejection. Below the threshold the counted sample was therefore mixed: the tracks with TOF, a fraction that grows with pT, passed a cut the others did not, and the efficiency carried the TOF matching and mismatch there, which the MC reproduces worse than the TPC response. Below the threshold the TPC separates the pion alone. The TOF now enters the PID from tofPIDThreshold up and never below, everywhere: - useTOFInPID (pT >= tofPIDThreshold and a TOF signal) decides the K/p rejection in the producer; - the pion tables carry it as UseTOFInPID, replacing HasTOF, and InNSigmaRegion applies the TOF window only when it is true, so the threshold exists in one place and the task keeps no copy of it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…Correlator pion producer The pion producer filled its true-primary nSigma histograms (h4RecMCPionTPCTOFnSigma, h3RecMCPionTPCnSigmaNoTOF) with the reconstructed centFT0M of the collision, while the event selection and the efficiencies of phiStrangeCorrelation use the generated one (McCentFT0Ms). The fraction of pions inside the nSigma window taken from them was therefore binned in a different multiplicity than the efficiency it multiplies. phi_strange_utils::multPercentile gives the percentile a collision is binned in: its own centFT0M in data and for a generated collision, that of the generated collision it comes from for a reconstructed one in MC. The pion producer and the event-selection producer, which did the same lookup twice, read it there; the event selection's behaviour is unchanged. In phiStrangeCorrelation, a comment on h4<X>MCReco: it is cut in the signal region only if select<X>InSigRegion is on, and with selectPionInSigRegion off the window's own efficiency comes from those producer histograms (MC) or from the data fits. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…elator event selection The process...WPhi functions of EventSelectionProducer passed the default selection and eventHasPhi as two arguments of the same call, so eventHasPhi ran on every collision, also on those the default selection had rejected. It then filled the WPhi QA histograms and the "with a phi" bin of hEventSelectionData/MC with rejected events, and in MC reconstruction it read the generated collision through mcCollision_as also for a collision without one. The selection seen by phiStrangeCorrelation was right, since its filter requires defaultSel and phimesonSel together. The single-column table of before February 2026 had the && that avoided this; it was lost when the selection became two columns. eventHasPhi is now evaluated only when the default selection (INEL>0 for the generated collisions) passes; phimesonSel is then false for a rejected event, which changes no selection. Also removed the commented-out leftovers of the old selection tables (DefaultSelection*, PhimesonSelection*, PhiStrangeDefEvtSel*, lf_selection_default_collision), which no longer exist in the data model. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…amed minPtTOFInPID The option bounded only the producer's TOF requirement (cfgIsTOFChecked); since the TOF enters the pion PID from it up and never below (useTOFInPID, the K/p rejection and the nSigma window of phiStrangeCorrelation), it means something else with the same values. Renamed with its meaning, so that a train configuration says which rule a production ran with, which the option values alone cannot. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…species names The option was a std::array<bool, 6>, which a train configuration records as bare elements (activeCorrelationTypes._M_elems[i]): which element is which species was known only from this file. It is now the list of the species correlated with the phi, by the names of AssocParticleLabels, so that the configuration says which species were on and their order no longer matters. init turns the names into the positions the loops index, and stops on a name that is not a species. The default lists all six species, Lambda and AntiLambda included, so that the MC trains have them for the efficiencies. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…StrangeCorrelator - processMCGenClosure: a generated phi is a trigger only if it decays to K+K-, the trigger of data. A phi in another channel was correlated with its own daughters (the K0S of K0S K0L, the pions of pi+pi-pi0), pairs data do not have. - processParticleEfficiency: new option phiEfficiencyKKOnly (default false, today's behaviour). With it the generated phi of the efficiency is only phi -> K+K-, so the phi efficiency leaves out the BR to K+K- instead of holding it as every other efficiency holds that of its channel. - PhiMesonCandProducer::processMCGen with trueGenPhi: only phi -> K+K-, as the events with a phi of data and of trueGenPhi false. With trueGenPhi false the generated K+K- pairs are formed K+ outside, K- inside: each pair is written once instead of twice, and the inner loop runs only for the K+. - EventSelectionProducer: a comment moved to its own line, which clang-format required. The decay channel is checked with RecoDecay::isMatchedMCGen. Pythia adds no photon to phi -> K+K- (HadronLevel:QED off): in an MC AO2D, 0 of the 42370 phi decay to K+K-gamma. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…of two flags PhiStrangeEvtSelDataLike and PhiStrangeEvtSelMcGen had two bool columns, DefaultSel and PhimesonSel, and phiStrangeCorrelation filtered on both. Since the phi requirement runs only on selected events, an event with a phi is always a selected one, so the two flags are one hierarchy. They are now one column, SelectionLevel (kRejected, kDefault, kDefaultWithPhi), which cannot hold the combination that must not exist (a phi in a rejected event): - the producer writes the level each event reaches; the WPhi processes raise kDefault to kDefaultWithPhi only after eventHasPhi, still evaluated on selected events only; - the V0, cascade and pion producers keep the events at kDefault and above; - phiStrangeCorrelation keeps selectionLevel > eventSelectionType: 0 keeps every selected event, 1 those with a phi. The option is compared as as<uint8_t>, the column's type, as the framework's own test of a filter on a uint8_t column does. Also assumedMass renamed AssumedMass (O2 linter, constexpr constant). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ator The DCAxy templates of the primary, weak-decay and material pions covered |DCAxy| < 0.05 cm, while the producer's cut is 0.004 + 0.013/pT: 0.069 cm at 0.2 GeV/c. Below about 0.28 GeV/c the accepted tracks with the largest DCA fell outside the axis, the tails where the secondaries weigh most. The axis now spans +-0.1 cm with the same bin width. The weak-decay template's title said DCAz. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ator h2PionDCAxy, (pT, DCAxy) of every track the pion producer selects in data, with the axes of the MC templates of primary, weak-decay and material pions: the distribution to fit with them for the fraction of primaries. It holds whatever is not a pion among the selected tracks; the nSigma window is applied by phiStrangeCorrelation, not here. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…h the strangeness analysis notes Defaults from the K0S/Lambda (V0 production vs multiplicity, June 2026, Table 1) and Xi/Omega (ALICE-ANA-2026-1446, Table 3) analyses in pp at 13.6 TeV. V0s: - dcaV0Dau 1.0 -> 0.5; applyCtauCut, vetoK0SInLambda on; rejMassLambda 5 -> 10 MeV; - the Armenteros cut of the K0S has its own switch, applyArmenterosCutK0S (on), separate from vetoLambdaInK0S, which now only rejects the Lambda mass (off), as the note applies the one without the other. Cascades: - the cuts that differ between Xi and Omega are per species: dcaPosToPV, dcaNegToPV, dcaV0Dau, dcaCascDau, cosPA, v0CosPA; the common prefilter keeps only dcaBachToPV (0.1 -> 0.05), the rest is applied in selectionCascade; - the cuts of the note the trains have not applied so far, each with a switch, OFF by default: the DCA of the V0 to the PV (applyDcaV0ToPVCut), the DCAxy of the bachelor-baryon pair (applyBachBaryonCut), the Lambda mass window (applyLambdaMassWindow), the proper decay length in cm as for the V0s (applyCtauCut, ctauXi 22.6 and ctauOmega 17.2 = 4.6 and 7 c tau), the Xi mass rejection in the Omega (vetoXiInOmega). The per-species option groups are folded into v0Configs and cascadeConfigs (no prefix, so the option names are unchanged), and the descriptions of the competing-mass vetoes say which mass is compared. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…cCollisions PhimesonCandidatesMcGen had an index to Collisions while the producer fills it with the McCollision index. processMCGenWPhi, over McCollisions, could then not group it and received the candidates of the whole DF: a generated event passed the phi requirement if any event of its DF had a candidate in the window. Measured on a local MC AO2D (LHC24f4d, 112408 generated INEL>0 events), with eventSelectionType 1 and trueGenPhi false: generated events with a phi 112408 before, 3494 after. The reconstructed side is unchanged (287 events). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
With trueGenPhi the generated phi was written with a mass of 0, and the event selection keeps only candidates in the phi signal window (unless withTrueGenPhi): no generated event passed the phi requirement, with no message. The phi is now written with its own mass, so the window applies to it as to the K+K- pairs of trueGenPhi false. Measured on a local MC AO2D (LHC24f4d, 112408 generated INEL>0 events), with eventSelectionType 1: generated events with a phi 0 before, 1509 after, and the 1536 generated phi -> K+K- of the closure all kept (PYTHIA generates the phi within 1.00-1.04 GeV/c2, inside the default window 1.00-1.05). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…n counted in outOfMap/
With the efficiencies applied, a candidate at or beyond the last pT bin of its
map has no efficiency to read and is dropped. It was dropped uncounted, while
the comment of computeWeight said it was counted. It is now counted as a zero
efficiency is: outOfMap/SE/h3Phi per phi candidate, outOfMap/{SE,ME}/h3<assoc>
per pair. The rule is one predicate per particle (isPhiBeyondMap,
isAssocBeyondMap); isAssocValid keeps only the signal-region selection, so the
MC reconstructed of the efficiency no longer depend on the pT range of the
online maps.
The phi of the mixed event are the candidates of the same event, already
counted there once each: zeroEfficiency/ME/h3Phi is removed and no
outOfMap/ME/h3Phi is added.
Measured on a local data AO2D (run 528531) with the pp26_highIR_updated maps:
34 phi of 8549 beyond the map (pT > 10 GeV/c) now in outOfMap/SE/h3Phi, the
weighted histograms unchanged.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
processPhiAssocME ran for every species whose ME process switch is on, also those left out of activeCorrelationTypes, which the same event skips. Their efficiency map is not loaded, and BoundEfficiencyMap reads an absent map as an efficiency of 1: with the efficiencies applied those pairs got the phi weight alone, with no message. Measured on a local data AO2D with K0S, Xi, Omega and pi active: 61 phi-Lambda and 74 phi-AntiLambda ME pairs filled, no SE pair. The ME now returns for an inactive species, as the same event does. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
scannito
requested review from
alibuild,
ercolessi,
mpuccio,
omvazque and
skundu692
as code owners
November 27, 2026 16:53
scannito
requested review from
HorstMa,
abmodak,
dmallick2,
gbencedi,
lhusova,
maciacco,
mario-krueger,
prottayCMT,
romainschotter and
smaff92
as code owners
November 27, 2026 16:53
Contributor
There was a problem hiding this comment.
Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.
An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing.
|
O2 linter results: ❌ 0 errors, |
romainschotter
approved these changes
Nov 27, 2026
romainschotter
enabled auto-merge (squash)
November 27, 2026 17:30
Collaborator
|
Error while checking build/O2Physics/code-check for 72b9cf0 at 2026-11-27 20:17: Full log here. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes and updates for the phi-strangeness correlation analysis (
phiStrangeCorrelator,phiStrangeCorrelation,LFPhiStrangeCorrelationTables.h).Fixes
use-after-free when
perPeriodEfficiencyreloads them at a run change).eventSelectionTypewas never applied by the collision filter:eventSelectionType == 0compares aConfigurablewith a number, for which DPL has no expression operator, so it became a constant with the default (0) when the
Filterwas built. The two bool flags are replaced by one column,SelectionLevel(rejected / default / defaultwith a phi), filtered with
selectionLevel > as<uint8_t>(eventSelectionType).PhimesonCandidatesMcGenis indexed toMcCollisions(it was indexed toCollisionsand filled with theMcCollisionindex): the generated phi requirement saw the candidates of the whole DF.trueGenPhithe generated phi is written with its mass (it was 0, so no generated event passed the window).efficiency:
phiEfficiencyKKOnly), and kept witheventSelectionType1; generated anti-Lambda counted as AntiLambda.Sumw2; candidates with zero efficiency or beyond the last pT bin of their map aredropped and counted (
zeroEfficiency/,outOfMap/) instead of entering with weight 1 or silently;propagateEffErrorremoved (it summed the map error per entry in quadrature; the map error is correlated and ispropagated offline).
activeCorrelationTypes, as the same event.Updates
cfgRCTLabel).for ctau, Armenteros, competing-mass vetoes, V0 DCA to PV, bachelor-baryon DCA, Lambda mass window.
minPtTOFInPID), nSigma split by TOF, generated multiplicity in the MC histograms,DCAxy of the selected tracks in data, wider DCAxy axis of the MC templates.
activeCorrelationTypesis a list of species names (all six by default); defaults aligned with the current trains.Configuration changes for existing wagons (DPL ignores a key that no longer exists, so these must be updated):
furtherV0Selection,minMPhiSignal/maxMPhiSignal(nowrangeMPhiSignal),rangeMK0sSignalandrangeMLambdaSignalof the producer,dcaCascDau(now per species),propagateEffError;tofPIDThreshold->minPtTOFInPID;activeCorrelationTypes(list of names instead of six booleans);windows of the task,
maxMPhi.Tested locally on a data and an MC AO2D: all process functions, event selection levels on data and MC, V0 and
cascade switches, online efficiencies from the CCDB (maps loaded once). Not yet tested:
perPeriodEfficiencyacross arun change.
🤖 Generated with Claude Code