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 noThrow=false)
 
 InputFileCatalog (std::vector< std::string > const &fileNames, std::string const &override, std::string const &overrideFallback, bool noThrow=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 noThrow)
 
void init (std::vector< std::string > const &fileNames, std::string const &override, std::string const &overrideFallback, bool noThrow)
 

Private Attributes

boost::scoped_ptr< FileLocatorfallbackFileLocator_
 
std::vector< std::string > fallbackFileNames_
 
std::vector< FileCatalogItemfileCatalogItems_
 
boost::scoped_ptr< FileLocatorfileLocator_
 
std::vector< std::string > fileNames_
 
std::vector< std::string > logicalFileNames_
 
boost::scoped_ptr< FileLocatoroverrideFallbackFileLocator_
 
boost::scoped_ptr< FileLocatoroverrideFileLocator_
 

Detailed Description

Definition at line 28 of file InputFileCatalog.h.

Constructor & Destructor Documentation

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

Definition at line 14 of file InputFileCatalog.cc.

References init().

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

Definition at line 27 of file InputFileCatalog.cc.

References init().

27  :
32  fileLocator_(),
36 
37  init(fileNames, override, overrideFallback, noThrow);
38  }
boost::scoped_ptr< FileLocator > fallbackFileLocator_
std::vector< FileCatalogItem > fileCatalogItems_
boost::scoped_ptr< FileLocator > overrideFileLocator_
boost::scoped_ptr< FileLocator > fileLocator_
std::vector< std::string > fileNames_
void init(std::vector< std::string > const &fileNames, std::string const &override, std::string const &overrideFallback, bool noThrow)
boost::scoped_ptr< FileLocator > overrideFallbackFileLocator_
std::vector< std::string > fallbackFileNames_
std::vector< std::string > const & fileNames() const
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
std::vector<std::string> const& edm::InputFileCatalog::fallbackFileNames ( ) const
inline

Definition at line 36 of file InputFileCatalog.h.

References fallbackFileNames_.

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

Definition at line 33 of file InputFileCatalog.h.

References fileCatalogItems_.

Referenced by edm::EDInputSource::fileCatalogItems(), and edm::RootInputFileSequence::fileCatalogItems().

33 {return fileCatalogItems_;}
std::vector< FileCatalogItem > fileCatalogItems_
std::vector<std::string> const& edm::InputFileCatalog::fileNames ( ) const
inline
void edm::InputFileCatalog::findFile ( std::string &  pfn,
std::string &  fallbackPfn,
std::string const &  lfn,
bool  noThrow 
)
private

Definition at line 80 of file InputFileCatalog.cc.

References edm::hlt::Exception, fallbackFileLocator_, fileLocator_, overrideFallbackFileLocator_, and overrideFileLocator_.

Referenced by init().

80  {
82  pfn = overrideFileLocator_->pfn(lfn);
83  if (pfn.empty()) {
84  pfn = fileLocator_->pfn(lfn);
85  }
86  } else {
87  pfn = fileLocator_->pfn(lfn);
88  }
89  if (pfn.empty()) {
90  if (!noThrow) {
91  throw cms::Exception("LogicalFileNameNotFound", "FileCatalog::findFile()\n")
92  << "Logical file name '" << lfn << "' was not found in the file catalog.\n"
93  << "If you wanted a local file, you forgot the 'file:' prefix\n"
94  << "before the file name in your configuration file.\n";
95  }
96  pfn = lfn;
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  }
list pfn
Definition: dbtoconf.py:76
boost::scoped_ptr< FileLocator > fallbackFileLocator_
boost::scoped_ptr< FileLocator > overrideFileLocator_
boost::scoped_ptr< FileLocator > fileLocator_
boost::scoped_ptr< FileLocator > overrideFallbackFileLocator_
void edm::InputFileCatalog::init ( std::vector< std::string > const &  fileNames,
std::string const &  override,
std::string const &  overrideFallback,
bool  noThrow 
)
private

Definition at line 42 of file InputFileCatalog.cc.

References edm::errors::Configuration, ExpressReco_HICollisions_FallBack::e, edm::hlt::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  // Clear the LFN.
55  lt->clear();
56  } else {
57  if (!fileLocator_) {
58  fileLocator_.reset(new FileLocator("", false));
59  }
60  if (!overrideFileLocator_ && !inputOverride.empty()) {
61  overrideFileLocator_.reset(new FileLocator(inputOverride, false));
62  }
63  if (!fallbackFileLocator_) {
64  try {
65  fallbackFileLocator_.reset(new FileLocator("", true));
66  } catch (cms::Exception const& e) {
67  // No valid fallback locator is OK too.
68  }
69  }
70  if (!overrideFallbackFileLocator_ && !inputOverrideFallback.empty()) {
71  overrideFallbackFileLocator_.reset(new FileLocator(inputOverrideFallback, true));
72  }
73  boost::trim(*lt);
74  findFile(*it, *ft, *lt, noThrow);
75  }
76  fileCatalogItems_.push_back(FileCatalogItem(*it, *lt, *ft));
77  }
78  }
boost::scoped_ptr< FileLocator > fallbackFileLocator_
void findFile(std::string &pfn, std::string &fallbackPfn, std::string const &lfn, bool noThrow)
std::vector< FileCatalogItem > fileCatalogItems_
boost::scoped_ptr< FileLocator > overrideFileLocator_
boost::scoped_ptr< FileLocator > fileLocator_
std::vector< std::string > fileNames_
static bool isPhysical(std::string const &name)
boost::scoped_ptr< FileLocator > overrideFallbackFileLocator_
std::vector< std::string > fallbackFileNames_
< trclass="colgroup">< tdclass="colgroup"colspan=5 > Muon Digi collections</td >< tr >< td >< ahref="classDTDigi.html"> DTDigi</a ></td >< td >< ahref="DataFormats_DTDigi.html"> MuonDigiCollection & lt
std::vector< std::string > logicalFileNames_
static bool edm::InputFileCatalog::isPhysical ( std::string const &  name)
inlinestatic

Definition at line 38 of file InputFileCatalog.h.

Referenced by init().

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

Definition at line 34 of file InputFileCatalog.h.

References logicalFileNames_.

Referenced by edm::ExternalInputSource::logicalFileNames(), and edm::EDInputSource::logicalFileNames().

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

Member Data Documentation

boost::scoped_ptr<FileLocator> edm::InputFileCatalog::fallbackFileLocator_
private

Definition at line 51 of file InputFileCatalog.h.

Referenced by findFile(), and init().

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

Definition at line 47 of file InputFileCatalog.h.

Referenced by fallbackFileNames(), and init().

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

Definition at line 48 of file InputFileCatalog.h.

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

boost::scoped_ptr<FileLocator> edm::InputFileCatalog::fileLocator_
private

Definition at line 49 of file InputFileCatalog.h.

Referenced by findFile(), and init().

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

Definition at line 46 of file InputFileCatalog.h.

Referenced by fileNames(), and init().

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

Definition at line 45 of file InputFileCatalog.h.

Referenced by init(), and logicalFileNames().

boost::scoped_ptr<FileLocator> edm::InputFileCatalog::overrideFallbackFileLocator_
private

Definition at line 52 of file InputFileCatalog.h.

Referenced by findFile(), and init().

boost::scoped_ptr<FileLocator> edm::InputFileCatalog::overrideFileLocator_
private

Definition at line 50 of file InputFileCatalog.h.

Referenced by findFile(), and init().