CMS 3D CMS Logo

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
List of all members | Public Member Functions | Private Attributes
pat::GenericDuplicateRemover< Comparator, Arbitrator > Class Template Reference

#include <GenericDuplicateRemover.h>

Public Member Functions

template<typename Collection >
std::unique_ptr< std::vector< size_t > > duplicates (const Collection &items) const
 
 GenericDuplicateRemover ()
 
 GenericDuplicateRemover (const Comparator &comp)
 
 GenericDuplicateRemover (const Comparator &comp, const Arbitrator &arbiter)
 
 ~GenericDuplicateRemover ()
 

Private Attributes

Arbitrator arbiter_
 
Comparator comparator_
 

Detailed Description

template<typename Comparator, typename Arbitrator>
class pat::GenericDuplicateRemover< Comparator, Arbitrator >

Definition at line 11 of file GenericDuplicateRemover.h.

Constructor & Destructor Documentation

◆ GenericDuplicateRemover() [1/3]

template<typename Comparator, typename Arbitrator>
pat::GenericDuplicateRemover< Comparator, Arbitrator >::GenericDuplicateRemover ( )
inline

Definition at line 13 of file GenericDuplicateRemover.h.

13 {}

◆ GenericDuplicateRemover() [2/3]

template<typename Comparator, typename Arbitrator>
pat::GenericDuplicateRemover< Comparator, Arbitrator >::GenericDuplicateRemover ( const Comparator comp)
inline

Definition at line 14 of file GenericDuplicateRemover.h.

14 : comparator_(comp) {}

◆ GenericDuplicateRemover() [3/3]

template<typename Comparator, typename Arbitrator>
pat::GenericDuplicateRemover< Comparator, Arbitrator >::GenericDuplicateRemover ( const Comparator comp,
const Arbitrator &  arbiter 
)
inline

Definition at line 15 of file GenericDuplicateRemover.h.

15 : comparator_(comp), arbiter_(arbiter) {}

◆ ~GenericDuplicateRemover()

template<typename Comparator, typename Arbitrator>
pat::GenericDuplicateRemover< Comparator, Arbitrator >::~GenericDuplicateRemover ( )
inline

Definition at line 17 of file GenericDuplicateRemover.h.

17 {}

Member Function Documentation

◆ duplicates()

template<typename Comparator , typename Arbitrator >
template<typename Collection >
std::unique_ptr< std::vector< size_t > > pat::GenericDuplicateRemover< Comparator, Arbitrator >::duplicates ( const Collection &  items) const

Indices of duplicated items to remove Comparator is used to check for duplication, Arbiter to pick the best one e.g. comparator(x1, x2) should return true if they are duplicates arbitrator(x1, x2) should return true if x1 is better, that is we want to keep x1 and delete x2 Collection can be vector, View, or anything with the same interface

Definition at line 36 of file GenericDuplicateRemover.h.

37  {
38  size_t size = items.size();
39 
40  std::vector<bool> bad(size, false);
41 
42  for (size_t ie = 0; ie < size; ++ie) {
43  if (bad[ie])
44  continue; // if already marked bad
45 
46  for (size_t je = ie + 1; je < size; ++je) {
47  if (bad[je])
48  continue; // if already marked bad
49 
50  if (comparator_(items[ie], items[je])) {
51  int toRemove = arbiter_(items[ie], items[je]) ? je : ie;
52  bad[toRemove] = true;
53  }
54  }
55  }
56 
57  auto ret = std::make_unique<std::vector<size_t>>();
58 
59  for (size_t i = 0; i < size; ++i) {
60  if (bad[i])
61  ret->push_back(i);
62  }
63 
64  return ret;
65 }

References mps_fire::i, mps_monitormerge::items, runTheMatrix::ret, and findQualityFiles::size.

Referenced by pat::DuplicatedPhotonRemover::duplicatesBySeed(), pat::DuplicatedPhotonRemover::duplicatesBySuperCluster(), pat::DuplicatedElectronRemover::duplicatesToRemove(), edmIntegrityCheck.IntegrityCheck::report(), edmIntegrityCheck.IntegrityCheck::structured(), and edmIntegrityCheck.IntegrityCheck::test().

Member Data Documentation

◆ arbiter_

template<typename Comparator, typename Arbitrator>
Arbitrator pat::GenericDuplicateRemover< Comparator, Arbitrator >::arbiter_
private

Definition at line 29 of file GenericDuplicateRemover.h.

◆ comparator_

template<typename Comparator, typename Arbitrator>
Comparator pat::GenericDuplicateRemover< Comparator, Arbitrator >::comparator_
private

Definition at line 28 of file GenericDuplicateRemover.h.

runTheMatrix.ret
ret
prodAgent to be discontinued
Definition: runTheMatrix.py:543
AlCaHLTBitMon_QueryRunRegistry.comp
string comp
Definition: AlCaHLTBitMon_QueryRunRegistry.py:249
mps_fire.i
i
Definition: mps_fire.py:428
pixelTrack::Quality::bad
mps_monitormerge.items
list items
Definition: mps_monitormerge.py:29
pat::GenericDuplicateRemover::arbiter_
Arbitrator arbiter_
Definition: GenericDuplicateRemover.h:29
pat::GenericDuplicateRemover::comparator_
Comparator comparator_
Definition: GenericDuplicateRemover.h:28
findQualityFiles.size
size
Write out results.
Definition: findQualityFiles.py:443