1 #ifndef DQMOffline_Trigger_VarRangeCut_h 2 #define DQMOffline_Trigger_VarRangeCut_h 26 #include <boost/algorithm/string.hpp> 28 template <
typename ObjType>
43 template <
typename ObjType>
46 varFunc_ = hltdqm::getUnaryFuncFloat<ObjType>(varName_);
47 auto ranges =
config.getParameter<std::vector<std::string> >(
"allowedRanges");
49 std::vector<std::string> splitRange;
51 if (splitRange.size() != 2)
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])});
58 template <
typename ObjType>
62 desc.add<std::vector<std::string> >(
"allowedRanges", std::vector<std::string>());
66 template <
typename ObjType>
71 float varVal = varFunc_(
obj);
72 for (
auto&
range : allowedRanges_) {
73 if (varVal >=
range.first && varVal <
range.second)
std::vector< std::pair< float, float > > allowedRanges_
static edm::ParameterSetDescription makePSetDescription()
const std::string & varName() const
bool operator()(const ObjType &obj) const
def split(sequence, size)
std::function< float(const ObjType &)> varFunc_
VarRangeCut(const edm::ParameterSet &config)