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 // Set catType=TrivialCatalog: use trivial data catalogs from <event-data>
9 // Set catType=RucioCatalog: use data catalogs from <data-access> and storage.json
10 //
12 
13 #include <memory>
14 #include <string>
15 #include <vector>
18 
19 namespace edm {
21  public:
22  FileCatalogItem(std::vector<std::string> const& pfns, std::string const& lfn) : pfns_(pfns), lfn_(lfn) {}
23 
24  std::string const& fileName(unsigned iCatalog) const { return pfns_[iCatalog]; }
25  std::string const& logicalFileName() const { return lfn_; }
26 
27  std::vector<std::string> const& fileNames() const { return pfns_; }
28 
29  private:
30  std::vector<std::string> pfns_;
32  };
33 
35  public:
36  InputFileCatalog(std::vector<std::string> const& fileNames,
37  std::string const& override,
38  bool useLFNasPFNifLFNnotFound = false,
39  //switching between two catalog types
40  //edm::CatalogType catType = edm::CatalogType::TrivialCatalog);
42 
44  std::vector<FileCatalogItem> const& fileCatalogItems() const { return fileCatalogItems_; }
45  std::vector<std::string> const& logicalFileNames() const { return logicalFileNames_; }
46  std::vector<std::string> fileNames(unsigned iCatalog) const;
47  bool empty() const { return fileCatalogItems_.empty(); }
48  static bool isPhysical(std::string const& name) { return (name.empty() || name.find(':') != std::string::npos); }
49 
50  private:
51  void init(std::string const& override, bool useLFNasPFNifLFNnotFound, edm::CatalogType catType);
52  void findFile(std::string const& lfn,
53  std::vector<std::string>& pfns,
54  bool useLFNasPFNifLFNnotFound,
55  edm::CatalogType catType);
56  std::vector<std::string> logicalFileNames_;
57  std::vector<std::string> fileNames_;
58  std::vector<FileCatalogItem> fileCatalogItems_;
60 
61  std::vector<edm::propagate_const<std::unique_ptr<FileLocator>>> fileLocators_trivalCatalog_;
62  std::vector<edm::propagate_const<std::unique_ptr<FileLocator>>> fileLocators_;
63  };
64 } // namespace edm
65 
66 #endif
void findFile(std::string const &lfn, std::vector< std::string > &pfns, bool useLFNasPFNifLFNnotFound, edm::CatalogType catType)
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, edm::CatalogType catType)
std::string const & fileName(unsigned iCatalog) const
std::string const & logicalFileName() const
InputFileCatalog(std::vector< std::string > const &fileNames, std::string const &override, bool useLFNasPFNifLFNnotFound=false, edm::CatalogType catType=edm::CatalogType::RucioCatalog)
std::vector< edm::propagate_const< std::unique_ptr< FileLocator > > > fileLocators_trivalCatalog_
std::vector< std::string > const & fileNames() const
HLT enums.
edm::propagate_const< std::unique_ptr< FileLocator > > overrideFileLocator_
std::vector< std::string > const & logicalFileNames() const
std::vector< std::string > logicalFileNames_
std::vector< FileCatalogItem > const & fileCatalogItems() const