-
Notifications
You must be signed in to change notification settings - Fork 77
Unique mc evtnumber #751
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
Unique mc evtnumber #751
Conversation
|
This seems closely related to the Issue #145 and corresponding PRs: The definite solution was to fix the issue in the NEXUS itself making sure that one production has a unique event count, however since now (probably before too?) we need to be able to split a long NEXUS event into shorter buffer-size events we are back to the problem of having to re-index events after the NEXUS production and ensure their uniqueness. Maybe @jacg and @jmbenlloch that were dealing with this problem in the past can give us some guidance? |
|
Since this is somewhat urgent and we lack a very appealing option, I am inclined to go with the simplest one for now, ie add one parameter in config file (either |
c656983 to
6a2cb85
Compare
|
In the current version the event numbers generated become |
6a2cb85 to
fa4fa2e
Compare
c8c0462 to
aed8204
Compare
invisible_cities/io/mcinfo_io.py
Outdated
| return -1 | ||
|
|
||
|
|
||
| def copy_nexus_eventmap(h5out : tb.file.File, |
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.
Mabe add 'safe_copy ...` since in case the table is not present you don't copy and the name is a bit misleading
invisible_cities/io/mcinfo_io.py
Outdated
| for fn in files_in: | ||
| evt_map = load_eventnumbermap(fn) | ||
| try: | ||
| evt_mask = evt_map.evt_number.isin(evt_arr) |
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 is a bit hard to understand. Can you add a comment that evt_map is None if the table is not present, and you are also protected against table present but with wrong columns?
invisible_cities/io/mcinfo_io.py
Outdated
| except AttributeError: | ||
| ## No copy and return the parts of the | ||
| ## original arrays found. | ||
| if check_mc_present(fn): |
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.
Why do you need this check? This function should work with MC files, so the table has to be present. The copy_mc_info should take care it raises appropriate error/warning in case the table is not present. In case there is no MC table you probably do not even want to do any event mapping
| event_numbers: List[int] , | ||
| db_file : str , | ||
| run_number : int , | ||
| copy_eventmap: bool = True) -> None: |
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.
Add new parameter to docstrings
| def test_copy_nexus_eventmap(config_tmpdir, ICDATADIR): | ||
| file_in = os.path.join(ICDATADIR , | ||
| 'nexus_new_kr83m_full.newformat.buffers.h5') | ||
| file_out = os.path.join(ICDATADIR, 'evtMapCopy.h5') |
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 should be a temporary path, not ICDATADIR
dd45b71 to
c7aa5b6
Compare
To be used to test MC copy and eventMap copy where there are split nexus events.
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 event splitting functionality keeping unique nexus event numbers across files by assuming a constant maximum number of splits per event. A new table that maps IC event number to original MC event number is added to Run group ensuring the code is compatible with the old formats of MC production. The code is documented and tested, good job!
Adds functions to generate unique event numbers for MC to allow for safe processing of split nexus events and simplify MC event mixing.
In need of more tests and a file number reader but ready for discussion.
Discussion continues from issue #715