Skip to content

Conversation

@paolafer
Copy link
Collaborator

@paolafer paolafer commented May 1, 2019

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.

Copy link
Collaborator

@mmkekic mmkekic left a 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?

@paolafer
Copy link
Collaborator Author

Ok, I added a flag to the read_mcinfo_evt function. Tests are running fine.

Copy link
Collaborator

@mmkekic mmkekic left a 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

@paolafer paolafer force-pushed the new-load-mc-hit-function branch from d1012f3 to 3420d4f Compare October 21, 2019 13:24
Copy link
Collaborator

@mmkekic mmkekic left a 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 :)

carmenromo pushed a commit that referenced this pull request Oct 21, 2019
#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 :)
@carmenromo carmenromo merged commit 3420d4f into next-exp:master Oct 21, 2019
@paolafer paolafer deleted the new-load-mc-hit-function branch February 24, 2020 09:37
andLaing pushed a commit to andLaing/IC that referenced this pull request May 13, 2020
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 :)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants