CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes
edm::InputFileCatalog Class Reference

#include <InputFileCatalog.h>

Public Member Functions

bool empty () const
 
std::vector< std::string > const & fallbackFileNames () const
 
std::vector< FileCatalogItem >
const & 
fileCatalogItems () const
 
std::vector< std::string > const & fileNames () const
 
 InputFileCatalog (std::vector< std::string > const &fileNames, std::string const &override, bool useLFNasPFNifLFNnotFound=false)
 
 InputFileCatalog (std::vector< std::string > const &fileNames, std::string const &override, std::string const &overrideFallback, bool useLFNasPFNifLFNnotFound=false)
 
std::vector< std::string > const & logicalFileNames () const
 
 ~InputFileCatalog ()
 

Static Public Member Functions

static bool isPhysical (std::string const &name)
 

Private Member Functions

void findFile (std::string &pfn, std::string &fallbackPfn, std::string const &lfn, bool useLFNasPFNifLFNnotFound)
 
void init (std::string const &override, std::string const &overrideFallback, bool useLFNasPFNifLFNnotFound)
 

Private Attributes

edm::propagate_const
< std::unique_ptr< FileLocator > > 
fallbackFileLocator_
 
std::vector< std::string > fallbackFileNames_
 
std::vector< FileCatalogItemfileCatalogItems_
 
edm::propagate_const
< std::unique_ptr< FileLocator > > 
fileLocator_
 
std::vector< std::string > fileNames_
 
std::vector< std::string > logicalFileNames_
 
edm::propagate_const
< std::unique_ptr< FileLocator > > 
overrideFallbackFileLocator_
 
edm::propagate_const
< std::unique_ptr< FileLocator > > 
overrideFileLocator_
 

Detailed Description

Definition at line 29 of file InputFileCatalog.h.

Constructor & Destructor Documentation

edm::InputFileCatalog::InputFileCatalog ( std::vector< std::string > const &  fileNames,
std::string const &  override,
bool  useLFNasPFNifLFNnotFound = false 
)

Definition at line 14 of file InputFileCatalog.cc.

References init().

14  :
19  fileLocator_(),
23 
24  init(override, "", useLFNasPFNifLFNnotFound);
25  }
std::vector< FileCatalogItem > fileCatalogItems_
std::vector< std::string > fileNames_
edm::propagate_const< std::unique_ptr< FileLocator > > fileLocator_
std::vector< std::string > fallbackFileNames_
edm::propagate_const< std::unique_ptr< FileLocator > > overrideFallbackFileLocator_
edm::propagate_const< std::unique_ptr< FileLocator > > fallbackFileLocator_
std::vector< std::string > const & fileNames() const
edm::propagate_const< std::unique_ptr< FileLocator > > overrideFileLocator_
void init(std::string const &override, std::string const &overrideFallback, bool useLFNasPFNifLFNnotFound)
std::vector< std::string > logicalFileNames_
edm::InputFileCatalog::InputFileCatalog ( std::vector< std::string > const &  fileNames,
std::string const &  override,
std::string const &  overrideFallback,
bool  useLFNasPFNifLFNnotFound = false 
)

Definition at line 27 of file InputFileCatalog.cc.

References init().

27  :
32  fileLocator_(),
36 
37  init(override, overrideFallback, useLFNasPFNifLFNnotFound);
38  }
std::vector< FileCatalogItem > fileCatalogItems_
std::vector< std::string > fileNames_
edm::propagate_const< std::unique_ptr< FileLocator > > fileLocator_
std::vector< std::string > fallbackFileNames_
edm::propagate_const< std::unique_ptr< FileLocator > > overrideFallbackFileLocator_
edm::propagate_const< std::unique_ptr< FileLocator > > fallbackFileLocator_
std::vector< std::string > const & fileNames() const
edm::propagate_const< std::unique_ptr< FileLocator > > overrideFileLocator_
void init(std::string const &override, std::string const &overrideFallback, bool useLFNasPFNifLFNnotFound)
std::vector< std::string > logicalFileNames_
edm::InputFileCatalog::~InputFileCatalog ( )

Definition at line 40 of file InputFileCatalog.cc.

40 {}

Member Function Documentation

bool edm::InputFileCatalog::empty ( void  ) const
inline

Definition at line 38 of file InputFileCatalog.h.

