CMS 3D CMS Logo

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

◆ VarRangeCut()

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

Definition at line 44 of file VarRangeCut.h.

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 }

References FastTimerService_cff::range, diffTwoXMLs::ranges, submitPVValidationJobs::split(), and AlCaHLTBitMon_QueryRunRegistry::string.

Member Function Documentation

◆ makePSetDescription()

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

Definition at line 59 of file VarRangeCut.h.

59  {
61  desc.add<std::string>("rangeVar", "");
62  desc.add<std::vector<std::string> >("allowedRanges", std::vector<std::string>());
63  return desc;
64 }

References submitPVResolutionJobs::desc, and AlCaHLTBitMon_QueryRunRegistry::string.

◆ operator()()

template<typename ObjType >
bool VarRangeCut< ObjType >::operator() ( const ObjType &  obj) const

Definition at line 67 of file VarRangeCut.h.

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 }

References getGTfromDQMFile::obj, and FastTimerService_cff::range.

◆ varName()

template<typename ObjType >
const std::string& VarRangeCut< ObjType >::varName ( ) const
inline

Definition at line 35 of file VarRangeCut.h.

35 { return varName_; }

References VarRangeCut< ObjType >::varName_.

Member Data Documentation

◆ allowedRanges_

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

Definition at line 40 of file VarRangeCut.h.

◆ varFunc_

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

Definition at line 39 of file VarRangeCut.h.

◆ varName_

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

Definition at line 38 of file VarRangeCut.h.

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

diffTwoXMLs.ranges
string ranges
Definition: diffTwoXMLs.py:79
FastTimerService_cff.range
range
Definition: FastTimerService_cff.py:34
edm::ParameterSetDescription
Definition: ParameterSetDescription.h:52
VarRangeCut::varName_
std::string varName_
Definition: VarRangeCut.h:38
config
Definition: config.py:1
submitPVValidationJobs.split
def split(sequence, size)
Definition: submitPVValidationJobs.py:352
getGTfromDQMFile.obj
obj
Definition: getGTfromDQMFile.py:32
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
submitPVResolutionJobs.desc
string desc
Definition: submitPVResolutionJobs.py:251
cms::Exception
Definition: Exception.h:70
VarRangeCut::varFunc_
std::function< float(const ObjType &)> varFunc_
Definition: VarRangeCut.h:39
VarRangeCut::allowedRanges_
std::vector< std::pair< float, float > > allowedRanges_
Definition: VarRangeCut.h:40