CMS 3D CMS Logo

Public Member Functions | Private Attributes

JetTracksAssociatorAtVertex Class Reference

#include <JetTracksAssociatorAtVertex.h>

Inheritance diagram for JetTracksAssociatorAtVertex:
edm::EDProducer edm::ProducerBase edm::ProductRegistryHelper

List of all members.

Public Member Functions

 JetTracksAssociatorAtVertex (const edm::ParameterSet &)
virtual void produce (edm::Event &, const edm::EventSetup &)
virtual ~JetTracksAssociatorAtVertex ()

Private Attributes

JetTracksAssociationDRVertex mAssociator
JetTracksAssociationDRVertexAssigned mAssociatorAssigned
edm::InputTag mJets
int mTrackQuality
edm::InputTag mTracks
edm::InputTag pvSrc
 if true, use the track/jet association with vertex assignment to tracks
bool useAssigned

Detailed Description

Definition at line 20 of file JetTracksAssociatorAtVertex.h.


Constructor & Destructor Documentation

JetTracksAssociatorAtVertex::JetTracksAssociatorAtVertex ( const edm::ParameterSet fConfig)

Definition at line 19 of file JetTracksAssociatorAtVertex.cc.

References edm::ParameterSet::exists(), edm::ParameterSet::getParameter(), pvSrc, and useAssigned.

  : mJets (fConfig.getParameter<edm::InputTag> ("jets")),
    mTracks (fConfig.getParameter<edm::InputTag> ("tracks")),
    mAssociator (fConfig.getParameter<double> ("coneSize")),
    mAssociatorAssigned (fConfig.getParameter<double> ("coneSize")),
    useAssigned(false), pvSrc()
{

  if ( fConfig.exists("useAssigned") ) {
    useAssigned = fConfig.getParameter<bool> ("useAssigned");
    pvSrc = fConfig.getParameter<edm::InputTag> ("pvSrc");
  }

  produces<reco::JetTracksAssociation::Container> ();
}
JetTracksAssociatorAtVertex::~JetTracksAssociatorAtVertex ( ) [virtual]

Definition at line 35 of file JetTracksAssociatorAtVertex.cc.

{}

Member Function Documentation

void JetTracksAssociatorAtVertex::produce ( edm::Event fEvent,
const edm::EventSetup fSetup 
) [virtual]

Implements edm::EDProducer.

Definition at line 37 of file JetTracksAssociatorAtVertex.cc.

References reco::JetExtendedAssociation::allJets(), muonTagProbeFilters_cff::allTracks, edm::Event::getByLabel(), i, mAssociator, mAssociatorAssigned, mJets, mTracks, JetTracksAssociationDRVertexAssigned::produce(), JetTracksAssociationDRVertex::produce(), edm::Handle< T >::product(), edm::Event::put(), pvSrc, and useAssigned.

                                                                                       {
  edm::Handle <edm::View <reco::Jet> > jets_h;
  fEvent.getByLabel (mJets, jets_h);
  edm::Handle <reco::TrackCollection> tracks_h;
  fEvent.getByLabel (mTracks, tracks_h);
  
  std::auto_ptr<reco::JetTracksAssociation::Container> jetTracks (new reco::JetTracksAssociation::Container (reco::JetRefBaseProd(jets_h)));

  // format inputs
  std::vector <edm::RefToBase<reco::Jet> > allJets;
  allJets.reserve (jets_h->size());
  for (unsigned i = 0; i < jets_h->size(); ++i) allJets.push_back (jets_h->refAt(i));
  std::vector <reco::TrackRef> allTracks;
  allTracks.reserve (tracks_h->size());
  // run algo
  for (unsigned i = 0; i < tracks_h->size(); ++i) {
    allTracks.push_back (reco::TrackRef (tracks_h, i));
  }
  if ( !useAssigned ) {
    mAssociator.produce (&*jetTracks, allJets, allTracks);
  } else {
    edm::Handle<reco::VertexCollection> pvHandle;
    fEvent.getByLabel(pvSrc,pvHandle);
    const reco::VertexCollection & vertices = *pvHandle.product();     
    mAssociatorAssigned.produce (&*jetTracks, allJets, allTracks,vertices);
  }


  // store output
  fEvent.put (jetTracks);
}

Member Data Documentation

Definition at line 31 of file JetTracksAssociatorAtVertex.h.

Referenced by produce().

Definition at line 32 of file JetTracksAssociatorAtVertex.h.

Referenced by produce().

Definition at line 28 of file JetTracksAssociatorAtVertex.h.

Referenced by produce().

Definition at line 30 of file JetTracksAssociatorAtVertex.h.

Definition at line 29 of file JetTracksAssociatorAtVertex.h.

Referenced by produce().

if true, use the track/jet association with vertex assignment to tracks

Definition at line 34 of file JetTracksAssociatorAtVertex.h.

Referenced by JetTracksAssociatorAtVertex(), and produce().

Definition at line 33 of file JetTracksAssociatorAtVertex.h.

Referenced by JetTracksAssociatorAtVertex(), and produce().