# Several fixes for the PAPA Framework (Rerun of 1261)

**PAL comment:** !1261 (closed) fails to pass CI while local attempts (by hand) on same runner work. This MR is a copy of the branch moved to my fork.

No clue why the other MR got corrupted or how this could have made the jobs work at 95% and deterministically fail on something independent of the changes introduced.

This merge request fixes several issues with the papa framework:

## Most important: Weighting of particles embedded with pluto

Weighting of all pluto particles:Before, the total weight`w_{\text{pair}}`

of a pair was calculated by`w_{\text{pair}} = \sqrt{w_1 \cdot w_2}`

, which is incorrect. The correct weighting should be`w_{\text{pair}} = w_1 \cdot w_2`

for combinatorial pairs (pairs of two tracks from different mothers) and`w_{\text{pair}} = w_1 = w_2`

for signal pairs (pairs of two tracks from the same mother), since the probabilities are not independent if the tracks come from the same mother, i.e. if there is a`e^+`

from a`\phi \rightarrow e^+e^-`

decay in the event, there will also be a`e^-`

in the same event. Fortunately, the previous implementation gave the correct result for signal pairs as`w_{\text{pair}} = \sqrt{w_1 \cdot w_2} = w_1 = w_2`

(for`w_1 = w_2`

). For combinatorial pairs on the other hand, the previous implementation gave incorrect results since`\sqrt{w_1 \cdot w_2} \neq w_1 \cdot w_2`

. Since the weights for pluto particles`w \ll 1`

, the previous implementation gave to high weights thus overestimating the combinatorial background:`\sqrt{w_1 \cdot w_2} \geq w_1 \cdot w_2`

for`w_1,w_2 \leq 1`

.

Example: For a pair with one track from a`\omega \rightarrow e^+e^-`

(`w_1 = 4.28 \times 10^{-4}`

) and one track from a non-pluto source like conversion (`w_2 = 1`

) the previous implementation gives`w_{\text{pair}} = \sqrt{w_1 \cdot w_2} = \sqrt{4.28 \times 10^{-4} \cdot 1} = 2.07 \times 10^{-2}`

, while the correct implementation gives`w_{\text{pair}} = w_1 \cdot w_2 = 4.28 \times 10^{-4} \cdot 1 = 4.28 \times 10^{-4}`

.

The correct calculation was implemented with commit 7ff2f060. See attached image for comb. background comparison (previous implementation: black dots, this commit: red dots).

Mass dependent scaling for combinatorial pairs from (partly) thermal sources:Since dielectron pairs from thermal sources (in-medium SF and QGP-radiation) have very limited statistics at high masses, they are embedded with flat mass distributions (therefore enhanced at high masses) and have to be rescaled to the correct mass distribution in the analysis. Up to now this was done using thereconstructedmass of the pair, which is incorrect. Each track from a thermal source is enhanced by a factor depending on theMCmass of its mother particle and should be rescaled accordingly. For signal pairs (pairs of two tracks from the same mother) the previous implementation gives mostly correct results as`m_{\text{MC}} \approx m_{\text{rec}}`

for pairs coming from the same mother. For combinatorial pairs on the other hand this can give very incorrect results, since the (reconstructed) mass of the combinatorial pair can differ greatly from the (MC) mass of the mothers of the two paired tracks.

Example: A track from a`\gamma_{\text{QGP-rad}} \rightarrow e^+e^-`

decay with a mass of`\sim 3`

GeV should be downscaled by`\sim 10^{-5}`

, but if it is in a combinatorial pair (for example with a track from a low mass decay like conversion) with a mass of`\sim 1`

GeV it will only be downscaled by`\sim 10^{-1}`

. Therefore, the previous calculation overestimated the combinatorial background from pairs with thermal contributions, especially at low masses.

The correct calculation (with dependence on the MC mass of the mother of each thermal track in the pair) was implemented in commit b11d0887. See attached image for comb. background comparison (this commit: blue dots)

Mass dependent scaling for single tracks from thermal sources:With commit b52a4070 now also single tracks from thermal sources can be scaled according to the MC mass of the mother particle, allowing for example to plot the correct momentum distribution for single tracks. Without scaling the tracks from thermal sources are artificially enhanced.