-
Notifications
You must be signed in to change notification settings - Fork 77
Faster function to load MC hits #654
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
Faster function to load MC hits #654
Conversation
mmkekic
left a comment
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.
Since most of the code in both function is just a copy from read_mcinfo_evt and read_mcinfo, isnt it better to have a flag in those function as return_only_hits = False and make a minimal change to continue the loop if particle and generator information is not needed?
|
Ok, I added a flag to the |
mmkekic
left a comment
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.
I think after this changes this PR can be approved
d1012f3 to
3420d4f
Compare
mmkekic
left a comment
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 PR adds a more efficient way to read mchit info only from MC tables, with a minimal change to existing functions. Good job :)
#654 [author: paolafer] In this PR I changed the function called by `load_mchits()`, which loads the true MC hits of a range of events in a file. The previous function loads all the true information (including particles) and returns only hits, while this function loads only the hits. The time is reduced to ~75% of the original time, for a file of ~8000 events of 511-keV gamma interactions, therefore I thought that this new implementation could be worth it. I haven't added any test, because we have already a test for the `load_mchits() function, which uses internally the new function. This change should be transparent to the user. [reviewer: mmkekic] This PR adds a more efficient way to read mchit info only from MC tables, with a minimal change to existing functions. Good job :)
next-exp#654 [author: paolafer] In this PR I changed the function called by `load_mchits()`, which loads the true MC hits of a range of events in a file. The previous function loads all the true information (including particles) and returns only hits, while this function loads only the hits. The time is reduced to ~75% of the original time, for a file of ~8000 events of 511-keV gamma interactions, therefore I thought that this new implementation could be worth it. I haven't added any test, because we have already a test for the `load_mchits() function, which uses internally the new function. This change should be transparent to the user. [reviewer: mmkekic] This PR adds a more efficient way to read mchit info only from MC tables, with a minimal change to existing functions. Good job :)
In this PR I changed the function called by
load_mchits(), which loads the true MC hits of a range of events in a file. The previous function loads all the true information (including particles) and returns only hits, while this function loads only the hits. The time is reduced to ~75% of the original time, for a file of ~8000 events of 511-keV gamma interactions, therefore I thought that this new implementation could be worth it. I haven't added any test, because we have already a test for theload_mchits()function, which uses internally the new function. This change should be transparent to the user.