Main Page
Namespaces
Classes
Package Documentation
src
GeneratorInterface
Pythia8Interface
src
SLHAReaderBase.cc
Go to the documentation of this file.
1
#include "
GeneratorInterface/Pythia8Interface/interface/SLHAReaderBase.h
"
2
#include "
FWCore/Utilities/interface/Exception.h
"
3
4
#include <sstream>
5
6
#include "TFile.h"
7
#include "TTree.h"
8
9
SLHAReaderBase::SLHAReaderBase
(
const
edm::ParameterSet
& conf) {
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
21
SLHAReaderBase::~SLHAReaderBase
() {
file_
->Close(); }
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
33
EDM_REGISTER_PLUGINFACTORY
(
SLHAReaderFactory
,
"SLHAReaderFactory"
);
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Exception
Definition:
hltDiff.cc:292
EDM_REGISTER_PLUGINFACTORY
#define EDM_REGISTER_PLUGINFACTORY(_factory_, _category_)
Definition:
PluginFactory.h:86
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition:
AlCaHLTBitMon_QueryRunRegistry.py:256
corrVsCorr.filename
filename
Definition:
corrVsCorr.py:123
SLHAReaderBase::~SLHAReaderBase
virtual ~SLHAReaderBase()
Definition:
SLHAReaderBase.cc:21
tablePrinter.delim
delim
Definition:
tablePrinter.py:80
SLHAReaderBase.h
SLHAReaderBase::splitline
static std::vector< std::string > splitline(const std::string &line, char delim)
Definition:
SLHAReaderBase.cc:23
SLHAReaderBase::tree_
TTree * tree_
Definition:
SLHAReaderBase.h:26
edmplugin::PluginFactory
Definition:
PluginFactory.h:33
mps_splice.line
line
Definition:
mps_splice.py:76
SLHAReaderBase::SLHAReaderBase
SLHAReaderBase(const edm::ParameterSet &conf)
Definition:
SLHAReaderBase.cc:9
Exception.h
edm::ParameterSet
Definition:
ParameterSet.h:36
SLHAReaderBase::file_
TFile * file_
Definition:
SLHAReaderBase.h:25
callgraph.fields
fields
Definition:
callgraph.py:18
Generated for CMSSW Reference Manual by
1.8.11