#include <VariableHelper.h>
Public Member Functions | |
VariableHelper & | get () |
VariableHelper & | init (std::string user, const edm::ParameterSet &iConfig) |
void | postProcess (const edm::Event &event, const edm::EventSetup &setup) |
void | preModule (const edm::ModuleDescription &desc) |
VariableHelper & | set (std::string user) |
VariableHelperService (const edm::ParameterSet &iConfig, edm::ActivityRegistry &r) | |
~VariableHelperService () | |
Private Attributes | |
std::map< std::string, VariableHelper * > | multipleInstance_ |
bool | printValuesForEachEvent_ |
std::string | printValuesForEachEventCategory_ |
VariableHelper * | SetVariableHelperUniqueInstance_ |
Definition at line 34 of file VariableHelper.h.
VariableHelperService::VariableHelperService | ( | const edm::ParameterSet & | iConfig, |
edm::ActivityRegistry & | r | ||
) | [inline] |
Definition at line 42 of file VariableHelper.h.
References edm::ParameterSet::exists(), edm::ParameterSet::getParameter(), postProcess(), preModule(), printValuesForEachEvent_, printValuesForEachEventCategory_, edm::ActivityRegistry::watchPostProcessEvent(), and edm::ActivityRegistry::watchPreModule().
{ r.watchPreModule(this, &VariableHelperService::preModule ); r.watchPostProcessEvent(this, &VariableHelperService::postProcess ); printValuesForEachEvent_ = iConfig.exists("printValuesForEachEventCategory"); if (printValuesForEachEvent_) printValuesForEachEventCategory_ = iConfig.getParameter<std::string>("printValuesForEachEventCategory"); }
VariableHelperService::~VariableHelperService | ( | ) | [inline] |
Definition at line 49 of file VariableHelper.h.
References multipleInstance_.
{ for (std::map<std::string, VariableHelper* > :: iterator it=multipleInstance_.begin(); it!=multipleInstance_.end(); ++it){ delete it->second; } }
VariableHelper& VariableHelperService::get | ( | void | ) | [inline] |
Definition at line 67 of file VariableHelper.h.
References benchmark_cfg::cerr, and SetVariableHelperUniqueInstance_.
{ if (!SetVariableHelperUniqueInstance_) { std::cerr<<" none of VariableHelperUniqueInstance_ or SetVariableHelperUniqueInstance_ is valid."<<std::endl; throw; } else return (*SetVariableHelperUniqueInstance_); }
VariableHelper& VariableHelperService::init | ( | std::string | user, |
const edm::ParameterSet & | iConfig | ||
) | [inline] |
Definition at line 55 of file VariableHelper.h.
References benchmark_cfg::cerr, multipleInstance_, VariableHelper::print(), VariableHelper::setHolder(), SetVariableHelperUniqueInstance_, and hcal_dqm_sourceclient-file_cfg::user.
{ if (multipleInstance_.find(user)!=multipleInstance_.end()){ std::cerr<<user<<" VariableHelper user already defined."<<std::endl; throw;} else SetVariableHelperUniqueInstance_ = new VariableHelper(iConfig); multipleInstance_[user] = SetVariableHelperUniqueInstance_; SetVariableHelperUniqueInstance_->setHolder(user); SetVariableHelperUniqueInstance_->print(); return (*SetVariableHelperUniqueInstance_); }
void VariableHelperService::postProcess | ( | const edm::Event & | event, |
const edm::EventSetup & | setup | ||
) | [inline] |
Definition at line 85 of file VariableHelper.h.
References f, multipleInstance_, printValuesForEachEvent_, and printValuesForEachEventCategory_.
Referenced by VariableHelperService().
{ if (!printValuesForEachEvent_) return; std::map<std::string, VariableHelper* >::iterator f= multipleInstance_.begin(); for (; f!=multipleInstance_.end();++f){ // std::cout<<" category is: "<<printValuesForEachEventCategory_+"|"+f->first<<std::endl; // std::cout<<f->first<<"\n" <<f->second->printValues(event); edm::LogInfo(printValuesForEachEventCategory_+"|"+f->first)<<f->first<<"\n" <<f->second->printValues(event); } }
void VariableHelperService::preModule | ( | const edm::ModuleDescription & | desc | ) | [inline] |
Definition at line 76 of file VariableHelper.h.
References f, edm::ModuleDescription::moduleLabel(), multipleInstance_, and SetVariableHelperUniqueInstance_.
Referenced by VariableHelperService().
{ //does a set with the module name, except that it does not throw on non-configured modules std::map<std::string, VariableHelper* >::iterator f=multipleInstance_.find(desc.moduleLabel()); if (f != multipleInstance_.end()) SetVariableHelperUniqueInstance_ = (f->second); else { //do not say anything but set it to zero to get a safe crash in get() if ever called SetVariableHelperUniqueInstance_ =0;} }
VariableHelper& VariableHelperService::set | ( | std::string | user | ) | [inline] |
Definition at line 97 of file VariableHelper.h.
References benchmark_cfg::cerr, f, multipleInstance_, SetVariableHelperUniqueInstance_, and hcal_dqm_sourceclient-file_cfg::user.
{ std::map<std::string, VariableHelper* >::iterator f=multipleInstance_.find(user); if (f == multipleInstance_.end()){ std::cerr<<user<<" VariableHelper user not defined."<<std::endl; throw; } else{ SetVariableHelperUniqueInstance_ = (f->second); return (*SetVariableHelperUniqueInstance_); } }
std::map<std::string, VariableHelper* > VariableHelperService::multipleInstance_ [private] |
Definition at line 37 of file VariableHelper.h.
Referenced by init(), postProcess(), preModule(), set(), and ~VariableHelperService().
bool VariableHelperService::printValuesForEachEvent_ [private] |
Definition at line 39 of file VariableHelper.h.
Referenced by postProcess(), and VariableHelperService().
std::string VariableHelperService::printValuesForEachEventCategory_ [private] |
Definition at line 40 of file VariableHelper.h.
Referenced by postProcess(), and VariableHelperService().
Definition at line 36 of file VariableHelper.h.
Referenced by get(), init(), preModule(), and set().