All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions | Protected Member Functions | List of all members
ana::WildcardSource Class Reference

File source based on a wildcard (glob) More...

#include <WildcardSource.h>

Inheritance diagram for ana::WildcardSource:
ana::FileListSource ana::IFileSource

Public Member Functions

 WildcardSource (const std::string &wildcard, int stride=-1, int offset=-1)
 
virtual ~WildcardSource ()
 
- Public Member Functions inherited from ana::FileListSource
 FileListSource (const std::vector< std::string > &files, int stride=-1, int offset=-1)
 default offset and stride mean obey cmd-line options More...
 
virtual ~FileListSource ()
 
virtual TFile * GetNextFile () override
 Returns the next file in sequence, ready for reading. More...
 
int NFiles () const override
 May return -1 indicating the number of files is not known. More...
 
- Public Member Functions inherited from ana::IFileSource
virtual ~IFileSource ()
 

Protected Member Functions

std::vector< std::string > WildcardOrLs (const std::string &wildcard) const
 

Additional Inherited Members

- Protected Attributes inherited from ana::FileListSource
std::vector< std::string > fFileNames
 The list of files. More...
 
std::vector< std::string >
::iterator 
fIt
 Iterator into fFileNames. More...
 
int fStride
 
int fN
 Number of files that will actually be returned. More...
 
TFile * fFile
 The most-recently-returned file. More...
 
- Static Protected Attributes inherited from ana::FileListSource
static bool fgGotTickets = false
 Have we renewed our tickets? More...
 

Detailed Description

File source based on a wildcard (glob)

Definition at line 8 of file WildcardSource.h.

Constructor & Destructor Documentation

ana::WildcardSource::WildcardSource ( const std::string &  wildcard,
int  stride = -1,
int  offset = -1 
)
Parameters
wildcardWildcard or glob. Anything glob() accepts is OK. May be a single literal filename.

Definition at line 28 of file WildcardSource.cxx.

31  : FileListSource(sorted(WildcardOrLs(wildcard)), stride, offset)
32  {
33  }
BEGIN_PROLOG TPC Trig offset(g4 rise time) ProjectToHeight
Definition: CORSIKAGen.fcl:7
std::vector< std::string > WildcardOrLs(const std::string &wildcard) const
FileListSource(const std::vector< std::string > &files, int stride=-1, int offset=-1)
default offset and stride mean obey cmd-line options
ana::WildcardSource::~WildcardSource ( )
virtual

Definition at line 36 of file WildcardSource.cxx.

37  {
38  }

Member Function Documentation

std::vector< std::string > ana::WildcardSource::WildcardOrLs ( const std::string &  wildcard) const
protected

Definition at line 42 of file WildcardSource.cxx.

43  {
44  std::vector<std::string> ret = Wildcard(wildcard);
45 
46  struct stat ss;
47  // If we found nothing, but it's because pnfs isn't mounted, try ifdh ls
48  // instead.
49  if(ret.empty() &&
50  wildcard.find("/pnfs/") == 0 &&
51  stat("/pnfs/", &ss) != 0){
52 
53  std::cout << "No files matching " << wildcard << " but that's probably because /pnfs is not mounted on the current node." << std::endl;
54 
55  // This doesn't work because "ifdh ls" doesn't actually understand
56  // wildcard syntax properly.
57  // ifdh i;
58  // ret = i.ls(wildcard, 0);
59  }
60 
61  return ret;
62  }
std::vector< std::string > Wildcard(const std::string &wildcardString)
BEGIN_PROLOG could also be cout

The documentation for this class was generated from the following files: