CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros 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  private:
23  void produce(edm::Event&, const edm::EventSetup&) override;
25 };
26 
32 
33 template<typename CKey, typename CVal>
35  am_(consumes<am_t>(cfg.template getParameter<edm::InputTag>("src"))) {
36  produces<as_t>();
37 }
38 
39 template<typename CKey, typename CVal>
41  using namespace edm;
42  using namespace std;
43  Handle<am_t> am;
44  evt.getByToken(am_, am);
45 
46  auto_ptr<as_t> as(new as_t);
47  typename as_t::Filler filler(*as);
48  filler.fill();
49  size_t size = am->size();
50  vector<int> indices;
51  indices.reserve(size);
52  for(typename am_t::const_iterator i = am->begin(); i != am->end(); ++i) {
53  indices.push_back(i->val.key());
54  }
55  filler.insert(am->refProd().key, indices.begin(), indices.end());
56  evt.put(as);
57 }
58 
59 #endif
int i
Definition: DBlmapReader.cc:9
tuple cfg
Definition: looper.py:293
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:462
void insert(const H &h, I begin, I end)
Definition: ValueMap.h:52
AssociationMapOneToOne2Association(const edm::ParameterSet &)
void produce(edm::Event &, const edm::EventSetup &) override
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:121
edm::AssociationMap< edm::OneToOne< CKey, CVal > > am_t
tuple size
Write out results.
def template
Definition: svgfig.py:520