CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_1/src/SimTracker/TrackHistory/src/JetVetoedTracksAssociatorDRVertex.cc

Go to the documentation of this file.
00001 
00002 #include "SimTracker/TrackHistory/interface/JetVetoedTracksAssociatorDRVertex.h"
00003 
00004 
00005 JetVetoedTracksAssociationDRVertex::JetVetoedTracksAssociationDRVertex (double dr) : mDeltaR2Threshold(dr*dr) {}
00006 
00007 
00008 void JetVetoedTracksAssociationDRVertex::produce (
00009     reco::JetTracksAssociation::Container* fAssociation,
00010     const std::vector<edm::RefToBase<reco::Jet> >& fJets,
00011     const std::vector<reco::TrackRef>& fTracks,
00012     TrackClassifier & classifier
00013 ) const
00014 {
00015     // cache tracks kinematics
00016     std::vector <math::RhoEtaPhiVector> trackP3s;
00017     trackP3s.reserve (fTracks.size());
00018     for (unsigned i = 0; i < fTracks.size(); ++i)
00019     {
00020         const reco::Track* track = &*(fTracks[i]);
00021         trackP3s.push_back (math::RhoEtaPhiVector (track->p(),track->eta(), track->phi()));
00022     }
00023     //loop on jets and associate
00024     for (unsigned j = 0; j < fJets.size(); ++j)
00025     {
00026         reco::TrackRefVector assoTracks;
00027         const reco::Jet* jet = &*(fJets[j]);
00028         double jetEta = jet->eta();
00029         double jetPhi = jet->phi();
00030         for (unsigned t = 0; t < fTracks.size(); ++t)
00031         {
00032             double dR2 = deltaR2 (jetEta, jetPhi, trackP3s[t].eta(), trackP3s[t].phi());
00033             classifier.evaluate( reco::TrackBaseRef(fTracks[t]) );
00034             if (
00035                 dR2 < mDeltaR2Threshold &&
00036                 (
00037                     classifier.is(TrackClassifier::BWeakDecay) ||
00038                     classifier.is(TrackClassifier::CWeakDecay) ||
00039                     classifier.is(TrackClassifier::PrimaryVertex)
00040                 )
00041             ) assoTracks.push_back (fTracks[t]);
00042         }
00043         reco::JetTracksAssociation::setValue (fAssociation, fJets[j], assoTracks);
00044     }
00045 }
00046 
00047