File indexing completed on 2024-04-06 12:27:50
0001 #include "RecoTauTag/RecoTau/interface/PFTauPrimaryVertexProducerBase.h"
0002 #include "FWCore/Framework/interface/MakerMacros.h"
0003
0004
0005 class PFTauPrimaryVertexProducer final : public PFTauPrimaryVertexProducerBase {
0006 public:
0007 explicit PFTauPrimaryVertexProducer(const edm::ParameterSet& iConfig);
0008 ~PFTauPrimaryVertexProducer() override;
0009
0010 static void fillDescriptions(edm::ConfigurationDescriptions& descriptions);
0011
0012 protected:
0013 void nonTauTracksInPV(const reco::VertexRef&,
0014 const std::vector<edm::Ptr<reco::TrackBase> >&,
0015 std::vector<const reco::Track*>&) override;
0016 };
0017
0018 PFTauPrimaryVertexProducer::PFTauPrimaryVertexProducer(const edm::ParameterSet& iConfig)
0019 : PFTauPrimaryVertexProducerBase::PFTauPrimaryVertexProducerBase(iConfig) {}
0020
0021 PFTauPrimaryVertexProducer::~PFTauPrimaryVertexProducer() {}
0022
0023 void PFTauPrimaryVertexProducer::nonTauTracksInPV(const reco::VertexRef& thePVRef,
0024 const std::vector<edm::Ptr<reco::TrackBase> >& tauTracks,
0025 std::vector<const reco::Track*>& nonTauTracks) {
0026
0027 for (reco::Vertex::trackRef_iterator vtxTrkRef = thePVRef->tracks_begin(); vtxTrkRef != thePVRef->tracks_end();
0028 vtxTrkRef++) {
0029 bool matched = false;
0030 for (const auto& tauTrack : tauTracks) {
0031 if (tauTrack.id() == vtxTrkRef->id() && tauTrack.key() == vtxTrkRef->key()) {
0032 matched = true;
0033 break;
0034 }
0035 }
0036 if (!matched)
0037 nonTauTracks.push_back((*vtxTrkRef).get());
0038 }
0039 }
0040
0041 void PFTauPrimaryVertexProducer::fillDescriptions(edm::ConfigurationDescriptions& descriptions) {
0042 auto desc = PFTauPrimaryVertexProducerBase::getDescriptionsBase();
0043 descriptions.add("pfTauPrimaryVertexProducer", desc);
0044 }
0045
0046 DEFINE_FWK_MODULE(PFTauPrimaryVertexProducer);