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  public:
20  // Checks if two objects share the same supercluster seed
22  template <typename T1, typename T2>
23  bool operator()(const T1 &t1, const T2 &t2) const {
24  return (t1.superCluster()->seed() == t2.superCluster()->seed());
25  }
26  };
27 
28  // Checks if two objects share the same supercluster seed
30  template <typename T1, typename T2>
31  bool operator()(const T1 &t1, const T2 &t2) const {
32  return (t1.superCluster() == t2.superCluster());
33  }
34  };
35 
39  template <typename PhotonCollection>
40  std::unique_ptr<std::vector<size_t> > duplicatesBySuperCluster(const PhotonCollection &photons) const;
41 
45  template <typename PhotonCollection>
46  std::unique_ptr<std::vector<size_t> > duplicatesBySeed(const PhotonCollection &photons) const;
47 
49  template <typename PhotonCollection, typename ElectronCollection>
50  std::unique_ptr<pat::OverlapList> electronsBySeed(const PhotonCollection &photons,
51  const ElectronCollection &electrons) const;
52 
54  template <typename PhotonCollection, typename ElectronCollection>
55  std::unique_ptr<pat::OverlapList> electronsBySuperCluster(const PhotonCollection &photons,
56  const ElectronCollection &electrons) const;
57 
58  // ===== Concrete versions for users (and to get it compiled, so I can see if there are errors) ===
59  std::unique_ptr<std::vector<size_t> > duplicatesBySeed(const reco::PhotonCollection &photons) const;
60  std::unique_ptr<std::vector<size_t> > duplicatesBySeed(const edm::View<reco::Photon> &photons) const;
61  std::unique_ptr<std::vector<size_t> > duplicatesBySuperCluster(const edm::View<reco::Photon> &photons) const;
62  std::unique_ptr<std::vector<size_t> > duplicatesBySuperCluster(const reco::PhotonCollection &photons) const;
63  std::unique_ptr<pat::OverlapList> electronsBySeed(const reco::PhotonCollection &photons,
65  std::unique_ptr<pat::OverlapList> electronsBySeed(const edm::View<reco::Photon> &photons,
67  std::unique_ptr<pat::OverlapList> electronsBySuperCluster(const edm::View<reco::Photon> &photons,
69  std::unique_ptr<pat::OverlapList> electronsBySuperCluster(const reco::PhotonCollection &photons,
71  std::unique_ptr<pat::OverlapList> electronsBySeed(const reco::PhotonCollection &photons,
73  std::unique_ptr<pat::OverlapList> electronsBySeed(const edm::View<reco::Photon> &photons,
75  std::unique_ptr<pat::OverlapList> electronsBySuperCluster(const edm::View<reco::Photon> &photons,
77  std::unique_ptr<pat::OverlapList> electronsBySuperCluster(const reco::PhotonCollection &photons,
79  };
80 } // namespace pat
81 
82 template <typename PhotonCollection>
83 std::unique_ptr<std::vector<size_t> > pat::DuplicatedPhotonRemover::duplicatesBySuperCluster(
84  const PhotonCollection &photons) const {
85  typedef typename PhotonCollection::value_type PhotonType;
87  return dups.duplicates(photons);
88 }
89 
90 template <typename PhotonCollection>
91 std::unique_ptr<std::vector<size_t> > pat::DuplicatedPhotonRemover::duplicatesBySeed(
92  const PhotonCollection &photons) const {
93  typedef typename PhotonCollection::value_type PhotonType;
95  return dups.duplicates(photons);
96 }
97 
99 template <typename PhotonCollection, typename ElectronCollection>
101  const PhotonCollection &photons, const ElectronCollection &electrons) const {
103  return ovl.find(photons, electrons);
104 }
105 
107 template <typename PhotonCollection, typename ElectronCollection>
108 std::unique_ptr<pat::OverlapList> pat::DuplicatedPhotonRemover::electronsBySeed(
109  const PhotonCollection &photons, const ElectronCollection &electrons) const {
111  return ovl.find(photons, electrons);
112 }
113 
114 #endif
std::unique_ptr< std::vector< size_t > > duplicatesBySeed(const PhotonCollection &photons) 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< 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::unique_ptr< std::vector< size_t > > duplicatesBySuperCluster(const PhotonCollection &photons) const
std::unique_ptr< OverlapList > find(const Collection &items, const OtherCollection &other) const
std::vector< Electron > ElectronCollection
Definition: Electron.h:36
std::unique_ptr< std::vector< size_t > > duplicates(const Collection &items) const
bool operator()(const T1 &t1, const T2 &t2) const
std::vector< Photon > PhotonCollection
collectin of Photon objects
Definition: PhotonFwd.h:9
std::vector< Photon > PhotonCollection
Definition: Photon.h:31