References fileCatalogItems_.

38 {return fileCatalogItems_.empty();}
std::vector< FileCatalogItem > fileCatalogItems_
std::vector<std::string> const& edm::InputFileCatalog::fallbackFileNames ( ) const
inline

Definition at line 37 of file InputFileCatalog.h.

References fallbackFileNames_.

37 {return fallbackFileNames_;}
std::vector< std::string > fallbackFileNames_
std::vector<FileCatalogItem> const& edm::InputFileCatalog::fileCatalogItems ( ) const
inline

Definition at line 34 of file InputFileCatalog.h.

References fileCatalogItems_.

34 {return fileCatalogItems_;}
std::vector< FileCatalogItem > fileCatalogItems_
std::vector<std::string> const& edm::InputFileCatalog::fileNames ( ) const
inline

Definition at line 36 of file InputFileCatalog.h.

References fileNames_.

Referenced by DQMFileReader::beginJob(), edm::FromFiles::fileNames(), and edm::StreamerFileReader::StreamerFileReader().

36 {return fileNames_;}
std::vector< std::string > fileNames_
void edm::InputFileCatalog::findFile ( std::string &  pfn,
std::string &  fallbackPfn,
std::string const &  lfn,
bool  useLFNasPFNifLFNnotFound 
)
private

Definition at line 84 of file InputFileCatalog.cc.

References fallbackFileLocator_, fileLocator_, overrideFallbackFileLocator_, and overrideFileLocator_.

Referenced by init().

84  {
86  pfn = overrideFileLocator_->pfn(lfn);
87  if (pfn.empty()) {
88  pfn = fileLocator_->pfn(lfn);
89  }
90  } else {
91  pfn = fileLocator_->pfn(lfn);
92  }
93  if (pfn.empty() && useLFNasPFNifLFNnotFound) {
94  pfn = lfn;
95  }
96  // Empty PFN will be found by caller.
97 
99  fallbackPfn = overrideFallbackFileLocator_->pfn(lfn);
100  if (fallbackFileLocator_ && fallbackPfn.empty()) {
101  fallbackPfn = fallbackFileLocator_->pfn(lfn);
102  }
103  } else if (fallbackFileLocator_) {
104  fallbackPfn = fallbackFileLocator_->pfn(lfn);
105  // Empty fallback PFN is OK.
106  }
107  }
edm::propagate_const< std::unique_ptr< FileLocator > > fileLocator_
edm::propagate_const< std::unique_ptr< FileLocator > > overrideFallbackFileLocator_
edm::propagate_const< std::unique_ptr< FileLocator > > fallbackFileLocator_
edm::propagate_const< std::unique_ptr< FileLocator > > overrideFileLocator_
void edm::InputFileCatalog::init ( std::string const &  override,
std::string const &  overrideFallback,
bool  useLFNasPFNifLFNnotFound 
)
private

Definition at line 42 of file InputFileCatalog.cc.

References edm::errors::Configuration, alignCSCRings::e, Exception, fallbackFileLocator_, fallbackFileNames_, fileCatalogItems_, fileLocator_, fileNames_, findFile(), isPhysical(), logicalFileNames_, lt, overrideFallbackFileLocator_, and overrideFileLocator_.

Referenced by InputFileCatalog().

