1 #ifndef ConfigurableAnalysis_VariableHelper_H 2 #define ConfigurableAnalysis_VariableHelper_H 19 typedef std::map<std::string,const CachingVariable*>::const_iterator
iterator;
49 printValuesForEachEvent_ = iConfig.
exists(
"printValuesForEachEventCategory");
50 if (printValuesForEachEvent_)
54 for (std::map<std::string, VariableHelper* > :: iterator it=multipleInstance_.begin(); it!=multipleInstance_.end(); ++it){
60 if (multipleInstance_.find(user)!=multipleInstance_.end()){
61 std::cerr<<user<<
" VariableHelper user already defined."<<std::endl;
63 else SetVariableHelperUniqueInstance_ =
new VariableHelper(iConfig, iC);
64 multipleInstance_[
user] = SetVariableHelperUniqueInstance_;
65 SetVariableHelperUniqueInstance_->
setHolder(user);
67 SetVariableHelperUniqueInstance_->
print();
68 return (*SetVariableHelperUniqueInstance_);
72 if (!SetVariableHelperUniqueInstance_)
74 std::cerr<<
" none of VariableHelperUniqueInstance_ or SetVariableHelperUniqueInstance_ is valid."<<std::endl;
77 else return (*SetVariableHelperUniqueInstance_);
83 std::map<std::string, VariableHelper* >::iterator
f=multipleInstance_.find(desc.
moduleLabel());
84 if (f != multipleInstance_.end()) {
85 SetVariableHelperUniqueInstance_ = (f->second);
88 SetVariableHelperUniqueInstance_ =
nullptr;
93 if (!printValuesForEachEvent_)
return;
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;
114 SetVariableHelperUniqueInstance_ = (f->second);
115 return (*SetVariableHelperUniqueInstance_);
T getParameter(std::string const &) const
VariableHelper(const edm::ParameterSet &iConfig, edm::ConsumesCollector &iC)
const CachingVariable * variable(std::string name) const
void watchPreModuleEvent(PreModuleEvent::slot_type const &iSlot)
std::map< std::string, VariableHelper * > multipleInstance_
void watchPostEvent(PostEvent::slot_type const &iSlot)
bool exists(std::string const ¶meterName) const
checks if a parameter exists
VariableHelper * SetVariableHelperUniqueInstance_
std::string printValuesForEachEventCategory_
std::map< std::string, const CachingVariable * > variables_
std::string const & moduleLabel() const
void postProcess(edm::StreamContext const &sc)
ModuleDescription const * moduleDescription() const
bool printValuesForEachEvent_
std::string printValues(const edm::Event &event) const
void preModule(edm::StreamContext const &, edm::ModuleCallingContext const &mcc)
void setHolder(std::string hn)
VariableHelperService(const edm::ParameterSet &iConfig, edm::ActivityRegistry &r)
VariableHelper & init(std::string user, const edm::ParameterSet &iConfig, edm::ConsumesCollector &&iC)
std::map< std::string, const CachingVariable * >::const_iterator iterator