CMS 3D CMS Logo

JetChargeProducer Class Reference

#include <PhysicsTools/JetCharge/plugins/JetChargeProducer.h>

Inheritance diagram for JetChargeProducer:

edm::EDProducer edm::ProducerBase edm::ProductRegistryHelper

List of all members.

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_


Detailed Description

Definition at line 13 of file JetChargeProducer.h.


Member Typedef Documentation

typedef reco::JetFloatAssociation::Container JetChargeProducer::JetChargeCollection

Definition at line 15 of file JetChargeProducer.h.


Constructor & Destructor Documentation

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 }


Member Function Documentation

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 }


Member Data Documentation

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().


The documentation for this class was generated from the following files:
Generated on Tue Jun 9 18:26:03 2009 for CMSSW by  doxygen 1.5.4