1 #ifndef ConfigurableAnalysis_VariableHelper_H 2 #define ConfigurableAnalysis_VariableHelper_H 19 typedef std::map<std::string, const CachingVariable*>::const_iterator
iterator;
31 std::map<std::string, const CachingVariable*>
variables_;
44 : SetVariableHelperUniqueInstance_(
nullptr) {
49 printValuesForEachEvent_ = iConfig.
exists(
"printValuesForEachEventCategory");
50 if (printValuesForEachEvent_)
54 for (std::map<std::string, VariableHelper*>::iterator it = multipleInstance_.begin(); it != multipleInstance_.end();
61 if (multipleInstance_.find(user) != multipleInstance_.end()) {
62 std::cerr << user <<
" VariableHelper user already defined." << std::endl;
65 SetVariableHelperUniqueInstance_ =
new VariableHelper(iConfig, iC);
66 multipleInstance_[
user] = SetVariableHelperUniqueInstance_;
67 SetVariableHelperUniqueInstance_->
setHolder(user);
69 SetVariableHelperUniqueInstance_->
print();
70 return (*SetVariableHelperUniqueInstance_);
74 if (!SetVariableHelperUniqueInstance_) {
75 std::cerr <<
" none of VariableHelperUniqueInstance_ or SetVariableHelperUniqueInstance_ is valid." << std::endl;
78 return (*SetVariableHelperUniqueInstance_);
84 std::map<std::string, VariableHelper*>::iterator
f = multipleInstance_.find(desc.
moduleLabel());
85 if (f != multipleInstance_.end()) {
86 SetVariableHelperUniqueInstance_ = (f->second);
89 SetVariableHelperUniqueInstance_ =
nullptr;
93 if (!printValuesForEachEvent_)
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;
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)
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::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)
std::map< std::string, const CachingVariable * > variables_
void setHolder(std::string hn)
std::map< std::string, const CachingVariable * >::const_iterator iterator
VariableHelperService(const edm::ParameterSet &iConfig, edm::ActivityRegistry &r)
std::map< std::string, VariableHelper * > multipleInstance_
VariableHelper & init(std::string user, const edm::ParameterSet &iConfig, edm::ConsumesCollector &&iC)