CMS 3D CMS Logo

Public Member Functions | Private Attributes

VariableHelperService Class Reference

#include <VariableHelper.h>

List of all members.

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]
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;
    }
  }

Member Function Documentation

VariableHelper& VariableHelperService::get ( void  ) [inline]

Definition at line 67 of file VariableHelper.h.

References dtNoiseDBValidation_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]
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 dtNoiseDBValidation_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_);
    }
  }

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

Definition at line 39 of file VariableHelper.h.

Referenced by postProcess(), and VariableHelperService().

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