LDMX-Software / G4DarkBreM

Dark Bremmstrahlung in Geant4 with MadGraph event libraries.
https://ldmx-software.github.io/G4DarkBreM/
Apache License 2.0
0 stars 1 forks source link

Add support for caching the ElementXsecCache/interpolation entries to disk #24

Open EinarElen opened 12 months ago

EinarElen commented 12 months ago

As discussed last week, the Xsec calculation can be a significant part of the runtime of even simple applications. This could be reduced by simply writing the resulting cache to disk after a run is complete and attempting to load it when the cache is created. We already have the ability to stream the cache to disk so we just need the inverse :)

One thing that we should be careful with is to ensure that a cache created with one Xsec calculation method isn't used for a model that relies on another. I would think the easiest way to do that would be to have a header in the cache file that we check and warn if the user tries to use an incompatible one (and fall back to just calculating it from scratch)