#include <AssociationVectorSelector.h>
Public Member Functions | |
AssociationVectorSelector (const edm::ParameterSet &) | |
Private Types | |
typedef edm::AssociationVector < KeyRefProd, CVal > | association_t |
typedef association_t::CKey | collection_t |
Private Member Functions | |
void | produce (edm::Event &, const edm::EventSetup &) |
Private Attributes | |
edm::InputTag | association_ |
KeySelector | selectKey_ |
ValSelector | selectVal_ |
Definition at line 17 of file AssociationVectorSelector.h.
typedef edm::AssociationVector<KeyRefProd, CVal> AssociationVectorSelector< KeyRefProd, CVal, KeySelector, ValSelector >::association_t [private] |
Definition at line 21 of file AssociationVectorSelector.h.
typedef association_t::CKey AssociationVectorSelector< KeyRefProd, CVal, KeySelector, ValSelector >::collection_t [private] |
Definition at line 22 of file AssociationVectorSelector.h.
AssociationVectorSelector< KeyRefProd, CVal, KeySelector, ValSelector >::AssociationVectorSelector | ( | const edm::ParameterSet & | cfg | ) |
Definition at line 36 of file AssociationVectorSelector.h.
References AlCaHLTBitMon_QueryRunRegistry::string.
: association_(cfg.template getParameter<edm::InputTag>("association")), selectKey_(reco::modules::make<KeySelector>(cfg)), selectVal_(reco::modules::make<ValSelector>(cfg)) { std::string alias(cfg.template getParameter<std::string>("@module_label")); produces<collection_t>().setBranchAlias(alias); produces<association_t>().setBranchAlias(alias + "Association"); }
void AssociationVectorSelector< KeyRefProd, CVal, KeySelector, ValSelector >::produce | ( | edm::Event & | evt, |
const edm::EventSetup & | |||
) | [private, virtual] |
Implements edm::EDProducer.
Definition at line 46 of file AssociationVectorSelector.h.
References clone(), edm::Event::getByLabel(), edm::Event::getRefBeforePut(), i, getGTfromDQMFile::obj, edm::Event::put(), and findQualityFiles::size.
{ using namespace edm; using namespace std; Handle<association_t> association; evt.getByLabel(association_, association); auto_ptr<collection_t> selected(new collection_t); vector<typename CVal::value_type> selectedValues; size_t size = association->size(); selected->reserve(size); selectedValues.reserve(size); for(typename association_t::const_iterator i = association->begin(); i != association->end(); ++i) { const typename association_t::key_type & obj = * i->first; if(selectKey_(obj)&&selectVal_(i->second)) { typedef typename edm::clonehelper::CloneTrait<collection_t>::type clone_t; selected->push_back(clone_t::clone(obj)); selectedValues.push_back(i->second); } } // new association must be created after the // selected collection is full because it uses the size KeyRefProd ref = evt.getRefBeforePut<collection_t>(); auto_ptr<association_t> selectedAssociation(new association_t(ref, selected.get())); size = selected->size(); OrphanHandle<collection_t> oh = evt.put(selected); for(size_t i = 0; i != size; ++i) selectedAssociation->setValue(i, selectedValues[i]); evt.put(selectedAssociation); }
edm::InputTag AssociationVectorSelector< KeyRefProd, CVal, KeySelector, ValSelector >::association_ [private] |
Definition at line 24 of file AssociationVectorSelector.h.
KeySelector AssociationVectorSelector< KeyRefProd, CVal, KeySelector, ValSelector >::selectKey_ [private] |
Definition at line 25 of file AssociationVectorSelector.h.
ValSelector AssociationVectorSelector< KeyRefProd, CVal, KeySelector, ValSelector >::selectVal_ [private] |
Definition at line 26 of file AssociationVectorSelector.h.