#include <PhysicsTools/JetCharge/plugins/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.
00003 : 00004 src_(cfg.getParameter<edm::InputTag>("src")), 00005 algo_(cfg) { 00006 produces<JetChargeCollection>(); 00007 }
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(), it, metsig::jet, edm::Event::put(), reco::JetFloatAssociation::setValue(), src_, and tracks.
00009 { 00010 edm::Handle<reco::JetTracksAssociationCollection> hJTAs; 00011 iEvent.getByLabel(src_, hJTAs); 00012 typedef reco::JetTracksAssociationCollection::const_iterator IT; 00013 typedef edm::RefToBase<reco::Jet> JetRef; 00014 00015 if (hJTAs->keyProduct().isNull()) { 00016 // need to work around this bug someway, altough it's not stricly my fault 00017 std::auto_ptr<JetChargeCollection> ret(new JetChargeCollection()); 00018 iEvent.put(ret); 00019 return; 00020 } 00021 std::auto_ptr<JetChargeCollection> ret(new JetChargeCollection(hJTAs->keyProduct())); 00022 for (IT it = hJTAs->begin(), ed = hJTAs->end(); it != ed; ++it) { 00023 const JetRef &jet = it->first; 00024 const reco::TrackRefVector &tracks = it->second; 00025 float val = static_cast<float>( algo_.charge(jet->p4(), tracks) ); 00026 reco::JetFloatAssociation::setValue(*ret, jet, val); 00027 } 00028 00029 iEvent.put(ret); 00030 }
JetCharge JetChargeProducer::algo_ [private] |
edm::InputTag JetChargeProducer::src_ [private] |