Closed carmeloevoli closed 2 years ago
Should we do this as a new integrator, derived from the current pi0?
My notes about the calculation of the absorption coefficient for CMB can be found here
The new integrator is very similar to pi0, just adding a function which computes K(E)
and using it following my equation (7).
Notice however that my equation for K(E)
(equation 4) looks different than that implemented now in HERMES.
I am working on a branch to implement CMB absorption.
Notice that I had to modify the BreitWheeler
class with the new expression.
Now I don't know how to write this:
https://github.com/cosmicrays/hermes/blob/79c19ef652d609b32139084a4a0a483c5ffb17f6/src/integrators/PiZeroCmbAbsorptionIntegrator.cpp#L9
std::expm1(static_cast<double>(eps / kT))
if you want to override HERMES units...
It is a ratio of energies, shouldn't be a "QNumber"?
Yes, although QNumber
is dimensionless, it is still a HERMES unit, and a std
function such as expm1
will not accept it without casting it to double.
eps / kT
is QNumber
and a compiler already knows that, you don't need to cast a dimensionless expression to QNumber
by hand, but from QNumber
to ordinary double
or float
, you have to.
thanks, in fact I was trying to use this:
https://github.com/cosmicrays/hermes/blob/51d8e4b6ff4943838c17c0005d5a75c5909b9762/include/hermes/units/UnitsFunctions.h#L18
but of course it doesn't work if I use std
I am thinking that it is better to have in the public code the PiZeroAbsorptionIntegrator
having only CMB as photon field.
We will work separately on a new integrator with a generic photon field but at the moment is way too slow.
Another issue. I don't understand why PiZeroAbsorptionIntegrator
is not derived from PiZeroIntegrator
with the override of just 1 or 2 functions. In this way, if we change something on PiZeroIntegrator
automatically gets inherited by PiZeroAbsorptionIntegrator
.
In the branch, I'm working on this idea.
The PiZeroAbsorptionIntegrator
is now working in C++. We should modify python/integrators.cpp
to have it also in python.
It is as fast as PiZeroIntegrator
. I had a minimal approach by implementing only the few functions that are different from PiZeroIntegrator
. I think that we should keep this Integrator in HERMES and leaving the absorption on a generic photon field to future updates.
Branch merged and CI working. That's all folks!
In order to speed up the pi0 integrator including gamma-ray absorption we should consider the case in which CMB is the only photon field. Being spatially uniform it simplifies the runtime calculation of the optical depth.