File indexing completed on 2024-04-06 12:09:52
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 explicit VarRangeCutColl(const std::vector<edm::ParameterSet>& configs) {
0028 for (const auto& cutConfig : configs)
0029 rangeCuts_.emplace_back(VarRangeCut<ObjType>(cutConfig));
0030 }
0031
0032
0033 bool operator()(const ObjType& obj) const {
0034 for (auto& cut : rangeCuts_) {
0035 if (!cut(obj))
0036 return false;
0037 }
0038 return true;
0039 }
0040
0041
0042
0043
0044
0045
0046
0047 bool operator()(const ObjType& obj, const std::string& varToSkip) const {
0048 for (auto& cut : rangeCuts_) {
0049 if (cut.varName() == varToSkip)
0050 continue;
0051 if (!cut(obj))
0052 return false;
0053 }
0054 return true;
0055 }
0056
0057 bool operator()(const ObjType& obj, const std::vector<std::string>& varsToSkip) const {
0058 for (auto& cut : rangeCuts_) {
0059 if (std::find(varsToSkip.begin(), varsToSkip.end(), cut.varName()) != varsToSkip.end())
0060 continue;
0061 if (!cut(obj))
0062 return false;
0063 }
0064 return true;
0065 }
0066
0067 private:
0068 std::vector<VarRangeCut<ObjType> > rangeCuts_;
0069 };
0070
0071 #endif