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 | Static Public Member Functions | Private Attributes
VarRangeCut< ObjType > Class Template Reference

#include <VarRangeCut.h>

Public Member Functions

bool operator() (const ObjType &obj) const
 
const std::string & varName () const
 
 VarRangeCut (const edm::ParameterSet &config)
 

Static Public Member Functions

static edm::ParameterSetDescription makePSetDescription ()
 

Private Attributes

std::vector< std::pair< float,
float > > 
allowedRanges_
 
std::function< float(const
ObjType &)> 
varFunc_
 
std::string varName_
 

Detailed Description

template<typename ObjType>
class VarRangeCut< ObjType >

Definition at line 29 of file VarRangeCut.h.

Constructor & Destructor Documentation

template<typename ObjType >
VarRangeCut< ObjType >::VarRangeCut ( const edm::ParameterSet config)
explicit

Definition at line 44 of file VarRangeCut.h.

References edm::ParameterSet::getParameter(), sistrip::SpyUtilities::range(), diffTwoXMLs::ranges, submitPVValidationJobs::split(), and AlCaHLTBitMon_QueryRunRegistry::string.

44  {
45  varName_ = config.getParameter<std::string>("rangeVar");
46  varFunc_ = hltdqm::getUnaryFuncFloat<ObjType>(varName_);
47  auto ranges = config.getParameter<std::vector<std::string> >("allowedRanges");
48  for (auto range : ranges) {
49  std::vector<std::string> splitRange;
50  boost::split(splitRange, range, boost::is_any_of(":"));
51  if (splitRange.size() != 2)
52  throw cms::Exception("ConfigError")
53  << "in VarRangeCut::VarRangeCut range " << range << " is not of format X:Y" << std::endl;
54  allowedRanges_.push_back({std::stof(splitRange[0]), std::stof(splitRange[1])});
55  }
56 }
std::vector< std::pair< float, float > > allowedRanges_
Definition: VarRangeCut.h:40
std::string varName_
Definition: VarRangeCut.h:38
const uint16_t range(const Frame &aFrame)
string ranges
Definition: diffTwoXMLs.py:79
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
std::function< float(const ObjType &)> varFunc_
Definition: VarRangeCut.h:39

Member Function Documentation

template<typename ObjType >
edm::ParameterSetDescription VarRangeCut< ObjType >::makePSetDescription ( )
static

Definition at line 59 of file VarRangeCut.h.

References edm::ParameterSetDescription::add(), submitPVResolutionJobs::desc, and AlCaHLTBitMon_QueryRunRegistry::string.

59  {
61  desc.add<std::string>("rangeVar", "");
62  desc.add<std::vector<std::string> >("allowedRanges", std::vector<std::string>());
63  return desc;
64 }
ParameterDescriptionBase * add(U const &iLabel, T const &value)
template<typename ObjType >
bool VarRangeCut< ObjType >::operator() ( const ObjType &  obj) const

Definition at line 67 of file VarRangeCut.h.

References sistrip::SpyUtilities::range().

67  {
68  if (!varFunc_)
69  return true; //auto pass if we dont specify a variable function
70  else {
71  float varVal = varFunc_(obj);
72  for (auto& range : allowedRanges_) {
73  if (varVal >= range.first && varVal < range.second)
74  return true;
75  }
76  return false;
77  }
78 }
std::vector< std::pair< float, float > > allowedRanges_
Definition: VarRangeCut.h:40
const uint16_t range(const Frame &aFrame)
std::function< float(const ObjType &)> varFunc_
Definition: VarRangeCut.h:39
template<typename ObjType >
const std::string& VarRangeCut< ObjType >::varName ( ) const
inline

Definition at line 35 of file VarRangeCut.h.

References VarRangeCut< ObjType >::varName_.

35 { return varName_; }
std::string varName_
Definition: VarRangeCut.h:38

Member Data Documentation

template<typename ObjType >
std::vector<std::pair<float, float> > VarRangeCut< ObjType >::allowedRanges_
private

Definition at line 40 of file VarRangeCut.h.

template<typename ObjType >
std::function<float(const ObjType&)> VarRangeCut< ObjType >::varFunc_
private

Definition at line 39 of file VarRangeCut.h.

template<typename ObjType >
std::string VarRangeCut< ObjType >::varName_
private

Definition at line 38 of file VarRangeCut.h.

Referenced by VarRangeCut< ObjType >::varName().