CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
AssociationMapOneToOne2Association.h
Go to the documentation of this file.
1 #ifndef CommonTools_UtilAlgos_AssociationMapOneToOne2Association_h
2 #define CommonTools_UtilAlgos_AssociationMapOneToOne2Association_h
3 /* \class AssociationMapOneToOne2Association
4  *
5  * \author Luca Lista, INFN
6  *
7  * \version $Id: AssociationMapOneToOne2Association.h,v 1.2 2010/02/20 20:55:14 wmtan Exp $
8  */
9 
15 
16 template <typename CKey, typename CVal>
18 public:
20 
21 private:
24  void produce(edm::Event&, const edm::EventSetup&) override;
26 };
27 
33 
34 template <typename CKey, typename CVal>
36  : am_(consumes<am_t>(cfg.template getParameter<edm::InputTag>("src"))) {
37  produces<as_t>();
38 }
39 
40 template <typename CKey, typename CVal>
42  using namespace edm;
43  using namespace std;
44  Handle<am_t> am;
45  evt.getByToken(am_, am);
46 
47  unique_ptr<as_t> as(new as_t);
48  typename as_t::Filler filler(*as);
49  filler.fill();
50  size_t size = am->size();
51  vector<int> indices;
52  indices.reserve(size);
53  for (typename am_t::const_iterator i = am->begin(); i != am->end(); ++i) {
54  indices.push_back(i->val.key());
55  }
56  filler.insert(am->refProd().key, indices.begin(), indices.end());
57  evt.put(std::move(as));
58 }
59 
60 #endif
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:133
tuple cfg
Definition: looper.py:296
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:539
void insert(const H &h, I begin, I end)
Definition: ValueMap.h:53
AssociationMapOneToOne2Association(const edm::ParameterSet &)
void produce(edm::Event &, const edm::EventSetup &) override
def move
Definition: eostools.py:511
edm::AssociationMap< edm::OneToOne< CKey, CVal > > am_t
list indices
Definition: dqmdumpme.py:50
tuple size
Write out results.
def template
Definition: svgfig.py:521