CMS 3D CMS Logo

List of all members | Public Member Functions | Static Public Member Functions | Protected Attributes
SLHAReaderBase Class Referenceabstract

#include <SLHAReaderBase.h>

Inheritance diagram for SLHAReaderBase:
SLHAReaderpMSSM

Public Member Functions

virtual std::string getSLHA (const std::string &configDesc)=0
 
 SLHAReaderBase (const edm::ParameterSet &conf)
 
virtual ~SLHAReaderBase ()
 

Static Public Member Functions

static std::vector< std::string > splitline (const std::string &line, char delim)
 

Protected Attributes

TFile * file_
 
TTree * tree_
 

Detailed Description

Definition at line 12 of file SLHAReaderBase.h.

Constructor & Destructor Documentation

◆ SLHAReaderBase()

SLHAReaderBase::SLHAReaderBase ( const edm::ParameterSet conf)

Definition at line 9 of file SLHAReaderBase.cc.

References Exception, file_, corrVsCorr::filename, edm::ParameterSet::getParameter(), AlCaHLTBitMon_QueryRunRegistry::string, and tree_.

9  {
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 }
T getParameter(std::string const &) const
Definition: ParameterSet.h:303

◆ ~SLHAReaderBase()

SLHAReaderBase::~SLHAReaderBase ( )
virtual

Definition at line 21 of file SLHAReaderBase.cc.

References file_.

21 { file_->Close(); }

Member Function Documentation

◆ getSLHA()

virtual std::string SLHAReaderBase::getSLHA ( const std::string &  configDesc)
pure virtual

Implemented in SLHAReaderpMSSM.

◆ splitline()

std::vector< std::string > SLHAReaderBase::splitline ( const std::string &  line,
char  delim 
)
static

Definition at line 23 of file SLHAReaderBase.cc.

References l1GtPatternGenerator_cfi::fields, mps_splice::line, contentValuesCheck::ss, and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by SLHAReaderpMSSM::getSLHA().

23  {
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 }

Member Data Documentation

◆ file_

TFile* SLHAReaderBase::file_
protected

Definition at line 25 of file SLHAReaderBase.h.

Referenced by SLHAReaderBase(), and ~SLHAReaderBase().

◆ tree_

TTree* SLHAReaderBase::tree_
protected

Definition at line 26 of file SLHAReaderBase.h.

Referenced by SLHAReaderpMSSM::getSLHA(), and SLHAReaderBase().