Matcher of number of reconstructed objects in the event to probe. More...
Public Member Functions | |
ObjectMultiplicityCounter (const edm::ParameterSet &iConfig) | |
virtual void | produce (edm::Event &iEvent, const edm::EventSetup &iSetup) |
virtual | ~ObjectMultiplicityCounter () |
Private Attributes | |
StringCutObjectSelector< T, true > | objCut_ |
edm::InputTag | objects_ |
edm::InputTag | probes_ |
Matcher of number of reconstructed objects in the event to probe.
Definition at line 27 of file ObjectMultiplicityCounter.cc.
ObjectMultiplicityCounter< T >::ObjectMultiplicityCounter | ( | const edm::ParameterSet & | iConfig | ) | [explicit] |
Definition at line 41 of file ObjectMultiplicityCounter.cc.
: probes_(iConfig.getParameter<edm::InputTag>("probes")), objects_(iConfig.getParameter<edm::InputTag>("objects")), objCut_(iConfig.existsAs<std::string>("objectSelection") ? iConfig.getParameter<std::string>("objectSelection") : "", true) { produces<edm::ValueMap<float> >(); }
ObjectMultiplicityCounter< T >::~ObjectMultiplicityCounter | ( | ) | [virtual] |
Definition at line 51 of file ObjectMultiplicityCounter.cc.
{ }
void ObjectMultiplicityCounter< T >::produce | ( | edm::Event & | iEvent, |
const edm::EventSetup & | iSetup | ||
) | [virtual] |
Implements edm::EDProducer.
Definition at line 57 of file ObjectMultiplicityCounter.cc.
References prof2calltree::count, edm::Event::getByLabel(), dbtoconf::object, edm::Event::put(), and makeHLTPrescaleTable::values.
{ using namespace edm; // read input Handle<View<reco::Candidate> > probes; Handle<View<T> > objects; iEvent.getByLabel(probes_, probes); iEvent.getByLabel(objects_, objects); // fill float count = 0.0; View<reco::Candidate>::const_iterator probe, endprobes = probes->end(); typename View<T>::const_iterator object, endobjects = objects->end(); for (object = objects->begin(); object != endobjects; ++object) { if ( !(objCut_(*object)) ) continue; count += 1.0; } // prepare vector for output std::vector<float> values(probes->size(), count); // convert into ValueMap and store std::auto_ptr<ValueMap<float> > valMap(new ValueMap<float>()); ValueMap<float>::Filler filler(*valMap); filler.insert(probes, values.begin(), values.end()); filler.fill(); iEvent.put(valMap); }
StringCutObjectSelector<T,true> ObjectMultiplicityCounter< T >::objCut_ [private] |
Definition at line 37 of file ObjectMultiplicityCounter.cc.
edm::InputTag ObjectMultiplicityCounter< T >::objects_ [private] |
Definition at line 36 of file ObjectMultiplicityCounter.cc.
edm::InputTag ObjectMultiplicityCounter< T >::probes_ [private] |
Definition at line 35 of file ObjectMultiplicityCounter.cc.