test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
VariableHelper.h
Go to the documentation of this file.
1 #ifndef ConfigurableAnalysis_VariableHelper_H
2 #define ConfigurableAnalysis_VariableHelper_H
3 
10 
12  public:
15  for (iterator it = variables_.begin() ; it!=variables_.end() ;++it){
16  delete it->second;
17  }
18  }
19  typedef std::map<std::string,const CachingVariable*>::const_iterator iterator;
20 
22 
23  iterator begin() { return variables_.begin();}
24  iterator end() { return variables_.end();}
25 
26  void setHolder(std::string hn);
27  void print() const;
28  std::string printValues(const edm::Event & event) const;
29  private:
30  std::map<std::string,const CachingVariable*> variables_;
31 };
32 
33 
34 
35 
37  private:
39  std::map<std::string, VariableHelper* > multipleInstance_;
40 
43  public:
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  }
54  for (std::map<std::string, VariableHelper* > :: iterator it=multipleInstance_.begin(); it!=multipleInstance_.end(); ++it){
55  delete it->second;
56  }
57  }
58 
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  }
70 
71  VariableHelper & get(){
73  {
74  std::cerr<<" none of VariableHelperUniqueInstance_ or SetVariableHelperUniqueInstance_ is valid."<<std::endl;
75  throw;
76  }
77  else return (*SetVariableHelperUniqueInstance_);
78  }
79 
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  }
90 
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  }
106 
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  }
118 };
119 
120 #endif
T getParameter(std::string const &) const
VariableHelper(const edm::ParameterSet &iConfig, edm::ConsumesCollector &iC)
VariableHelper & set(std::string user)
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 &parameterName) const
checks if a parameter exists
VariableHelper * SetVariableHelperUniqueInstance_
iterator end()
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
std::string printValues(const edm::Event &event) const
double f[11][100]
void preModule(edm::StreamContext const &, edm::ModuleCallingContext const &mcc)
How EventSelector::AcceptEvent() decides whether to accept an event for output otherwise it is excluding the probing of A single or multiple positive and the trigger will pass if any such matching triggers are PASS or EXCEPTION[A criterion thatmatches no triggers at all is detected and causes a throw.] A single negative with an expectation of appropriate bit checking in the decision and the trigger will pass if any such matching triggers are FAIL or EXCEPTION A wildcarded negative criterion that matches more than one trigger in the trigger but the state exists so we define the behavior If all triggers are the negative crieriion will lead to accepting the event(this again matches the behavior of"!*"before the partial wildcard feature was incorporated).The per-event"cost"of each negative criterion with multiple relevant triggers is about the same as!*was in the past
void setHolder(std::string hn)
VariableHelperService(const edm::ParameterSet &iConfig, edm::ActivityRegistry &r)
return(e1-e2)*(e1-e2)+dp *dp
iterator begin()
void print() const
VariableHelper & init(std::string user, const edm::ParameterSet &iConfig, edm::ConsumesCollector &&iC)
std::map< std::string, const CachingVariable * >::const_iterator iterator