#include <JetChargeProducer.h>
Public Types | |
typedef reco::JetFloatAssociation::Container | JetChargeCollection |
Public Member Functions | |
JetChargeProducer (const edm::ParameterSet &cfg) | |
virtual void | produce (edm::Event &, const edm::EventSetup &) |
Private Attributes | |
JetCharge | algo_ |
edm::InputTag | src_ |
Definition at line 13 of file JetChargeProducer.h.
Definition at line 15 of file JetChargeProducer.h.
JetChargeProducer::JetChargeProducer | ( | const edm::ParameterSet & | cfg | ) | [explicit] |
Definition at line 3 of file JetChargeProducer.cc.
: src_(cfg.getParameter<edm::InputTag>("src")), algo_(cfg) { produces<JetChargeCollection>(); }
void JetChargeProducer::produce | ( | edm::Event & | iEvent, |
const edm::EventSetup & | iSetup | ||
) | [virtual] |
Implements edm::EDProducer.
Definition at line 9 of file JetChargeProducer.cc.
References algo_, JetCharge::charge(), edm::Event::getByLabel(), metsig::jet, edm::Event::put(), run_regression::ret, reco::JetExtendedAssociation::setValue(), src_, and testEve_cfg::tracks.
{ edm::Handle<reco::JetTracksAssociationCollection> hJTAs; iEvent.getByLabel(src_, hJTAs); typedef reco::JetTracksAssociationCollection::const_iterator IT; typedef edm::RefToBase<reco::Jet> JetRef; if (hJTAs->keyProduct().isNull()) { // need to work around this bug someway, altough it's not stricly my fault std::auto_ptr<JetChargeCollection> ret(new JetChargeCollection()); iEvent.put(ret); return; } std::auto_ptr<JetChargeCollection> ret(new JetChargeCollection(hJTAs->keyProduct())); for (IT it = hJTAs->begin(), ed = hJTAs->end(); it != ed; ++it) { const JetRef &jet = it->first; const reco::TrackRefVector &tracks = it->second; float val = static_cast<float>( algo_.charge(jet->p4(), tracks) ); reco::JetFloatAssociation::setValue(*ret, jet, val); } iEvent.put(ret); }
JetCharge JetChargeProducer::algo_ [private] |
Definition at line 21 of file JetChargeProducer.h.
Referenced by produce().
edm::InputTag JetChargeProducer::src_ [private] |
Definition at line 20 of file JetChargeProducer.h.
Referenced by produce().