CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
VariableFormulaEventSelector Class Reference

#include <VariableEventSelector.h>

Inheritance diagram for VariableFormulaEventSelector:
EventSelector

Public Member Functions

bool select (const edm::Event &e) const override
 decision of the selector module More...
 
 VariableFormulaEventSelector (const edm::ParameterSet &pset, edm::ConsumesCollector &&iC)
 
 VariableFormulaEventSelector (const edm::ParameterSet &pset, edm::ConsumesCollector &iC)
 
- Public Member Functions inherited from EventSelector
const std::vector< std::string > & description ()
 
 EventSelector ()
 
 EventSelector (const edm::ParameterSet &iConfig, edm::ConsumesCollector &&iC)
 
 EventSelector (const edm::ParameterSet &iConfig, edm::ConsumesCollector &iC)
 
const std::string & name () const
 name of the module (from configuration) More...
 
virtual ~EventSelector ()
 

Private Attributes

TFormula * formula_
 
double threshold_
 
std::set< std::string > vars_
 

Additional Inherited Members

- Protected Attributes inherited from EventSelector
std::vector< std::string > description_
 
std::string name_
 

Detailed Description

Definition at line 10 of file VariableEventSelector.h.

Constructor & Destructor Documentation

◆ VariableFormulaEventSelector() [1/2]

VariableFormulaEventSelector::VariableFormulaEventSelector ( const edm::ParameterSet pset,
edm::ConsumesCollector &&  iC 
)
inline

Definition at line 12 of file VariableEventSelector.h.

◆ VariableFormulaEventSelector() [2/2]

VariableFormulaEventSelector::VariableFormulaEventSelector ( const edm::ParameterSet pset,
edm::ConsumesCollector iC 
)
inline

Definition at line 14 of file VariableEventSelector.h.

14  : EventSelector(pset, iC) {
15  const std::string name_ = pset.getParameter<std::string>("fname");
16  TString ts(pset.getParameter<std::string>("formula"));
17  //find the variables. register and replace
18  int open = ts.Index("[");
19  int close = ts.Index("]");
20  while (open > 0) {
21  ++open;
22  TString sub(ts(open, close - open));
23  //std::cout<<"found:"<< sub <<std::endl;
24  vars_.insert(sub.Data());
25  //vars_.insert( ts(open,close-open));
26  open = ts.Index("[", open);
27  close = ts.Index("]", open);
28  }
29 
30  unsigned int v_i;
31  std::set<std::string>::iterator v_it;
32  for (v_i = 0, v_it = vars_.begin(); v_i != vars_.size(); ++v_i, ++v_it) {
33  ts.ReplaceAll(TString::Format("[%s]", v_it->c_str()), TString::Format("[%d]", v_i));
34  }
35 
36  //std::cout<<" formula found:"<< ts <<std::endl;
37  formula_ = new TFormula(name_.c_str(), ts);
38  //vars_ = pset.getParameter<std::vector<std::string>>("variables");
39  threshold_ = pset.getParameter<double>("threshold");
40  }

References formula_, EventSelector::name_, muonDTDigis_cfi::pset, AlCaHLTBitMon_QueryRunRegistry::string, threshold_, and vars_.

Member Function Documentation

◆ select()

bool VariableFormulaEventSelector::select ( const edm::Event ) const
inlineoverridevirtual

decision of the selector module

Implements EventSelector.

Definition at line 42 of file VariableEventSelector.h.

42  {
43  unsigned int v_i;
44  std::set<std::string>::iterator v_it;
45 
46  for (v_i = 0, v_it = vars_.begin(); v_i != vars_.size(); ++v_i, ++v_it) {
47  const CachingVariable* var = edm::Service<VariableHelperService>()->get().variable(*v_it);
48  if (!var->compute(e))
49  return false;
50  double v = (*var)(e);
51  formula_->SetParameter(v_i, v);
52  }
53 
54  //should be valuated 0. or 1. in double
55  return (formula_->Eval(0.) >= threshold_);
56  }

References MillePedeFileConverter_cfg::e, formula_, threshold_, findQualityFiles::v, trigObjTnPSource_cfi::var, and vars_.

Member Data Documentation

◆ formula_

TFormula* VariableFormulaEventSelector::formula_
private

Definition at line 60 of file VariableEventSelector.h.

Referenced by select(), and VariableFormulaEventSelector().

◆ threshold_

double VariableFormulaEventSelector::threshold_
private

Definition at line 62 of file VariableEventSelector.h.

Referenced by select(), and VariableFormulaEventSelector().

◆ vars_

std::set<std::string> VariableFormulaEventSelector::vars_
private

Definition at line 61 of file VariableEventSelector.h.

Referenced by select(), and VariableFormulaEventSelector().

CachingVariable
Definition: CachingVariable.h:40
VariableFormulaEventSelector::vars_
std::set< std::string > vars_
Definition: VariableEventSelector.h:61
findQualityFiles.v
v
Definition: findQualityFiles.py:179
trigObjTnPSource_cfi.var
var
Definition: trigObjTnPSource_cfi.py:21
EventSelector::name_
std::string name_
Definition: EventSelector.h:32
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
EventSelector::EventSelector
EventSelector()
Definition: EventSelector.h:18
edm::Service
Definition: Service.h:30
VariableFormulaEventSelector::VariableFormulaEventSelector
VariableFormulaEventSelector(const edm::ParameterSet &pset, edm::ConsumesCollector &&iC)
Definition: VariableEventSelector.h:12
VariableFormulaEventSelector::threshold_
double threshold_
Definition: VariableEventSelector.h:62
muonDTDigis_cfi.pset
pset
Definition: muonDTDigis_cfi.py:27
VariableFormulaEventSelector::formula_
TFormula * formula_
Definition: VariableEventSelector.h:60
MillePedeFileConverter_cfg.e
e
Definition: MillePedeFileConverter_cfg.py:37