-
Notifications
You must be signed in to change notification settings - Fork 4.6k
PPS: association cut fix #35941
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
Merged
Merged
PPS: association cut fix #35941
Changes from 3 commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
9512cc1
replace std::vector::at with operator[]
jan-kaspar 8362ee6
remove mutable class members, use REGISTER_PLUGIN_INIT instead
jan-kaspar 3849f99
code format
jan-kaspar beaf37b
replace std::map::at with find
jan-kaspar 3bd6d0b
validate structure during initialisation
jan-kaspar 4eb4170
code format
jan-kaspar File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 the line @malbouis meant
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.
Thanks! I see now. At the moment of opening the PR, there was only this answer: #35936 (comment), which I interpret that
atis OK for a map. Later, another answer was provided: #35936 (comment), which seems to be in disagreement with the first one. I guess I need a decision which hint to follow. If there is no clear guideline, keeping the code as is saves my time.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.
@makortel @VinInn , is it ok to keep the .at() in this case?
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.
Hi @jan-kaspar my interpretation is that Matti is saying
atis OK if we are OK with throwing an exception, while Vincenzo is saying it is not OK to throw the exception, thusatis also not OK. I thinkfindshould be used.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.
The real question is: does one really need a
map?Is not a trivial array enough? (what values of "arm" should be supported?)
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.
What would be the circumstances if an element is not found? I'm wondering mostly between
sectorcomes from data (directly or via some processing) and can go out of bounds occasionally, andsectororiginally comes from configuration and out of bounds values would be logic errors.What would the calling code do if an element is not found?
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.
The
sectorrefers to the LHC sectors around IP5: these are two and will never change. I agree that array/vector would have been a better design. The code has been made by a student and I didn't catch this - sorry for that. Now that the class is already used in CondDB, I don't want to change it anymore. On the other hand, doing the search (by map::find) on a map with two elements is not that costly, so I believe we are having a sort of academic discussion. I will commit the change to map::find soon.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.
For the moment there is no guarantee in the code that the DB payload will contain data for both LHC sectors. We assume that the person who uploads the conditions to DB does this well. Let me know if you wish me to put some "protection" to the code.
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.
Done in beaf37b.