CMS 3D CMS Logo

VarRangeCutColl.h
Go to the documentation of this file.
1 #ifndef DQMOffline_Trigger_VarRangeCutColl_h
2 #define DQMOffline_Trigger_VarRangeCutColl_h
3 
4 //********************************************************************************
5 //
6 // Description:
7 // A collection cut minimal selection cuts.
8 // These selection cuts are intended to be simple selections on kinematic variables.
9 // The cuts are ANDed together
10 // intended use case cuts on et and eta
11 // However individual cuts can be skipped, so you can disable say only the Et cut
12 // when you're doing a turn on
13 //
14 // Implimentation:
15 // Basically a vector of VarRangeCuts which a nice operator() function to make it
16 // easy to use
17 //
18 // Author : Sam Harper , RAL, May 2017
19 //
20 //***********************************************************************************
21 
23 
24 template <typename ObjType>
26 public:
27  explicit VarRangeCutColl(const std::vector<edm::ParameterSet>& configs) {
28  for (const auto& cutConfig : configs)
29  rangeCuts_.emplace_back(VarRangeCut<ObjType>(cutConfig));
30  }
31 
32  //if no cuts are defined, it returns true
33  bool operator()(const ObjType& obj) const {
34  for (auto& cut : rangeCuts_) {
35  if (!cut(obj))
36  return false;
37  }
38  return true;
39  }
40 
41  //this version allows us to skip a range check for a specificed variable
42  //okay this feature requirement was missed in the initial (very rushed) design phase
43  //and thats why its now hacked in
44  //basically if you're applying an Et cut, you want to automatically turn it of
45  //when you're making a turn on curve...
46  //if no cuts are defined, it returns true
47  bool operator()(const ObjType& obj, const std::string& varToSkip) const {
48  for (auto& cut : rangeCuts_) {
49  if (cut.varName() == varToSkip)
50  continue;
51  if (!cut(obj))
52  return false;
53  }
54  return true;
55  }
56  //for multiple cuts to skip
57  bool operator()(const ObjType& obj, const std::vector<std::string>& varsToSkip) const {
58  for (auto& cut : rangeCuts_) {
59  if (std::find(varsToSkip.begin(), varsToSkip.end(), cut.varName()) != varsToSkip.end())
60  continue;
61  if (!cut(obj))
62  return false;
63  }
64  return true;
65  }
66 
67 private:
68  std::vector<VarRangeCut<ObjType> > rangeCuts_;
69 };
70 
71 #endif
TkAlMuonSelectors_cfi.cut
cut
Definition: TkAlMuonSelectors_cfi.py:5
VarRangeCutColl::rangeCuts_
std::vector< VarRangeCut< ObjType > > rangeCuts_
Definition: VarRangeCutColl.h:68
spr::find
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:19
VarRangeCutColl
Definition: VarRangeCutColl.h:25
VarRangeCutColl::operator()
bool operator()(const ObjType &obj) const
Definition: VarRangeCutColl.h:33
trigObjTnPSource_cfi.configs
configs
Definition: trigObjTnPSource_cfi.py:75
getGTfromDQMFile.obj
obj
Definition: getGTfromDQMFile.py:32
VarRangeCut.h
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
VarRangeCutColl::operator()
bool operator()(const ObjType &obj, const std::string &varToSkip) const
Definition: VarRangeCutColl.h:47
VarRangeCutColl::VarRangeCutColl
VarRangeCutColl(const std::vector< edm::ParameterSet > &configs)
Definition: VarRangeCutColl.h:27
VarRangeCut
Definition: VarRangeCut.h:29
VarRangeCutColl::operator()
bool operator()(const ObjType &obj, const std::vector< std::string > &varsToSkip) const
Definition: VarRangeCutColl.h:57