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
edm::FileCatalogItem::FileCatalogItem
FileCatalogItem(std::vector< std::string > const &pfns, std::string const &lfn)
Definition: InputFileCatalog.h:20
propagate_const.h
edm
HLT enums.
Definition: AlignableModifier.h:19
edm::InputFileCatalog::isPhysical
static bool isPhysical(std::string const &name)
Definition: InputFileCatalog.h:43
edm::InputFileCatalog::~InputFileCatalog
~InputFileCatalog()
Definition: InputFileCatalog.cc:24
edm::InputFileCatalog::findFile
void findFile(std::string const &lfn, std::vector< std::string > &pfns, bool useLFNasPFNifLFNnotFound)
Definition: InputFileCatalog.cc:86
edm::InputFileCatalog::fileCatalogItems_
std::vector< FileCatalogItem > fileCatalogItems_
Definition: InputFileCatalog.h:50
edm::InputFileCatalog::fileNames
std::vector< std::string > fileNames(unsigned iCatalog) const
Definition: InputFileCatalog.cc:26
edm::InputFileCatalog::fileLocators_
std::vector< edm::propagate_const< std::unique_ptr< FileLocator > > > fileLocators_
Definition: InputFileCatalog.h:53
edm::InputFileCatalog
Definition: InputFileCatalog.h:32
edm::FileCatalogItem::logicalFileName
std::string const & logicalFileName() const
Definition: InputFileCatalog.h:23
FileLocator.h
edm::InputFileCatalog::empty
bool empty() const
Definition: InputFileCatalog.h:42
edm::InputFileCatalog::fileNames_
std::vector< std::string > fileNames_
Definition: InputFileCatalog.h:49
edm::propagate_const
Definition: propagate_const.h:32
edm::FileCatalogItem::fileNames
std::vector< std::string > const & fileNames() const
Definition: InputFileCatalog.h:25
edm::InputFileCatalog::init
void init(std::string const &override, bool useLFNasPFNifLFNnotFound)
Definition: InputFileCatalog.cc:35
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
edm::FileCatalogItem::fileName
std::string const & fileName(unsigned iCatalog) const
Definition: InputFileCatalog.h:22
edm::InputFileCatalog::logicalFileNames
std::vector< std::string > const & logicalFileNames() const
Definition: InputFileCatalog.h:40
edm::FileCatalogItem::pfns_
std::vector< std::string > pfns_
Definition: InputFileCatalog.h:28
edm::InputFileCatalog::overrideFileLocator_
edm::propagate_const< std::unique_ptr< FileLocator > > overrideFileLocator_
Definition: InputFileCatalog.h:51
edm::InputFileCatalog::InputFileCatalog
InputFileCatalog(std::vector< std::string > const &fileNames, std::string const &override, bool useLFNasPFNifLFNnotFound=false)
Definition: InputFileCatalog.cc:17
edm::InputFileCatalog::logicalFileNames_
std::vector< std::string > logicalFileNames_
Definition: InputFileCatalog.h:48
edm::FileCatalogItem
Definition: InputFileCatalog.h:18
edm::FileCatalogItem::lfn_
std::string lfn_
Definition: InputFileCatalog.h:29
Skims_PA_cff.name
name
Definition: Skims_PA_cff.py:17
edm::InputFileCatalog::fileCatalogItems
std::vector< FileCatalogItem > const & fileCatalogItems() const
Definition: InputFileCatalog.h:39