CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
List of all members | Public Member Functions | Private Attributes
VariableEventSelector Class Reference

#include <VariableEventSelector.h>

Inheritance diagram for VariableEventSelector:
EventSelector

Public Member Functions

bool select (const edm::Event &e) const override
 decision of the selector module More...
 
 VariableEventSelector (const edm::ParameterSet &pset, edm::ConsumesCollector &&iC)
 
 VariableEventSelector (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

bool doMax_
 
bool doMin_
 
double max_
 
double min_
 
std::string var_
 

Additional Inherited Members

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

Detailed Description

Definition at line 65 of file VariableEventSelector.h.

Constructor & Destructor Documentation

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

Definition at line 67 of file VariableEventSelector.h.

67 : VariableEventSelector(pset, iC) {}
VariableEventSelector(const edm::ParameterSet &pset, edm::ConsumesCollector &&iC)
VariableEventSelector::VariableEventSelector ( const edm::ParameterSet pset,
edm::ConsumesCollector iC 
)
inline

Definition at line 68 of file VariableEventSelector.h.

References EventSelector::description_, doMax_, doMin_, edm::ParameterSet::exists(), edm::ParameterSet::getParameter(), max_, min_, contentValuesCheck::ss, AlCaHLTBitMon_QueryRunRegistry::string, and var_.

68  : EventSelector(pset, iC) {
69  var_ = pset.getParameter<std::string>("var");
70  doMin_ = pset.exists("min");
71  if (doMin_)
72  min_ = pset.getParameter<double>("min");
73  doMax_ = pset.exists("max");
74  if (doMax_)
75  max_ = pset.getParameter<double>("max");
76 
77  std::stringstream ss;
78  ss << "event selector based on VariableHelper variable: " << var_;
79  description_.push_back(ss.str());
80  ss.str("");
81  if (doMin_) {
82  ss << "with minimum boundary: " << min_;
83  description_.push_back(ss.str());
84  ss.str("");
85  }
86  if (doMax_) {
87  ss << "with maximum boundary: " << max_;
88  description_.push_back(ss.str());
89  ss.str("");
90  }
91  }
bool exists(std::string const &parameterName) const
checks if a parameter exists
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
std::vector< std::string > description_
Definition: EventSelector.h:33

Member Function Documentation

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

decision of the selector module

Implements EventSelector.

Definition at line 92 of file VariableEventSelector.h.

References CachingVariable::compute(), doMax_, doMin_, alignCSCRings::e, max_, min_, findQualityFiles::v, isotrackApplyRegressor::var, and var_.

92  {
93  const CachingVariable* var = edm::Service<VariableHelperService>()->get().variable(var_);
94  if (!var->compute(e))
95  return false;
96 
97  double v = (*var)(e);
98 
99  if (doMin_ && v < min_)
100  return false;
101  else if (doMax_ && v > max_)
102  return false;
103  else
104  return true;
105  }
list var
if using global norm cols_to_minmax = [&#39;t_delta&#39;, &#39;t_hmaxNearP&#39;,&#39;t_emaxNearP&#39;, &#39;t_hAnnular&#39;, &#39;t_eAnnular&#39;,&#39;t_pt&#39;,&#39;t_nVtx&#39;,&#39;t_ieta&#39;,&#39;t_eHcal10&#39;, &#39;t_eHcal30&#39;,&#39;t_rhoh&#39;,&#39;t_eHcal&#39;] df[cols_to_minmax] = df[cols_to_minmax].apply(lambda x: (x - x.min()) / (x.max() - x.min()) if (x.max() - x.min() &gt; 0) else 1.0/200.0)
bool compute(const edm::Event &iEvent) const

Member Data Documentation

bool VariableEventSelector::doMax_
private

Definition at line 111 of file VariableEventSelector.h.

Referenced by select(), and VariableEventSelector().

bool VariableEventSelector::doMin_
private

Definition at line 109 of file VariableEventSelector.h.

Referenced by select(), and VariableEventSelector().

double VariableEventSelector::max_
private

Definition at line 112 of file VariableEventSelector.h.

Referenced by select(), and VariableEventSelector().

double VariableEventSelector::min_
private

Definition at line 110 of file VariableEventSelector.h.

Referenced by select(), and VariableEventSelector().

std::string VariableEventSelector::var_
private

Definition at line 108 of file VariableEventSelector.h.

Referenced by select(), and VariableEventSelector().