Go to the documentation of this file.00001 #ifndef PhysicsTools_PatUtils_DuplicatedPhotonRemover_h
00002 #define PhysicsTools_PatUtils_DuplicatedPhotonRemover_h
00003
00004 #include "PhysicsTools/PatUtils/interface/GenericDuplicateRemover.h"
00005 #include "PhysicsTools/PatUtils/interface/GenericOverlapFinder.h"
00006
00007 #include "DataFormats/EgammaCandidates/interface/GsfElectronFwd.h"
00008 #include "DataFormats/EgammaCandidates/interface/GsfElectron.h"
00009 #include "DataFormats/EgammaCandidates/interface/PhotonFwd.h"
00010 #include "DataFormats/EgammaCandidates/interface/Photon.h"
00011
00012 #include "DataFormats/Common/interface/View.h"
00013
00014 #include "CommonTools/Utils/interface/EtComparator.h"
00015
00016 namespace pat {
00017
00018 class DuplicatedPhotonRemover {
00019
00020 public:
00021
00022 struct EqualBySuperClusterSeed {
00023 template<typename T1, typename T2>
00024 bool operator()(const T1 &t1, const T2 &t2) const {
00025 return (t1.superCluster()->seed() == t2.superCluster()->seed());
00026 }
00027 };
00028
00029
00030 struct EqualBySuperCluster {
00031 template<typename T1, typename T2>
00032 bool operator()(const T1 &t1, const T2 &t2) const {
00033 return (t1.superCluster() == t2.superCluster());
00034 }
00035 };
00036
00040 template <typename PhotonCollection>
00041 std::auto_ptr< std::vector<size_t> > duplicatesBySuperCluster(const PhotonCollection &photons) const ;
00042
00046 template <typename PhotonCollection>
00047 std::auto_ptr< std::vector<size_t> > duplicatesBySeed(const PhotonCollection &photons) const ;
00048
00050 template <typename PhotonCollection, typename ElectronCollection>
00051 std::auto_ptr< pat::OverlapList >
00052 electronsBySeed(const PhotonCollection &photons, const ElectronCollection &electrons) const ;
00053
00055 template <typename PhotonCollection, typename ElectronCollection>
00056 std::auto_ptr< pat::OverlapList >
00057 electronsBySuperCluster(const PhotonCollection &photons, const ElectronCollection &electrons) const ;
00058
00059
00060 std::auto_ptr< std::vector<size_t> > duplicatesBySeed(const reco::PhotonCollection &photons) const ;
00061 std::auto_ptr< std::vector<size_t> > duplicatesBySeed(const edm::View<reco::Photon> &photons) const ;
00062 std::auto_ptr< std::vector<size_t> > duplicatesBySuperCluster(const edm::View<reco::Photon> &photons) const ;
00063 std::auto_ptr< std::vector<size_t> > duplicatesBySuperCluster(const reco::PhotonCollection &photons) const ;
00064 std::auto_ptr< pat::OverlapList > electronsBySeed(const reco::PhotonCollection &photons,
00065 const reco::GsfElectronCollection electrons) const ;
00066 std::auto_ptr< pat::OverlapList > electronsBySeed(const edm::View<reco::Photon> &photons,
00067 const reco::GsfElectronCollection electrons) const ;
00068 std::auto_ptr< pat::OverlapList > electronsBySuperCluster(const edm::View<reco::Photon> &photons,
00069 const reco::GsfElectronCollection electrons) const ;
00070 std::auto_ptr< pat::OverlapList > electronsBySuperCluster(const reco::PhotonCollection &photons,
00071 const reco::GsfElectronCollection electrons) const ;
00072 std::auto_ptr< pat::OverlapList > electronsBySeed(const reco::PhotonCollection &photons,
00073 const edm::View<reco::GsfElectron> electrons) const ;
00074 std::auto_ptr< pat::OverlapList > electronsBySeed(const edm::View<reco::Photon> &photons,
00075 const edm::View<reco::GsfElectron> electrons) const ;
00076 std::auto_ptr< pat::OverlapList > electronsBySuperCluster(const edm::View<reco::Photon> &photons,
00077 const edm::View<reco::GsfElectron> electrons) const ;
00078 std::auto_ptr< pat::OverlapList > electronsBySuperCluster(const reco::PhotonCollection &photons,
00079 const edm::View<reco::GsfElectron> electrons) const ;
00080 };
00081 }
00082
00083 template<typename PhotonCollection>
00084 std::auto_ptr< std::vector<size_t> >
00085 pat::DuplicatedPhotonRemover::duplicatesBySuperCluster(const PhotonCollection &photons) const {
00086 typedef typename PhotonCollection::value_type PhotonType;
00087 pat::GenericDuplicateRemover<EqualBySuperCluster, GreaterByEt<PhotonType> > dups;
00088 return dups.duplicates(photons);
00089 }
00090
00091 template<typename PhotonCollection>
00092 std::auto_ptr< std::vector<size_t> >
00093 pat::DuplicatedPhotonRemover::duplicatesBySeed(const PhotonCollection &photons) const {
00094 typedef typename PhotonCollection::value_type PhotonType;
00095 pat::GenericDuplicateRemover<EqualBySuperClusterSeed, GreaterByEt<PhotonType> > dups;
00096 return dups.duplicates(photons);
00097 }
00098
00100 template <typename PhotonCollection, typename ElectronCollection>
00101 std::auto_ptr< pat::OverlapList >
00102 pat::DuplicatedPhotonRemover::electronsBySuperCluster(const PhotonCollection &photons, const ElectronCollection &electrons) const {
00103 pat::GenericOverlapFinder< pat::OverlapDistance<EqualBySuperCluster> > ovl;
00104 return ovl.find(photons, electrons);
00105 }
00106
00108 template <typename PhotonCollection, typename ElectronCollection>
00109 std::auto_ptr< pat::OverlapList >
00110 pat::DuplicatedPhotonRemover::electronsBySeed(const PhotonCollection &photons, const ElectronCollection &electrons) const {
00111 pat::GenericOverlapFinder< pat::OverlapDistance<EqualBySuperClusterSeed> > ovl;
00112 return ovl.find(photons, electrons);
00113 }
00114
00115 #endif