CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
RecoTauCleaningTools.h
Go to the documentation of this file.
1 #ifndef RecoTauTag_RecoTau_RecoTauCleaningTools_h
2 #define RecoTauTag_RecoTau_RecoTauCleaningTools_h
3 
4 #include <algorithm>
5 
6 namespace reco::tau {
7 
8  template <typename RankingList, typename Type>
10  public:
11  // Store our list of ranking functions and intialize the vectors
12  // that hold the comparison result
13  explicit RecoTauLexicographicalRanking(const RankingList& rankers) : rankers_(rankers) {}
14  // Predicate to compare a and b
15  bool operator()(const Type& a, const Type& b) const {
16  for (auto const& ranker : rankers_) {
17  double aResult = (*ranker)(a);
18  double bResult = (*ranker)(b);
19  if (aResult != bResult)
20  return (aResult < bResult);
21  }
22  // If all aare equal return false
23  return false;
24  }
25 
26  private:
27  const RankingList& rankers_;
28  };
29 
30  template <typename Container, class OverlapFunction>
32  // Output container of clean objects
34  OverlapFunction overlapChecker;
35  for (auto const& candidate : dirty) {
36  // Check if this overlaps with a pizero already in the clean list
37  bool overlaps = false;
38  for (auto cleaned = clean.begin(); cleaned != clean.end() && !overlaps; ++cleaned) {
39  overlaps = overlapChecker(candidate, *cleaned);
40  }
41  // If it didn't overlap with anything clean, add it to the clean list
42  if (!overlaps)
43  clean.insert(clean.end(), candidate);
44  }
45  return clean;
46  }
47 
48 } // namespace reco::tau
49 
50 #endif
static void clean(char *s)
RecoTauLexicographicalRanking(const RankingList &rankers)
bool operator()(const Type &a, const Type &b) const
double b
Definition: hdecay.h:118
double a
Definition: hdecay.h:119
Container cleanOverlaps(const Container &dirty)
edm::AssociationVector< reco::JetRefBaseProd, Values > Container