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 
SLHAReaderBase.h
SLHAReaderBase::file_
TFile * file_
Definition: SLHAReaderBase.h:25
SLHAReaderBase::splitline
static std::vector< std::string > splitline(const std::string &line, char delim)
Definition: SLHAReaderBase.cc:23
SLHAReaderBase::~SLHAReaderBase
virtual ~SLHAReaderBase()
Definition: SLHAReaderBase.cc:21
contentValuesCheck.ss
ss
Definition: contentValuesCheck.py:33
corrVsCorr.filename
filename
Definition: corrVsCorr.py:123
SLHAReaderBase::tree_
TTree * tree_
Definition: SLHAReaderBase.h:26
EDM_REGISTER_PLUGINFACTORY
#define EDM_REGISTER_PLUGINFACTORY(_factory_, _category_)
Definition: PluginFactory.h:89
SLHAReaderBase::SLHAReaderBase
SLHAReaderBase(const edm::ParameterSet &conf)
Definition: SLHAReaderBase.cc:9
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
edm::ParameterSet
Definition: ParameterSet.h:47
edmplugin::PluginFactory
Definition: PluginFactory.h:34
Exception
Definition: hltDiff.cc:245
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
Exception.h
l1GtPatternGenerator_cfi.fields
fields
Definition: l1GtPatternGenerator_cfi.py:91
mps_splice.line
line
Definition: mps_splice.py:76