CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
SingleElementCollectionSelectorPlusEvent.h
Go to the documentation of this file.
1 #ifndef RecoAlgos_SingleElementCollectionSelectorPlusEvent_h
2 #define RecoAlgos_SingleElementCollectionSelectorPlusEvent_h
3 
20 
21 namespace edm {
22  class Event;
23  class EventSetup;
24 } // namespace edm
25 
26 template <typename InputCollection,
27  typename Selector,
28  typename OutputCollection = typename helper::SelectedOutputCollectionTrait<InputCollection>::type,
29  typename StoreContainer = typename helper::StoreContainerTrait<OutputCollection>::type,
33  typedef StoreContainer container;
34  typedef typename container::const_iterator const_iterator;
36  : select_(reco::modules::make<Selector>(cfg, iC)) {}
37  const_iterator begin() const { return selected_.begin(); }
38  const_iterator end() const { return selected_.end(); }
40  selected_.clear();
41  for (size_t idx = 0; idx < c->size(); ++idx) {
42  if (select_(edm::Ref<InputCollection>(c, idx), ev)) //(*c)[idx]
43  addRef_(selected_, c, idx);
44  }
45  }
46 
47 private:
48  StoreContainer selected_;
50  RefAdder addRef_;
51 };
52 
53 #endif
const edm::EventSetup & c
tuple cfg
Definition: looper.py:296
S make(const edm::ParameterSet &cfg)
void select(const edm::Handle< InputCollection > &c, const edm::Event &ev, const edm::EventSetup &)
SingleElementCollectionSelectorPlusEvent(const edm::ParameterSet &cfg, edm::ConsumesCollector &&iC)
Functor that operates on &lt;T&gt;
Definition: Selector.h:22