-
Notifications
You must be signed in to change notification settings - Fork 35
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
EvtGen
does not take neutrino interaction probability into account
#620
Comments
We have already started the discussion here: https://icecube-spno.slack.com/archives/G01GECH3GUX/p1707221347547539 (for context). Okay, I do not have a strong opinion about this (yet). Let me just spill out a few thoughts:
How would you do it @sjoerd-bouma, would you store a weight like |
Good that you bring this up. This is an important topic and we need to find a good solution. Probably best to have a call on that topic. Here already a few thoughts:
|
So my suggestion in 2), if that wasn't clear, was sampling from |
To summarize the discussion in the inicemc call yesterday: we decided not to add another parameter named
We will in addition store the |
Hi, here is how IceCube does it. First there is a full Earth Monte Carlo being done to correctly simulate tau-regeneration or other absorption effects by the earth (using a specific Earth density model). Once those neutrinos reach the "active detection volume" (a region around IceCube which is sufficiently large to remove corner effects), we force an interaction. We always store the full individual weight information (interaction weight for forced interactions, zenith directional weight etc.) per event. But we also combine everything into a "oneweight" (which is also stored per event), which corresponds to the weight an E^-1 flux would have with a normalization of "1". Then you just need to multiply that "OneWeight" with a flux normalization an energy dependence if you do a reweighting for histograms. In principle you can also reconstruct the "oneweight" yourself. Typically, we genreate 50/50 anti neutrinos and neutrinos, but also that can be changed and corrected with appropriate "TypeWeights". The whole procedure is described in the documentation: Weights: https://software.icecube.wisc.edu/icetray/main/projects/neutrino-generator/weighting.html Finally, we have another project, |
Maybe it is worth thinking about to also use simweights in NuRadio? |
yes I think that might be a good idea.. I remember 10 years ago in IceCube it was always a problem new people always need to understand the whole weighting scheme and everybody makes mistakes in the beginning, especially when combining datasets. It is very convenient to have a dedicated project that takes the weights as input and does the weighting for you and that everybody relies on. |
Okay, I think for the short term I would support what @sjoerd-bouma summarised to be merged. Integrating simweights into NuRadio needs at least some carful testing... maybe more. I would volunteer looking into that if I find some time! |
I think the important part of the weight calculation is found here: |
Good point! As far as I understand we do not take that into account (that the interaction probability varies over our detector volume).. |
@thoglu Thanks for the input! I agree with Felix, having some tool similar to simweights for reweighting would be neat. In any case, it would be good to verify once more that we store everything that would be needed to compute a 'OneWeight', even if we don't want to explicitly do this (yet). Re:
- the interaction probability doesn't vary over the detector volume (other than the negligible but already included dependence on the survival probability). I'm pretty sure the interaction weight specified in the link is wrong (so I hope it's not implemented that way in the code @thoglu! Though I didn't check what effect it has). The survival probability P_survival is already the integrated survival probability, so to get the probability density of an interaction at X we need |
Okay I would agree that the interaction probability of an individual neutrino does not change over the volume. However, the spatial distribution (as a function of the direction) is not flat. But this is how we simulate it right? |
No @sjoerd-bouma , the derivation should be correct. There are two factors, so let us disentangle them. First factor: probability of any interaction at all over the total length "L" in active volume. The second factor is a relative weight of two "PDFs"! coming from the fact that we do not have uniform interaction distribution in reality (but of exponential form which is the exponential PDF of time/distance to interaction), but in simulation we "force" the interaction uniformly in IceCube, so we have a uniform distribution in simulation. So we have to correct for that by dividing the exponential PDF with a uniform PDF, a relative ratio of the two PDFs (which we call position weight). The second factor therefore is a ratio of two PDFs. The integral is there to properly normalize the exponential PDF. The total weight is multiplication of both of those. Where is the problem in the logic here? It is also in agreement with atmospheric and cosmic neutrino measurements by IceCube (in terms of the x,y,z distribution of measured neutrino events), which is further re-assuring. |
@thoglu I agree with your explanation! But that's not what's in the text:
Fortunately for IceCube, |
@sjoerd-bouma P_PosTrue is a PDF. You and the document are both correct. The PDF the interaction probability is d/dX (P_int (X)=d/dX (1-exp(-Cx))) =Cexp(-C*X) which is just the exponential with a prefactor (that means 1-CDF=survival and PDF are related just by a prefactor, both of them have exponential form). However, in the document, the prefactor is not there (they only use the survival term for whatever reason as a "proportionality" to exp), so they calculate the prefactor numerically as 1/sum by forming the integral over the exponential. If you look at an exponential PDF, there has to be a prefactor (https://en.wikipedia.org/wiki/Exponential_distribution) for it to be correctly normalized. It is confusing because 1-CDF (survival) and PDF have both exponential form, but one has an extra prefactor. I am pretty sure in the code there is no numerical integration, but just the respective analytical factors. I think your analytic calculation is wrong though: so the ratio to 1/L, which is the uniform PDF, is almost 1 but not quite and that is the second weight |
@thoglu Okay, I think I'm convinced now : ) took me long enough, but it seems they are indeed equivalent. Thanks for your patience! I think my analytic calculation is right and yours is wrong though ;) the 1/Q goes outside. It has units, so your expression doesn't work |
corrected, but I don't see them to be the same still |
Yeah, I was a bit sloppy with my notation - the The first factor was just |
yeah in IceCube neutrinos are propagated through the Earth, and if they do not make it to the active volume, they are dropped.. there is no forced interaction for neutrinos that do not reach the active volume (in default mode at least) |
I don't know if this is useful at all or not, but I think this related to a point I brought up several years ago? Basically the uniform volume sampling is not really correct for calculating A_eff, I think. |
It depends I guess how you use it. In IceCube, we never really work with V_eff, for example. We directly generate a flux from a "generating surface", not a "generating volume", and track everything with respect to that surface to translate to fluxes etc. the uniform sampling over the length in the volume then just corrects with a given weight and should be correct. |
Yeah what IceCube does (work from a generated surface) seems more sensible, since V_eff can't be exactly translated to A_eff except in a few special geometries, but we could store the per-event conversion factor as some sort of interaction weight (that's slightly more complicated than 1/l_int; I think it's more like A_proj(theta)/( * l_int or something like that, as long as l_int doesn't get too small). |
Hi Cosmin, all. I only vaguely remember this discussion from three years ago but back then I went through the effort of implementing an unforced event generator to verify that we indeed simulate things correctly with our "forced interaction" method. See slides here: |
Yes I remember this now. Can you remind me if you're just counting events within cylinder (i.e. the trigger condition is that the vertex is inside the cylinder, or something similar) or if there is a more complicated "trigger" condition? I think for the methods to diverge, the triggering must depend on the spatial position and neutrino direction in a non-uniform way (for simple trigger conditions you will get the same answer since the position and direction can be factored apart). I tried something similar (where I had a simple emission model + straight line raytracing) and got a ~7 percent difference in diffuse effective areas at high energies (See https://github.com/cozzyd/ToyDisc/blob/master/slides/ToyDisc.pdf ). So probably not a big effect, but it seemed to be there. There could be a bug of course. But by adding some sort of interaction weight, I think it could be verified with a more realistic simulation? |
@cozzyd I've been wrong before in this thread, but I don't think there's anything wrong with the current simulation method. The interaction PDF is still (if we're interested in the number of triggering interactions, we just multiply by The long and short of it is as long as we take into account the factors |
So I wonder if the difference is entirely due to the exponential sampling of the interaction point along the trajectory when I use the area method. That would explain why it's a bigger effect at higher energies, and it also breaks the "each pixel is independent of each other" argument, while remaining a smallish effect in the in-ice case (while being a big effect in the balloon case where we first noticed the difference!). If this is the case, then it's easy to fix with an interaction weight exactly as Thorsten described (the ratio of the exponential to uniform PDF along the intersecting segment). I can test this pretty easily with my Toy MC by sampling linearly rather than exponentially and seeing if the two sampling methods then agree. (Ok, this would still neglect that the ice density is not uniform, but that can be incorporated too). |
So maybe I'm missing something, but the argument I gave in my previous comment is not approximate, it is exact. One thing to note is that our definition of |
There really aren't separate survival probabilities inside and outside the simulation volume, and neither is there an 'interaction probability' separate from the survival probability! for the interaction PDF is completely general, even the dependence on the ice density is encoded in |
So I'm not sure I agree that you can specify that you split up the volume into voxels without specifying their shape, I think you may just end up with the same problem on a smaller scale? Based on numerical experiments, the exponential placement of the vertex indeed has nothing to do with anything (it's a good enough approximation, at least for the size volume considered here). The problem I think that for most geometries (including a cylinder), the projected area is different from different angles, which (I think) means that it's not appropriate to sample uniformly in direction if sampling volumetric. For example, here is the distribution of direction Z component as a function of distance^2 from center of the cylinder with the volumetric and area-based sampling methods: The area-based sampling method has to be weighted by interaction probability (otherwise the corners "catch" a lot more events, but since the path length is shorter, you're less likely to interact there; this is using a 1 EeV cross-section. The reason I show the perp2 component is so you can see there is no incorrect pileup in the corners with the area-based method). In both cases, the distribution of vertices is indeed uniform within the volume, but the angular distribution of arriving neutrinos is not, even before applying the survival probability. There could be a bug (or many!) in my toy MC but I think the idea makes intuitive sense. As for PREM, yes, you probably want to modify PREM so that the top 3 km (or whatever) are ice. It kind of looks like that's almost the case, except NuRadioMC using 1.002 g/cm^3 instead of 0.917 g/cm^3 for the top layer, so it's probably not too important. (My toy MC has it match, otherwise there would be strange discontinuities related to the fact that the survival probability for the area-based sampling is defined at entrance into the volume). There will still be a discontinuity in the firn using a more realistic ice model, but that's probably even more negligible... Though if a significant fraction of events do happen in the firn (which I think has to be true for some energies /zenith angles), then using l_int based on deep ice is also not going to be right. Since the density of firn varies by more than a factor of 2, that might actually be pretty important to get right... |
I did specify the shape of my voxels! They're cubic with edge length It's not the projected area which is important, but the volume. This makes sense! In the case where the survival probability can be ignored, it's clear (I hope) that all that matters is the number of nucleons you have, and in fact this approximation is probably already better than the 7% discrepancy you found in your toy MC. If the survival probability can not be ignored, the result is exactly the one I stated previously, which is how it is treated already (okay, except PREM not having the correct density at the edges and as you mention |
This 'area vs path length' trade-off is exactly why you just get |
Another reason why the projected area doesn't matter - in the extreme case you mention ('perfect detection efficiency'), all/most neutrinos would interact essentially as soon as they hit the detector volume (or most likely before), so that the survival probability for anything that has travelled a significant distance within the detector volume goes to 0. In that case, uniform volume sampling * survival probability gets you... something that looks very much like the projected area, as you would expect! |
So I agree that the number of interactions just depends on number of nucleons, but in our case, we also care about the angular distribution of interacting particles, which will affect what you can observe (with an Askaryan detector, at least... with a bucket of scintillator, that's not something that affects what you observe). So I guess it's wrong to say that there's a problem with the volumetric sampling of vertex position, but instead maybe there's a problem with the isotropic sampling of neutrino direction within the volume, since the volume will have preferred directions (even if it was put out in space and there was no survival probability to talk about) due to having different cross-sections in different directions? I certainly agree that the integral of Note also that the "perfect detection efficiency" doesn't mean that every neutrino interacts, but rather than you observe every neutrino that interacts. In that case, since p_{obs} does not depend on angle, maybe you can indeed integrate out the volume and get the same answer. But I will be the first to admit that my geometric intuition regarding these things is not great, and I could be talking nonsense. (This is why I tried to do this toy MC thing... but there are lots of ways I could have screwed up...). |
For a small enough voxel, you can, because |
Currently, when a user specifies a particular neutrino energy spectrum in
generator.py
, the distribution of event energies matches this flux. In simulation.py, these events are then weighted by their survival probability after earth attenuation. However, their interaction probability is not taken into account. This means the resulting flux is not the one that would be observed by a detector, but instead matches the effective volume.I think this is not particularly intuitive. I see two options:
generator.py
before sampling event energies (or at least add a parameter to enable this - I think this should be enabled by default).My personal view on this is that 1. is error-prone, whereas 2. (if we enable this by default, which I think we should) changes the way we compute effective volumes or expected number of events in
NuRadioMC.utilities.fluxes.py
. The latter would still be my preference, but I'm open to discussion.The text was updated successfully, but these errors were encountered: