Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Question regarding deactivation of candidate in EMPairProduction #488

Closed
LeanderSchlegel opened this issue May 21, 2024 · 2 comments · Fixed by #491
Closed

Question regarding deactivation of candidate in EMPairProduction #488

LeanderSchlegel opened this issue May 21, 2024 · 2 comments · Fixed by #491
Assignees

Comments

@LeanderSchlegel
Copy link
Member

LeanderSchlegel commented May 21, 2024

Dear all,

I looked into the EMPairProduction module and wondered if the order of the lines, checking first for secondary electron-positron-pairs to be injected and returning otherwise (l. 180)
// check if secondary electron pair needs to be produced if (not haveElectrons) return;
and later deactivating the candidate for the catastrophic energyloss (l. 206)
// photon is lost after interacting candidate->setActive(false);
are necessary in that way, maybe connected to preventing the sporadic failures adressed by (f054f9e).
If I see it correctly, I think a problem of the order could be, that in case of haveElectrons=False no catastrophic energy-loss can be applied. I changed the order for myself and if it would indeed be a bug, I could provide a fix together with two very small optimizations @JulienDoerner and me looked on, in EMDoublePairProduction and EMInverseComptonScattering.

Many thanks
Leander

@lukasmerten
Copy link
Member

Looks like a bug to me.
go ahead and prepare a PR

@rafaelab
Copy link
Member

rafaelab commented Jun 4, 2024

Hi @LeanderSchlegel,
Sorry for the late reply.
This indeed seems to be bug.
The photon should be deactivated regardless of haveElectrons.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants