CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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)]))
51  addRef_(selected_, 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 {
69  static void init(S& s, const edm::Event& evt, const edm::EventSetup& es) {
70  typedef typename EventSetupInit<typename S::selector>::type ESI;
71  ESI::init(s.select_, evt, es);
72  }
73  };
74 
75  template <typename I, typename V, typename S, typename O, typename C, typename R>
79  };
80  } // namespace modules
81 } // namespace reco
82 
83 #endif
helper::MatcherGetRef< C >::ref_type getRef(const Handle< C > &c, size_t k)
Definition: getRef.h:28
const edm::EventSetup & c
tuple cfg
Definition: looper.py:296
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:539
int init
Definition: HydjetWrapper.h:64
S make(const edm::ParameterSet &cfg)
static void init(S &s, const edm::Event &evt, const edm::EventSetup &es)
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
take no action (default)
list var
if using global norm cols_to_minmax = [&#39;t_delta&#39;, &#39;t_hmaxNearP&#39;,&#39;t_emaxNearP&#39;, &#39;t_hAnnular&#39;, &#39;t_eAnnular&#39;,&#39;t_pt&#39;,&#39;t_nVtx&#39;,&#39;t_ieta&#39;,&#39;t_eHcal10&#39;, &#39;t_eHcal30&#39;,&#39;t_rhoh&#39;,&#39;t_eHcal&#39;] df[cols_to_minmax] = df[cols_to_minmax].apply(lambda x: (x - x.min()) / (x.max() - x.min()) if (x.max() - x.min() &gt; 0) else 1.0/200.0)
const std::complex< double > I
Definition: I.h:8
Functor that operates on &lt;T&gt;
Definition: Selector.h:22
AssociatedVariableCollectionSelectorEventSetupInit< AssociatedVariableCollectionSelector< I, V, S, O, C, R > > type
def template
Definition: svgfig.py:521
void select(const edm::Handle< InputCollection > &c, const edm::Event &evt, const edm::EventSetup &)