CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_6_1_1/src/FWCore/Sources/src/EDInputSource.cc

Go to the documentation of this file.
00001 /*----------------------------------------------------------------------
00002 ----------------------------------------------------------------------*/
00003 
00004 #include "FWCore/Sources/interface/EDInputSource.h"
00005 #include "FWCore/MessageLogger/interface/MessageLogger.h"
00006 #include "FWCore/ParameterSet/interface/ParameterSet.h"
00007 #include "FWCore/ParameterSet/interface/ParameterSetDescription.h"
00008 #include "FWCore/Utilities/interface/EDMException.h"
00009 
00010 namespace edm {
00011   
00012   // The default value provided as the second argument to the getUntrackedParameter function call
00013   // is not used when the ParameterSet has been validated and the parameters are not optional
00014   // in the description.  As soon as all primary input sources and all modules with a secondary
00015   // input sources have defined descriptions, the defaults in the getUntrackedParameterSet function
00016   // calls can and should be deleted from the code.
00017   EDInputSource::EDInputSource(ParameterSet const& pset, InputSourceDescription const& desc) :
00018       InputSource(pset, desc),
00019       catalog_(pset.getUntrackedParameter<std::vector<std::string> >("fileNames"),
00020         pset.getUntrackedParameter<std::string>("overrideCatalog", std::string())),
00021       secondaryCatalog_(pset.getUntrackedParameter<std::vector<std::string> >("secondaryFileNames", std::vector<std::string>()),
00022         pset.getUntrackedParameter<std::string>("overrideCatalog", std::string())) {
00023 
00024      if (secondaryCatalog_.empty() && pset.getUntrackedParameter<bool>("needSecondaryFileNames", false)) {
00025         throw Exception(errors::Configuration, "EDInputSource") << "'secondaryFileNames' must be specified\n";
00026      }
00027   }
00028 
00029   EDInputSource::~EDInputSource() {
00030   }
00031 
00032   void
00033   EDInputSource::fillDescription(ParameterSetDescription & desc) {
00034     std::vector<std::string> defaultStrings;
00035     desc.addUntracked<std::vector<std::string> >("fileNames")
00036         ->setComment("Names of files to be processed.");
00037     desc.addUntracked<std::vector<std::string> >("secondaryFileNames", defaultStrings)
00038         ->setComment("Names of secondary files to be processed.");
00039     desc.addUntracked<bool>("needSecondaryFileNames", false)
00040         ->setComment("If True, 'secondaryFileNames' must be specified and be non-empty.");
00041     desc.addUntracked<std::string>("overrideCatalog", std::string());
00042     InputSource::fillDescription(desc);
00043   }
00044 }