Skip to content
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

Adding possibility to add a list of files to TRestDataSet #514

Open
wants to merge 8 commits into
base: master
Choose a base branch
from

Conversation

juanangp
Copy link
Member

@juanangp juanangp commented Apr 10, 2024

juanangp Ok: 23 Powered by Pull Request Badge

Added the posibility to add a file list instead of a file pattern in TRestDataSet.

Note that if the file list is empty it will just use the file pattern provided, however the file pattern will be ignored if the file list is not empty.

@juanangp juanangp requested a review from nkx111 as a code owner April 10, 2024 11:21
@juanangp juanangp requested review from jgalan and lobis April 10, 2024 11:21
@AlvaroEzq
Copy link
Contributor

Maybe it could be generalized to a list of file patterns? I have found myself in this situation where one file pattern isn't enough to get all the files I need.

I found out that TRestTools::GetFilesMatchingPattern() accepts several file patterns by joining them with "\n" (for example "/data/R00001_*_tags.root\n/data/R00002_*_tags.root") and I have using this workaround but is quite annoying. This will be a more readable solution.

Copy link
Member

@jgalan jgalan left a comment

Choose a reason for hiding this comment

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

Perhaps when we call SetFileList and the list is not empty, we should force fFilesMatchingPattern = "fileList" so that when we explore the metadata we know the file list was initialized by other means other than a filename pattern.

Or, following @AlvaroEzq proposal we may promote std::string fFilesMatchingPattern to a std::vector <std::string> fFilesMatchingPattern; which can be either a pattern name list or just a file list.

@juanangp
Copy link
Member Author

Perhaps when we call SetFileList and the list is not empty, we should force fFilesMatchingPattern = "fileList" so that when we explore the metadata we know the file list was initialized by other means other than a filename pattern.

Or, following @AlvaroEzq proposal we may promote std::string fFilesMatchingPattern to a std::vector <std::string> fFilesMatchingPattern; which can be either a pattern name list or just a file list.

Ok, now fFilePattern is a vector of strings that can be set using SetFilePattern, it should be also compatible with previous implementation.

@@ -182,7 +182,7 @@ class TRestDataSet : public TRestMetadata {
inline auto IsMergedDataSet() const { return fMergedDataset; }

inline void SetObservablesList(const std::vector<std::string>& obsList) { fObservablesList = obsList; }
inline void SetFilePattern(const std::string& pattern) { fFilePattern = pattern; }
inline void SetFilePattern(const std::string& pattern) { fFilePatternList.push_back(pattern); }
Copy link
Member

Choose a reason for hiding this comment

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

In principle if it is adding an entry to the list, the method name should be like "AddFilePattern"...

@nkx111
Copy link
Member

nkx111 commented May 6, 2024

In principle it is always possible to describe a series of files with one single pattern. In the case "/data/R00001_tags.root\n/data/R00002tags.root", it is equivalent with "/data/R0000[1-2]*_tags.root". But it's still OK to have a list of patterns for convenience.

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.

None yet

4 participants