CMS 3D CMS Logo

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, edm::ConsumesCollector &&iC)
 
void postProcess (edm::StreamContext const &sc)
 
void preModule (edm::StreamContext const &, edm::ModuleCallingContext const &mcc)
 
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::VariableHelperService ( const edm::ParameterSet iConfig,
edm::ActivityRegistry r 
)
inline

Definition at line 43 of file VariableHelper.h.

References edm::ParameterSet::exists(), edm::ParameterSet::getParameter(), postProcess(), preModule(), printValuesForEachEvent_, printValuesForEachEventCategory_, alignCSCRings::r, and AlCaHLTBitMon_QueryRunRegistry::string.

45  //r.watchPreModule(this, &VariableHelperService::preModule );
46  r.watchPreModuleEvent(this, &VariableHelperService::preModule);
47  //r.watchPostProcessEvent(this, &VariableHelperService::postProcess );
48  r.watchPostEvent(this, &VariableHelperService::postProcess);
49  printValuesForEachEvent_ = iConfig.exists("printValuesForEachEventCategory");
51  printValuesForEachEventCategory_ = iConfig.getParameter<std::string>("printValuesForEachEventCategory");
52  }
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
bool exists(std::string const &parameterName) const
checks if a parameter exists
VariableHelper * SetVariableHelperUniqueInstance_
std::string printValuesForEachEventCategory_
void postProcess(edm::StreamContext const &sc)
void preModule(edm::StreamContext const &, edm::ModuleCallingContext const &mcc)

◆ ~VariableHelperService()

VariableHelperService::~VariableHelperService ( )
inline

Definition at line 53 of file VariableHelper.h.

References multipleInstance_.

53  {
54  for (std::map<std::string, VariableHelper*>::iterator it = multipleInstance_.begin(); it != multipleInstance_.end();
55  ++it) {
56  delete it->second;
57  }
58  }
std::map< std::string, VariableHelper * > multipleInstance_

Member Function Documentation

◆ get()

VariableHelper& VariableHelperService::get ( )
inline

◆ init()

VariableHelper& VariableHelperService::init ( std::string  user,
const edm::ParameterSet iConfig,
edm::ConsumesCollector &&  iC 
)
inline

Definition at line 60 of file VariableHelper.h.

References DMR_cfg::cerr, multipleInstance_, VariableHelper::print(), VariableHelper::setHolder(), SetVariableHelperUniqueInstance_, and EnviromentSettings::user.

60  {
61  if (multipleInstance_.find(user) != multipleInstance_.end()) {
62  std::cerr << user << " VariableHelper user already defined." << std::endl;
63  throw;
64  } else
68 
71  }
void print() const
VariableHelper * SetVariableHelperUniqueInstance_
void setHolder(std::string hn)
std::map< std::string, VariableHelper * > multipleInstance_

◆ postProcess()

void VariableHelperService::postProcess ( edm::StreamContext const &  sc)
inline

Definition at line 92 of file VariableHelper.h.

References printValuesForEachEvent_.

Referenced by VariableHelperService().

92  {
94  return;
95 
96  /*const edm::Event & event;
97  std::map<std::string, VariableHelper* >::iterator f= multipleInstance_.begin();
98  for (; f!=multipleInstance_.end();++f){
99  // std::cout<<" category is: "<<printValuesForEachEventCategory_+"|"+f->first<<std::endl;
100  // std::cout<<f->first<<"\n" <<f->second->printValues(event);
101 
102  edm::LogInfo(printValuesForEachEventCategory_+"|"+f->first)<<f->first<<"\n"
103  <<f->second->printValues(event);
104  }
105  */
106  }

◆ preModule()

void VariableHelperService::preModule ( edm::StreamContext const &  ,
edm::ModuleCallingContext const &  mcc 
)
inline

Definition at line 81 of file VariableHelper.h.

References submitPVResolutionJobs::desc, f, edm::ModuleCallingContext::moduleDescription(), multipleInstance_, and SetVariableHelperUniqueInstance_.

Referenced by VariableHelperService().

81  {
82  const edm::ModuleDescription& desc = *mcc.moduleDescription();
83  //does a set with the module name, except that it does not throw on non-configured modules
84  std::map<std::string, VariableHelper*>::iterator f = multipleInstance_.find(desc.moduleLabel());
85  if (f != multipleInstance_.end()) {
87  return;
88  }
90  }
VariableHelper * SetVariableHelperUniqueInstance_
double f[11][100]
std::map< std::string, VariableHelper * > multipleInstance_

◆ set()

VariableHelper& VariableHelperService::set ( std::string  user)
inline

Definition at line 108 of file VariableHelper.h.

References DMR_cfg::cerr, f, multipleInstance_, SetVariableHelperUniqueInstance_, and EnviromentSettings::user.

108  {
109  std::map<std::string, VariableHelper*>::iterator f = multipleInstance_.find(user);
110  if (f == multipleInstance_.end()) {
111  std::cerr << user << " VariableHelper user not defined." << std::endl;
112  throw;
113  } else {
116  }
117  }
VariableHelper * SetVariableHelperUniqueInstance_
double f[11][100]
std::map< std::string, VariableHelper * > multipleInstance_

Member Data Documentation

◆ multipleInstance_

std::map<std::string, VariableHelper*> VariableHelperService::multipleInstance_
private

Definition at line 37 of file VariableHelper.h.

Referenced by init(), preModule(), set(), and ~VariableHelperService().

◆ printValuesForEachEvent_

bool VariableHelperService::printValuesForEachEvent_
private

Definition at line 39 of file VariableHelper.h.

Referenced by postProcess(), and VariableHelperService().

◆ printValuesForEachEventCategory_

std::string VariableHelperService::printValuesForEachEventCategory_
private

Definition at line 40 of file VariableHelper.h.

Referenced by VariableHelperService().

◆ SetVariableHelperUniqueInstance_

VariableHelper* VariableHelperService::SetVariableHelperUniqueInstance_
private

Definition at line 36 of file VariableHelper.h.

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