CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_4_1_8_patch9/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::setRun(RunNumber_t) {
00034       LogWarning("IllegalCall")
00035         << "EDInputSource::setRun()\n"
00036         << "Run number cannot be modified for an EDInputSource\n";
00037   }
00038 
00039   void
00040   EDInputSource::setLumi(LuminosityBlockNumber_t) {
00041       LogWarning("IllegalCall")
00042         << "EDInputSource::setLumi()\n"
00043         << "Luminosity Block ID cannot be modified for an EDInputSource\n";
00044   }
00045 
00046   void
00047   EDInputSource::fillDescription(ParameterSetDescription & desc) {
00048     std::vector<std::string> defaultStrings;
00049     desc.addUntracked<std::vector<std::string> >("fileNames")
00050         ->setComment("Names of files to be processed.");
00051     desc.addUntracked<std::vector<std::string> >("secondaryFileNames", defaultStrings)
00052         ->setComment("Names of secondary files to be processed.");
00053     desc.addUntracked<bool>("needSecondaryFileNames", false)
00054         ->setComment("If True, 'secondaryFileNames' must be specified and be non-empty.");
00055     desc.addUntracked<std::string>("overrideCatalog", std::string());
00056     InputSource::fillDescription(desc);
00057   }
00058 }