CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
AssociationVector2ValueMap.h
Go to the documentation of this file.
1 #ifndef CommonTools_UtilAlgos_AssociationVector2ValueMap_h
2 #define CommonTools_UtilAlgos_AssociationVector2ValueMap_h
3 /* \class AssociationVector2ValueMap
4  *
5  * \author Luca Lista, INFN
6  *
7  * \version $Id: AssociationVector2ValueMap.h,v 1.2 2010/02/20 20:55:15 wmtan Exp $
8  */
9 
14 
15 template<typename KeyRefProd, typename CVal>
17  public:
19  private:
21  typedef typename CVal::value_type value_t;
23  typedef typename av_t::CKey collection_t;
24  void produce(edm::Event&, const edm::EventSetup&) override;
26 };
27 
33 
34 template<typename KeyRefProd, typename CVal>
36  av_(consumes<av_t>(cfg.template getParameter<edm::InputTag>("src"))) {
37  produces<vm_t>();
38 }
39 
40 template<typename KeyRefProd, typename CVal>
42  using namespace edm;
43  using namespace std;
44  Handle<av_t> av;
45  evt.getByToken(av_, av);
46 
47  auto_ptr<vm_t> vm(new vm_t);
48  typename vm_t::Filler filler(*vm);
49  filler.fill();
50  size_t size = av->size();
51  vector<value_t> values;
52  values.reserve(size);
53  for(typename av_t::const_iterator i = av->begin(); i != av->end(); ++i) {
54  values.push_back(i->second);
55  }
56  filler.insert(av->keyProduct(), values.begin(), values.end());
57  evt.put(vm);
58 }
59 
60 #endif
int i
Definition: DBlmapReader.cc:9
tuple cfg
Definition: looper.py:237
transient_vector_type::const_iterator const_iterator
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:446
void insert(const H &h, I begin, I end)
Definition: ValueMap.h:52
edm::AssociationVector< KeyRefProd, CVal > av_t
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:113
void produce(edm::Event &, const edm::EventSetup &) override
KeyRefProd::product_type CKey
Container::value_type value_type
AssociationVector2ValueMap(const edm::ParameterSet &)
tuple size
Write out results.
def template
Definition: svgfig.py:520