42  {
43 
44  fileCatalogItems_.reserve(fileNames_.size());
45  typedef std::vector<std::string>::iterator iter;
46  for(iter it = fileNames_.begin(), lt = logicalFileNames_.begin(), itEnd = fileNames_.end(), ft = fallbackFileNames_.begin();
47  it != itEnd; ++it, ++lt, ++ft) {
48  boost::trim(*it);
49  if (it->empty()) {
50  throw Exception(errors::Configuration, "InputFileCatalog::InputFileCatalog()\n")
51  << "An empty string specified in the fileNames parameter for input source.\n";
52  }
53  if (isPhysical(*it)) {
54  if(it->back() == ':') {
55  throw Exception(errors::Configuration, "InputFileCatalog::InputFileCatalog()\n")
56  << "An empty physical file name specified in the fileNames parameter for input source.\n";
57  }
58  // Clear the LFN.
59  lt->clear();
60  } else {
61  if (!fileLocator_) {
62  fileLocator_ = std::make_unique<FileLocator>("", false); // propagate_const<T> has no reset() function
63  }
64  if (!overrideFileLocator_ && !inputOverride.empty()) {
65  overrideFileLocator_ = std::make_unique<FileLocator>(inputOverride, false); // propagate_const<T> has no reset() function
66  }
67  if (!fallbackFileLocator_) {
68  try {
69  fallbackFileLocator_ = std::make_unique<FileLocator>("", true); // propagate_const<T> has no reset() function
70  } catch (cms::Exception const& e) {
71  // No valid fallback locator is OK too.
72  }
73  }
74  if (!overrideFallbackFileLocator_ && !inputOverrideFallback.empty()) {
75  overrideFallbackFileLocator_ = std::make_unique<FileLocator>(inputOverrideFallback, true); // propagate_const<T> has no reset() function
76  }
77  boost::trim(*lt);
78  findFile(*it, *ft, *lt, useLFNasPFNifLFNnotFound);
79  }
80  fileCatalogItems_.push_back(FileCatalogItem(*it, *lt, *ft));
81  }
82  }
std::vector< FileCatalogItem > fileCatalogItems_
std::vector< std::string > fileNames_
static bool isPhysical(std::string const &name)
edm::propagate_const< std::unique_ptr< FileLocator > > fileLocator_
std::vector< std::string > fallbackFileNames_
edm::propagate_const< std::unique_ptr< FileLocator > > overrideFallbackFileLocator_
edm::propagate_const< std::unique_ptr< FileLocator > > fallbackFileLocator_
edm::propagate_const< std::unique_ptr< FileLocator > > overrideFileLocator_
< trclass="colgroup">< tdclass="colgroup"colspan=5 > DT local reconstruction</td ></tr >< tr >< td >< ahref="classDTRecHit1DPair.html"> DTRecHit1DPair</a ></td >< td >< ahref="DataFormats_DTRecHit.html"> edm::RangeMap & lt
std::vector< std::string > logicalFileNames_
void findFile(std::string &pfn, std::string &fallbackPfn, std::string const &lfn, bool useLFNasPFNifLFNnotFound)
static bool edm::InputFileCatalog::isPhysical ( std::string const &  name)
inlinestatic

Definition at line 39 of file InputFileCatalog.h.

Referenced by init().

39  {
40  return (name.empty() || name.find(':') != std::string::npos);
41  }
std::vector<std::string> const& edm::InputFileCatalog::logicalFileNames ( ) const
inline

Definition at line 35 of file InputFileCatalog.h.

References logicalFileNames_.

Referenced by edm::FromFiles::logicalFileNames().

35 {return logicalFileNames_;}
std::vector< std::string > logicalFileNames_

Member Data Documentation

edm::propagate_const<std::unique_ptr<FileLocator> > edm::InputFileCatalog::fallbackFileLocator_
private

Definition at line 52 of file InputFileCatalog.h.

Referenced by findFile(), and init().

std::vector<std::string> edm::InputFileCatalog::fallbackFileNames_
private

Definition at line 48 of file InputFileCatalog.h.

Referenced by fallbackFileNames(), and init().

std::vector<FileCatalogItem> edm::InputFileCatalog::fileCatalogItems_
private

Definition at line 49 of file InputFileCatalog.h.

Referenced by empty(), fileCatalogItems(), and init().

edm::propagate_const<std::unique_ptr<FileLocator> > edm::InputFileCatalog::fileLocator_
private

Definition at line 50 of file InputFileCatalog.h.

Referenced by findFile(), and init().

std::vector<std::string> edm::InputFileCatalog::fileNames_
private

Definition at line 47 of file InputFileCatalog.h.

Referenced by fileNames(), and init().

std::vector<std::string> edm::InputFileCatalog::logicalFileNames_
private

Definition at line 46 of file InputFileCatalog.h.

Referenced by init(), and logicalFileNames().

edm::propagate_const<std::unique_ptr<FileLocator> > edm::InputFileCatalog::overrideFallbackFileLocator_
private

Definition at line 53 of file InputFileCatalog.h.

Referenced by findFile(), and init().

edm::propagate_const<std::unique_ptr<FileLocator> > edm::InputFileCatalog::overrideFileLocator_
private

Definition at line 51 of file InputFileCatalog.h.

Referenced by findFile(), and init().