CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Attributes
VariableHelperService Class Reference

#include <VariableHelper.h>

Public Member Functions

VariableHelperget ()
 
VariableHelperinit (std::string user, const edm::ParameterSet &iConfig)
 
void postProcess (const edm::Event &event, const edm::EventSetup &setup)
 
void preModule (const edm::ModuleDescription &desc)
 
VariableHelperset (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_
 
VariableHelperSetVariableHelperUniqueInstance_
 

Detailed Description

Definition at line 34 of file VariableHelper.h.

Constructor & Destructor Documentation

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().

42  {
45  printValuesForEachEvent_ = iConfig.exists("printValuesForEachEventCategory");
47  printValuesForEachEventCategory_ = iConfig.getParameter<std::string>("printValuesForEachEventCategory");
48  }
T getParameter(std::string const &) const
bool exists(std::string const &parameterName) const
checks if a parameter exists
std::string printValuesForEachEventCategory_
void watchPreModule(PreModule::slot_type const &iSlot)
void preModule(const edm::ModuleDescription &desc)
void postProcess(const edm::Event &event, const edm::EventSetup &setup)
void watchPostProcessEvent(PostProcessEvent::slot_type const &iSlot)
VariableHelperService::~VariableHelperService ( )
inline

Definition at line 49 of file VariableHelper.h.

References multipleInstance_.

49  {
50  for (std::map<std::string, VariableHelper* > :: iterator it=multipleInstance_.begin(); it!=multipleInstance_.end(); ++it){
51  delete it->second;
52  }
53  }
std::map< std::string, VariableHelper * > multipleInstance_

Member Function Documentation

VariableHelper& VariableHelperService::get ( void  )
inline
VariableHelper& VariableHelperService::init ( std::string  user,
const edm::ParameterSet iConfig 
)
inline
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().

85  {
86  if (!printValuesForEachEvent_) return;
87  std::map<std::string, VariableHelper* >::iterator f= multipleInstance_.begin();
88  for (; f!=multipleInstance_.end();++f){
89  // std::cout<<" category is: "<<printValuesForEachEventCategory_+"|"+f->first<<std::endl;
90  // std::cout<<f->first<<"\n" <<f->second->printValues(event);
91 
92  edm::LogInfo(printValuesForEachEventCategory_+"|"+f->first)<<f->first<<"\n"
93  <<f->second->printValues(event);
94  }
95  }
std::map< std::string, VariableHelper * > multipleInstance_
std::string printValuesForEachEventCategory_
double f[11][100]
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().

76  {
77  //does a set with the module name, except that it does not throw on non-configured modules
78  std::map<std::string, VariableHelper* >::iterator f=multipleInstance_.find(desc.moduleLabel());
79  if (f != multipleInstance_.end()) SetVariableHelperUniqueInstance_ = (f->second);
80  else {
81  //do not say anything but set it to zero to get a safe crash in get() if ever called
83  }
std::map< std::string, VariableHelper * > multipleInstance_
VariableHelper * SetVariableHelperUniqueInstance_
std::string const & moduleLabel() const
double f[11][100]
VariableHelper& VariableHelperService::set ( std::string  user)
inline

Definition at line 97 of file VariableHelper.h.

References dtNoiseDBValidation_cfg::cerr, f, multipleInstance_, and SetVariableHelperUniqueInstance_.

Referenced by betterConfigParser.BetterConfigParser::getGeneral().

97  {
98  std::map<std::string, VariableHelper* >::iterator f=multipleInstance_.find(user);
99  if (f == multipleInstance_.end()){
100  std::cerr<<user<<" VariableHelper user not defined."<<std::endl;
101  throw;
102  }
103  else{
104  SetVariableHelperUniqueInstance_ = (f->second);
106  }
107  }
std::map< std::string, VariableHelper * > multipleInstance_
VariableHelper * SetVariableHelperUniqueInstance_
double f[11][100]

Member Data Documentation

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().

VariableHelper* VariableHelperService::SetVariableHelperUniqueInstance_
private

Definition at line 36 of file VariableHelper.h.

Referenced by get(), init(), preModule(), and set().