CMS 3D CMS Logo

SLHAReaderBase.cc
Go to the documentation of this file.
3 
4 #include <sstream>
5 
6 #include "TFile.h"
7 #include "TTree.h"
8 
10  auto filename = conf.getParameter<std::string>("file");
11  file_ = TFile::Open(filename.c_str());
12  if (!file_)
13  throw cms::Exception("MissingFile") << "Could not open file " << filename;
14 
15  auto treename = conf.getParameter<std::string>("tree");
16  tree_ = (TTree*)file_->Get(treename.c_str());
17  if (!tree_)
18  throw cms::Exception("MissingTree") << "Could not get tree " << treename << " from file " << filename;
19 }
20 
22 
23 std::vector<std::string> SLHAReaderBase::splitline(const std::string& line, char delim) {
24  std::stringstream ss(line);
25  std::string field;
26  std::vector<std::string> fields;
27  while (getline(ss, field, delim)) {
28  fields.push_back(field);
29  }
30  return fields;
31 }
32 
T getParameter(std::string const &) const
virtual ~SLHAReaderBase()
static std::vector< std::string > splitline(const std::string &line, char delim)
SLHAReaderBase(const edm::ParameterSet &conf)
#define EDM_REGISTER_PLUGINFACTORY(_factory_, _category_)
Definition: PluginFactory.h:91