-
Notifications
You must be signed in to change notification settings - Fork 1
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
Support reading cached G4DB cross sections from disk #25
base: main
Are you sure you want to change the base?
Support reading cached G4DB cross sections from disk #25
Conversation
Oh the joys of >> formatting CSV...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks good, I have one comment related to the actual parsing and the rest are just style.
The tests are failing because #23 that I've been too lazy to patch. I believe we just need to pin cmake to an old version (e.g. 3.22?) so maybe try that on your next push? If you don't want to (or it doesn't work) that's fine, the 10.2.3 tests still pass and this doesn't actually interact with Geant4 so I'm comfortable not testing the other versions.
I believe this should cover the requested changes! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Stream it to a separate file (the output of xsec_calc isn't compatible with the ElementXsecCache::stream format)
I think this looks good and I wouldn't change anything about the changed files. I am wondering about the "isn't compatible" comment - I would like the possibility of someone to run the xsec calculator and then use that data as the start of a cache. Is that possible currently? If not, that's probably a bug that I should make an issue for.
With isn't compatible, I meant that the XS was calculated with a different method than the user is currently using! |
Ah yes 🤦 because the configuration could be different and there is no way for us to check on the cache-loading side. That makes sense, thank you |
Could we add this to the header of this csv file or something similar? |
I wouldn't want to break from CSV so that other tools (e.g. pandas) can load these files out of the box for easier analysis. This limits us to just modifying the current line with the column names. One option is we could add the method name to the Xsec column name, so Another option is to add another column specifying the method. I think this is overkill but maybe not. |
First draft at being able to read back a cache from disk. Took some faffing around because CSV parsing with iostreams is unpleasant (and I only just now realized that maybe we could use boost for something?) but I've tested it with the
xsec_calc
app byElementXsecCache::get
xsec_calc
isn't compatible with theElementXsecCache::stream
format)I ran this with an energy range of 0 - 100 GeV and these were the only differences
which are all rounding errors in the last available digit.
Technically, this is sufficient for me (as in it is all I need for implementing a separate process/model with its own slooooow XS calculation). If we'd want to have this be useful in LDMX-sw, we would need some additional features and I'm less sure that this is an urgent problem to solve and it has some concerns from a reproducibility perspective (where does the cache go, what if people mix up caches with different xsec calculation methods etc).
Would love to hear your thoughts on it, Tom (not tagging actively because it is a saturday...)