CMS 3D CMS Logo

SingleElementCollectionRefSelector.h
Go to the documentation of this file.
1 #ifndef RecoAlgos_SingleElementCollectionRefSelector_h
2 #define RecoAlgos_SingleElementCollectionRefSelector_h
3 
21 
22 namespace reco {
23  namespace modules {
24  template <typename S>
26  }
27 } // namespace reco
28 namespace edm {
29  class Event;
30  class EventSetup;
31 } // namespace edm
32 
33 template <typename InputType,
34  typename Selector,
35  typename OutputCollection = typename ::helper::SelectedOutputCollectionTrait<edm::View<InputType> >::type,
37  typename RefAdder = typename ::helper::SelectionAdderTrait<edm::View<InputType>, StoreContainer>::type>
40  typedef InputCollection collection;
41  typedef StoreContainer container;
42  typedef Selector selector;
43  typedef typename container::const_iterator const_iterator;
45  : select_(reco::modules::make<Selector>(cfg, iC)) {}
46  const_iterator begin() const { return selected_.begin(); }
47  const_iterator end() const { return selected_.end(); }
49  selected_.clear();
50  for (size_t idx = 0; idx < c->size(); ++idx) {
51  if (select_(c->refAt(idx)))
52  addRef_(selected_, c, idx);
53  }
54  }
55 
56 private:
57  container selected_;
58  selector select_;
59  RefAdder addRef_;
61 };
62 
64 
65 namespace reco {
66  namespace modules {
67  template <typename S>
68  struct SingleElementCollectionRefSelectorEventSetupInit {
69  static void init(S& s, const edm::Event& ev, const edm::EventSetup& es) {
70  typedef typename EventSetupInit<typename S::selector>::type ESI;
71  ESI::init(s.select_, ev, es);
72  }
73  };
74 
75  template <typename I, typename S, typename O, typename C, typename R>
76  struct EventSetupInit<SingleElementCollectionRefSelector<I, S, O, C, R> > {
78  };
79  } // namespace modules
80 } // namespace reco
81 
82 #endif
type
Definition: HCALResponse.h:21
SingleElementCollectionRefSelectorEventSetupInit< SingleElementCollectionRefSelector< I, S, O, C, R > > type
InputType
Definition: InputType.h:5
int init
Definition: HydjetWrapper.h:64
S make(const edm::ParameterSet &cfg)
bool ev
take no action (default)
void select(const edm::Handle< InputCollection > &c, const edm::Event &, const edm::EventSetup &)
const std::complex< double > I
Definition: I.h:8
Functor that operates on <T>
Definition: Selector.h:22
SingleElementCollectionRefSelector(const edm::ParameterSet &cfg, edm::ConsumesCollector &&iC)
fixed size matrix
HLT enums.
static void init(S &s, const edm::Event &ev, const edm::EventSetup &es)