Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Sort the branches alphabetically when writing Frames #421

Merged
merged 2 commits into from
Jun 5, 2023

Conversation

tmadlener
Copy link
Collaborator

BEGINRELEASENOTES

  • Make the collections appear in alphabetical order in root files, using a case insensitive sorting of the collections that are written.

ENDRELEASENOTES

As "requested" in AIDASoft/DD4hep#1108 (comment)

Copy link
Member

@jmcarcell jmcarcell left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, for consistency a similar thing should be done for the RNTuples

Comment on lines 30 to 31
std::vector<std::string> sortAlphabeticaly(const std::vector<std::string>& input) {
auto output = input;
Copy link
Member

@jmcarcell jmcarcell May 30, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
std::vector<std::string> sortAlphabeticaly(const std::vector<std::string>& input) {
auto output = input;
std::vector<std::string> sortAlphabeticaly(std::vector<std::string> vec) {

Alternatively, since it's making a copy anyway make it explicit by not passing by reference and changing the name to something else

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, yes. Excellent proposal. I always forget that this is a possibility for some reason.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For the name change it's only to make it clear that it's not modifying the input although that can be seen in the argument; I don't have a strong opinion

Comment on lines 35 to 38
// where we convert the strings to lower case char-by-char. The alternative is
// to make string copies inside the first lambda, transform them to lowercase
// and then use operator< of std::string, which would be effectively
// hand-writing what is happening below.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably worse since in the current way you only tolower the characters that you need to check

@tmadlener
Copy link
Collaborator Author

I agree on the RNTuple. Would it help to move the sortAlphabetically to root_utils already now, so that it is easier to reuse?

@jmcarcell
Copy link
Member

jmcarcell commented May 30, 2023

Yes, already done I see :)

@tmadlener
Copy link
Collaborator Author

Waiting for #423 to be merged first, just to make sure that this doesn't break things accidentally.

@tmadlener tmadlener merged commit 6979303 into AIDASoft:master Jun 5, 2023
@tmadlener tmadlener deleted the sorted-branches branch June 5, 2023 12:47
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants