CMS 3D CMS Logo

AssociatedVariableCollectionSelector.h
Go to the documentation of this file.
1 #ifndef CommonTools_UtilAlgos_AssociatedVariableCollectionSelector_h
2 #define CommonTools_UtilAlgos_AssociatedVariableCollectionSelector_h
3 /* \class AssociatedVariableCollectionSelector
4  *
5  * \author Luca Lista, INFN
6  *
7  * \version $Id: AssociatedVariableCollectionSelector.h,v 1.2 2010/02/20 20:55:13 wmtan Exp $
8  *
9  */
20 
21 namespace reco {
22  namespace modules {
23  template <typename S>
25  }
26 } // namespace reco
27 
28 template <typename InputCollection,
29  typename VarCollection,
30  typename Selector,
35 public:
37  typedef StoreContainer container;
38  typedef Selector selector;
39  typedef typename container::const_iterator const_iterator;
41  : varToken_(iC.consumes<VarCollection>(cfg.template getParameter<edm::InputTag>("var"))),
42  select_(reco::modules::make<Selector>(cfg, iC)) {}
43  const_iterator begin() const { return selected_.begin(); }
44  const_iterator end() const { return selected_.end(); }
45  void select(const edm::Handle<InputCollection>& c, const edm::Event& evt, const edm::EventSetup&) {
46  selected_.clear();
48  evt.getByToken(varToken_, var);
49  for (size_t idx = 0; idx < c->size(); ++idx) {
50  if (select_((*c)[idx], (*var)[edm::getRef(c, idx)]))
52  }
53  }
54 
55 private:
59  RefAdder addRef_;
61 };
62 
64 
65 namespace reco {
66  namespace modules {
67  template <typename S>
68  struct AssociatedVariableCollectionSelectorEventSetupInit {
70 
71  void init(S& s, const edm::Event& evt, const edm::EventSetup& es) { esi_.init(s.select_, evt, es); }
74  };
75 
76  template <typename I, typename V, typename S, typename O, typename C, typename R>
80  };
81 
82  } // namespace modules
83 } // namespace reco
84 
85 #endif
helper::MatcherGetRef< C >::ref_type getRef(const Handle< C > &c, size_t k)
Definition: getRef.h:28
S make(const edm::ParameterSet &cfg)
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:540
AssociatedVariableCollectionSelector(const edm::ParameterSet &cfg, edm::ConsumesCollector &&iC)
uint32_t T const *__restrict__ uint32_t const *__restrict__ int32_t int Histo::index_type cudaStream_t V
const std::complex< double > I
Definition: I.h:8
def template(fileName, svg, replaceme="REPLACEME")
Definition: svgfig.py:521
Functor that operates on <T>
Definition: Selector.h:22
AssociatedVariableCollectionSelectorEventSetupInit< AssociatedVariableCollectionSelector< I, V, S, O, C, R > > type
void init(S &s, const edm::Event &evt, const edm::EventSetup &es)
fixed size matrix
HLT enums.
void select(const edm::Handle< InputCollection > &c, const edm::Event &evt, const edm::EventSetup &)