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 36 of file VariableHelper.h.

Constructor & Destructor Documentation

VariableHelperService::VariableHelperService ( const edm::ParameterSet iConfig,
edm::ActivityRegistry r 
)
inline

Definition at line 44 of file VariableHelper.h.

References edm::ParameterSet::exists(), edm::ParameterSet::getParameter(), postProcess(), preModule(), AlCaHLTBitMon_QueryRunRegistry::string, edm::ActivityRegistry::watchPostEvent(), and edm::ActivityRegistry::watchPreModuleEvent().

45  //r.watchPreModule(this, &VariableHelperService::preModule );
47  //r.watchPostProcessEvent(this, &VariableHelperService::postProcess );
49  printValuesForEachEvent_ = iConfig.exists("printValuesForEachEventCategory");
51  printValuesForEachEventCategory_ = iConfig.getParameter<std::string>("printValuesForEachEventCategory");
52  }
T getParameter(std::string const &) const
void watchPreModuleEvent(PreModuleEvent::slot_type const &iSlot)
void watchPostEvent(PostEvent::slot_type const &iSlot)
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 ( )
inline

Definition at line 53 of file VariableHelper.h.

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

Member Function Documentation

VariableHelper& VariableHelperService::get ( )
inline

Definition at line 71 of file VariableHelper.h.

References MessageLogger_cfi::cerr.

Referenced by Options.Options::__getitem__(), betterConfigParser.BetterConfigParser::__updateDict(), betterConfigParser.BetterConfigParser::getCompares(), and betterConfigParser.BetterConfigParser::getResultingSection().

71  {
73  {
74  std::cerr<<" none of VariableHelperUniqueInstance_ or SetVariableHelperUniqueInstance_ is valid."<<std::endl;
75  throw;
76  }
77  else return (*SetVariableHelperUniqueInstance_);
78  }
VariableHelper * SetVariableHelperUniqueInstance_
VariableHelper& VariableHelperService::init ( std::string  user,
const edm::ParameterSet iConfig,
edm::ConsumesCollector &&  iC 
)
inline

Definition at line 59 of file VariableHelper.h.

References MessageLogger_cfi::cerr, VariableHelper::print(), VariableHelper::setHolder(), dataset::user, and VariableHelper::VariableHelper().

59  {
60  if (multipleInstance_.find(user)!=multipleInstance_.end()){
61  std::cerr<<user<<" VariableHelper user already defined."<<std::endl;
62  throw;}
63  else SetVariableHelperUniqueInstance_ = new VariableHelper(iConfig, iC);
66 
69  }
std::map< std::string, VariableHelper * > multipleInstance_
VariableHelper * SetVariableHelperUniqueInstance_
void setHolder(std::string hn)
void print() const
void VariableHelperService::postProcess ( edm::StreamContext const &  sc)
inline

Definition at line 91 of file VariableHelper.h.

Referenced by VariableHelperService().

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

Definition at line 80 of file VariableHelper.h.

References f, edm::ModuleCallingContext::moduleDescription(), edm::ModuleDescription::moduleLabel(), and mathSSE::return().

Referenced by VariableHelperService().

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

Definition at line 107 of file VariableHelper.h.

References MessageLogger_cfi::cerr, f, and dataset::user.

107  {
108  std::map<std::string, VariableHelper* >::iterator f=multipleInstance_.find(user);
109  if (f == multipleInstance_.end()){
110  std::cerr<<user<<" VariableHelper user not defined."<<std::endl;
111  throw;
112  }
113  else{
114  SetVariableHelperUniqueInstance_ = (f->second);
116  }
117  }
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 39 of file VariableHelper.h.

bool VariableHelperService::printValuesForEachEvent_
private

Definition at line 41 of file VariableHelper.h.

std::string VariableHelperService::printValuesForEachEventCategory_
private

Definition at line 42 of file VariableHelper.h.

VariableHelper* VariableHelperService::SetVariableHelperUniqueInstance_
private

Definition at line 38 of file VariableHelper.h.