CMS 3D CMS Logo

InputFileCatalog.h
Go to the documentation of this file.
1 #ifndef FWCore_Catalog_InputFileCatalog_h
2 #define FWCore_Catalog_InputFileCatalog_h
3 //
5 // Class InputFileCatalog. Services to manage InputFile catalog.
6 // Physical file names, pfns_ of FileCatalogItem, are constructed from multiple data catalogs in site-local-config.xml. Each member of pfns_ corresponds to a data catalog.
7 // Note that fileNames(unsigned iCatalog) of InputFileCatalog return physical file names of all input files corresponding to a data catalog (for example, a job has 10 input files provided as a PoolSource, the fileNames(unsigned iCatalog) will return PFNs of these 10 files constructed from a data catalog)
8 //
10 
11 #include <memory>
12 #include <string>
13 #include <vector>
16 
17 namespace edm {
19  public:
20  FileCatalogItem(std::vector<std::string> const& pfns, std::string const& lfn) : pfns_(pfns), lfn_(lfn) {}
21 
22  std::string const& fileName(unsigned iCatalog) const { return pfns_[iCatalog]; }
23  std::string const& logicalFileName() const { return lfn_; }
24 
25  std::vector<std::string> const& fileNames() const { return pfns_; }
26 
27  private:
28  std::vector<std::string> pfns_;
30  };
31 
33  public:
34  InputFileCatalog(std::vector<std::string> const& fileNames,
35  std::string const& override,
36  bool useLFNasPFNifLFNnotFound = false);
37 
39  std::vector<FileCatalogItem> const& fileCatalogItems() const { return fileCatalogItems_; }
40  std::vector<std::string> const& logicalFileNames() const { return logicalFileNames_; }
41  std::vector<std::string> fileNames(unsigned iCatalog) const;
42  bool empty() const { return fileCatalogItems_.empty(); }
43  static bool isPhysical(std::string const& name) { return (name.empty() || name.find(':') != std::string::npos); }
44 
45  private:
46  void init(std::string const& override, bool useLFNasPFNifLFNnotFound);
47  void findFile(std::string const& lfn, std::vector<std::string>& pfns, bool useLFNasPFNifLFNnotFound);
48  std::vector<std::string> logicalFileNames_;
49  std::vector<std::string> fileNames_;
50  std::vector<FileCatalogItem> fileCatalogItems_;
52 
53  std::vector<edm::propagate_const<std::unique_ptr<FileLocator>>> fileLocators_;
54  };
55 } // namespace edm
56 
57 #endif
void findFile(std::string const &lfn, std::vector< std::string > &pfns, bool useLFNasPFNifLFNnotFound)
std::vector< std::string > fileNames(unsigned iCatalog) const
std::vector< FileCatalogItem > fileCatalogItems_
FileCatalogItem(std::vector< std::string > const &pfns, std::string const &lfn)
std::vector< std::string > fileNames_
std::vector< edm::propagate_const< std::unique_ptr< FileLocator > > > fileLocators_
static bool isPhysical(std::string const &name)
std::vector< std::string > pfns_
void init(std::string const &override, bool useLFNasPFNifLFNnotFound)
std::string const & fileName(unsigned iCatalog) const
std::string const & logicalFileName() const
std::vector< std::string > const & fileNames() const
HLT enums.
edm::propagate_const< std::unique_ptr< FileLocator > > overrideFileLocator_
std::vector< std::string > const & logicalFileNames() const
InputFileCatalog(std::vector< std::string > const &fileNames, std::string const &override, bool useLFNasPFNifLFNnotFound=false)
std::vector< std::string > logicalFileNames_
std::vector< FileCatalogItem > const & fileCatalogItems() const