29 #include <unordered_map> 44 template <
class T,
class U>
45 bool isInFootprint(
const T& thefootprint,
const U& theCandidate) {
46 for (
auto itr = thefootprint.begin(); itr != thefootprint.end(); ++itr) {
47 if (itr->key() == theCandidate.key())
56 template <
class T,
class U>
57 bool isInFootprintAlternative(
const T& thefootprint,
const U& theCandidate) {
58 for (
auto itr = thefootprint.begin(); itr != thefootprint.end(); ++itr) {
59 if (itr->key() == theCandidate->sourceCandidatePtr(0).key())
72 "miniAODVertexCodes")),
107 "PhotonPFIsolationWithMapBasedVeto");
119 bool inFootprint =
false;
121 const float deltar2 =
125 if (aspacked.
get()) {
126 inFootprint = isInFootprint(aspat_photonptr->associatedPackedPFCandidates(), aspacked);
129 if (aspacked->charge() != 0) {
130 bool is_vertex_allowed =
false;
133 is_vertex_allowed =
true;
138 result &= (is_vertex_allowed);
154 throw cms::Exception(
"InvalidIsolationInput") <<
"The supplied candidate to be used as isolation " 155 <<
"was neither a reco::Photon nor a pat::Photon!";
IsolationConeDefinitionBase(const edm::ParameterSet &c)
EDGetTokenT< ProductType > mayConsume(edm::InputTag const &tag)
edm::Handle< edm::ValueMap< std::vector< reco::PFCandidateRef > > > particleBasedIsolationMap
const std::vector< unsigned > _miniAODVertexCodes
const std::string _isolateAgainst
edm::Ptr< pat::PackedCandidate > PackedCandidatePtr
void getEventInfo(const edm::Event &iEvent) override
void setConsumes(edm::ConsumesCollector iC) override
const std::string _vertexCollection
bool isNonnull() const
Checks for non-null.
PhotonPFIsolationWithMapBasedVeto & operator=(const PhotonPFIsolationWithMapBasedVeto &)=delete
T const * get() const
Returns C++ pointer to the item.
edm::Ptr< reco::Photon > recoPhotonPtr
const unsigned _vertexIndex
constexpr auto deltaR2(const T1 &t1, const T2 &t2) -> decltype(t1.eta())
const edm::InputTag _particleBasedIsolation
PhotonPFIsolationWithMapBasedVeto(const edm::ParameterSet &c)
edm::Ptr< pat::Photon > patPhotonPtr
#define DEFINE_EDM_PLUGIN(factory, type, name)
bool isInIsolationCone(const reco::CandidatePtr &photon, const reco::CandidatePtr &pfCandidate) const final
~PhotonPFIsolationWithMapBasedVeto() override
Destructor.
edm::EDGetTokenT< edm::ValueMap< std::vector< reco::PFCandidateRef > > > particleBasedIsolationToken_