CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
InputSource.h
Go to the documentation of this file.
1 #ifndef DataFormats_FWLite_interface_InputSource_h
2 #define DataFormats_FWLite_interface_InputSource_h
3 
4 #include <vector>
5 #include <string>
7 
16 namespace fwlite {
17 
18  class InputSource {
19 
20  public:
23  throw cms::Exception("InvalidInput") << "Must specify a vstring fileNames" << std::endl;
24  }
27  maxEvents_(-1), reportAfter_(10),
28  files_( cfg.getParameterSet("fwliteInput").getParameter<std::vector<std::string> >("fileNames") )
29  {
30  // optional parameter
31  if( cfg.getParameterSet("fwliteInput").existsAs<int>("maxEvents")){
32  maxEvents_ = cfg.getParameterSet("fwliteInput").getParameter<int>("maxEvents");
33  }
34  // optional parameter
35  if( cfg.getParameterSet("fwliteInput").existsAs<unsigned int>("outputEvery")){
36  reportAfter_ = cfg.getParameterSet("fwliteInput").getParameter<unsigned int>("outputEvery");
37  }
38  }
40  const std::vector<std::string>& files() const { return files_; }
42  int maxEvents() const { return maxEvents_; }
44  unsigned int reportAfter() const { return reportAfter_;}
45 
46  protected:
50  unsigned int reportAfter_;
52  std::vector<std::string> files_;
53  };
54 }
55 
56 #endif
T getParameter(std::string const &) const
tuple cfg
Definition: looper.py:293
bool existsAs(std::string const &parameterName, bool trackiness=true) const
checks if a parameter exists as a given type
Definition: ParameterSet.h:186
InputSource(const edm::ParameterSet &cfg)
default constructor from parameter set
Definition: InputSource.h:26
ParameterSet const & getParameterSet(ParameterSetID const &id)
std::vector< std::string > files_
vector of input files
Definition: InputSource.h:52
unsigned int reportAfter_
report after N events
Definition: InputSource.h:50
InputSource()
empty constructor
Definition: InputSource.h:22
int maxEvents_
maximal number of events to loop
Definition: InputSource.h:48
ParameterSet const & getParameterSet(std::string const &) const
int maxEvents() const
return maxEvetns_
Definition: InputSource.h:42
const std::vector< std::string > & files() const
return vector of files_
Definition: InputSource.h:40
unsigned int reportAfter() const
return reportAfter_
Definition: InputSource.h:44