CMS 3D CMS Logo

DuplicatedPhotonRemover.h
Go to the documentation of this file.
1 #ifndef PhysicsTools_PatUtils_DuplicatedPhotonRemover_h
2 #define PhysicsTools_PatUtils_DuplicatedPhotonRemover_h
3 
6 
11 
13 
15 
16 namespace pat {
17 
19 
20  public:
21  // Checks if two objects share the same supercluster seed
23  template<typename T1, typename T2>
24  bool operator()(const T1 &t1, const T2 &t2) const {
25  return (t1.superCluster()->seed() == t2.superCluster()->seed());
26  }
27  };
28 
29  // Checks if two objects share the same supercluster seed
31  template<typename T1, typename T2>
32  bool operator()(const T1 &t1, const T2 &t2) const {
33  return (t1.superCluster() == t2.superCluster());
34  }
35  };
36 
40  template <typename PhotonCollection>
41  std::unique_ptr< std::vector<size_t> > duplicatesBySuperCluster(const PhotonCollection &photons) const ;
42 
46  template <typename PhotonCollection>
47  std::unique_ptr< std::vector<size_t> > duplicatesBySeed(const PhotonCollection &photons) const ;
48 
50  template <typename PhotonCollection, typename ElectronCollection>
51  std::unique_ptr< pat::OverlapList >
52  electronsBySeed(const PhotonCollection &photons, const ElectronCollection &electrons) const ;
53 
55  template <typename PhotonCollection, typename ElectronCollection>
56  std::unique_ptr< pat::OverlapList >
57  electronsBySuperCluster(const PhotonCollection &photons, const ElectronCollection &electrons) const ;
58 
59  // ===== Concrete versions for users (and to get it compiled, so I can see if there are errors) ===
60  std::unique_ptr< std::vector<size_t> > duplicatesBySeed(const reco::PhotonCollection &photons) const ;
61  std::unique_ptr< std::vector<size_t> > duplicatesBySeed(const edm::View<reco::Photon> &photons) const ;
62  std::unique_ptr< std::vector<size_t> > duplicatesBySuperCluster(const edm::View<reco::Photon> &photons) const ;
63  std::unique_ptr< std::vector<size_t> > duplicatesBySuperCluster(const reco::PhotonCollection &photons) const ;
64  std::unique_ptr< pat::OverlapList > electronsBySeed(const reco::PhotonCollection &photons,
65  const reco::GsfElectronCollection& electrons) const ;
66  std::unique_ptr< pat::OverlapList > electronsBySeed(const edm::View<reco::Photon> &photons,
67  const reco::GsfElectronCollection& electrons) const ;
68  std::unique_ptr< pat::OverlapList > electronsBySuperCluster(const edm::View<reco::Photon> &photons,
69  const reco::GsfElectronCollection& electrons) const ;
70  std::unique_ptr< pat::OverlapList > electronsBySuperCluster(const reco::PhotonCollection &photons,
71  const reco::GsfElectronCollection& electrons) const ;
72  std::unique_ptr< pat::OverlapList > electronsBySeed(const reco::PhotonCollection &photons,
73  const edm::View<reco::GsfElectron>& electrons) const ;
74  std::unique_ptr< pat::OverlapList > electronsBySeed(const edm::View<reco::Photon> &photons,
75  const edm::View<reco::GsfElectron>& electrons) const ;
76  std::unique_ptr< pat::OverlapList > electronsBySuperCluster(const edm::View<reco::Photon> &photons,
77  const edm::View<reco::GsfElectron>& electrons) const ;
78  std::unique_ptr< pat::OverlapList > electronsBySuperCluster(const reco::PhotonCollection &photons,
79  const edm::View<reco::GsfElectron>& electrons) const ;
80  };
81 }
82 
83 template<typename PhotonCollection>
84 std::unique_ptr< std::vector<size_t> >
86  typedef typename PhotonCollection::value_type PhotonType;
88  return dups.duplicates(photons);
89 }
90 
91 template<typename PhotonCollection>
92 std::unique_ptr< std::vector<size_t> >
94  typedef typename PhotonCollection::value_type PhotonType;
96  return dups.duplicates(photons);
97 }
98 
100 template <typename PhotonCollection, typename ElectronCollection>
101 std::unique_ptr< pat::OverlapList >
104  return ovl.find(photons, electrons);
105 }
106 
108 template <typename PhotonCollection, typename ElectronCollection>
109 std::unique_ptr< pat::OverlapList >
112  return ovl.find(photons, electrons);
113 }
114 
115 #endif
std::unique_ptr< std::vector< size_t > > duplicatesBySeed(const PhotonCollection &photons) const
std::vector< GsfElectron > GsfElectronCollection
collection of GsfElectron objects
std::unique_ptr< pat::OverlapList > electronsBySeed(const PhotonCollection &photons, const ElectronCollection &electrons) const
Indices of photons which happen to be also electrons (that is, they share the same SC seed) ...
Definition: HeavyIon.h:7
std::vector< Electron > ElectronCollection
Definition: Electron.h:37
bool operator()(const T1 &t1, const T2 &t2) const
std::unique_ptr< std::vector< size_t > > duplicatesBySuperCluster(const PhotonCollection &photons) const
bool operator()(const T1 &t1, const T2 &t2) const
std::unique_ptr< OverlapList > find(const Collection &items, const OtherCollection &other) const
std::vector< Photon > PhotonCollection
collectin of Photon objects
Definition: PhotonFwd.h:9
std::unique_ptr< std::vector< size_t > > duplicates(const Collection &items) const
std::unique_ptr< pat::OverlapList > electronsBySuperCluster(const PhotonCollection &photons, const ElectronCollection &electrons) const
Indices of photons which happen to be also electrons (that is, they share the same SC) ...
std::vector< Photon > PhotonCollection
Definition: Photon.h:32