FileListSource.h
Go to the documentation of this file.
1 #pragma once
2 
4 
5 #include <string>
6 #include <vector>
7 
8 namespace ana
9 {
10  /// Simple file source based on an explicit list provided by the user
12  {
13  public:
14  /// Default \a stride, \a offset, and \a limit mean obey cmd-line options
15  FileListSource(const std::vector<std::string>& files,
16  int stride = -1, int offset = -1, int limit = -1);
17  virtual ~FileListSource();
18 
19  virtual TFile* GetNextFile() override;
20  int NFiles() const override {return fFileNames.size();}
21 
22  const std::vector<std::string>& GetFileNames() const { return fFileNames; }
23  protected:
24  std::vector<std::string> fFileNames; ///< The list of files
25  std::vector<std::string>::iterator fIt; ///< Iterator into \ref fFileNames
26  std::vector<std::string> fRetry; ///< List of files that failed 1st attempt
27  bool fInRetry; ///< Did we finish fFileNames and are now in fRetry?
28  TFile* fFile; ///< The most-recently-returned file
29  static bool fgGotTickets; ///< Have we renewed our tickets?
30  };
31 }
FileListSource(const std::vector< std::string > &files, int stride=-1, int offset=-1, int limit=-1)
Default stride, offset, and limit mean obey cmd-line options.
Cuts and Vars for the 2020 FD DiF Study.
Definition: vars.h:6
std::vector< std::string >::iterator fIt
Iterator into fFileNames.
std::vector< std::string > fFileNames
The list of files.
int NFiles() const override
May return -1 indicating the number of files is not known.
const std::vector< std::string > & GetFileNames() const
bool fInRetry
Did we finish fFileNames and are now in fRetry?
Interface class for accessing ROOT files in sequence.
Definition: IFileSource.h:10
Simple file source based on an explicit list provided by the user.
std::vector< std::string > fRetry
List of files that failed 1st attempt.
static bool fgGotTickets
Have we renewed our tickets?
virtual TFile * GetNextFile() override
Returns the next file in sequence, ready for reading.
TFile * fFile
The most-recently-returned file.