File indexing completed on 2024-04-06 12:25:28
0001
0002
0003
0004 #include "RecoJets/JetAssociationAlgorithms/interface/JetTracksAssociationDR.h"
0005 #include "FWCore/MessageLogger/interface/MessageLogger.h"
0006
0007
0008
0009 JetTracksAssociationDR::JetTracksAssociationDR(double fDr) : mDeltaR2Threshold(fDr * fDr) { ; }
0010
0011
0012
0013 JetTracksAssociationDR::~JetTracksAssociationDR() { ; }
0014
0015
0016
0017 void JetTracksAssociationDR::associateTracksToJets(Association* fAssociation,
0018 const JetRefs& fJets,
0019 const TrackRefs& fTracks) {
0020 JetRefs::const_iterator ii = fJets.begin();
0021 JetRefs::const_iterator jj = fJets.end();
0022 for (; ii != jj; ++ii) {
0023 reco::TrackRefVector associated;
0024 associateTracksToJet(associated, **ii, fTracks);
0025 reco::JetTracksAssociation::setValue(fAssociation, *ii, associated);
0026 }
0027 }
0028
0029
0030
0031 void JetTracksAssociationDR::createJetRefs(JetRefs& output, const Jets& input) {
0032 output.clear();
0033 output.reserve(input->size());
0034 for (unsigned ii = 0; ii < input->size(); ++ii) {
0035 output.push_back(input->refAt(ii));
0036 }
0037 }
0038
0039
0040
0041 void JetTracksAssociationDR::createTrackRefs(TrackRefs& output, const Tracks& input, const TrackQuality& quality) {
0042 if (quality == reco::TrackBase::undefQuality) {
0043 edm::LogError("JetTracksAssociationDR") << " Unknown TrackQuality value: " << static_cast<int>(quality)
0044 << ". See possible values in 'reco::TrackBase::TrackQuality'";
0045 }
0046
0047 output.clear();
0048 output.reserve(input->size());
0049 for (unsigned ii = 0; ii < input->size(); ++ii) {
0050 if ((*input)[ii].quality(quality)) {
0051 output.push_back(reco::TrackRef(input, ii));
0052 }
0053 }
0054 }