CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_4_1_8_patch13/src/RecoJets/JetAssociationAlgorithms/src/JetTracksAssociationDR.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: JetTracksAssociationDR.cc,v 1.1 2009/03/30 15:06:33 bainbrid Exp $
00004 
00005 #include "RecoJets/JetAssociationAlgorithms/interface/JetTracksAssociationDR.h"
00006 #include "FWCore/MessageLogger/interface/MessageLogger.h"
00007 
00008 // -----------------------------------------------------------------------------
00009 //
00010 JetTracksAssociationDR::JetTracksAssociationDR( double fDr ) 
00011   : mDeltaR2Threshold(fDr*fDr)
00012 {;}
00013 
00014 // -----------------------------------------------------------------------------
00015 //
00016 JetTracksAssociationDR::~JetTracksAssociationDR() 
00017 {;}
00018 
00019 // -----------------------------------------------------------------------------
00020 //
00021 void JetTracksAssociationDR::associateTracksToJets( Association* fAssociation, 
00022                                                     const JetRefs& fJets,
00023                                                     const TrackRefs& fTracks ) 
00024 {
00025   JetRefs::const_iterator ii = fJets.begin();
00026   JetRefs::const_iterator jj = fJets.end();
00027   for ( ; ii != jj; ++ii ) {
00028     reco::TrackRefVector associated;
00029     associateTracksToJet( associated, **ii, fTracks );
00030     reco::JetTracksAssociation::setValue( fAssociation, *ii, associated );
00031   }
00032 }
00033 
00034 // -----------------------------------------------------------------------------
00035 //
00036 void JetTracksAssociationDR::createJetRefs( JetRefs& output, 
00037                                             const Jets& input ) {
00038   output.clear();
00039   output.reserve( input->size() );
00040   for ( unsigned ii = 0; ii < input->size(); ++ii ) { 
00041     output.push_back( input->refAt(ii) );
00042   }
00043 }
00044 
00045 // -----------------------------------------------------------------------------
00046 //
00047 void JetTracksAssociationDR::createTrackRefs( TrackRefs& output,
00048                                               const Tracks& input,
00049                                               const TrackQuality& quality ) {
00050 
00051   if ( quality == reco::TrackBase::undefQuality ) {
00052     edm::LogError("JetTracksAssociationDR")
00053       << " Unknown TrackQuality value: " 
00054       << static_cast<int>( quality )
00055       << ". See possible values in 'reco::TrackBase::TrackQuality'";
00056   }
00057 
00058   output.clear();
00059   output.reserve( input->size() );
00060   for ( unsigned ii = 0; ii < input->size(); ++ii ) { 
00061     if ( (*input)[ii].quality( quality ) ) { 
00062       output.push_back( reco::TrackRef( input, ii ) );
00063     }
00064   }
00065 
00066 }