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"
);
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
edm::ParameterSet
Definition:
ParameterSet.h:47
edmplugin::PluginFactory
Definition:
PluginFactory.h:34
AlCaHLTBitMon_QueryRunRegistry.string
string string
Definition:
AlCaHLTBitMon_QueryRunRegistry.py:256
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
Generated for CMSSW Reference Manual by
1.8.16