#include <PhysicsTools/UtilAlgos/interface/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 CachingVariable * | variable (std::string name) const |
VariableHelper (const edm::ParameterSet &iConfig) | |
~VariableHelper () | |
Private Attributes | |
std::map< std::string, const CachingVariable * > | variables_ |
Definition at line 9 of file VariableHelper.h.
typedef std::map<std::string,const CachingVariable*>::const_iterator VariableHelper::iterator |
Definition at line 17 of file VariableHelper.h.
VariableHelper::VariableHelper | ( | const edm::ParameterSet & | iConfig | ) |
Definition at line 9 of file VariableHelper.cc.
References DBSPlugin::get(), edm::ParameterSet::getParameter(), edm::ParameterSet::getParameterSetNames(), i, method, and variables_.
00009 { 00010 std::vector<std::string> psetNames; 00011 iConfig.getParameterSetNames(psetNames); 00012 for (uint i=0;i!=psetNames.size();++i){ 00013 std::string & vname=psetNames[i]; 00014 edm::ParameterSet vPset=iConfig.getParameter<edm::ParameterSet>(psetNames[i]); 00015 std::string method=vPset.getParameter<std::string>("method"); 00016 00017 CachingVariableFactory::get()->create(method,CachingVariable::CachingVariableFactoryArg(vname,variables_,vPset)); 00018 } 00019 00020 }
VariableHelper::~VariableHelper | ( | ) | [inline] |
Definition at line 12 of file VariableHelper.h.
References it, and variables_.
00012 { 00013 for (iterator it = variables_.begin() ; it!=variables_.end() ;++it){ 00014 delete it->second; 00015 } 00016 }
Definition at line 21 of file VariableHelper.h.
References variables_.
00021 { return variables_.begin();}
Definition at line 22 of file VariableHelper.h.
References variables_.
00022 { return variables_.end();}
Definition at line 28 of file VariableHelper.cc.
References it, and variables_.
Referenced by VariableHelperService::init(), and variable().
00028 { 00029 iterator it = variables_.begin(); 00030 iterator it_end = variables_.end(); 00031 for (;it!=it_end;++it) it->second->print(); 00032 }
std::string VariableHelper::printValues | ( | const edm::Event & | event | ) | const |
Definition at line 34 of file VariableHelper.cc.
References it, ss, and variables_.
00034 { 00035 std::stringstream ss; 00036 iterator it = variables_.begin(); 00037 iterator it_end = variables_.end(); 00038 ss<<std::setw(10)<<event.id().run()<<" : " 00039 <<std::setw(10)<<event.id().event(); 00040 for (;it!=it_end;++it) { 00041 if (it->second->compute(event)) 00042 ss<<" : "<<it->first<<"="<<(*it->second)(event); 00043 else 00044 ss<<" : "<<it->first<<" N/A"; 00045 } 00046 return ss.str(); 00047 }
void VariableHelper::setHolder | ( | std::string | hn | ) |
Definition at line 22 of file VariableHelper.cc.
References it, and variables_.
Referenced by VariableHelperService::init().
00022 { 00023 iterator it = variables_.begin(); 00024 iterator it_end = variables_.end(); 00025 for (;it!=it_end;++it) it->second->setHolder(hn); 00026 }
const CachingVariable * VariableHelper::variable | ( | std::string | name | ) | const |
Definition at line 48 of file VariableHelper.cc.
References print(), v, and variables_.
00048 { 00049 iterator v=variables_.find(name); 00050 if (v!=variables_.end()) 00051 return v->second; 00052 else 00053 { 00054 edm::LogError("VariableHelper")<<"I don't know anything named: "<<name 00055 <<" list of available variables follows."; 00056 print(); 00057 return 0; 00058 } 00059 }
std::map<std::string,const CachingVariable*> VariableHelper::variables_ [private] |
Definition at line 28 of file VariableHelper.h.
Referenced by begin(), end(), print(), printValues(), setHolder(), variable(), VariableHelper(), and ~VariableHelper().