File indexing completed on 2025-02-13 02:58:09
0001 #ifndef DQMOffline_Trigger_VarRangeCutColl_h
0002 #define DQMOffline_Trigger_VarRangeCutColl_h
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022 #include "DQMOffline/Trigger/interface/VarRangeCut.h"
0023
0024 template <typename ObjType>
0025 class VarRangeCutColl {
0026 public:
0027 VarRangeCutColl() {}
0028 explicit VarRangeCutColl(const std::vector<edm::ParameterSet>& configs) {
0029 for (const auto& cutConfig : configs)
0030 rangeCuts_.emplace_back(VarRangeCut<ObjType>(cutConfig));
0031 }
0032
0033
0034 bool operator()(const ObjType& obj) const {
0035 for (auto& cut : rangeCuts_) {
0036 if (!cut(obj))
0037 return false;
0038 }
0039 return true;
0040 }
0041
0042
0043
0044
0045
0046
0047
0048 bool operator()(const ObjType& obj, const std::string& varToSkip) const {
0049 for (auto& cut : rangeCuts_) {
0050 if (cut.varName() == varToSkip)
0051 continue;
0052 if (!cut(obj))
0053 return false;
0054 }
0055 return true;
0056 }
0057
0058 bool operator()(const ObjType& obj, const std::vector<std::string>& varsToSkip) const {
0059 for (auto& cut : rangeCuts_) {
0060 if (std::find(varsToSkip.begin(), varsToSkip.end(), cut.varName()) != varsToSkip.end())
0061 continue;
0062 if (!cut(obj))
0063 return false;
0064 }
0065 return true;
0066 }
0067
0068 private:
0069 std::vector<VarRangeCut<ObjType> > rangeCuts_;
0070 };
0071
0072 #endif