CMS 3D CMS Logo

List of all members | Public Types | Public Member Functions | Private Attributes
VariableHelper Class Reference

#include <VariableHelper.h>

Public Types

typedef std::map< std::string, const CachingVariable * >::const_iterator iterator
 

Public Member Functions

iterator begin ()
 
iterator end ()
 
void print () const
 
std::string printValues (const edm::Event &event) const
 
void setHolder (std::string hn)
 
const CachingVariablevariable (std::string name) const
 
 VariableHelper (const edm::ParameterSet &iConfig, edm::ConsumesCollector &iC)
 
 ~VariableHelper ()
 

Private Attributes

std::map< std::string, const CachingVariable * > variables_
 

Detailed Description

Definition at line 11 of file VariableHelper.h.

Member Typedef Documentation

◆ iterator

typedef std::map<std::string, const CachingVariable*>::const_iterator VariableHelper::iterator

Definition at line 19 of file VariableHelper.h.

Constructor & Destructor Documentation

◆ VariableHelper()

VariableHelper::VariableHelper ( const edm::ParameterSet iConfig,
edm::ConsumesCollector iC 
)

Definition at line 9 of file VariableHelper.cc.

9  {
10  std::vector<std::string> psetNames;
11  iConfig.getParameterSetNames(psetNames);
12  for (unsigned int i = 0; i != psetNames.size(); ++i) {
13  std::string& vname = psetNames[i];
14  edm::ParameterSet vPset = iConfig.getParameter<edm::ParameterSet>(psetNames[i]);
15  std::string method = vPset.getParameter<std::string>("method");
16 
19  }
20 }

References get, edm::ParameterSet::getParameter(), edm::ParameterSet::getParameterSetNames(), mps_fire::i, AlcaSiPixelAliHarvester0T_cff::method, AlCaHLTBitMon_QueryRunRegistry::string, and variables_.

◆ ~VariableHelper()

VariableHelper::~VariableHelper ( )
inline

Definition at line 14 of file VariableHelper.h.

14  {
15  for (iterator it = variables_.begin(); it != variables_.end(); ++it) {
16  delete it->second;
17  }
18  }

References variables_.

Member Function Documentation

◆ begin()

iterator VariableHelper::begin ( void  )
inline

Definition at line 23 of file VariableHelper.h.

23 { return variables_.begin(); }

References variables_.

◆ end()

iterator VariableHelper::end ( void  )
inline

Definition at line 24 of file VariableHelper.h.

24 { return variables_.end(); }

References variables_.

◆ print()

void VariableHelper::print ( void  ) const

Definition at line 29 of file VariableHelper.cc.

29  {
30  iterator it = variables_.begin();
31  iterator it_end = variables_.end();
32  for (; it != it_end; ++it)
33  it->second->print();
34 }

References variables_.

Referenced by VariableHelperService::init(), and variable().

◆ printValues()

std::string VariableHelper::printValues ( const edm::Event event) const

Definition at line 36 of file VariableHelper.cc.

36  {
37  std::stringstream ss;
38  iterator it = variables_.begin();
39  iterator it_end = variables_.end();
40  ss << std::setw(10) << event.id().run() << " : " << std::setw(10) << event.id().event();
41  for (; it != it_end; ++it) {
42  if (it->second->compute(event))
43  ss << " : " << it->first << "=" << (*it->second)(event);
44  else
45  ss << " : " << it->first << " N/A";
46  }
47  return ss.str();
48 }

References edmPickEvents::event, contentValuesCheck::ss, and variables_.

◆ setHolder()

void VariableHelper::setHolder ( std::string  hn)

Definition at line 22 of file VariableHelper.cc.

22  {
23  iterator it = variables_.begin();
24  iterator it_end = variables_.end();
25  for (; it != it_end; ++it)
26  it->second->setHolder(hn);
27 }

References variables_.

Referenced by VariableHelperService::init().

◆ variable()

const CachingVariable * VariableHelper::variable ( std::string  name) const

Definition at line 49 of file VariableHelper.cc.

49  {
50  iterator v = variables_.find(name);
51  if (v != variables_.end())
52  return v->second;
53  else {
54  edm::LogError("VariableHelper") << "I don't know anything named: " << name
55  << " list of available variables follows.";
56  print();
57  return nullptr;
58  }
59 }

References Skims_PA_cff::name, print(), findQualityFiles::v, and variables_.

Member Data Documentation

◆ variables_

std::map<std::string, const CachingVariable*> VariableHelper::variables_
private
mps_fire.i
i
Definition: mps_fire.py:428
VariableHelper::print
void print() const
Definition: VariableHelper.cc:29
AlcaSiPixelAliHarvester0T_cff.method
method
Definition: AlcaSiPixelAliHarvester0T_cff.py:41
findQualityFiles.v
v
Definition: findQualityFiles.py:179
contentValuesCheck.ss
ss
Definition: contentValuesCheck.py:33
VariableHelper::iterator
std::map< std::string, const CachingVariable * >::const_iterator iterator
Definition: VariableHelper.h:19
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
edm::ParameterSet
Definition: ParameterSet.h:47
edmPickEvents.event
event
Definition: edmPickEvents.py:273
VariableHelper::variables_
std::map< std::string, const CachingVariable * > variables_
Definition: VariableHelper.h:31
get
#define get
Skims_PA_cff.name
name
Definition: Skims_PA_cff.py:17
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
CachingVariable::CachingVariableFactoryArg
Definition: CachingVariable.h:46
event
Definition: event.py:1
edm::Log
Definition: MessageLogger.h:70
edm::ParameterSet::getParameterSetNames
size_t getParameterSetNames(std::vector< std::string > &output, bool trackiness=true) const
Definition: ParameterSet.cc:724