CMS 3D CMS Logo

/afs/cern.ch/work/a/aaltunda/public/www/CMSSW_6_2_5/src/RecoJets/JetAssociationAlgorithms/src/JetTracksAssociationExplicit.cc

Go to the documentation of this file.
00001 // Associate jets with tracks by simple "dR" criteria
00002 // Fedor Ratnikov (UMd), Aug. 28, 2007
00003 // $Id: JetTracksAssociationExplicit.cc,v 1.1 2012/01/13 21:11:03 srappocc Exp $
00004 
00005 #include "RecoJets/JetAssociationAlgorithms/interface/JetTracksAssociationExplicit.h"
00006 
00007 #include "DataFormats/JetReco/interface/PFJet.h"
00008 #include "DataFormats/TrackReco/interface/Track.h"
00009 
00010 JetTracksAssociationExplicit::JetTracksAssociationExplicit () 
00011 {}
00012 
00013 void JetTracksAssociationExplicit::produce (reco::JetTracksAssociation::Container* fAssociation, 
00014                                             const std::vector <edm::RefToBase<reco::Jet> >& fJets,
00015                                             const std::vector <reco::TrackRef>& fTracks) const 
00016 {
00017   for (unsigned j = 0; j < fJets.size(); ++j) { 
00018     reco::PFJet const * pfJet = dynamic_cast<reco::PFJet const *>( &* (fJets[j]) ) ;
00019     if ( pfJet != 0 ) {
00020       reco::TrackRefVector assoTracks = pfJet->getTrackRefs();
00021       reco::JetTracksAssociation::setValue (fAssociation, fJets[j], assoTracks);
00022     } else {
00023       throw cms::Exception("InvalidConfiguration") 
00024         << "From JetTracksAssociationExplicit::produce: Only PFJets are currently supported for this module" << std::endl;
00025     }
00026   }
00027 }