File indexing completed on 2024-04-06 12:23:30
0001 #ifndef PhysicsTools_IsolationAlgos_EventDependentAbsVetos_h
0002 #define PhysicsTools_IsolationAlgos_EventDependentAbsVetos_h
0003
0004 #include "FWCore/Framework/interface/ConsumesCollector.h"
0005 #include "PhysicsTools/IsolationAlgos/interface/EventDependentAbsVeto.h"
0006 #include "FWCore/Utilities/interface/InputTag.h"
0007 #include "DataFormats/Common/interface/View.h"
0008 #include "DataFormats/Common/interface/AssociationMap.h"
0009 #include "DataFormats/Candidate/interface/Candidate.h"
0010 #include "DataFormats/JetReco/interface/PFJet.h"
0011
0012 namespace reco {
0013 namespace isodeposit {
0014 class OtherCandidatesDeltaRVeto : public EventDependentAbsVeto {
0015 public:
0016
0017 OtherCandidatesDeltaRVeto(const edm::InputTag& candidates, double deltaR, edm::ConsumesCollector& iC)
0018 : src_(iC.consumes<edm::View<reco::Candidate> >(candidates)), deltaR2_(deltaR * deltaR) {}
0019
0020
0021 ~OtherCandidatesDeltaRVeto() override {}
0022
0023
0024
0025 bool veto(double eta, double phi, float value) const override;
0026
0027
0028 void centerOn(double eta, double phi) override {}
0029
0030
0031 void setEvent(const edm::Event& iEvent, const edm::EventSetup& iSetup) override;
0032
0033 private:
0034 edm::EDGetTokenT<edm::View<reco::Candidate> > src_;
0035 float deltaR2_;
0036 std::vector<Direction> items_;
0037 };
0038
0039 class OtherCandVeto : public EventDependentAbsVeto {
0040 public:
0041
0042 OtherCandVeto(const edm::InputTag& candidates, AbsVeto* veto, edm::ConsumesCollector& iC)
0043 : src_(iC.consumes<edm::View<reco::Candidate> >(candidates)), veto_(veto) {}
0044
0045
0046 ~OtherCandVeto() override {}
0047
0048
0049
0050 bool veto(double eta, double phi, float value) const override;
0051
0052
0053 void centerOn(double eta, double phi) override {}
0054
0055
0056 void setEvent(const edm::Event& iEvent, const edm::EventSetup& iSetup) override;
0057
0058 private:
0059 edm::EDGetTokenT<edm::View<reco::Candidate> > src_;
0060 std::vector<Direction> items_;
0061 std::unique_ptr<AbsVeto> veto_;
0062 };
0063
0064 class OtherJetConstituentsDeltaRVeto : public EventDependentAbsVeto {
0065 public:
0066
0067 OtherJetConstituentsDeltaRVeto(Direction dir,
0068 const edm::InputTag& jets,
0069 double dRjet,
0070 const edm::InputTag& pfCandAssocMap,
0071 double dRconstituent,
0072 edm::ConsumesCollector& iC)
0073 : evt_(nullptr),
0074 vetoDir_(dir),
0075 srcJets_(iC.consumes<reco::PFJetCollection>(jets)),
0076 dR2jet_(dRjet * dRjet),
0077 srcPFCandAssocMap_(iC.consumes<JetToPFCandidateAssociation>(pfCandAssocMap)),
0078 dR2constituent_(dRconstituent * dRconstituent) {
0079
0080
0081
0082
0083
0084
0085 }
0086
0087
0088 ~OtherJetConstituentsDeltaRVeto() override {}
0089
0090
0091
0092 bool veto(double eta, double phi, float value) const override;
0093
0094
0095 void centerOn(double eta, double phi) override;
0096
0097
0098 void setEvent(const edm::Event& evt, const edm::EventSetup& es) override;
0099
0100 private:
0101 typedef edm::AssociationMap<edm::OneToMany<std::vector<reco::PFJet>, std::vector<reco::PFCandidate>, unsigned int> >
0102 JetToPFCandidateAssociation;
0103
0104 void initialize();
0105
0106 const edm::Event* evt_;
0107
0108 Direction vetoDir_;
0109 edm::EDGetTokenT<reco::PFJetCollection> srcJets_;
0110 double dR2jet_;
0111 edm::EDGetTokenT<JetToPFCandidateAssociation> srcPFCandAssocMap_;
0112 double dR2constituent_;
0113 std::vector<Direction> items_;
0114 };
0115 }
0116 }
0117 #endif