CMS 3D CMS Logo

ObjectPairCollectionSelector.h
Go to the documentation of this file.
1 #ifndef RecoAlgos_ObjectPairCollectionSelector_h
2 #define RecoAlgos_ObjectPairCollectionSelector_h
3 
21 #include <vector>
22 
23 namespace edm {
24  class Event;
25 }
26 
27 template <typename InputCollection,
28  typename Selector,
29  typename StoreContainer = std::vector<const typename InputCollection::value_type *>,
32 public:
34 
35 private:
36  typedef const typename InputCollection::value_type *reference;
37  typedef StoreContainer container;
38  typedef typename container::const_iterator const_iterator;
39 
40 public:
43  const_iterator begin() const { return selected_.begin(); }
44  const_iterator end() const { return selected_.end(); }
46  unsigned int s = c->size();
47  std::vector<bool> v(s, false);
48  for (unsigned int i = 0; i < s; ++i)
49  for (unsigned int j = i + 1; j < s; ++j) {
50  if (select_((*c)[i], (*c)[j]))
51  v[i] = v[j] = true;
52  }
53  selected_.clear();
54  for (unsigned int i = 0; i < s; ++i)
55  if (v[i])
56  addRef_(selected_, c, i);
57  }
58 
59 private:
61  StoreContainer selected_;
62  RefAdder addRef_;
63 };
64 
65 #endif
S make(const edm::ParameterSet &cfg)
const InputCollection::value_type * reference
Functor that operates on <T>
Definition: Selector.h:22
fixed size matrix
HLT enums.
void select(const edm::Handle< InputCollection > &c, const edm::Event &, const edm::EventSetup &)
ObjectPairCollectionSelector(const edm::ParameterSet &cfg, edm::ConsumesCollector &&iC)
container::const_iterator const_iterator