CMS 3D CMS Logo

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
size
Write out results.
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:133
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:539
AssociationMapOneToOne2Association(const edm::ParameterSet &)
void produce(edm::Event &, const edm::EventSetup &) override
def template(fileName, svg, replaceme="REPLACEME")
Definition: svgfig.py:521
edm::AssociationMap< edm::OneToOne< CKey, CVal > > am_t
HLT enums.
def move(src, dest)
Definition: eostools.py:511